Skip to content

Commit

Permalink
OMWAPPI-1077 locked API for XCast
Browse files Browse the repository at this point in the history
  • Loading branch information
kiran-kottarathil-infosys committed May 28, 2024
1 parent 230eefc commit 103ea5d
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions XCast/XCast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
#include <syscall.h>
#include <cstring>
#include "RtXcastConnector.h"
#include "UtilsSynchroIarm.hpp"

using namespace std;

// Events
Expand Down Expand Up @@ -116,17 +118,17 @@ XCast::XCast() : PluginHost::JSONRPC()
if(XCast::isCastEnabled)
{
LOGINFO("XcastService::Register methods and create onLocateCastTimer ");
Register(METHOD_GET_API_VERSION_NUMBER, &XCast::getApiVersionNumber, this);
Register(METHOD_ON_APPLICATION_STATE_CHANGED , &XCast::applicationStateChanged, this);
Register(METHOD_SET_ENABLED, &XCast::setEnabled, this);
Register(METHOD_GET_ENABLED, &XCast::getEnabled, this);
Register(METHOD_GET_STANDBY_BEHAVIOR, &XCast::getStandbyBehavior, this);
Register(METHOD_SET_STANDBY_BEHAVIOR, &XCast::setStandbyBehavior, this);
Register(METHOD_GET_FRIENDLYNAME, &XCast::getFriendlyName, this);
Register(METHOD_SET_FRIENDLYNAME, &XCast::setFriendlyName, this);
Register(METHOD_REG_APPLICATIONS, &XCast::registerApplications, this);
Register(METHOD_UNREG_APPLICATIONS, &XCast::unregisterApplications, this);
Register(METHOD_GET_PROTOCOLVERSION, &XCast::getProtocolVersion, this);
Utils::Synchro::RegisterLockedApi(METHOD_GET_API_VERSION_NUMBER, &XCast::getApiVersionNumber, this);
Utils::Synchro::RegisterLockedApi(METHOD_ON_APPLICATION_STATE_CHANGED , &XCast::applicationStateChanged, this);
Utils::Synchro::RegisterLockedApi(METHOD_SET_ENABLED, &XCast::setEnabled, this);
Utils::Synchro::RegisterLockedApi(METHOD_GET_ENABLED, &XCast::getEnabled, this);
Utils::Synchro::RegisterLockedApi(METHOD_GET_STANDBY_BEHAVIOR, &XCast::getStandbyBehavior, this);
Utils::Synchro::RegisterLockedApi(METHOD_SET_STANDBY_BEHAVIOR, &XCast::setStandbyBehavior, this);
Utils::Synchro::RegisterLockedApi(METHOD_GET_FRIENDLYNAME, &XCast::getFriendlyName, this);
Utils::Synchro::RegisterLockedApi(METHOD_SET_FRIENDLYNAME, &XCast::setFriendlyName, this);
Utils::Synchro::RegisterLockedApi(METHOD_REG_APPLICATIONS, &XCast::registerApplications, this);
Utils::Synchro::RegisterLockedApi(METHOD_UNREG_APPLICATIONS, &XCast::unregisterApplications, this);
Utils::Synchro::RegisterLockedApi(METHOD_GET_PROTOCOLVERSION, &XCast::getProtocolVersion, this);

m_locateCastTimer.connect( bind( &XCast::onLocateCastTimer, this ));
}
Expand All @@ -147,7 +149,7 @@ void XCast::InitializeIARM()
if (Utils::IARM::init())
{
IARM_Result_t res;
IARM_CHECK( IARM_Bus_RegisterEventHandler(IARM_BUS_PWRMGR_NAME,IARM_BUS_PWRMGR_EVENT_MODECHANGED, powerModeChange) );
IARM_CHECK( Utils::Synchro::RegisterLockedIarmEventHandler<XCast>(IARM_BUS_PWRMGR_NAME,IARM_BUS_PWRMGR_EVENT_MODECHANGED, powerModeChange) );
IARM_Bus_PWRMgr_GetPowerState_Param_t param;
res = IARM_Bus_Call(IARM_BUS_PWRMGR_NAME, IARM_BUS_PWRMGR_API_GetPowerState,
(void *)&param, sizeof(param));
Expand All @@ -163,7 +165,7 @@ void XCast::DeinitializeIARM()
if (Utils::IARM::isConnected())
{
IARM_Result_t res;
IARM_CHECK( IARM_Bus_RemoveEventHandler(IARM_BUS_PWRMGR_NAME,IARM_BUS_PWRMGR_EVENT_MODECHANGED, powerModeChange) );
IARM_CHECK( Utils::Synchro::RemoveLockedEventHandler<XCast>(IARM_BUS_PWRMGR_NAME,IARM_BUS_PWRMGR_EVENT_MODECHANGED, powerModeChange) );
}
Unregister(METHOD_GET_API_VERSION_NUMBER);
Unregister(METHOD_ON_APPLICATION_STATE_CHANGED);
Expand Down

0 comments on commit 103ea5d

Please sign in to comment.