RDK Documentation (Open Sourced RDK Components)

Description

Data Structures

struct  _PWRMgr_LED_Settings_t
 
struct  _PWRMgr_Settings_t
 
struct  _UIMgr_Settings_t
 
struct  PWRMgr_Standby_Video_State_t
 
struct  keyType
 
struct  timerStruct
 
struct  keyVariant
 
struct  stateMachine
 
struct  KeyMap
 

Macros

#define LOG(...)   printf(__VA_ARGS__)
 
#define PADDING_SIZE   32
 
#define _UIMGR_SETTINGS_MAGIC   0xFEBEEFAC
 
#define MAX_NUM_VIDEO_PORTS   5
 
#define INITIAL_TIME_OUT_VALUE   10000
 
#define MAX_RESET_MODE_COUNT   5
 
#define KEY_COMBINATION_TIMEOUT   2000
 
#define POWER_KEY_HOLD_TIME_FOR_REBOOT   10000
 
#define POWER_KEY_HOLD_TIME_FOR_RESET   2000
 
#define POWER_KEY_HOLD_TIME_FOR_FACTORY_RESET   30000
 
#define LOG(...)   printf(__VA_ARGS__)
 
#define PADDING_SIZE   32
 
#define _UIMGR_SETTINGS_MAGIC   0xFEBEEFAC
 
#define MAX_NUM_VIDEO_PORTS   5
 
#define INITIAL_TIME_OUT_VALUE   10000
 
#define MAX_RESET_MODE_COUNT   5
 
#define KEY_COMBINATION_TIMEOUT   2000
 
#define POWER_KEY_HOLD_TIME_FOR_REBOOT   10000
 
#define POWER_KEY_HOLD_TIME_FOR_RESET   2000
 
#define POWER_KEY_HOLD_TIME_FOR_FACTORY_RESET   30000
 

Typedefs

typedef struct _PWRMgr_LED_Settings_t PWRMgr_LED_Settings_t
 
typedef struct _PWRMgr_Settings_t PWRMgr_Settings_t
 
typedef enum _UIDev_PowerState_t UIDev_PowerState_t
 
typedef struct _UIMgr_Settings_t UIMgr_Settings_t
 
typedef struct keyType keyType_t
 
typedef struct timerStruct timerStruct_t
 
typedef enum keyValue keyValue_t
 
typedef struct keyVariant keyVariant_t
 
typedef enum state state_t
 
typedef struct stateMachine stateMachine_t
 
typedef enum resetType resetType_t
 
typedef struct KeyMap KeyMap_t
 
typedef struct _PWRMgr_LED_Settings_t PWRMgr_LED_Settings_t
 
typedef struct _PWRMgr_Settings_t PWRMgr_Settings_t
 
typedef enum _UIDev_PowerState_t UIDev_PowerState_t
 
typedef struct _UIMgr_Settings_t UIMgr_Settings_t
 
typedef struct keyType keyType_t
 
typedef struct timerStruct timerStruct_t
 
typedef enum keyValue keyValue_t
 
typedef struct keyVariant keyVariant_t
 
typedef enum state state_t
 
typedef struct stateMachine stateMachine_t
 
typedef enum resetType resetType_t
 
typedef struct KeyMap KeyMap_t
 

Enumerations

enum  _UIDev_PowerState_t
 
enum  keyValue
 
enum  state
 
enum  resetType
 
enum  _UIDev_PowerState_t
 
enum  keyValue
 
enum  state
 
enum  resetType
 

Functions

int processColdFactoryReset ()
 
int processCustomerReset ()
 
int processFactoryReset ()
 
int processWareHouseReset ()
 
int processWHReset ()
 
int processWHResetNoReboot ()
 
int processWHClear ()
 
int processWHClearNoReboot ()
 
int processPersonalityReset ()
 
int processUserFactoryReset ()
 
static void _speechEventHandler (const char *owner, IARM_EventId_t eventId, void *data, size_t len)
 
static void _sleepModeChangeHandler (const char *owner, IARM_EventId_t eventId, void *data, size_t len)
 
static void _controlEventHandler (const char *owner, IARM_EventId_t eventId, void *data, size_t len)
 
static void _irEventHandler (const char *owner, IARM_EventId_t eventId, void *data, size_t len)
 
static void _systemStateChangeHandler (const char *owner, IARM_EventId_t eventId, void *data, size_t len)
 
static IARM_Result_t _SetPowerState (void *arg)
 
static IARM_Result_t _GetPowerState (void *arg)
 
static IARM_Result_t _WareHouseReset (void *arg)
 
static IARM_Result_t _WareHouseClear (void *arg)
 
