RDK Documentation (Open Sourced RDK Components)
ledmgrmain.cpp
1 /*
2  * If not stated otherwise in this file or this component's Licenses.txt file the
3  * following copyright and licenses apply:
4  *
5  * Copyright 2016 RDK Management
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18 */
19 
20 /**
21  * @defgroup LED LED Manager
22  * - The LED Manager is an application that is responsible for controlling the LEDs on the product.
23  * - Manages the STB front panel color LED to communicate the system status.
24  *
25  * @defgroup LED_TYPES LED Data types
26  * @ingroup LED
27  *
28  * @defgroup LED_APIS LED API
29  * @ingroup LED
30  *
31  **/
32 #include <iostream>
33 #include <stdio.h>
34 #include <stdint.h>
35 #include <cstdlib>
36 #include <string.h>
37 #include <semaphore.h>
38 #include <glib.h>
39 #include <pthread.h>
40 #include <unistd.h>
41 
42 #include "libIBus.h"
43 #include "sysMgr.h"
44 #include "libIBusDaemon.h"
45 #include "irMgr.h"
46 #include "comcastIrKeyCodes.h"
47 #include "pwrMgr.h"
48 
49 #include "frontPanelIndicator.hpp"
50 #include "frontPanelConfig.hpp"
51 
52 #include "ledmgr_types.hpp"
53 #include "ledmgr.hpp"
54 #include "cap.h"
55 
56 sem_t g_app_done_sem;
57 
58 /**
59  * @addtogroup LED_APIS
60  * @{
61  */
62 /** @brief This API is used to trace the debug logs prints.
63  *
64  * @param[in] state system state
65  */
66 void trace_event(int state)
67 {
68 #define HANDLE(event) case event:\
69  std::cout<<"Detected event "<<#event<<std::endl;\
70  break;
71 
72  switch(state)
73  {
74  HANDLE(IARM_BUS_SYSMGR_SYSSTATE_CHANNELMAP);
75  HANDLE(IARM_BUS_SYSMGR_SYSSTATE_DISCONNECTMGR);
76  HANDLE(IARM_BUS_SYSMGR_SYSSTATE_TUNEREADY);
77  HANDLE(IARM_BUS_SYSMGR_SYSSTATE_EXIT_OK);
78  HANDLE(IARM_BUS_SYSMGR_SYSSTATE_CMAC);
79  HANDLE(IARM_BUS_SYSMGR_SYSSTATE_MOTO_ENTITLEMENT);
80  HANDLE(IARM_BUS_SYSMGR_SYSSTATE_MOTO_HRV_RX);
81  HANDLE(IARM_BUS_SYSMGR_SYSSTATE_CARD_CISCO_STATUS);
82  HANDLE(IARM_BUS_SYSMGR_SYSSTATE_VIDEO_PRESENTING);
83  HANDLE(IARM_BUS_SYSMGR_SYSSTATE_HDMI_OUT);
84  HANDLE(IARM_BUS_SYSMGR_SYSSTATE_HDCP_ENABLED);
85  HANDLE(IARM_BUS_SYSMGR_SYSSTATE_HDMI_EDID_READ);
86  HANDLE(IARM_BUS_SYSMGR_SYSSTATE_FIRMWARE_DWNLD);
87  HANDLE(IARM_BUS_SYSMGR_SYSSTATE_TIME_SOURCE);
88  HANDLE(IARM_BUS_SYSMGR_SYSSTATE_TIME_ZONE);
89  HANDLE(IARM_BUS_SYSMGR_SYSSTATE_CA_SYSTEM);
90  HANDLE(IARM_BUS_SYSMGR_SYSSTATE_ESTB_IP);
91  HANDLE(IARM_BUS_SYSMGR_SYSSTATE_ECM_IP);
92  HANDLE(IARM_BUS_SYSMGR_SYSSTATE_LAN_IP);
93  HANDLE(IARM_BUS_SYSMGR_SYSSTATE_MOCA);
94  HANDLE(IARM_BUS_SYSMGR_SYSSTATE_DOCSIS);
95  HANDLE(IARM_BUS_SYSMGR_SYSSTATE_DSG_BROADCAST_CHANNEL);
96  HANDLE(IARM_BUS_SYSMGR_SYSSTATE_DSG_CA_TUNNEL);
97  HANDLE(IARM_BUS_SYSMGR_SYSSTATE_CABLE_CARD);
98  HANDLE(IARM_BUS_SYSMGR_SYSSTATE_CABLE_CARD_DWNLD);
99  HANDLE(IARM_BUS_SYSMGR_SYSSTATE_CVR_SUBSYSTEM);
100  HANDLE(IARM_BUS_SYSMGR_SYSSTATE_DOWNLOAD);
101  HANDLE(IARM_BUS_SYSMGR_SYSSTATE_VOD_AD);
102  HANDLE(IARM_BUS_SYSMGR_SYSSTATE_DAC_INIT_TIMESTAMP);
103  HANDLE(IARM_BUS_SYSMGR_SYSSTATE_CABLE_CARD_SERIAL_NO);
104  HANDLE(IARM_BUS_SYSMGR_SYSSTATE_ECM_MAC);
105  HANDLE(IARM_BUS_SYSMGR_SYSSTATE_DAC_ID);
106  HANDLE(IARM_BUS_SYSMGR_SYSSTATE_PLANT_ID);
107  HANDLE(IARM_BUS_SYSMGR_SYSSTATE_STB_SERIAL_NO);
108  HANDLE(IARM_BUS_SYSMGR_SYSSTATE_BOOTUP);
109  HANDLE(IARM_BUS_SYSMGR_SYSSTATE_GATEWAY_CONNECTION);
110  HANDLE(IARM_BUS_SYSMGR_SYSSTATE_DST_OFFSET);
111  HANDLE(IARM_BUS_SYSMGR_SYSSTATE_RF_CONNECTED);
112  HANDLE(IARM_BUS_SYSMGR_SYSSTATE_PARTNERID_CHANGE);
113  HANDLE(IARM_BUS_SYSMGR_SYSSTATE_IP_MODE);
114  HANDLE(IARM_BUS_SYSMGR_SYSSTATE_LP_CONNECTION_RESET);
115  HANDLE(IARM_BUS_SYSMGR_SYSSTATE_RWS_CONNECTION_RESET);
116  default:
117  break;
118  }
119 #undef HANDLE
120 }
121 
122 /**
123  * @brief This API toggles between two LED modes, such as Dimming the light and Setting full brightness.
124  */
126 {
127  using namespace device;
128  static bool isVeryBright = true;
129  if(true == isVeryBright)
130  {
132  isVeryBright = false;
133  INFO("Dimming the light\n");
134  }
135  else
136  {
138  isVeryBright = true;
139  INFO("Setting full brightness\n");
140  }
141 }
142 
143 /** @brief This API receives the IR events from IR manager to handle the detected key pressed and give LED indication accordingly using received keycode and type.
144  *
145  * @param[in] owner owner of the event
146  * @param[in] eventId event ID
147  * @param[in] data event data
148  * @param[in] len event size
149  */
150 void keyEventHandler(const char *owner, IARM_EventId_t eventId, void *data, size_t len)
151 {
152  if( IARM_BUS_PWRMGR_POWERSTATE_STANDBY_DEEP_SLEEP != ledMgr::getInstance().getPowerState() )
153  {
155  ledMgr::getInstance().handleKeyPress(irEventData->data.irkey.keyCode, irEventData->data.irkey.keyType);
156  }
157  else
158  INFO("power state is deepsleep, handleKeyPress not invoked");
159  return;
160 }
161 
162 /** @brief This API handles power mode change events received from power manager.
163  *
164  * Power Manager monitors Power IR key events and reacts to power state changes.
165  *
166  * @param[in] owner owner of the event
167  * @param[in] eventId power manager event ID
168  * @param[in] data event data
169  * @param[in] len event size
170  */
171 void powerEventHandler(const char *owner, IARM_EventId_t eventId, void *data, size_t len)
172 {
174  switch(eventId)
175  {
177  ledMgr::getInstance().setPowerState(eventData->data.state.newState);
178  INFO("Detected power status change to 0x%x\n", eventData->data.state.newState);
179  break;
180 
182  if(0 <= eventData->data.reset_sequence_progress)
183  {
184  INFO("Reset sequence %d.\n", eventData->data.reset_sequence_progress);
185  ledMgr::getInstance().handleDeviceReset(eventData->data.reset_sequence_progress);
186  }
187  else
188  {
189  INFO("Exit reset sequence.\n");
190  ledMgr::getInstance().handleDeviceResetAbort();
191  }
192  break;
193  default:
194  break;
195  }
196 }
197 
198 /** @brief This callback notification received when there is a system mode change to handle from IARM manager.
199  *
200  * @param[in] arg system mode change param
201  *
202  * @return Returns status of the operation.
203  */
204 IARM_Result_t modeChangeHandler(void *arg)
205 {
206  IARM_Bus_CommonAPI_SysModeChange_Param_t *param = (IARM_Bus_CommonAPI_SysModeChange_Param_t *)arg;
207  ledMgr::getInstance().handleModeChange((unsigned int) param->newMode);
208  return IARM_RESULT_SUCCESS;
209 }
210 
211 /** @brief To handle IARM BUS system state event callback.
212  *
213  * @param[in] owner owner of the event
214  * @param[in] eventId event ID
215  * @param[in] data event data
216  * @param[in] len event size
217  */
218 void sysEventHandler(const char *owner, IARM_EventId_t eventId, void *data, size_t len)
219 {
221  IARM_Bus_SYSMgr_SystemState_t stateId = sysEventData->data.systemStates.stateId;
222  trace_event(stateId);
223 
224  switch(stateId)
225  {
226  case IARM_BUS_SYSMGR_SYSSTATE_CHANNELMAP:
227  break;
228  case IARM_BUS_SYSMGR_SYSSTATE_DISCONNECTMGR:
229  break;
230  case IARM_BUS_SYSMGR_SYSSTATE_TUNEREADY:
231  break;
232  case IARM_BUS_SYSMGR_SYSSTATE_EXIT_OK:
233  break;
234  case IARM_BUS_SYSMGR_SYSSTATE_CMAC:
235  break;
236  case IARM_BUS_SYSMGR_SYSSTATE_MOTO_ENTITLEMENT:
237  break;
238  case IARM_BUS_SYSMGR_SYSSTATE_MOTO_HRV_RX:
239  break;
240  case IARM_BUS_SYSMGR_SYSSTATE_CARD_CISCO_STATUS:
241  break;
242  case IARM_BUS_SYSMGR_SYSSTATE_VIDEO_PRESENTING:
243  break;
244  case IARM_BUS_SYSMGR_SYSSTATE_HDMI_OUT:
245  break;
246  case IARM_BUS_SYSMGR_SYSSTATE_HDCP_ENABLED:
247  break;
248  case IARM_BUS_SYSMGR_SYSSTATE_HDMI_EDID_READ:
249  break;
250  case IARM_BUS_SYSMGR_SYSSTATE_FIRMWARE_DWNLD:
251  ledMgr::getInstance().handleCDLEvents(sysEventData->data.systemStates.state);
252  break;
253  case IARM_BUS_SYSMGR_SYSSTATE_TIME_SOURCE:
254  break;
255  case IARM_BUS_SYSMGR_SYSSTATE_TIME_ZONE:
256  break;
257  case IARM_BUS_SYSMGR_SYSSTATE_CA_SYSTEM:
258  break;
259  case IARM_BUS_SYSMGR_SYSSTATE_ESTB_IP:
260  break;
261  case IARM_BUS_SYSMGR_SYSSTATE_ECM_IP:
262  break;
263  case IARM_BUS_SYSMGR_SYSSTATE_LAN_IP:
264  break;
265  case IARM_BUS_SYSMGR_SYSSTATE_MOCA:
266  break;
267  case IARM_BUS_SYSMGR_SYSSTATE_DOCSIS:
268  break;
269  case IARM_BUS_SYSMGR_SYSSTATE_DSG_BROADCAST_CHANNEL:
270  break;
271  case IARM_BUS_SYSMGR_SYSSTATE_DSG_CA_TUNNEL:
272  break;
273  case IARM_BUS_SYSMGR_SYSSTATE_CABLE_CARD:
274  break;
275  case IARM_BUS_SYSMGR_SYSSTATE_CABLE_CARD_DWNLD:
276  break;
277  case IARM_BUS_SYSMGR_SYSSTATE_CVR_SUBSYSTEM:
278  break;
279  case IARM_BUS_SYSMGR_SYSSTATE_DOWNLOAD:
280  break;
281  case IARM_BUS_SYSMGR_SYSSTATE_VOD_AD:
282  break;
283  case IARM_BUS_SYSMGR_SYSSTATE_DAC_INIT_TIMESTAMP:
284  break;
285  case IARM_BUS_SYSMGR_SYSSTATE_CABLE_CARD_SERIAL_NO:
286  break;
287  case IARM_BUS_SYSMGR_SYSSTATE_ECM_MAC:
288  break;
289  case IARM_BUS_SYSMGR_SYSSTATE_DAC_ID:
290  break;
291  case IARM_BUS_SYSMGR_SYSSTATE_PLANT_ID:
292  break;
293  case IARM_BUS_SYSMGR_SYSSTATE_STB_SERIAL_NO:
294  break;
295  case IARM_BUS_SYSMGR_SYSSTATE_BOOTUP:
296  break;
297  case IARM_BUS_SYSMGR_SYSSTATE_GATEWAY_CONNECTION:
298  ledMgr::getInstance().handleGatewayConnectionEvent(sysEventData->data.systemStates.state, sysEventData->data.systemStates.error);
299  break;
300  case IARM_BUS_SYSMGR_SYSSTATE_DST_OFFSET:
301  break;
302  case IARM_BUS_SYSMGR_SYSSTATE_RF_CONNECTED:
303  break;
304  case IARM_BUS_SYSMGR_SYSSTATE_PARTNERID_CHANGE:
305  break;
306  case IARM_BUS_SYSMGR_SYSSTATE_IP_MODE:
307  break;
308  case IARM_BUS_SYSMGR_SYSSTATE_LP_CONNECTION_RESET:
309  break;
310  case IARM_BUS_SYSMGR_SYSSTATE_RWS_CONNECTION_RESET:
311  break;
312  default:
313  break;
314  }
315 }
316 
317 /**
318  * @brief To Register required IARM event handlers with appropriate callback function to handle the event.
319  */
321 {
322  int32_t ret;
323  if(0 != IARM_Bus_RegisterEventHandler(IARM_BUS_SYSMGR_NAME, IARM_BUS_SYSMGR_EVENT_SYSTEMSTATE, sysEventHandler))
324  {
325  goto err_3;
326  }
328  {
329  goto err_4;
330  }
331 
333  {
334  goto err_5;
335  }
337  {
338  goto err_6;
339  }
340 
342  REPORT_IF_UNEQUAL(IARM_RESULT_SUCCESS, IARM_Bus_Call(IARM_BUS_PWRMGR_NAME, "GetPowerState", (void *)&power_query_arg, sizeof(power_query_arg)));
343  ledMgr::getInstance().setPowerState(power_query_arg.curState);
344 
345 
346  if(0 != IARM_Bus_RegisterCall(IARM_BUS_COMMON_API_SysModeChange, modeChangeHandler))
347  {
348  goto err_7;
349  }
350  INFO("Successfully initialized event handlers\n");
351  return 0;
352 
353  /*Clean exit if there are errors.*/
354 err_7:
356 err_6:
358 err_5:
360 err_4:
361  IARM_Bus_UnRegisterEventHandler(IARM_BUS_SYSMGR_NAME, IARM_BUS_SYSMGR_EVENT_SYSTEMSTATE);
362 err_3:
363  ERROR("Error initializing event handlers\n");
364  return -1;
365 }
366 
367 /**
368  * @brief This API UnRegister IARM event handlers in order to release bus-facing resources.
369  */
371 {
375  IARM_Bus_UnRegisterEventHandler(IARM_BUS_SYSMGR_NAME, IARM_BUS_SYSMGR_EVENT_SYSTEMSTATE);
376  INFO("Successfully terminated all event handlers\n");
377  return 0;
378 }
379 
380 /**
381  * @brief This API prints the LED use-cases.
382  */
384 {
385  INFO("Menu:\n");
386  INFO("1. Enable power\n");
387  INFO("2. Disable power\n");
388  INFO("3. Cycle power through colours\n");
389  INFO("4. 4 slow blinks\n");
390  INFO("5. 4 fast blinks\n");
391  INFO("6. Simulate reset.\n");
392  INFO("7. Simulate reset abort\n");
393 }
394 
395 /**
396  * @brief This Thread launches command line interface.
397  */
398 void* command_line_prompt(void *ptr)
399 {
400  while(true)
401  {
402  int singleExecution = 0;
403  int choice = 0;
404 
405  if(NULL == ptr) // Print menu and read the option for multiple execution in CLI mode
406  {
407  print_menu();
408  INFO("Enter command:\n");
409  if(!(std::cin >> choice))
410  {
411  ERROR("Oops!\n");
412  cin.clear();
413  cin.ignore(10000, '\n');
414  continue;
415  }
416  }
417  else
418  {
419  choice = *((int *)ptr);
420  cout << "Choice is : "<<choice<<endl;
421  singleExecution = 1;
422  }
423 
424  switch(choice)
425  {
426  case 1:
427  ledMgr::getInstance().getIndicator("Power").setState(STATE_STEADY_ON);
428  break;
429  case 2:
430  ledMgr::getInstance().getIndicator("Power").setState(STATE_STEADY_OFF);
431  break;
432  case 3:
433  ERROR("Unimplemented.\n");
434  break;
435  case 4:
436  ledMgr::getInstance().getIndicator("Power").setBlink(ledMgr::getInstance().getPattern(STATE_SLOW_BLINK), 4);
437  break;
438  case 5:
439  ledMgr::getInstance().getIndicator("Power").setBlink(ledMgr::getInstance().getPattern(STATE_FAST_BLINK), 4);
440  break;
441  case 6:
442  {
443  IARM_Bus_PWRMgr_EventData_t eventData;
444  for(int i = 1; i < 6; i++)
445  {
446  eventData.data.reset_sequence_progress = i;
448  sleep(1);
449  }
450  }
451  break;
452  case 7:
453  {
454  IARM_Bus_PWRMgr_EventData_t eventData;
455  for(int i = 1; i < 3; i++)
456  {
457  eventData.data.reset_sequence_progress = i;
459  sleep(1);
460  }
461  eventData.data.reset_sequence_progress = -1;
463  }
464  break;
465 
466  default:
467  ERROR("Unknown option.\n");
468  break;
469  }
470 
471  if(singleExecution) // To come out of loop in case of single execution in CLI mode
472  break;
473  }
474  return NULL;
475 }
476 
477 static bool drop_root()
478 {
479  bool ret = false,retval = false;
480  cap_user appcaps = {{0, 0, 0, '\0', 0, 0, 0, '\0'}};
481  ret = isBlocklisted();
482  if(ret)
483  {
484  INFO("NonRoot feature is disabled\n");
485  }
486  else
487  {
488  INFO("NonRoot feature is enabled\n");
489  appcaps.caps = NULL;
490  appcaps.user_name = NULL;
491  if(init_capability() != NULL) {
492  if(drop_root_caps(&appcaps) != -1) {
493  if(update_process_caps(&appcaps) != -1) {
494  read_capability(&appcaps);
495  retval = true;
496  }
497  }
498  }
499  }
500  return retval;
501 }
502 
503 int main(int argc, char *argv[])
504 {
505  setlinebuf(stdout); //necessary to make sure the logs get flushed when running as a daemon/service
506  INFO("ledmgr is running\n");
507  if(!drop_root())
508  {
509  ERROR("drop_root function failed!\n");
510  }
511  if(0 != sem_init(&g_app_done_sem, 0, 0))
512  {
513  ERROR("Could not initialize semaphore!\n");
514  return -1;
515  }
516  GMainLoop * main_loop = g_main_loop_new(NULL, false);
517 
518  /*Initialize DS-facing resources*/
519  ledMgr::getInstance().createBlinkPatterns();
520  /*Initialize bus-facing resources*/
521  if(0 != init_event_handlers())
522  {
523  ERROR("Error initializing event handlers!\n");
524  return -1;
525  }
526  INFO("Successfully initialized event handlers\n");
527 
528 
529  //TODO: Development aid. Remove
530  /*Check and enable diagnostic aid*/
531  if(2 == argc)
532  {
533  pthread_t thread;
534  if(0 != pthread_create(&thread, NULL, command_line_prompt, NULL))
535  {
536  ERROR("Could not launch command line interface.\n");
537  }
538  }
539 
540  if(3 == argc)
541  {
542  int stcmp_result = strcmp(argv[1],"--CLI");
543  if (0 == stcmp_result)
544  {
545  print_menu();
546  int arg = strtol(argv[2],NULL,10);
547  pthread_t thread;
548  if(0 != pthread_create(&thread, NULL, command_line_prompt, (void *)&arg))
549  {
550  ERROR("Could not launch command line interface.\n");
551  }
552  }
553  }
554 
555  /*Enter event loop */
556  g_main_loop_run(main_loop);
557  g_main_loop_unref(main_loop);
558  sem_wait(&g_app_done_sem);
559 
560  /*Release bus-facing resources*/
562  /*Release DS-facing resources.*/
563  return 0;
564 }
565 
566 
567 /** @} */ //END OF GROUP LED_APIS
IARM_BUS_PWRMGR_NAME
#define IARM_BUS_PWRMGR_NAME
Definition: pwrMgr.h:54
ledMgr::handleModeChange
virtual void handleModeChange(unsigned int mode)
Ths API shows a reference implementation for handles when there is a changes in system mode(IARM bus ...
Definition: ledmgr.cpp:46
command_line_prompt
void * command_line_prompt(void *ptr)
This Thread launches command line interface.
Definition: ledmgrmain.cpp:398
ledMgr::handleKeyPress
virtual void handleKeyPress(int key_code, int key_type)
This API shows a reference implementation for handling key press and give LED indication accordingly....
Definition: ledmgr.cpp:105
keyEventHandler
void keyEventHandler(const char *owner, IARM_EventId_t eventId, void *data, size_t len)
This API receives the IR events from IR manager to handle the detected key pressed and give LED indic...
Definition: ledmgrmain.cpp:150
IARM_BUS_IRMGR_EVENT_IRKEY
@ IARM_BUS_IRMGR_EVENT_IRKEY
Definition: irMgr.h:220
device::FrontPanelConfig::getInstance
static FrontPanelConfig & getInstance()
This API gets the instance of the FrontPanelConfig. When called for the first time,...
Definition: frontPanelConfig.cpp:82
sysMgr.h
IARM-Bus Sys Manager Public API.
trace_event
void trace_event(int state)
This API is used to trace the debug logs prints.
Definition: ledmgrmain.cpp:66
modeChangeHandler
IARM_Result_t modeChangeHandler(void *arg)
This callback notification received when there is a system mode change to handle from IARM manager.
Definition: ledmgrmain.cpp:204
IARM_BUS_SYSMGR_NAME
#define IARM_BUS_SYSMGR_NAME
Definition: sysMgr.h:110
_IARM_Bus_PWRMgr_GetPowerState_Param_t
Structure which holds the current power state of the CPE.
Definition: pwrMgr.h:173
term_event_handlers
int32_t term_event_handlers()
This API UnRegister IARM event handlers in order to release bus-facing resources.
Definition: ledmgrmain.cpp:370
IARM_Bus_Call
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.
Definition: iarm_bus.c:57
indicator::setBlink
int setBlink(const blinkPattern_t *pattern, int repetitions=-1)
This API enables the indicator to blink with the specified blinking pattern.
Definition: indicator.cpp:148
indicator::setState
int setState(indicatorState_t state)
This API cancel the current blinking indicator if any, to change the state .
Definition: indicator.cpp:285
_PWRMgr_EventData_t
Structure which holds the event data.
Definition: pwrMgr.h:117
STATE_SLOW_BLINK
@ STATE_SLOW_BLINK
Definition: fp_profile.hpp:30
sysEventHandler
void sysEventHandler(const char *owner, IARM_EventId_t eventId, void *data, size_t len)
To handle IARM BUS system state event callback.
Definition: ledmgrmain.cpp:218
frontPanelIndicator.hpp
Structures and classes for front panel indicator are defined here.
device::FrontPanelIndicator::setBrightness
void setBrightness(const int &brightness, const bool toPersist=true)
This API sets the brightness or intensity of the front panel indicators.
Definition: frontPanelIndicator.cpp:306
IARM_Bus_RegisterEventHandler
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....
Definition: iarmMgrMocks.cpp:43
IARM_Bus_RegisterCall
IARM_Result_t IARM_Bus_RegisterCall(const char *methodName, IARM_BusCall_t handler)
This API is used to register an RPC method that can be invoked by other applications.
_IARM_BUS_SYSMgr_EventData_t
Definition: sysMgr.h:229
ledMgrBase::getIndicator
indicator & getIndicator(const std::string &name)
This API search for the matching indicator and return the indicator.
Definition: ledmgrbase.cpp:51
libIBus.h
RDK IARM-Bus API Declarations.
IARM_BUS_IRMGR_NAME
#define IARM_BUS_IRMGR_NAME
Definition: irMgr.h:216
frontPanelConfig.hpp
Structures and classes to manage front panel are defined here.
device::FrontPanelConfig::getIndicator
FrontPanelIndicator & getIndicator(int id)
This function gets an instance of the FrontPanelndicator with the specified id, only if the id passed...
Definition: frontPanelConfig.cpp:147
init_event_handlers
int32_t init_event_handlers()
To Register required IARM event handlers with appropriate callback function to handle the event.
Definition: ledmgrmain.cpp:320
IARM_BUS_PWRMGR_EVENT_MODECHANGED
@ IARM_BUS_PWRMGR_EVENT_MODECHANGED
Definition: pwrMgr.h:60
IARM_BUS_PWRMGR_EVENT_RESET_SEQUENCE
@ IARM_BUS_PWRMGR_EVENT_RESET_SEQUENCE
Definition: pwrMgr.h:62
ledMgrBase::setPowerState
void setPowerState(int state)
This function sets the power state.
Definition: ledmgrbase.cpp:101
toggleBrightness
void toggleBrightness()
This API toggles between two LED modes, such as Dimming the light and Setting full brightness.
Definition: ledmgrmain.cpp:125
ledMgrBase::createBlinkPatterns
virtual int createBlinkPatterns()
This API creates blink patterns using the pattern type, duration, sequence … etc. as parameters.
Definition: ledmgrbase.cpp:169
pwrMgr.h
IARM-Bus Power Manager Public API.
irMgr.h
IARM-Bus IR Manager API.
_IRMgr_EventData_t
Definition: irMgr.h:235
ledMgr::handleGatewayConnectionEvent
virtual void handleGatewayConnectionEvent(unsigned int state, unsigned int error)
This API shows a reference implementation of calling appropriate ledmgr indicator API depends of the ...
Definition: ledmgr.cpp:75
powerEventHandler
void powerEventHandler(const char *owner, IARM_EventId_t eventId, void *data, size_t len)
This API handles power mode change events received from power manager.
Definition: ledmgrmain.cpp:171
IARM_Bus_UnRegisterEventHandler
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...
print_menu
void print_menu()
This API prints the LED use-cases.
Definition: ledmgrmain.cpp:383
STATE_FAST_BLINK
@ STATE_FAST_BLINK
Definition: fp_profile.hpp:32