Skip to content

Commit

Permalink
Merge branch 'rdkcentral:sprint/2401' into for_checkin
Browse files Browse the repository at this point in the history
  • Loading branch information
gururaajar authored Mar 18, 2024
2 parents 9ab21c2 + 743b82f commit 1cdaa12
Show file tree
Hide file tree
Showing 58 changed files with 1,574 additions and 174 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/L0-PersistentStore-grpc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: L0-PersistentStore-grpc

on:
push:
paths:
- PersistentStore/grpc/**
pull_request:
paths:
- PersistentStore/grpc/**

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
path: ${{github.repository}}

- name: Install valgrind, coverage, cmake, protoc, grpc_cpp_plugin, grpc
run: |
sudo apt update
sudo apt install -y valgrind lcov cmake protobuf-compiler protobuf-compiler-grpc libgrpc++-dev
- name: Build Thunder
working-directory: ${{github.workspace}}
run: sh +x ${GITHUB_REPOSITORY}/.github/workflows/BuildThunder.sh

- name: Build
working-directory: ${{github.workspace}}
run: |
cmake -S ${GITHUB_REPOSITORY}/PersistentStore/grpc/l0test -B build/grpcl0test -DCMAKE_INSTALL_PREFIX="install/usr" -DCMAKE_CXX_FLAGS="--coverage -Wall -Werror"
cmake --build build/grpcl0test --target install
- name: Run
working-directory: ${{github.workspace}}
run: PATH=${PWD}/install/usr/bin:${PATH} LD_LIBRARY_PATH=${PWD}/install/usr/lib:${LD_LIBRARY_PATH} valgrind --tool=memcheck --log-file=valgrind_log --leak-check=yes --show-reachable=yes --track-fds=yes --fair-sched=try grpcl0test

- name: Generate coverage
working-directory: ${{github.workspace}}
run: |
lcov -c -o coverage.info -d build/grpcl0test
genhtml -o coverage coverage.info
- name: Upload artifacts
if: ${{ !env.ACT }}
uses: actions/upload-artifact@v4
with:
name: artifacts
path: |
coverage/
valgrind_log
if-no-files-found: warn
29 changes: 29 additions & 0 deletions .github/workflows/L2-PersistentStore-grpc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: L2-PersistentStore-grpc

on:
push:
paths:
- PersistentStore/grpc/**
pull_request:
paths:
- PersistentStore/grpc/**

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
path: ${{github.repository}}

- name: Install cmake, protoc, grpc_cpp_plugin, grpc
run: |
sudo apt update
sudo apt install -y cmake protobuf-compiler protobuf-compiler-grpc libgrpc++-dev
- name: Build
working-directory: ${{github.workspace}}
run: |
cmake -S ${GITHUB_REPOSITORY}/PersistentStore/grpc/l2test -B build/grpcl2test -DCMAKE_INSTALL_PREFIX="install/usr" -DCMAKE_CXX_FLAGS="-Wall -Werror"
cmake --build build/grpcl2test --target install
4 changes: 2 additions & 2 deletions AVInput/AVInput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -925,7 +925,7 @@ void AVInput::dsAVVideoModeEventHandler(const char *owner, IARM_EventId_t eventI
if (IARM_BUS_DSMGR_EVENT_HDMI_IN_VIDEO_MODE_UPDATE == eventId) {
IARM_Bus_DSMgr_EventData_t *eventData = (IARM_Bus_DSMgr_EventData_t *)data;
int hdmi_in_port = eventData->data.hdmi_in_video_mode.port;
dsVideoPortResolution_t resolution;
dsVideoPortResolution_t resolution = {};
resolution.pixelResolution = eventData->data.hdmi_in_video_mode.resolution.pixelResolution;
resolution.interlaced = eventData->data.hdmi_in_video_mode.resolution.interlaced;
resolution.frameRate = eventData->data.hdmi_in_video_mode.resolution.frameRate;
Expand Down Expand Up @@ -1161,7 +1161,7 @@ std::string AVInput::getSPD(int iPort)
memcpy(&pre,spdVect.data(),sizeof(struct dsSpd_infoframe_st));

char str[200] = {0};
sprintf(str, "Packet Type:%02X,Version:%u,Length:%u,vendor name:%s,product des:%s,source info:%02X",
snprintf(str, sizeof(str), "Packet Type:%02X,Version:%u,Length:%u,vendor name:%s,product des:%s,source info:%02X",
pre.pkttype,pre.version,pre.length,pre.vendor_name,pre.product_des,pre.source_info);
spdbase64 = str;
}
Expand Down
50 changes: 31 additions & 19 deletions Bluetooth/Bluetooth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -414,10 +414,15 @@ namespace WPEFramework
JsonArray Bluetooth::getPairedDevices()
{
JsonArray deviceArray;
BTRMGR_PairedDevicesList_t pairedDevices;
BTRMGR_PairedDevicesList_t *pairedDevices = (BTRMGR_PairedDevicesList_t*)malloc(sizeof(BTRMGR_PairedDevicesList_t));
if(pairedDevices == nullptr)
{
LOGERR("Failed to allocate memory");
return deviceArray;
}

memset (&pairedDevices, 0, sizeof(pairedDevices));
BTRMGR_Result_t rc = BTRMGR_GetPairedDevices(0, &pairedDevices);
memset (pairedDevices, 0, sizeof(BTRMGR_PairedDevicesList_t));
BTRMGR_Result_t rc = BTRMGR_GetPairedDevices(0, pairedDevices);
if (BTRMGR_RESULT_SUCCESS != rc)
{
LOGERR("Failed to get the paired devices");
Expand All @@ -426,26 +431,32 @@ namespace WPEFramework
{
int i = 0;
JsonObject deviceDetails;
LOGINFO ("Success.... Paired %d Devices", pairedDevices.m_numOfDevices);
for (; i < pairedDevices.m_numOfDevices; i++)
LOGINFO ("Success.... Paired %d Devices", pairedDevices->m_numOfDevices);
for (; i < pairedDevices->m_numOfDevices; i++)
{
deviceDetails["deviceID"] = std::to_string(pairedDevices.m_deviceProperty[i].m_deviceHandle);
deviceDetails["name"] = string(pairedDevices.m_deviceProperty[i].m_name);
deviceDetails["deviceType"] = string(BTRMGR_GetDeviceTypeAsString(pairedDevices.m_deviceProperty[i].m_deviceType));
deviceDetails["connected"] = pairedDevices.m_deviceProperty[i].m_isConnected?true:false;
deviceDetails["deviceID"] = std::to_string(pairedDevices->m_deviceProperty[i].m_deviceHandle);
deviceDetails["name"] = string(pairedDevices->m_deviceProperty[i].m_name);
deviceDetails["deviceType"] = string(BTRMGR_GetDeviceTypeAsString(pairedDevices->m_deviceProperty[i].m_deviceType));
deviceDetails["connected"] = pairedDevices->m_deviceProperty[i].m_isConnected?true:false;
deviceArray.Add(deviceDetails);
}
}
free(pairedDevices);
return deviceArray;
}

JsonArray Bluetooth::getConnectedDevices()
{
JsonArray deviceArray;
BTRMGR_ConnectedDevicesList_t connectedDevices;
BTRMGR_ConnectedDevicesList_t *connectedDevices = (BTRMGR_ConnectedDevicesList_t*)malloc(sizeof(BTRMGR_ConnectedDevicesList_t));
if(connectedDevices == nullptr)
{
LOGERR("Failed to allocate memory");
return deviceArray;
}

memset (&connectedDevices, 0, sizeof(connectedDevices));
BTRMGR_Result_t rc = BTRMGR_GetConnectedDevices(0, &connectedDevices);
memset (connectedDevices, 0, sizeof(BTRMGR_ConnectedDevicesList_t));
BTRMGR_Result_t rc = BTRMGR_GetConnectedDevices(0, connectedDevices);
if (BTRMGR_RESULT_SUCCESS != rc)
{
LOGERR("Failed to get the connected devices");
Expand All @@ -454,16 +465,17 @@ namespace WPEFramework
{
int i = 0;
JsonObject deviceDetails;
LOGINFO ("Success.... Connected %d Devices", connectedDevices.m_numOfDevices);
for (; i < connectedDevices.m_numOfDevices; i++)
LOGINFO ("Success.... Connected %d Devices", connectedDevices->m_numOfDevices);
for (; i < connectedDevices->m_numOfDevices; i++)
{
deviceDetails["deviceID"] = std::to_string(connectedDevices.m_deviceProperty[i].m_deviceHandle);
deviceDetails["name"] = string(connectedDevices.m_deviceProperty[i].m_name);
deviceDetails["deviceType"] = string(BTRMGR_GetDeviceTypeAsString(connectedDevices.m_deviceProperty[i].m_deviceType));
deviceDetails["activeState"] = std::to_string(connectedDevices.m_deviceProperty[i].m_powerStatus);
deviceDetails["deviceID"] = std::to_string(connectedDevices->m_deviceProperty[i].m_deviceHandle);
deviceDetails["name"] = string(connectedDevices->m_deviceProperty[i].m_name);
deviceDetails["deviceType"] = string(BTRMGR_GetDeviceTypeAsString(connectedDevices->m_deviceProperty[i].m_deviceType));
deviceDetails["activeState"] = std::to_string(connectedDevices->m_deviceProperty[i].m_powerStatus);
deviceArray.Add(deviceDetails);
}
}
free(connectedDevices);
return deviceArray;
}

Expand Down Expand Up @@ -862,7 +874,7 @@ namespace WPEFramework
return mediaTrackInfo;
}

void Bluetooth::notifyEventWrapper (BTRMGR_EventMessage_t eventMsg)
void Bluetooth::notifyEventWrapper (BTRMGR_EventMessage_t &eventMsg)
{
JsonObject params;
string profileInfo;
Expand Down
2 changes: 1 addition & 1 deletion Bluetooth/Bluetooth.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ namespace WPEFramework {

public:
static Bluetooth* _instance;
void notifyEventWrapper (BTRMGR_EventMessage_t eventMsg);
void notifyEventWrapper (BTRMGR_EventMessage_t &eventMsg);

private:
static const string STATUS_NO_BLUETOOTH_HARDWARE;
Expand Down
17 changes: 13 additions & 4 deletions ContinueWatching/ContinueWatching.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,9 @@ namespace WPEFramework {
}

fseek(file, 0, SEEK_SET);
fread(jsonDoc, numbytes, 1, file);
if(numbytes >= 0) {
(void)fread(jsonDoc, numbytes, 1, file);
}
fclose(file);
file = NULL;
jsonDoc[numbytes] = 0;
Expand Down Expand Up @@ -646,7 +648,9 @@ namespace WPEFramework {
}

fseek(file, 0, SEEK_SET);
fread(jsonDoc, 1, numbytes, file);
if(numbytes >= 0) {
(void)fread(jsonDoc, numbytes, 1, file);
}
fclose(file);
jsonDoc[numbytes] = '\0';

Expand Down Expand Up @@ -705,7 +709,9 @@ namespace WPEFramework {
return false;
}
fseek(file, 0, SEEK_SET);
fread(jsonDoc, numbytes, 1, file);
if(numbytes >= 0) {
(void)fread(jsonDoc, numbytes, 1, file);
}
fclose(file);
file = NULL;
jsonDoc[numbytes] = 0;
Expand Down Expand Up @@ -764,7 +770,10 @@ namespace WPEFramework {
unsigned char hash[SHA256_DIGEST_LENGTH];
SHA256_CTX sha256Ctx;
SHA256_Init(&sha256Ctx);
SHA256_Update(&sha256Ctx, str.c_str(), str.size());
int check_update = SHA256_Update(&sha256Ctx, str.c_str(), str.size());
if(check_update == 0){
LOGWARN("Failed hash update");
}
SHA256_Final(hash, &sha256Ctx);
std::stringstream strStream;
/* Iterate through hash & convert each byte to 2-char wide hex */
Expand Down
2 changes: 1 addition & 1 deletion ContinueWatching/ContinueWatching.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ namespace WPEFramework {

std::string mStrApplicationName;
#if !defined(DISABLE_SECAPI)
SEC_OBJECTID mSecObjectId;
SEC_OBJECTID mSecObjectId = 0;
#endif
};