static IARM_Result_t _ColdFactoryReset (void *)
 
static IARM_Result_t _FactoryReset (void *)
 
static IARM_Result_t _UserFactoryReset (void *)
 
static IARM_Result_t _GetPowerStateBeforeReboot (void *arg)
 
static IARM_Result_t _HandleReboot (void *arg)
 
static IARM_Result_t _handleDeepsleepTimeoutWakeup (void *arg)
 
static void handleDeepsleepTimeoutWakeup (void *arg)
 
static void * deepsleepTimeoutWakeupThread (void *arg)
 
static int _InitSettings (const char *settingsFile)
 
static int _WriteSettings (const char *settingsFile)
 
static void _DumpSettings (const PWRMgr_Settings_t *pSettings)
 
static int _SetLEDStatus (IARM_Bus_PWRMgr_PowerState_t state)
 
int _SetAVPortsPowerState (IARM_Bus_PWRMgr_PowerState_t powerState)
 
static IARM_Bus_PWRMgr_PowerState_t _ConvertUIDevToIARMBusPowerState (UIDev_PowerState_t powerState)
 
static IARM_Result_t _SetStandbyVideoState (void *arg)
 
static IARM_Result_t _GetStandbyVideoState (void *arg)
 
void IARM_Bus_PWRMGR_RegisterSleepTimerAPIs (void *)
 
static IARM_Result_t _SysModeChange (void *arg)
 This function is a event handler which returns current system mode using IARM. It returns mode as "NORMAL", "WAREHOUSE","EAS" or "UNKNOWN". More...
 
static gboolean heartbeatMsg (gpointer data)
 
static IARM_Result_t _SetNetworkStandbyMode (void *arg)
 
static IARM_Result_t _GetNetworkStandbyMode (void *arg)
 
static void setPowerStateBeforeReboot (IARM_Bus_PWRMgr_PowerState_t powerState)
 
static bool get_video_port_standby_setting (const char *port)
 
IARM_Result_t PWRMgr_Start (int argc, char *argv[])
 
IARM_Result_t PWRMgr_Loop ()
 
IARM_Result_t PWRMgr_Stop (void)
 
static void * _AsyncPowerWareHouseOperation (void *pWareHouseOpnArg)
 
static int _SetPowerWareHouseOperation (IARM_Bus_PWRMgr_WareHouseOps_t eWareHouseOpn)
 
IARM_Result_t initReset ()
 
int checkResetSequence (int keyType, int keyCode)
 
void setResetPowerState (IARM_Bus_PWRMgr_PowerState_t newPwrState)
 
void PwrMgr_Reset (IARM_Bus_PWRMgr_PowerState_t newState, bool isFPKeyPress)
 
void performReboot (const char *requestor, const char *reboot_reason_custom, const char *reboot_reason_other)
 
int main (int argc, char *argv[])
 
static void storeFocus ()
 
static void getSystemTime (long *syst)
 
static void releaseFocus ()
 
static void grabFocus ()
 
static void ResetResetState (void)
 
void blinkLEDs (void)
 
int checkResetModeSequence (int keyType, int keyCode, resetType_t resetMode)
 
IARM_Result_t unInitReset ()
 
static void check_payload (const char **input, const char *default_arg)
 
void _handleDeepsleepTimeoutWakeup ()
 
void handleDeepsleepTimeoutWakeup ()
 

Variables

static PWRMgr_Settings_t m_settings = {0}
 
static const char * m_settingsFile = NULL
 
static bool isCecLocalLogicEnabled = false
 
static PWRMgr_Standby_Video_State_t g_standby_video_port_setting [5]
 
static pwrMgrProductTraits::ux_controllerux = nullptr
 
static pthread_mutex_t wareHouseOpsMutex = PTHREAD_MUTEX_INITIALIZER
 
static pthread_t asyncPowerWarehouseOpsThreadId = NULL
 
static int ecm_connectivity_lost = 0
 
dsSleepMode_t m_sleepMode = dsHOST_SLEEP_MODE_LIGHT
 
time_t xre_timer
 
static bool deepSleepWakeup = false
 
static IARM_Bus_Daemon_SysMode_t isEASInProgress = IARM_BUS_SYS_MODE_NORMAL
 
GMainLoop * pwrMgr_Gloop = NULL
 
std::string powerStateBeforeReboot_gc
 
static IARM_Bus_PWRMgr_PowerState_t g_last_known_power_state = IARM_BUS_PWRMGR_POWERSTATE_ON
 
static pthread_mutex_t tMutexLock
 
static pthread_cond_t tMutexCond
 
static long gKeyPressedTime = 0
 
