|
RDK Documentation (Open Sourced RDK Components)
|
35 static void _eventHandler(
const char *owner, IARM_EventId_t eventId,
void *data,
size_t len)
39 printf(
"Event handler invoked :: \n");
47 printf(
"Time out event called \n");
48 printf(
"Deep Sleep time out occured \n");
54 printf(
"Event IARM_BUS_PWRMGR_EVENT_MODECHANGED: State Changed %d to %d\n",
55 param->data.state.curState, param->data.state.newState);
58 #ifdef ENABLE_THERMAL_PROTECTION
63 printf(
"Event IARM_BUS_PWRMGR_EVENT_THERMAL_MODECHANGED: State Changed %d to %d\n \
64 Current temperature is %f ", param->data.therm.curLevel, param->data.therm.newLevel,
65 param->data.therm.curTemperature);
68 #endif //ENABLE_THERMAL_PROTECTION
87 printf(
"Tring to initialize IARM..\n");
91 if(IARM_RESULT_SUCCESS != err)
93 printf(
"Error initialing IARM bus()... error code : %d\n",err);
97 printf(
"Trying to connect..\n");
101 if(IARM_RESULT_SUCCESS != err)
103 printf(
"Error connecting to IARM bus()... error code : %d\n",err);
109 #ifdef ENABLE_THERMAL_PROTECTION
115 printf(
"Enter command..\n");
116 printf(
"c - check power status\n");
117 printf(
"s - set power status\n");
118 printf(
"w - warehouse reset the box\n");
119 printf(
"t - set time out \n");
120 #ifdef ENABLE_THERMAL_PROTECTION
121 printf(
"v - get current temperature \n");
122 printf(
"u - set temperature thresholds: \n");
124 printf(
"x - exit..\n");
136 printf(
"Enter time out \n :");
137 scanf(
"%d",&timeOut);
143 if( err == IARM_RESULT_SUCCESS)
145 printf(
"Successfully set the time out \n");
148 #ifdef ENABLE_THERMAL_PROTECTION
151 IARM_Bus_PWRMgr_GetThermalState_Param_t param;
153 IARM_BUS_PWRMGR_API_GetThermalState,
156 if(err == IARM_RESULT_SUCCESS)
158 printf(
"Current level is : (%d), temperature : %f \n",param.curLevel,param.curTemperature);
164 IARM_Bus_PWRMgr_SetTempThresholds_Param_t param;
166 printf(
"Enter high temperature level \n :");
167 scanf(
"%d",&temperature);
168 param.tempHigh = temperature;
169 printf(
"Enter critical temperature level \n :");
170 scanf(
"%d",&temperature);
171 param.tempCritical = temperature;
174 IARM_BUS_PWRMGR_API_SetTemperatureThresholds,
177 if(err == IARM_RESULT_SUCCESS)
179 printf(
"Threshold temperature levels updated \n");
194 if(err == IARM_RESULT_SUCCESS)
196 printf(
"Current state is : (%d)\n",param.curState);
204 printf(
"Give a state to set..\n");
205 printf(
"n - Power on\n");
206 printf(
"f - Power off\n");
207 printf(
"b - Standby\n");
208 printf(
"l - light sleep \n");
209 printf(
"d - deep sleep \n");
211 while(state !=
'n' && state !=
'f' && state !=
'b' && state !=
'l' && state !=
'd')
213 printf(
"Give a valid state n/f/b/l/d\n");
219 case 'n': param.
newState = IARM_BUS_PWRMGR_POWERSTATE_ON;
break;
220 case 'f': param.
newState = IARM_BUS_PWRMGR_POWERSTATE_OFF;
break;
221 case 'b': param.
newState = IARM_BUS_PWRMGR_POWERSTATE_STANDBY;
break;
222 case 'l': param.
newState = IARM_BUS_PWRMGR_POWERSTATE_STANDBY_LIGHT_SLEEP;
break;
223 case 'd': param.
newState = IARM_BUS_PWRMGR_POWERSTATE_STANDBY_DEEP_SLEEP;
break;
230 if(err == IARM_RESULT_SUCCESS)
232 printf(
"Successfully set the state..\n");
241 if(err == IARM_RESULT_SUCCESS)
243 printf(
"Successfully executed Warehouse reset command..\n");
250 }
while(input !=
'x');
253 #ifdef ENABLE_THERMAL_PROTECTION
#define IARM_BUS_PWRMGR_API_SetPowerState
#define IARM_BUS_PWRMGR_NAME
Structure which holds the new powerstate to be set to the device.
IARM_Result_t IARM_Bus_Term(void)
This API is used to terminate the IARM-Bus library.
Structure which holds the current power state of the CPE.
IARM_Result_t IARM_Bus_Call(const char *ownerName, const char *methodName, void *arg, size_t argLen)
This API is used to Invoke RPC method by its application name and method name.
Structure which holds the event data.
#define IARM_BUS_PWRMGR_API_WareHouseReset
#define IARM_BUS_PWRMGR_API_GetPowerState
IARM_Result_t IARM_Bus_RegisterEventHandler(const char *ownerName, IARM_EventId_t eventId, IARM_EventHandler_t handler)
This API register to listen to event and provide the callback function for event notification....
IARM_Result_t IARM_Bus_Disconnect(void)
This API disconnect Application from IARM Bus so the application will not receive any IARM event or R...
#define IARM_BUS_PWRMGR_API_SetDeepSleepTimeOut
RDK IARM-Bus API Declarations.
@ IARM_BUS_PWRMGR_EVENT_MODECHANGED
IARM-Bus Power Manager Public API.
@ IARM_BUS_PWRMGR_EVENT_DEEPSLEEP_TIMEOUT
IARM_Result_t IARM_Bus_Connect(void)
This API is used to connect application to the IARM bus daemon. After connected, the application can ...
IARM_Bus_PWRMgr_PowerState_t newState
IARM_Result_t IARM_Bus_UnRegisterEventHandler(const char *ownerName, IARM_EventId_t eventId)
This API is used to Remove ALL handlers registered for the given event. This API remove the all the e...
@ IARM_BUS_PWRMGR_EVENT_THERMAL_MODECHANGED
Structure which holds the timeout value to set for Deep sleep.
IARM_Result_t IARM_Bus_Init(const char *name)
This API is used to initialize the IARM-Bus library.