Expand Down
27 changes: 14 additions & 13 deletions ControlService/ControlService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ namespace WPEFramework {
ControlService::ControlService()
: PluginHost::JSONRPC()
, m_apiVersionNumber((uint32_t)-1) /* default max uint32_t so everything gets enabled */ //TODO(MROLLINS) Can't we access this from jsonrpc interface?
, m_numOfBindRemotes(0)
{
LOGINFO("ctor");
ControlService::_instance = this;
Expand Down Expand Up @@ -228,11 +229,11 @@ namespace WPEFramework {
}
}

void ControlService::irmgrHandler(const char *owner, IARM_EventId_t eventId, void *data, size_t len)
void ControlService::irmgrHandler(const char *owner, IARM_EventId_t eventId, void *dataP, size_t len)
{
if (eventId == IARM_BUS_IRMGR_EVENT_IRKEY)
{
IARM_Bus_IRMgr_EventData_t *irEventData = (IARM_Bus_IRMgr_EventData_t*)data;
IARM_Bus_IRMgr_EventData_t *irEventData = (IARM_Bus_IRMgr_EventData_t*)dataP;
int keyCode = irEventData->data.irkey.keyCode;
int keySrc = irEventData->data.irkey.keySrc;
int keyType = irEventData->data.irkey.keyType;
Expand Down Expand Up @@ -269,14 +270,14 @@ namespace WPEFramework {
}
}

void ControlService::ctrlmHandler(const char *owner, IARM_EventId_t eventId, void *data, size_t len)
void ControlService::ctrlmHandler(const char *owner, IARM_EventId_t eventId, void *dataP, size_t len)
{
if (eventId == CTRLM_RCU_IARM_EVENT_KEY_GHOST)
{
LOGINFO("Got a controlMgr ghost key event!");
if (data != NULL)
if (dataP != NULL)
{
ctrlm_rcu_iarm_event_key_ghost_t *msg = (ctrlm_rcu_iarm_event_key_ghost_t*)data;
ctrlm_rcu_iarm_event_key_ghost_t *msg = (ctrlm_rcu_iarm_event_key_ghost_t*)dataP;
int remoteId = msg->controller_id;
int ghostCode = msg->ghost_code;

Expand Down Expand Up @@ -332,9 +333,9 @@ namespace WPEFramework {
len, sizeof(ctrlm_rcu_iarm_event_battery_t));
return;
}
if (data != NULL)
if (dataP != NULL)
{
ctrlm_rcu_iarm_event_battery_t *msg = (ctrlm_rcu_iarm_event_battery_t*)data;
ctrlm_rcu_iarm_event_battery_t *msg = (ctrlm_rcu_iarm_event_battery_t*)dataP;
if (msg->api_revision == CTRLM_RCU_IARM_BUS_API_REVISION)
{
int remoteId = msg->controller_id;
Expand Down Expand Up @@ -370,9 +371,9 @@ namespace WPEFramework {
len, sizeof(ctrlm_rcu_iarm_event_remote_reboot_t));
return;
}
if (data != NULL)
if (dataP != NULL)
{
ctrlm_rcu_iarm_event_remote_reboot_t *msg = (ctrlm_rcu_iarm_event_remote_reboot_t*)data;
ctrlm_rcu_iarm_event_remote_reboot_t *msg = (ctrlm_rcu_iarm_event_remote_reboot_t*)dataP;
if (msg->api_revision == CTRLM_RCU_IARM_BUS_API_REVISION)
{
int remoteId = msg->controller_id;
Expand Down Expand Up @@ -413,9 +414,9 @@ namespace WPEFramework {
len, sizeof(ctrlm_rcu_iarm_event_reverse_cmd_t));
return;
}
if (data != NULL)
if (dataP != NULL)
{
ctrlm_rcu_iarm_event_reverse_cmd_t *msg = (ctrlm_rcu_iarm_event_reverse_cmd_t*)data;
ctrlm_rcu_iarm_event_reverse_cmd_t *msg = (ctrlm_rcu_iarm_event_reverse_cmd_t*)dataP;
if (msg->api_revision == CTRLM_RCU_IARM_BUS_API_REVISION)
{
ctrlm_rcu_reverse_cmd_t cmd = msg->action;
Expand Down Expand Up @@ -463,9 +464,9 @@ namespace WPEFramework {
else if (eventId == CTRLM_RCU_IARM_EVENT_CONTROL)
{
LOGINFO("Got a controlMgr control event!");
if (data != NULL)
if (dataP != NULL)
{
ctrlm_rcu_iarm_event_control_t *msg = (ctrlm_rcu_iarm_event_control_t*)data;
ctrlm_rcu_iarm_event_control_t *msg = (ctrlm_rcu_iarm_event_control_t*)dataP;
int remoteId = msg->controller_id;
int value = msg->event_value;
int spare_value = msg->spare_value;
Expand Down
1 change: 0 additions & 1 deletion ControlService/test/controlSvcTestClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,6 @@ int main(int argc, char** argv)
cmd = lastCmd;
else if ((cmd[0] >= '0') && (cmd[0] <= '9'))
{
choice = stoi(cmd);
remoteId = 255;
timeOutPeriod = 0;
pairingMode = 255;
Expand Down
14 changes: 10 additions & 4 deletions DataCapture/DataCapture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ namespace WPEFramework {
Register(METHOD_ENABLE_AUDIO_CAPTURE, &DataCapture::enableAudioCaptureWrapper, this);
Register(METHOD_GET_AUDIO_CLIP, &DataCapture::getAudioClipWrapper, this);

_audio_properties = {};
_sock_adaptor.reset(new socket_adaptor());
}

Expand Down Expand Up @@ -513,10 +514,15 @@ namespace WPEFramework {
chunk = curl_slist_append(chunk, "Content-Type: audio/x-wav");

//set url and data
curl_easy_setopt(curl, CURLOPT_URL, url);
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, chunk);
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, data.size());
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, &data[0]);
if(curl_easy_setopt(curl, CURLOPT_URL, url) != CURLE_OK)
LOGWARN("Failed to set curl option: CURLOPT_URL");
if(curl_easy_setopt(curl, CURLOPT_HTTPHEADER, chunk) != CURLE_OK)
LOGWARN("Failed to set curl option: CURLOPT_HTTPHEADER");
if(curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, data.size()) != CURLE_OK)
LOGWARN("Failed to set curl option: CURLOPT_POSTFIELDSIZE");
if(curl_easy_setopt(curl, CURLOPT_POSTFIELDS, &data[0]) != CURLE_OK)
LOGWARN("Failed to set curl option: CURLOPT_POSTFIELDS");


//perform blocking upload call
res = curl_easy_perform(curl);
Expand Down
Loading

0 comments on commit 1cdaa12

Please sign in to comment.