static long gKeyReleasedTime = 0
 
static long gCurrentTime = 0
 
static int gTimeOutValue = 0
 
static bool inResetMode = false
 
static bool gResetMonitoredOnIBus = false
 
static unsigned int gLastResetEvent = 0
 
static bool gInitialized = false
 
static bool isRIFocus = false
 
static bool isXREFocus = false
 
static bool grabedFocus = false
 
static int modeIndexStatus = 0
 
static bool gWaitState = false
 
static bool gResetTimer = true
 
static bool gIsSameKey = false
 
static bool gKeyAllowed [] = {true, true, true, true}
 
static stateMachine_t coldFactory = {ENDED, 0, processColdFactoryReset}
 
static stateMachine_t factory = {ENDED, 0, processFactoryReset}
 
static stateMachine_t wareHouse = {ENDED, 0, processWareHouseReset}
 
static stateMachine_t customer = {ENDED, 0, processCustomerReset}
 
static stateMachine_t personality = {ENDED, 0, processPersonalityReset}
 
stateMachine_tstateMachineList [] = {&coldFactory, &factory, &wareHouse, &customer, &personality}
 
static const char * resetString [5] = {"CLDINIT", "FR RST", "WH RST", "CUST", "PERS"}
 
static keyType_t coldFactorySeq []
 
static keyType_t factorySeq []
 
static keyType_t wareHouseSeq []
 
static keyType_t customerSeq []
 
keyType_t personalityResetSeq []
 
static const keyVariant_t keyVariants [] = {{ KED_POWER, KED_RF_POWER}, {KED_OK, KED_SELECT}}
 
static KeyMap_t Reset_Rules [5]
 
static IARM_Bus_PWRMgr_PowerState_t curPwrState = IARM_BUS_PWRMGR_POWERSTATE_STANDBY
 
static PWRMgr_Settings_t m_settings = {0}
 
static const char * m_settingsFile = NULL
 
static bool isCecLocalLogicEnabled = false
 
static PWRMgr_Standby_Video_State_t g_standby_video_port_setting [5]
 
static pthread_mutex_t wareHouseOpsMutex = PTHREAD_MUTEX_INITIALIZER
 
static pthread_t asyncPowerWarehouseOpsThreadId = NULL
 
static int ecm_connectivity_lost = 0
 
dsSleepMode_t m_sleepMode = dsHOST_SLEEP_MODE_LIGHT
 
time_t xre_timer
 
static bool deepSleepWakeup = false
 
static IARM_Bus_Daemon_SysMode_t isEASInProgress = IARM_BUS_SYS_MODE_NORMAL
 
GMainLoop * pwrMgr_Gloop = NULL
 
std::string powerStateBeforeReboot_gc
 
static IARM_Bus_PWRMgr_PowerState_t g_last_known_power_state = IARM_BUS_PWRMGR_POWERSTATE_ON
 
static pthread_mutex_t tMutexLock
 
static pthread_cond_t tMutexCond
 
static long gKeyPressedTime = 0
 
static long gKeyReleasedTime = 0
 
static long gCurrentTime = 0
 
static int gTimeOutValue = 0
 
static bool inResetMode = false
 
static bool gResetMonitoredOnIBus = false
 
static unsigned int gLastResetEvent = 0
 
static bool gInitialized = false
 
static bool isRIFocus = false
 
static bool isXREFocus = false
 
static bool grabedFocus = false
 
static int modeIndexStatus = 0
 
static bool gWaitState = false
 
static bool gResetTimer = true
 
static bool gIsSameKey = false
 
static bool gKeyAllowed [] = {true, true, true, true}
 
static stateMachine_t coldFactory = {ENDED, 0, processColdFactoryReset}
 
static stateMachine_t factory = {ENDED, 0, processFactoryReset}
 
static stateMachine_t wareHouse = {ENDED, 0, processWareHouseReset}
 
static stateMachine_t customer = {ENDED, 0, processCustomerReset}
 
static stateMachine_t personality = {ENDED, 0, processPersonalityReset}
 
stateMachine_tstateMachineList [] = {&coldFactory, &factory, &wareHouse, &customer, &personality}
 
static const char * resetString [5] = {"CLDINIT", "FR RST", "WH RST", "CUST", "PERS"}
 
static keyType_t coldFactorySeq []
 
static keyType_t factorySeq []
 
static keyType_t wareHouseSeq []
 
static keyType_t customerSeq []
 
keyType_t personalityResetSeq []
 
static const keyVariant_t keyVariants [] = {{ KED_POWER, KED_RF_POWER}, {KED_OK, KED_SELECT}}
 
static KeyMap_t Reset_Rules [5]
 
