Skip to content

Commit

Permalink
Merge branch 'sprint/2401' into sprint/2401
Browse files Browse the repository at this point in the history
  • Loading branch information
karuna2git authored Feb 23, 2024
2 parents 9eb9073 + 25e54fb commit be89223
Show file tree
Hide file tree
Showing 3 changed files with 135 additions and 64 deletions.
73 changes: 72 additions & 1 deletion HdmiCecSink/HdmiCecSink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,14 +222,21 @@ namespace WPEFramework
{
printHeader(header);
LOGINFO("Command: ActiveSource %s : %s : %s \n",GetOpName(msg.opCode()),msg.physicalAddress.name().c_str(),msg.physicalAddress.toString().c_str());

if(!(header.to == LogicalAddress(LogicalAddress::BROADCAST))){
LOGINFO("Ignore Direct messages, accepts only broadcast messages");
return;
}
HdmiCecSink::_instance->addDevice(header.from.toInt());
HdmiCecSink::_instance->updateActiveSource(header.from.toInt(), msg);
}
void HdmiCecSinkProcessor::process (const InActiveSource &msg, const Header &header)
{
printHeader(header);
LOGINFO("Command: InActiveSource %s : %s : %s \n",GetOpName(msg.opCode()),msg.physicalAddress.name().c_str(),msg.physicalAddress.toString().c_str());
if(header.to.toInt() == LogicalAddress::BROADCAST){
LOGINFO("Ignore Broadcast messages, accepts only direct messages");
return;
}

HdmiCecSink::_instance->updateInActiveSource(header.from.toInt(), msg);
}
Expand All @@ -238,20 +245,32 @@ namespace WPEFramework
{
printHeader(header);
LOGINFO("Command: ImageViewOn from %s\n", header.from.toString().c_str());
if(header.to.toInt() == LogicalAddress::BROADCAST){
LOGINFO("Ignore Broadcast messages, accepts only direct messages");
return;
}
HdmiCecSink::_instance->addDevice(header.from.toInt());
HdmiCecSink::_instance->updateImageViewOn(header.from.toInt());
}
void HdmiCecSinkProcessor::process (const TextViewOn &msg, const Header &header)
{
printHeader(header);
LOGINFO("Command: TextViewOn\n");
if(header.to.toInt() == LogicalAddress::BROADCAST){
LOGINFO("Ignore Broadcast messages, accepts only direct messages");
return;
}
HdmiCecSink::_instance->addDevice(header.from.toInt());
HdmiCecSink::_instance->updateImageViewOn(header.from.toInt());
}
void HdmiCecSinkProcessor::process (const RequestActiveSource &msg, const Header &header)
{
printHeader(header);
LOGINFO("Command: RequestActiveSource\n");
if(!(header.to == LogicalAddress(LogicalAddress::BROADCAST))){
LOGINFO("Ignore Direct messages, accepts only broadcast messages");
return;
}

HdmiCecSink::_instance->setActiveSource(true);
}
Expand All @@ -265,6 +284,10 @@ namespace WPEFramework
{
printHeader(header);
LOGINFO("Command: GetCECVersion sending CECVersion response \n");
if(header.to.toInt() == LogicalAddress::BROADCAST){
LOGINFO("Ignore Broadcast messages, accepts only direct messages");
return;
}
try
{
if(cecVersion == 2.0) {
Expand Down Expand Up @@ -301,6 +324,10 @@ namespace WPEFramework
{
printHeader(header);
LOGINFO("Command: GiveOSDName sending SetOSDName : %s\n",osdName.toString().c_str());
if(header.to.toInt() == LogicalAddress::BROADCAST){
LOGINFO("Ignore Broadcast messages, accepts only direct messages");
return;
}
try
{
conn.sendToAsync(header.from, MessageEncoder().encode(SetOSDName(osdName)));
Expand Down Expand Up @@ -329,6 +356,10 @@ namespace WPEFramework
void HdmiCecSinkProcessor::process (const GiveDeviceVendorID &msg, const Header &header)
{
printHeader(header);
if(header.to == LogicalAddress(LogicalAddress::BROADCAST)){
LOGINFO("Ignore Broadcast messages, accepts only direct messages");
return;
}
try
{
LOGINFO("Command: GiveDeviceVendorID sending VendorID response :%s\n",appVendorId.toString().c_str());
Expand All @@ -350,6 +381,10 @@ namespace WPEFramework
printHeader(header);
bool updateStatus ;
LOGINFO("Command: SetOSDName OSDName : %s\n",msg.osdName.toString().c_str());
if(header.to.toInt() == LogicalAddress::BROADCAST){
LOGINFO("Ignore Broadcast messages, accepts only direct messages");
return;
}

HdmiCecSink::_instance->addDevice(header.from.toInt());
updateStatus = HdmiCecSink::_instance->deviceList[header.from.toInt()].m_isOSDNameUpdated;
Expand Down Expand Up @@ -381,6 +416,10 @@ namespace WPEFramework
{
printHeader(header);
LOGINFO("Command: GetMenuLanguage\n");
if(header.to.toInt() == LogicalAddress::BROADCAST){
LOGINFO("Ignore Broadcast messages, accepts only direct messages");
return;
}
HdmiCecSink::_instance->sendMenuLanguage();
}
void HdmiCecSinkProcessor::process (const ReportPhysicalAddress &msg, const Header &header)
Expand All @@ -389,6 +428,10 @@ namespace WPEFramework
bool updateDeviceTypeStatus;
bool updatePAStatus;
LOGINFO("Command: ReportPhysicalAddress\n");
if(!(header.to == LogicalAddress(LogicalAddress::BROADCAST))){
LOGINFO("Ignore Direct messages, accepts only broadcast messages");
return;
}

if(!HdmiCecSink::_instance)
return;
Expand All @@ -415,6 +458,10 @@ namespace WPEFramework
bool updateStatus ;
printHeader(header);
LOGINFO("Command: DeviceVendorID VendorID : %s\n",msg.vendorId.toString().c_str());
if(!(header.to == LogicalAddress(LogicalAddress::BROADCAST))){
LOGINFO("Ignore Direct messages, accepts only broadcast messages");
return;
}

HdmiCecSink::_instance->addDevice(header.from.toInt());
updateStatus = HdmiCecSink::_instance->deviceList[header.from.toInt()].m_isVendorIDUpdated;
Expand All @@ -427,6 +474,10 @@ namespace WPEFramework
{
printHeader(header);
LOGINFO("Command: GiveDevicePowerStatus sending powerState :%d \n",powerState);
if(header.to.toInt() == LogicalAddress::BROADCAST){
LOGINFO("Ignore Broadcast messages, accepts only direct messages");
return;
}
try
{
conn.sendTo(header.from, MessageEncoder().encode(ReportPowerStatus(PowerStatus(powerState))));
Expand All @@ -441,6 +492,10 @@ namespace WPEFramework
uint32_t oldPowerStatus,newPowerStatus;
printHeader(header);
LOGINFO("Command: ReportPowerStatus Power Status from:%s status : %s \n",header.from.toString().c_str(),msg.status.toString().c_str());
if(header.to.toInt() == LogicalAddress::BROADCAST){
LOGINFO("Ignore Broadcast messages, accepts only direct messages");
return;
}
oldPowerStatus = HdmiCecSink::_instance->deviceList[header.from.toInt()].m_powerStatus.toInt();
HdmiCecSink::_instance->addDevice(header.from.toInt());
HdmiCecSink::_instance->deviceList[header.from.toInt()].update(msg.status);
Expand All @@ -460,6 +515,10 @@ namespace WPEFramework
{
printHeader(header);
LOGINFO("Command: FeatureAbort opcode=%s, Reason = %s\n", msg.feature.toString().c_str(), msg.reason.toString().c_str());
if(header.to.toInt() == LogicalAddress::BROADCAST){
LOGINFO("Ignore Broadcast messages, accepts only direct messages");
return;
}

if(header.from.toInt() < LogicalAddress::UNREGISTERED &&
msg.reason.toInt() == AbortReason::UNRECOGNIZED_OPCODE)
Expand Down Expand Up @@ -533,6 +592,10 @@ namespace WPEFramework
void HdmiCecSinkProcessor::process (const InitiateArc &msg, const Header &header)
{
printHeader(header);
if((!(header.from.toInt() == 0x5)) || (header.to.toInt() == LogicalAddress::BROADCAST)){
LOGINFO("Ignoring the message coming from addresses other than 0X5 or a braodcast message");
return;
}
PhysicalAddress physical_addr_invalid = {0x0F,0x0F,0x0F,0x0F};
PhysicalAddress physical_addr_arc_port = {0x0F,0x0F,0x0F,0x0F};

Expand All @@ -557,6 +620,10 @@ namespace WPEFramework
void HdmiCecSinkProcessor::process (const TerminateArc &msg, const Header &header)
{
printHeader(header);
if((!(header.from.toInt() == 0x5)) || (header.to.toInt() == LogicalAddress::BROADCAST)){
LOGINFO("Ignoring the message coming from addresses other than 0X5 or a braodcast message");
return;
}
if(!HdmiCecSink::_instance)
return;
HdmiCecSink::_instance->Process_TerminateArc();
Expand All @@ -578,6 +645,10 @@ namespace WPEFramework
{
printHeader(header);
LOGINFO("Command: ReportAudioStatus %s audio Mute status %d means %s and current Volume level is %d \n",GetOpName(msg.opCode()),msg.status.getAudioMuteStatus(),msg.status.toString().c_str(),msg.status.getAudioVolume());
if(header.to.toInt() == LogicalAddress::BROADCAST){
LOGINFO("Ignore Broadcast messages, accepts only direct messages");
return;
}
HdmiCecSink::_instance->Process_ReportAudioStatus_msg(msg);
}
void HdmiCecSinkProcessor::process (const GiveFeatures &msg, const Header &header)
Expand Down
44 changes: 22 additions & 22 deletions NetworkManager/service/NetworkManager.json
Original file line number Diff line number Diff line change
Expand Up @@ -224,10 +224,10 @@
"SetPrimaryInterface":{
"summary": "Sets the primary/default interface for the device. This call fails if the interface is not enabled.",
"events":{
"onActiveInterfaceChanged" : "Triggered when device’s default interface changed.",
"onInterfaceStateChanged" : "Triggered when interface’s state changed",
"onIPAddressChanged" : "Triggered when the device connects to router.",
"onInternetStatusChanged" : "Triggered when each IP address is lost or acquired."
"onActiveInterfaceChange" : "Triggered when device’s default interface changed.",
"onInterfaceStateChange" : "Triggered when interface’s state changed",
"onAddressChange" : "Triggered when the device connects to router.",
"onInternetStatusChange" : "Triggered when each IP address is lost or acquired."
},
"params": {
"type":"object",
Expand Down Expand Up @@ -314,8 +314,8 @@
"SetIPSettings":{
"summary": "Sets the IP settings for the given interface.",
"events":{
"onIPAddressChanged" : "Triggered when the device connects to router.",
"onInternetStatusChanged" : "Triggered when each IP address is lost or acquired."
"onAddressChange" : "Triggered when the device connects to router.",
"onInternetStatusChange" : "Triggered when each IP address is lost or acquired."
},
"params": {
"type":"object",
Expand Down Expand Up @@ -534,7 +534,7 @@
"StartConnectivityMonitoring":{
"summary": "Enable a continuous monitoring of internet connectivity with heart beat interval thats given. If the monitoring is already happening, it will be restarted with new given interval.",
"events":{
"onInternetStatusChanged" : "Triggered when internet connection state changed."
"onInternetStatusChange" : "Triggered when internet connection state changed."
},
"params": {
"type":"object",
Expand Down Expand Up @@ -903,8 +903,8 @@
"RemoveKnownSSID":{
"summary": "Remove given SSID from saved SSIDs. This method just removes from the list and of the list is having only one entry thats being removed, it will initiate a disconnect.",
"events":{
"onWiFiStateChanged" : "Triggered when Wifi state changes to DISCONNECTED",
"onIPAddressChanged" : "Triggered when an IP Address is assigned or lost",
"onWiFiStateChange" : "Triggered when Wifi state changes to DISCONNECTED",
"onAddressChange" : "Triggered when an IP Address is assigned or lost",
"onInternetStatusChange" : "Triggered when internet connection state changed"
},
"params": {
Expand Down Expand Up @@ -933,7 +933,7 @@
"WiFiConnect":{
"summary": "Initiates request to connect to the specified SSID with the given passphrase. Passphrase can be `null` when the network security is `NONE`. When called with no arguments, this method attempts to connect to the saved SSID and password. See `AddToKnownSSIDs`.",
"events":{
"onWiFiStateChanged" : "Triggered when Wifi state changes to CONNECTING, CONNECTED ."
"onWiFiStateChange" : "Triggered when Wifi state changes to CONNECTING, CONNECTED ."
},
"params": {
"type": "object",
Expand Down Expand Up @@ -961,8 +961,8 @@
"WiFiDisconnect":{
"summary": "Disconnects from the currently connected SSID. A event will be posted upon completion",
"events":{
"onWIFIStateChanged" : "Triggered when Wifi state changes to DISCONNECTED (only if currently connected).",
"onIPAddressChanged" : "Triggered when an IP Address is assigned or lost",
"onWIFIStateChange" : "Triggered when Wifi state changes to DISCONNECTED (only if currently connected).",
"onAddressChange" : "Triggered when an IP Address is assigned or lost",
"onInternetStatusChange" : "Triggered when internet connection state changed"
},
"result": {
Expand Down Expand Up @@ -1028,8 +1028,8 @@
"StartWPS":{
"summary": "Initiates a connection using Wifi Protected Setup (WPS). An existing connection will be disconnected before attempting to initiate a new connection. Failure in WPS pairing will trigger an error event.\n\nIf the `method` parameter is set to `SERIALIZED_PIN`, then RDK retrieves the serialized pin using the Manufacturer (MFR) API. If the `method` parameter is set to `PIN`, then RDK use the pin supplied as part of the request. If the `method` parameter is set to `PBC`, then RDK uses Push Button Configuration (PBC) to obtain the pin.",
"events":{
"onWIFIStateChanged" : "Triggered when Wifi state changes to DISCONNECTED (only if currently connected), CONNECTING, CONNECTED.",
"onIPAddressChanged" : "Triggered when an IP Address is assigned or lost",
"onWIFIStateChange" : "Triggered when Wifi state changes to DISCONNECTED (only if currently connected), CONNECTING, CONNECTED.",
"onAddressChange" : "Triggered when an IP Address is assigned or lost",
"onInternetStatusChange" : "Triggered when internet connection state changed"
},
"params": {
Expand Down Expand Up @@ -1072,7 +1072,7 @@
"StopWPS":{
"summary": "Cancels the in-progress WPS pairing operation. The operation forcefully stops the in-progress pairing attempt and aborts the current scan. WPS pairing must be in-progress for the operation to succeed.",
"events":{
"onWIFIStateChanged" : "Triggered when Wifi state changes to DISCONNECTED."
"onWIFIStateChange" : "Triggered when Wifi state changes to DISCONNECTED."
},
"result": {
"type": "object",
Expand All @@ -1089,7 +1089,7 @@
"GetWiFiSignalStrength":{
"summary": "Get WiFiSignalStrength of connected SSID.",
"events":{
"onWiFiSignalStrengthChanged" : "Triggered when Wifi signal strength switches between Excellent, Good, Fair, Weak."
"onWiFiSignalStrengthChange" : "Triggered when Wifi signal strength switches between Excellent, Good, Fair, Weak."
},
"result": {
"type": "object",
Expand Down Expand Up @@ -1228,7 +1228,7 @@
}
},
"events": {
"onInterfaceStateChanged":{
"onInterfaceStateChange":{
"summary": "Triggered when an interface state is changed. The possible states are \n* 'INTERFACE_ADDED' \n* 'INTERFACE_LINK_UP' \n* 'INTERFACE_LINK_DOWN' \n* 'INTERFACE_ACQUIRING_IP' \n* 'INTERFACE_REMOVED' \n* 'INTERFACE_DISABLED' \n",
"params": {
"type": "object",
Expand All @@ -1248,7 +1248,7 @@
]
}
},
"onIPAddressChanged":{
"onAddressChange":{
"summary": "Triggered when an IP Address is assigned or lost.",
"params": {
"type": "object",
Expand Down Expand Up @@ -1284,7 +1284,7 @@
]
}
},
"onActiveInterfaceChanged":{
"onActiveInterfaceChange":{
"summary": "Triggered when the primary/active interface changes, regardless if it's from a system operation or through the `SetPrimaryInterface` method.",
"params": {
"type": "object",
Expand Down Expand Up @@ -1383,13 +1383,13 @@
}
}
},
"onWiFiStateChanged":{
"onWiFiStateChange":{
"summary": "Triggered when WIFI connection state get changed. The possible states are, \n * '0' - 'WIFI_STATE_UNINSTALLED' \n * '1' - 'WIFI_STATE_DISABLED' \n * '2' - 'WIFI_STATE_DISCONNECTED' \n * '3' - 'WIFI_STATE_PAIRING' \n * '4' - 'WIFI_STATE_CONNECTING' \n * '5' - 'WIFI_STATE_CONNECTED' \n * '6' - 'WIFI_STATE_SSID_NOT_FOUND' \n * '7' - 'WIFI_STATE_SSID_CHANGED' \n * '8' - 'WIFI_STATE_CONNECTION_LOST' \n * '9' - 'WIFI_STATE_CONNECTION_FAILED' \n * '10'- 'WIFI_STATE_CONNECTION_INTERRUPTED' \n * '11' - 'WIFI_STATE_INVALID_CREDENTIALS' \n * '12' - 'WIFI_STATE_AUTHENTICATION_FAILED' \n * '13' - 'WIFI_STATE_ERROR' \n",
"params": {
"type": "object",
"properties": {
"state":{
"summary": "onWiFiStateChanged",
"summary": "onWiFiStateChange",
"type": "integer",
"example": "5"
}
Expand All @@ -1399,7 +1399,7 @@
]
}
},
"onWiFiSignalStrengthChanged":{
"onWiFiSignalStrengthChange":{
"summary": "Triggered when WIFI connection Signal Strength get changed.",
"params": {
"type": "object",
Expand Down
Loading

0 comments on commit be89223

Please sign in to comment.