Skip to content

Commit

Permalink
Merge pull request #5528 from apatel859/main
Browse files Browse the repository at this point in the history
RDK-45729: UserControlPress/Release messages HdmiCecSource plugin
  • Loading branch information
apatel859 authored Jul 15, 2024
2 parents 6bc0e35 + 5b4aa38 commit 1bfa6a3
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 2 deletions.
4 changes: 4 additions & 0 deletions HdmiCecSource/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ All notable changes to this RDK Service will be documented in this file.

* For more details, refer to [versioning](https://github.com/rdkcentral/rdkservices#versioning) section under Main README.

## [1.1.0] - 2024-07-15
### Added
- Added event for sendKey Presss and release messages

## [1.0.8] - 2024-03-21
### Changed
- Fixed IARM event handling to process in thread
Expand Down
34 changes: 34 additions & 0 deletions HdmiCecSource/HDMICecSource.json
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,40 @@
"logicalAddress"
]
}
},
"onKeyPressEvent":{
"summary": "Triggered when received UserControlPressed event from other CEC device",
"params": {
"type":"object",
"properties": {
"logicalAddress": {
"$ref": "#/definitions/logicalAddress"
},
"keyCode":{
"summary":"The key code for the pressed key. Possible values : `0x41` (VOLUME_UP), `0x42` (VOLUME_DOWN), `0x43` (MUTE), `0x01` (UP), `0x02` (DOWN), `0x03` (LEFT), `0x04` (RIGHT), `0x00` (SELECT), `0x09` (HOME), `0x0D` (BACK), `0x20` (NUMBER_0), `0x21` (NUMBER_1), `0x22` (NUMBER_2), `0x23` (NUMBER_3), `0x24` (NUMBER_4), `0x25` (NUMBER_5), `0x26` (NUMBER_6), `0x27` (NUMBER_7), `0x28` (NUMBER_8), `0x29` (NUMBER_9)",
"type": "integer",
"example": 65
}
},
"required": [
"logicalAddress",
"keyCode"
]
}
},
"onKeyReleaseEvent":{
"summary": "Triggered when received UserControlReleased event from other CEC device",
"params": {
"type":"object",
"properties": {
"logicalAddress": {
"$ref": "#/definitions/logicalAddress"
}
},
"required": [
"logicalAddress"
]
}
}
}
}
37 changes: 35 additions & 2 deletions HdmiCecSource/HdmiCecSource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,16 @@
#define HDMICEC_EVENT_ON_DEVICES_CHANGED "onDevicesChanged"
#define HDMICEC_EVENT_ON_HDMI_HOT_PLUG "onHdmiHotPlug"
#define HDMICEC_EVENT_ON_STANDBY_MSG_RECEIVED "standbyMessageReceived"
#define HDMICEC_EVENT_ON_KEYPRESS_MSG_RECEIVED "onKeyPressEvent"
#define HDMICEC_EVENT_ON_KEYRELEASE_MSG_RECEIVED "onKeyReleaseEvent"

#define DEV_TYPE_TUNER 1
#define HDMI_HOT_PLUG_EVENT_CONNECTED 0
#define ABORT_REASON_ID 4

#define API_VERSION_NUMBER_MAJOR 1
#define API_VERSION_NUMBER_MINOR 0
#define API_VERSION_NUMBER_PATCH 8
#define API_VERSION_NUMBER_MINOR 1
#define API_VERSION_NUMBER_PATCH 0

enum {
HDMICECSOURCE_EVENT_DEVICE_ADDED=0,
Expand Down Expand Up @@ -353,6 +356,21 @@ namespace WPEFramework
LOGINFO("Command: ReportPowerStatus TV Power Status from:%s status : %s \n",header.from.toString().c_str(),msg.status.toString().c_str());
HdmiCecSource::_instance->addDevice(header.from.toInt());
}

void HdmiCecSourceProcessor::process (const UserControlPressed &msg, const Header &header)
{
printHeader(header);
LOGINFO("Command: UserControlPressed message received from:%s command : %d \n",header.from.toString().c_str(),msg.uiCommand.toInt());
HdmiCecSource::_instance->SendKeyPressMsgEvent(header.from.toInt(),msg.uiCommand.toInt());
}

void HdmiCecSourceProcessor::process (const UserControlReleased &msg, const Header &header)
{
printHeader(header);
LOGINFO("Command: UserControlReleased message received from:%s \n",header.from.toString().c_str());
HdmiCecSource::_instance->SendKeyReleaseMsgEvent(header.from.toInt());
}

void HdmiCecSourceProcessor::process (const FeatureAbort &msg, const Header &header)
{
printHeader(header);
Expand Down Expand Up @@ -602,6 +620,21 @@ namespace WPEFramework
_instance->smConnection->sendTo(LogicalAddress(logicalAddress), MessageEncoder().encode(UserControlReleased()), 100);

}

void HdmiCecSource::SendKeyPressMsgEvent(const int logicalAddress,const int keyCode)
{
JsonObject params;
params["logicalAddress"] = JsonValue(logicalAddress);
params["keyCode"] = JsonValue(keyCode);
sendNotify(HDMICEC_EVENT_ON_KEYPRESS_MSG_RECEIVED, params);
}
void HdmiCecSource::SendKeyReleaseMsgEvent(const int logicalAddress)
{
JsonObject params;
params["logicalAddress"] = JsonValue(logicalAddress);
sendNotify(HDMICEC_EVENT_ON_KEYRELEASE_MSG_RECEIVED, params);
}

void HdmiCecSource::SendStandbyMsgEvent(const int logicalAddress)
{
JsonObject params;
Expand Down
4 changes: 4 additions & 0 deletions HdmiCecSource/HdmiCecSource.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ namespace WPEFramework {
void process (const DeviceVendorID &msg, const Header &header);
void process (const GiveDevicePowerStatus &msg, const Header &header);
void process (const ReportPowerStatus &msg, const Header &header);
void process (const UserControlPressed &msg, const Header &header);
void process (const UserControlReleased &msg, const Header &header);
void process (const FeatureAbort &msg, const Header &header);
void process (const Abort &msg, const Header &header);
void process (const Polling &msg, const Header &header);
Expand Down Expand Up @@ -197,6 +199,8 @@ namespace WPEFramework {
pthread_mutex_t m_lockUpdate;
bool cecEnableStatus;

void SendKeyPressMsgEvent(const int logicalAddress,const int keyCode);
void SendKeyReleaseMsgEvent(const int logicalAddress);
void SendStandbyMsgEvent(const int logicalAddress);
void sendActiveSourceEvent();
void addDevice(const int logicalAddress);
Expand Down

0 comments on commit 1bfa6a3

Please sign in to comment.