static IARM_Bus_PWRMgr_PowerState_t curPwrState = IARM_BUS_PWRMGR_POWERSTATE_STANDBY
 

Data Structure Documentation

◆ _PWRMgr_LED_Settings_t

struct _PWRMgr_LED_Settings_t

Definition at line 113 of file pwrMgr.c.

Collaboration diagram for _PWRMgr_LED_Settings_t:
Collaboration graph
Data Fields
unsigned int brightness
unsigned int color

◆ _PWRMgr_Settings_t

struct _PWRMgr_Settings_t

Definition at line 118 of file pwrMgr.c.

Collaboration diagram for _PWRMgr_Settings_t:
Collaboration graph
Data Fields
uint32_t magic
uint32_t version
uint32_t length
volatile IARM_Bus_PWRMgr_PowerState_t powerState
PWRMgr_LED_Settings_t ledSettings
char padding[32]

◆ _UIMgr_Settings_t

struct _UIMgr_Settings_t

Definition at line 140 of file pwrMgr.c.

Collaboration diagram for _UIMgr_Settings_t:
Collaboration graph
Data Fields
uint32_t magic
uint32_t version
uint32_t length
UIDev_PowerState_t powerState
char padding[32]

◆ PWRMgr_Standby_Video_State_t

struct PWRMgr_Standby_Video_State_t

Definition at line 153 of file pwrMgr.c.

Collaboration diagram for PWRMgr_Standby_Video_State_t:
Collaboration graph
Data Fields
char port[PWRMGR_MAX_VIDEO_PORT_NAME_LENGTH]
bool isEnabled

◆ keyType

struct keyType

Definition at line 85 of file reset.c.

Collaboration diagram for keyType:
Collaboration graph
Data Fields
int Key
int keyMode
int waitDuration
int validTime

◆ timerStruct

struct timerStruct

Definition at line 94 of file reset.c.

Collaboration diagram for timerStruct:
Collaboration graph
Data Fields
int waitFor
int validFor

◆ keyVariant

struct keyVariant

Definition at line 116 of file reset.c.

Collaboration diagram for keyVariant:
Collaboration graph
Data Fields
int Key
int Variant

◆ stateMachine

struct stateMachine

Definition at line 131 of file reset.c.

Collaboration diagram for stateMachine:
Collaboration graph

Data Fields

state_t state
 
int expectedKeyIndex
 
int(* resetFuction )(void)
 

◆ KeyMap

struct KeyMap

Definition at line 164 of file reset.c.

Collaboration diagram for KeyMap:
Collaboration graph
Data Fields
resetType_t reset
keyType_t * pData

Function Documentation

◆ _SysModeChange()

static IARM_Result_t _SysModeChange ( void *  arg)
static

This function is a event handler which returns current system mode using IARM. It returns mode as "NORMAL", "WAREHOUSE","EAS" or "UNKNOWN".

Parameters
[in]voidpointer to void, containing IARM_Bus_CommonAPI_SysModeChange_Param_t data.
Returns
variable of IARM_Result_t type.
Return values
IARM_RESULT_SUCCESSOn function completion.

Definition at line 2021 of file pwrMgr.c.

Variable Documentation

◆ coldFactorySeq [1/2]

keyType_t coldFactorySeq[]
static
Initial value:
= {{KEY_POWER, KET_KEYUP, 0, 0}, {KEY_OK, KET_KEYUP, 0, 2000},
{KEY_RIGHT, KET_KEYUP, 0, 2000}, {KEY_MENU, KET_KEYUP, 0, 2000},
{KEY_RIGHT, KET_KEYUP, 0, 2000}, {KEY_POWER, KET_KEYUP, 0, 0},
{KEY_NULL, 0, 0, 0}}

Definition at line 183 of file reset.c.

◆ factorySeq [1/2]

keyType_t factorySeq[]
static
Initial value:
= {{KEY_POWER, KET_KEYUP, 0, 0}, {KEY_OK, KET_KEYUP, 0, 2000},
{KEY_RIGHT, KET_KEYUP, 0, 2000}, {KEY_MENU, KET_KEYUP, 0, 2000},
{KEY_LEFT, KET_KEYUP, 0, 2000}, {KEY_POWER, KET_KEYUP, 0, 0},
{KEY_NULL, 0, 0, 0}}

Definition at line 188 of file reset.c.

◆ wareHouseSeq [1/2]

keyType_t wareHouseSeq[]
static
Initial value:
= {{KEY_POWER, KET_KEYUP, 0, 0}, {KEY_OK, KET_KEYUP, 0, 2000},
{KEY_RIGHT, KET_KEYUP, 0, 2000}, {KEY_DOWN, KET_KEYUP, 0, 2000},
{KEY_POWER, KET_KEYUP, 0, 0}, {KEY_NULL, 0, 0, 0}}

