RDK Documentation (Open Sourced RDK Components)

Description

Functions

static gboolean masterBlinkCallbackFunction (gpointer data)
 Callback function to perform indicator brightness with type "Blink". More...
 
static gboolean masterFlareCallbackFunction (gpointer data)
 Callback function to preform indicator brightness with flare value. More...
 
void trace_event (int state)
 This API is used to trace the debug logs prints. More...
 
void toggleBrightness ()
 This API toggles between two LED modes, such as Dimming the light and Setting full brightness.
 
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 indication accordingly using received keycode and type. More...
 
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. More...
 
IARM_Result_t modeChangeHandler (void *arg)
 This callback notification received when there is a system mode change to handle from IARM manager. More...
 
void sysEventHandler (const char *owner, IARM_EventId_t eventId, void *data, size_t len)
 To handle IARM BUS system state event callback. More...
 
int32_t init_event_handlers ()
 To Register required IARM event handlers with appropriate callback function to handle the event.
 
int32_t term_event_handlers ()
 This API UnRegister IARM event handlers in order to release bus-facing resources.
 
void print_menu ()
 This API prints the LED use-cases.
 
void * command_line_prompt (void *ptr)
 This Thread launches command line interface.
 
static bool drop_root ()
 
int main (int argc, char *argv[])
 
virtual void ledMgr::handleModeChange (unsigned int mode)
 Ths API shows a reference implementation for handles when there is a changes in system mode(IARM bus system modes: NORMAL, EAS, WAREHOUSE). More...
 
virtual void ledMgr::handleGatewayConnectionEvent (unsigned int state, unsigned int error)
 This API shows a reference implementation of calling appropriate ledmgr indicator API depends of the gateway connection event. More...
 
virtual void ledMgr::handleKeyPress (int key_code, int key_type)
 This API shows a reference implementation for handling key press and give LED indication accordingly. Indicator functions are called with the supported LED pattern or color. More...
 
 indicator::indicator (const std::string &name)
 
const std::string & indicator::getName () const
 API to return the indicator name. More...
 
void indicator::setColor (const unsigned int color)
 This API sets the indicator color. More...
 
void indicator::setBrightness (unsigned int intensity)
 This API sets the brightness of the specified LED. More...
 
int indicator::setBlink (const blinkPattern_t *pattern, int repetitions=-1)
 This API enables the indicator to blink with the specified blinking pattern. More...
 
int indicator::step ()
 This API is to register timer callback function depends on iteration pattern(indefinite iteration and finite iteration). More...
 
int indicator::timerCallback (void)
 This API requests to process the pattern iteration steps.
 
int indicator::registerCallback (unsigned int milliseconds)
 This API register timer callback function in order to complete the blinking pattern iteration count. More...
 
int indicator::setState (indicatorState_t state)
 This API cancel the current blinking indicator if any, to change the state . More...
 
int indicator::enableIndicator (bool enable)
 This API sets the indicator state. More...
 
void indicator::saveState ()
 This API saves all the current indicator related properties. More...
 
void indicator::restoreState ()
 API to restore the indicator properties from saved indicator properties. More...
 
void indicator::executeFlare (const unsigned int percentage_increase, const unsigned int length_ms)
 Register Flare callback function to set indicator brightness as flare. More...
 
void indicator::flareCallback (void)
 API to perform indicator brightness with flare value.
 
indicatorledMgrBase::getIndicator (const std::string &name)
 This API search for the matching indicator and return the indicator. More...
 
void ledMgrBase::setPowerState (int state)
 This function sets the power state. More...
 
int ledMgrBase::getPowerState ()
 This function used to get the power state. More...
 
bool ledMgrBase::setError (unsigned int position, bool value)
 This API stores the error and returns the transition state in order to call appropriate ledmgr indicator api. More...
 
const blinkPattern_tledMgrBase::getPattern (blinkPatternType_t pattern) const
 This API return the desired pattern info with respect to pattern type. More...
 

Function Documentation

◆ masterBlinkCallbackFunction()

static gboolean masterBlinkCallbackFunction ( gpointer  data)
static

Callback function to perform indicator brightness with type "Blink".

Parameters
[in]dataaddress of indicator class.
Returns
Returns corresponding blink pattern info structure.

Definition at line 36 of file indicator.cpp.

◆ masterFlareCallbackFunction()

static gboolean masterFlareCallbackFunction ( gpointer  data)
static

Callback function to preform indicator brightness with flare value.

Parameters
[in]dataaddress of indicator class.
Returns
Returns corresponding blink pattern info structure.

Definition at line 51 of file indicator.cpp.

◆ trace_event()

void trace_event ( int  state)

This API is used to trace the debug logs prints.

Parameters
[in]statesystem state

Definition at line 66 of file ledmgrmain.cpp.

◆ 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 indication accordingly using received keycode and type.

Parameters
[in]ownerowner of the event
[in]eventIdevent ID
[in]dataevent data
[in]lenevent size

Definition at line 150 of file ledmgrmain.cpp.

◆ 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.

Power Manager monitors Power IR key events and reacts to power state changes.

Parameters
[in]ownerowner of the event
[in]eventIdpower manager event ID
[in]dataevent data
[in]lenevent size

Definition at line 171 of file ledmgrmain.cpp.

◆ modeChangeHandler()

IARM_Result_t modeChangeHandler ( void *  arg)

This callback notification received when there is a system mode change to handle from IARM manager.

Parameters
[in]argsystem mode change param
Returns
Returns status of the operation.

Definition at line 204 of file ledmgrmain.cpp.

◆ sysEventHandler()

