-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: HDMI support on Ripple #264
base: main
Are you sure you want to change the base?
Conversation
|
…la-RPPL-1151_supportHdmiOnRipple
|
||
#[rpc(server)] | ||
pub trait Hdmi { | ||
#[method(name = "hdmi.setActiveInput")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HDMIInput.select
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated it.
#[derive(Debug, Serialize, Deserialize, Clone)] | ||
#[serde(rename_all = "camelCase")] | ||
pub struct StartHdmiInputRequest { | ||
pub id: String, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Enumeration for Start and Stop
pub operation: HDMIOperation
Add a new enum
#[derive(Debug, Serialize, Deserialize, Clone)]
#[serde(rename_all = "camelCase")]
pub enum HdmiOperation {
Start,
Stop
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added enum.
let response = state | ||
.get_thunder_client() | ||
.call(DeviceCallRequest { | ||
method: ThunderPlugin::AVInput.method("startInput"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use HdmiOperation to change the method to stopInput
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added.
…la-RPPL-1151_supportHdmiOnRipple
…llumuntala-RPPL-1151_supportHdmiOnRipple
.await | ||
.is_err() | ||
{ | ||
error!("Error while registration"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we still return an OK response even if we hit this block?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is similar to how on_hdcp_changed listener is implemented
.is_err() |
Can you elaborate on how I should change it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might need some input from @satlead on this one. However, from my point of view here the code reads:
- Send DeviceEventRequest to the extension that will handle it
- If we get an error then log it
- Tell the caller that everything worked ok
What I would expect is this:
- Send DeviceEventRequest to the extension that will handle it
- If we get an error then log it and tell the caller it didn't work
- If we didn't get an error then tell the caller that everything worked ok
So if this is the same in HDCP then I would think that might need looking at as well (in a different PR of course).
I think that a more appropriate implementation would be:
error!("Error while registration"); | |
error!("Error while registration"); | |
return Err(Error::Custom("Failed to subscribe to HdmiConnectionChanged event".to_owned())); |
Note: you will want to add a use statement for Error e.g. use jsonrpsee::core::Error;
.
@satlead please could you confirm I am on the right track with this one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it. thank you :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like there is a util function rpc_error
that can be used to glean it up a bit:
return Err(Error::Custom("Failed to subscribe to HdmiConnectionChanged event".to_owned()));
Becomes:
return Err(rpc_error("Failed to subscribe to HdmiConnectionChanged event"));
Sorry, I didn't know about this fn until just now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe it's rpc_err
. Used it, thanks.
if let HdmiOperation::Start = request.operation { | ||
if let Ok(response) = self | ||
.state | ||
.get_client() | ||
.send_extn_request(HdmiRequest::StartHdmiInput(request)) | ||
.await | ||
{ | ||
if let ExtnPayload::Response(ExtnResponse::Value(value)) = response.payload { | ||
if let Ok(res) = serde_json::from_value::<HdmiSelectOperationResponse>(value) { | ||
return Ok(res); | ||
} | ||
} | ||
} | ||
|
||
Err(rpc_err("FB error response TBD")) | ||
} else { | ||
if let Ok(response) = self | ||
.state | ||
.get_client() | ||
.send_extn_request(HdmiRequest::StopHdmiInput(request)) | ||
.await | ||
{ | ||
if let ExtnPayload::Response(ExtnResponse::Value(value)) = response.payload { | ||
if let Ok(res) = serde_json::from_value::<HdmiSelectOperationResponse>(value) { | ||
return Ok(res); | ||
} | ||
} | ||
} | ||
|
||
Err(rpc_err("FB error response TBD")) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The if/else block branches look the same to me. Is that right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes needs some cleanup by passing the operation to the Device handler
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed it in latest commit 01ea440#diff-130906b50b27c33d5f205f3da7521a976f98012695e1c65d5882619ddf96973fR73
pub enum AVInputAdjective { | ||
Hdmi, | ||
Ota, | ||
Composite, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this defined in an HDMI module? When implementing Composite for example I would not expect to find the adjective for it defined here in HDMI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah AVInput probably needs a super .rs file for OTA and composite
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved AVInputAdjective to a super .rs file.
} | ||
} | ||
|
||
async fn get_available_inputs(state: ThunderState, req: ExtnMessage) -> bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All of the handlers look basically the same. Is there a way we can reduce the repeated code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Certainly Start and Stop can be just one value in the operation which is what was suggested. Get available inputs body is slightly different so there would be something additional.
Think we can move the Thunder call alone to a separate function to reduce the boilerplate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactored it in latest code.
…llumuntala-RPPL-1151_supportHdmiOnRipple
…la-RPPL-1151_supportHdmiOnRipple
…la-RPPL-1151_supportHdmiOnRipple
…//github.com/rdkcentral/Ripple into cchillumuntala-RPPL-1151_supportHdmiOnRipple
…la-RPPL-1151_supportHdmiOnRipple
….com:rdkcentral/Ripple into cchillumuntala-RPPL-1151_supportHdmiOnRipple
2. Renamed fb_hdmi to fb_hdmi_input
…la-RPPL-1151_supportHdmiOnRipple
…la-RPPL-1151_supportHdmiOnRipple
…la-RPPL-1151_supportHdmiOnRipple
…la-RPPL-1151_supportHdmiOnRipple
What
Adds HDMI support on Ripple
Why
HDMI support on Ripple
How
Integrates with AVInput thunder api running on RDK devices
Test
Sends requests through firebolt hdmi module
Checklist