Definition at line 193 of file reset.c.

◆ customerSeq [1/2]

keyType_t customerSeq[]
static
Initial value:
= {{KEY_POWER, KET_KEYUP, 0, 0}, {KEY_OK, KET_KEYUP, 0, 2000},
{KED_UNDEFINEDKEY, KET_KEYUP, 0, 0}, {KEY_NULL, 0, 0, 0}}

Definition at line 198 of file reset.c.

◆ personalityResetSeq [1/2]

keyType_t personalityResetSeq[]
Initial value:
= {{KEY_POWER, KET_KEYUP, 0, 0}, {KEY_OK, KET_KEYUP, 0, 2000},
{KEY_LEFT, KET_KEYUP, 0, 2000}, {KEY_DOWN, KET_KEYUP, 0, 2000},
{KEY_POWER, KET_KEYUP, 0, 0}, {KEY_NULL, 0, 0, 0}}

Definition at line 201 of file reset.c.

◆ Reset_Rules [1/2]

KeyMap_t Reset_Rules[5]
static
Initial value:
= {{COLD_FACTORY, &coldFactorySeq[0]},{FACTORY, &factorySeq[0]},{WARE_HOUSE, &wareHouseSeq[0]},{CUSTOMER, &customerSeq[0]},
{PERSONALITY, &personalityResetSeq[0]}}

Definition at line 209 of file reset.c.

◆ coldFactorySeq [2/2]

keyType_t coldFactorySeq[]
static
Initial value:
= {{KEY_POWER, KET_KEYUP, 0, 0}, {KEY_OK, KET_KEYUP, 0, 2000},
{KEY_RIGHT, KET_KEYUP, 0, 2000}, {KEY_MENU, KET_KEYUP, 0, 2000},
{KEY_RIGHT, KET_KEYUP, 0, 2000}, {KEY_POWER, KET_KEYUP, 0, 0},
{KEY_NULL, 0, 0, 0}
}

Definition at line 183 of file reset.c.

◆ factorySeq [2/2]

keyType_t factorySeq[]
static
Initial value:
= {{KEY_POWER, KET_KEYUP, 0, 0}, {KEY_OK, KET_KEYUP, 0, 2000},
{KEY_RIGHT, KET_KEYUP, 0, 2000}, {KEY_MENU, KET_KEYUP, 0, 2000},
{KEY_LEFT, KET_KEYUP, 0, 2000}, {KEY_POWER, KET_KEYUP, 0, 0},
{KEY_NULL, 0, 0, 0}
}

Definition at line 189 of file reset.c.

◆ wareHouseSeq [2/2]

keyType_t wareHouseSeq[]
static
Initial value:
= {{KEY_POWER, KET_KEYUP, 0, 0}, {KEY_OK, KET_KEYUP, 0, 2000},
{KEY_RIGHT, KET_KEYUP, 0, 2000}, {KEY_DOWN, KET_KEYUP, 0, 2000},
{KEY_POWER, KET_KEYUP, 0, 0}, {KEY_NULL, 0, 0, 0}
}

Definition at line 195 of file reset.c.

◆ customerSeq [2/2]

keyType_t customerSeq[]
static
Initial value:
= {{KEY_POWER, KET_KEYUP, 0, 0}, {KEY_OK, KET_KEYUP, 0, 2000},
{KED_UNDEFINEDKEY, KET_KEYUP, 0, 0}, {KEY_NULL, 0, 0, 0}
}

Definition at line 201 of file reset.c.

◆ personalityResetSeq [2/2]

keyType_t personalityResetSeq[]
Initial value:
= {{KEY_POWER, KET_KEYUP, 0, 0}, {KEY_OK, KET_KEYUP, 0, 2000},
{KEY_LEFT, KET_KEYUP, 0, 2000}, {KEY_DOWN, KET_KEYUP, 0, 2000},
{KEY_POWER, KET_KEYUP, 0, 0}, {KEY_NULL, 0, 0, 0}
}

Definition at line 205 of file reset.c.

◆ Reset_Rules [2/2]

KeyMap_t Reset_Rules[5]
static
Initial value:
= {{COLD_FACTORY, &coldFactorySeq[0]},{FACTORY, &factorySeq[0]},{WARE_HOUSE, &wareHouseSeq[0]},{CUSTOMER, &customerSeq[0]},
{PERSONALITY, &personalityResetSeq[0]}
}

Definition at line 214 of file reset.c.