void sysEventHandler ( const char *  owner,
IARM_EventId_t  eventId,
void *  data,
size_t  len 
)

To handle IARM BUS system state event callback.

Parameters
[in]ownerowner of the event
[in]eventIdevent ID
[in]dataevent data
[in]lenevent size

Definition at line 218 of file ledmgrmain.cpp.

◆ handleModeChange()

void ledMgr::handleModeChange ( unsigned int  mode)
virtual

Ths API shows a reference implementation for handles when there is a changes in system mode(IARM bus system modes: NORMAL, EAS, WAREHOUSE).

Parameters
[in]modeIARM bus system mode.

Reimplemented from ledMgrBase.

Definition at line 46 of file ledmgr.cpp.

◆ handleGatewayConnectionEvent()

void ledMgr::handleGatewayConnectionEvent ( unsigned int  state,
unsigned int  error 
)
virtual

This API shows a reference implementation of calling appropriate ledmgr indicator API depends of the gateway connection event.

Parameters
[in]stateerror state.
[in]errorerror

Reimplemented from ledMgrBase.

Definition at line 75 of file ledmgr.cpp.

◆ handleKeyPress()

void ledMgr::handleKeyPress ( int  key_code,
int  key_type 
)
virtual

This API shows a reference implementation for handling key press and give LED indication accordingly. Indicator functions are called with the supported LED pattern or color.

Parameters
[in]key_codekey code.
[in]key_typekey type.

Reimplemented from ledMgrBase.

Definition at line 105 of file ledmgr.cpp.

◆ getName()

const std::string & indicator::getName ( ) const

API to return the indicator name.

Returns
Returns indicator name.

Definition at line 98 of file indicator.cpp.

◆ setColor()

void indicator::setColor ( const unsigned int  color)

This API sets the indicator color.

Parameters
[in]colorindicator color to be set.

Definition at line 109 of file indicator.cpp.

◆ setBrightness()

void indicator::setBrightness ( unsigned int  intensity)
private

This API sets the brightness of the specified LED.

Parameters
[in]intensityintensity value of brightness.

Definition at line 127 of file indicator.cpp.

◆ setBlink()

int indicator::setBlink ( const blinkPattern_t pattern,
int  repetitions = -1 
)

This API enables the indicator to blink with the specified blinking pattern.

Parameters
[in]patternblink pattern.
[in]repetitionsnumber of repetition count.
Returns
Returns status of the operation.

Definition at line 148 of file indicator.cpp.

◆ step()

int indicator::step ( )
private

This API is to register timer callback function depends on iteration pattern(indefinite iteration and finite iteration).

Returns
Returns status of the operation.

Definition at line 188 of file indicator.cpp.

◆ registerCallback()

int indicator::registerCallback ( unsigned int  milliseconds)
private

This API register timer callback function in order to complete the blinking pattern iteration count.

Parameters
[in]millisecondstime interval between calls to the callback function.
Returns
Returns status of the operation.

Definition at line 263 of file indicator.cpp.

◆ setState()

int indicator::setState ( indicatorState_t  state)

This API cancel the current blinking indicator if any, to change the state .

Parameters
[in]stateindicator state.
Returns
Returns status of the operation.

Definition at line 285 of file indicator.cpp.

◆ enableIndicator()

int indicator::enableIndicator ( bool  enable)
private

This API sets the indicator state.

Parameters
[in]enableindicator state.
Returns
Returns status of the operation.

Definition at line 326 of file indicator.cpp.

◆ saveState()

void indicator::saveState ( )

This API saves all the current indicator related properties.

When iterations >= 0 and the number of iterations has successfully completed, the LED will be left to the color/brightness as specified by the LAST element in the array

Definition at line 346 of file indicator.cpp.

◆ restoreState()

void indicator::restoreState ( )

API to restore the indicator properties from saved indicator properties.

When iterations >= 0 and the number of iterations has successfully completed, the LED will be left to the color/brightness as specified by the LAST element in the array

Definition at line 378 of file indicator.cpp.

◆ executeFlare()

void indicator::executeFlare ( const unsigned int  percentage_increase,
const unsigned int  length_ms 
)

Register Flare callback function to set indicator brightness as flare.

Parameters
[in]percentage_increaseflare percentage to be increased.
[in]length_mstime interval between calls to the callback function.

Definition at line 431 of file indicator.cpp.

◆ getIndicator()

indicator & ledMgrBase::getIndicator ( const std::string &  name)

This API search for the matching indicator and return the indicator.

Returns
Returns matching indicator.

Note: throws std::invalid_argument exception

Definition at line 51 of file ledmgrbase.cpp.

◆ setPowerState()

void ledMgrBase::setPowerState ( int  state)

This function sets the power state.

Parameters
[in]statepower state.

Definition at line 101 of file ledmgrbase.cpp.

◆ getPowerState()

int ledMgrBase::getPowerState ( )

This function used to get the power state.

Returns
Returns power state.

Definition at line 113 of file ledmgrbase.cpp.

◆ setError()

bool ledMgrBase::setError ( unsigned int  position,
bool  value 
)

This API stores the error and returns the transition state in order to call appropriate ledmgr indicator api.

Parameters
[in]positionerror position which points to the error type.
[in]valueerror state which points to true or false.
Returns
Returns error state transition.

Definition at line 130 of file ledmgrbase.cpp.

◆ getPattern()

const blinkPattern_t * ledMgrBase::getPattern ( blinkPatternType_t  type) const

This API return the desired pattern info with respect to pattern type.

Parameters
[in]typeBlink pattern type.
Returns
Returns corresponding blink pattern info structure.

Definition at line 186 of file ledmgrbase.cpp.