RDK Documentation (Open Sourced RDK Components)

Description

Modules

 IARM-Bus IR Manager internal API.
 

Data Structures

struct  _IRMgr_EventData_t
 
union  _IRMgr_EventData_t.data
 
struct  _IRKEY_DATA.data.fpkey
 
struct  _IRKEY_DATA.data.irkey
 
struct  _IARM_Bus_IRMgr_SetRepeatInterval_Param_t
 
struct  _IARM_Bus_IRMgr_GetRepeatInterval_Param_t
 

Macros

#define IARM_BUS_IRMGR_NAME   "IRMgr"
 
#define IARM_BUS_IRMGR_API_SetRepeatInterval   "SetRepeatInterval"
 
#define IARM_BUS_IRMGR_API_GetRepeatInterval   "GetRepeatInterval"
 
#define MAX_KEY_REPEATS   6
 
#define LAST_KEY_NUM_SECONDS   2
 
#define MICRO_SECS_PER_SEC   1000000L
 
#define MICROSECS_PER_MILLISEC   1000L
 
#define LOG_TRANSLATE_EVENT(OLD_KEY, NEW_KEY)
 
#define LOG(...)   printf(__VA_ARGS__)
 
#define RFC_BUFFER_SIZE   100
 

Typedefs

typedef enum _IRMgr_EventId_t IARM_Bus_IRMgr_EventId_t
 
typedef enum _IRMgr_KeySrc_t IARM_Bus_IRMgr_KeySrc_t
 
typedef struct _IRMgr_EventData_t IARM_Bus_IRMgr_EventData_t
 
typedef struct _IARM_Bus_IRMgr_SetRepeatInterval_Param_t IARM_Bus_IRMgr_SetRepeatInterval_Param_t
 
typedef struct _IARM_Bus_IRMgr_GetRepeatInterval_Param_t IARM_Bus_IRMgr_GetRepeatInterval_Param_t
 
typedef void(* uinput_dispatcher_t) (int keyCode, int keyType, int source)
 

Enumerations

enum  _IRMgr_EventId_t
 
enum  _IRMgr_KeySrc_t
 

Functions

static void * _LASTKeyTimerThreadFunc (void *arg)
 
static void * _KeyRepeatThreadFunc (void *arg)
 Thread entry fuction to post Repeat Keys. More...
 
static void _IrKeyCallback (int keyType, int keyCode)
 
static void _IrKeyCallbackFrom (int keyType, int keyCode, int keySrc, unsigned int keySrcId)
 
static void _IrInputKeyEventHandler (int keyType, int keyCode, int keySrc, unsigned int keySrcId)
 Calback funtion to that is registered with MAF to get notified for the key press. More...
 
static void _logEventHandler (const char *owner, IARM_EventId_t eventId, void *data, size_t len)
 Event Handler for RF Key Events. More...
 
static IARM_Result_t _SetRepeatInterval (void *arg)
 Sets key repeat interval. More...
 
static IARM_Result_t _GetRepeatInterval (void *arg)
 Gets key repeat interval. More...
 
IARM_Result_t IRMgr_Register_uinput (uinput_dispatcher_t f)
 register a uinput dispatcher. More...
 
IARM_Result_t IRMgr_Start (int argc, char *argv[])
 Starts the IR manager. More...
 
IARM_Result_t IRMgr_Loop ()
 Loop to keep the IR manager alive. More...
 
IARM_Result_t IRMgr_Stop (void)
 Terminates the IR manager. More...
 
static bool isKeyReleased (unsigned int uTimeoutValue)
 Calback funtion to that is registered with MAF to get notified for the key press. More...
 
int get_irmgr_RFC_config ()
 
static bool drop_root ()
 
int main (int argc, char *argv[])
 

Variables

int _IRMgr_EventData_t::_IRKEY_DATA::keyType
 
int _IRMgr_EventData_t::_IRKEY_DATA::keyCode
 
int _IRMgr_EventData_t::_IRKEY_DATA::keyTag
 
int _IRMgr_EventData_t::_IRKEY_DATA::keyOwner
 
int _IRMgr_EventData_t::_IRKEY_DATA::isFP
 
IARM_Bus_IRMgr_KeySrc_t _IRMgr_EventData_t::_IRKEY_DATA::keySrc
 
unsigned int _IRMgr_EventData_t::_IRKEY_DATA::keySourceId
 
struct _IRKEY_DATA {
int keyType
 
int keyCode
 
int keyTag
 
int keyOwner
 
int isFP
 
IARM_Bus_IRMgr_KeySrc_t keySrc
 
unsigned int keySourceId
 
_IRMgr_EventData_t::irkey
 
struct _IRKEY_DATA {
int keyType
 
int keyCode
 
int keyTag
 
int keyOwner
 
int isFP
 
IARM_Bus_IRMgr_KeySrc_t keySrc
 
unsigned int keySourceId
 
_IRMgr_EventData_t::fpkey
 
union {
   struct _IRKEY_DATA {
int keyType
 
int keyCode
 
int keyTag
 
int keyOwner
 
int isFP
 
IARM_Bus_IRMgr_KeySrc_t keySrc
 
unsigned int keySourceId
 
   } irkey
 
   struct _IRKEY_DATA {
int keyType
 
int keyCode
 
int keyTag
 
int keyOwner
 
int isFP
 
IARM_Bus_IRMgr_KeySrc_t keySrc
 
unsigned int keySourceId
 
   } fpkey
 
_IRMgr_EventData_t::data
 
unsigned int _IARM_Bus_IRMgr_SetRepeatInterval_Param_t::timeout
 
unsigned int _IARM_Bus_IRMgr_GetRepeatInterval_Param_t::timeout
 
static pthread_t eRepeatThreadID
 
static pthread_mutex_t tLastKeyMutex
 
static pthread_mutex_t tKeySeqMutex
 
static pthread_mutex_t tMutexLock
 
static pthread_cond_t tMutexCond
 
static int gCurrentKeyCode = KED_UNDEFINEDKEY
 
static int gCurrentKeySrcId = 0
 
static const unsigned int gInitialWaitTimeout = 500
 
static unsigned int gRepeatKeyInterval = 50
 
static int numKeyRepeats = 0
 
static int keyLogStatus = 1
 
static pthread_t eLASTKeyTimerThreadID
 
bool bLastKeyUpReceived = false
 
bool bLastTimerRunning = false
 
bool bIgnoreLastKeyup = false
 
int LASTkeySrc = IARM_BUS_IRMGR_KEYSRC_IR
 
int lastKeyNumMSecs = 1500
 
static bool isCecLocalLogicEnabled = false
 
static bool bNeedRFKeyUp = false
 
static uinput_dispatcher_t udispatcher = NULL
 

Data Structure Documentation

◆ _IRMgr_EventData_t

struct _IRMgr_EventData_t

Key Event Data

Definition at line 235 of file irMgr.h.

Collaboration diagram for _IRMgr_EventData_t:
Collaboration graph
Data Fields
union _IRMgr_EventData_t data

◆ _IRMgr_EventData_t.data

union _IRMgr_EventData_t.data

Definition at line 236 of file irMgr.h.

Collaboration diagram for _IRMgr_EventData_t.data:
Collaboration graph
Data Fields
data irkey
data fpkey

◆ _IRMgr_EventData_t::_IRKEY_DATA.data.fpkey

struct _IRMgr_EventData_t::_IRKEY_DATA.data.fpkey

Definition at line 237 of file irMgr.h.

Collaboration diagram for _IRKEY_DATA.data.fpkey:
Collaboration graph
Data Fields
int keyType

Key type (UP/DOWN/REPEAT)

int keyCode

Key code

int keyTag

key tag (identifies which remote)

int keyOwner

key owner (normal or pairing op)

int isFP

Key Source – Remote/FP - TBD - Need to be removed after changing MPEOS

IARM_Bus_IRMgr_KeySrc_t keySrc

Key Source – FP,IR,Remote

unsigned int keySourceId

◆ _IRMgr_EventData_t::_IRKEY_DATA.data.irkey

struct _IRMgr_EventData_t::_IRKEY_DATA.data.irkey

Definition at line 237 of file irMgr.h.

Collaboration diagram for _IRKEY_DATA.data.irkey:
Collaboration graph
Data Fields
int keyType

Key type (UP/DOWN/REPEAT)

int keyCode

Key code

int keyTag

key tag (identifies which remote)

int keyOwner

key owner (normal or pairing op)

int isFP

Key Source – Remote/FP - TBD - Need to be removed after changing MPEOS

IARM_Bus_IRMgr_KeySrc_t keySrc

Key Source – FP,IR,Remote

unsigned int keySourceId

◆ _IARM_Bus_IRMgr_SetRepeatInterval_Param_t

struct _IARM_Bus_IRMgr_SetRepeatInterval_Param_t

Declare Argument Data structure for SetRepeatInterval

Definition at line 256 of file irMgr.h.

Collaboration diagram for _IARM_Bus_IRMgr_SetRepeatInterval_Param_t:
Collaboration graph
Data Fields
unsigned int timeout

Repeat key interval timeout

◆ _IARM_Bus_IRMgr_GetRepeatInterval_Param_t

struct _IARM_Bus_IRMgr_GetRepeatInterval_Param_t

Declare Argument Data structure for GetRepeatInterval

Definition at line 264 of file irMgr.h.

Collaboration diagram for _IARM_Bus_IRMgr_GetRepeatInterval_Param_t:
Collaboration graph
Data Fields
unsigned int timeout

Repeat key interval timeout value retrived

Macro Definition Documentation

◆ IARM_BUS_IRMGR_NAME

#define IARM_BUS_IRMGR_NAME   "IRMgr"

IR Manager IARM -bus name

Definition at line 216 of file irMgr.h.

◆ IARM_BUS_IRMGR_API_SetRepeatInterval

#define IARM_BUS_IRMGR_API_SetRepeatInterval   "SetRepeatInterval"

Set the repeat key event interval

Definition at line 253 of file irMgr.h.

◆ IARM_BUS_IRMGR_API_GetRepeatInterval

#define IARM_BUS_IRMGR_API_GetRepeatInterval   "GetRepeatInterval"

Retrives the current repeat interval

Definition at line 261 of file irMgr.h.

◆ LOG_TRANSLATE_EVENT

#define LOG_TRANSLATE_EVENT (   OLD_KEY,
  NEW_KEY 
)
Value:
LOG("IR Key " #OLD_KEY "(0x%x) event is translated to " #NEW_KEY "(0x%x)\n", \
(unsigned int)OLD_KEY, (unsigned int)NEW_KEY)

Definition at line 57 of file irMgr.c.

Typedef Documentation

◆ IARM_Bus_IRMgr_EventId_t

Events published from IR Mananger

◆ IARM_Bus_IRMgr_KeySrc_t

Possible IR Manager Key Source

◆ IARM_Bus_IRMgr_EventData_t

◆ IARM_Bus_IRMgr_SetRepeatInterval_Param_t

Declare Argument Data structure for SetRepeatInterval

◆ IARM_Bus_IRMgr_GetRepeatInterval_Param_t

Declare Argument Data structure for GetRepeatInterval

Enumeration Type Documentation

◆ _IRMgr_EventId_t

Events published from IR Mananger

Enumerator
IARM_BUS_IRMGR_EVENT_IRKEY 

Key Event

IARM_BUS_IRMGR_EVENT_MAX 

Maximum event id

Definition at line 219 of file irMgr.h.

◆ _IRMgr_KeySrc_t

Possible IR Manager Key Source

Enumerator
IARM_BUS_IRMGR_KEYSRC_FP 

Key Source FP

IARM_BUS_IRMGR_KEYSRC_IR 

Key Source IR

IARM_BUS_IRMGR_KEYSRC_RF 

Key Source RF

Definition at line 227 of file irMgr.h.

Function Documentation

◆ _KeyRepeatThreadFunc()

static void * _KeyRepeatThreadFunc ( void *  arg)
static

Thread entry fuction to post Repeat Keys.

This functions handles posting a KET_KEYREPEAT with specified timeout

Parameters
voidpointer (NULL)
Returns
void pointer (NULL)

Definition at line 1230 of file irMgr.c.

◆ _IrInputKeyEventHandler()

static void _IrInputKeyEventHandler ( int  keyType,
int  keyCode,
int  keySrc,
unsigned int  keySrcId 
)
static

Calback funtion to that is registered with MAF to get notified for the key press.

This functions receives KET_KEYDOWN, KET_KEYREPEAT and KET_KEYUP and signals the thread.

Parameters
keyTypeType of event (KEYDOWN or KEYREPEAT or KEYUP)
keyCodeContains the key code that is trigger by the user
keySrcContains the key source that is trigger by the user
Returns
None

Definition at line 494 of file irMgr.c.

◆ _logEventHandler()

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

Event Handler for RF Key Events.

This function is a Event handler for RF key events. Post the Key to IARM IR key handler.

Parameters
voidpointer (Event ID , Data and Length)
Returns
void pointer (NULL)

Definition at line 1769 of file irMgr.c.

◆ _SetRepeatInterval()

static IARM_Result_t _SetRepeatInterval ( void *  arg)
static

Sets key repeat interval.

This functions sets/updates the interval between two KET_KEYREPEAT events

Parameters
callCtxContext to the caller function
methodIDMethod to be invoke
argSpecifies the timeout to be set
serialHandshake code to share with
Returns
None

Definition at line 279 of file irMgr.c.

◆ _GetRepeatInterval()

static IARM_Result_t _GetRepeatInterval ( void *  arg)
static

Gets key repeat interval.

This functions sets/updates the interval between two KET_KEYREPEAT events

Parameters
callCtxContext to the caller function
methodIDMethod to be invoke
argReceives the timeout that is set
serialHandshake code to share with
Returns
None

Definition at line 302 of file irMgr.c.

◆ IRMgr_Register_uinput()

IARM_Result_t IRMgr_Register_uinput ( uinput_dispatcher_t  f)

register a uinput dispatcher.

This function is invoked whenever a IR key event is sent out on IARM This should be called before IRMgr_Start()

Returns
Error code if stop fails.

Definition at line 145 of file irMgr.c.

◆ IRMgr_Start()

IARM_Result_t IRMgr_Start ( int  argc,
char *  argv[] 
)

Starts the IR manager.

This function registers and connects IR Manager to the IARM bus.

Returns
Error code if start fails.

Definition at line 151 of file irMgr.c.

◆ IRMgr_Loop()

IARM_Result_t IRMgr_Loop ( )

Loop to keep the IR manager alive.

This function will loop around to keep IR manager alive.

Definition at line 221 of file irMgr.c.

◆ IRMgr_Stop()

IARM_Result_t IRMgr_Stop ( void  )

Terminates the IR manager.

This function disconnects and terminates IR manager from IARM bus.

Returns
Error code if stop fails.

Definition at line 235 of file irMgr.c.

◆ isKeyReleased()

static bool isKeyReleased ( unsigned int  uTimeoutValue)
static

Calback funtion to that is registered with MAF to get notified for the key press.

This function Waits for given timeout for the key to be released. Upon timeout, returns true

Parameters
uTimeoutValueTime in milliseconds to wait for.
Returns
true or false

Definition at line 972 of file irMgr.c.

Variable Documentation

◆ keyType

int { ... } ::_IRKEY_DATA::keyType

Key type (UP/DOWN/REPEAT)

Definition at line 239 of file irMgr.h.

◆ keyCode

int { ... } ::_IRKEY_DATA::keyCode

Key code

Definition at line 240 of file irMgr.h.

◆ keyTag

int { ... } ::_IRKEY_DATA::keyTag

key tag (identifies which remote)

Definition at line 241 of file irMgr.h.

◆ keyOwner

int { ... } ::_IRKEY_DATA::keyOwner

key owner (normal or pairing op)

Definition at line 242 of file irMgr.h.

◆ isFP

int { ... } ::_IRKEY_DATA::isFP

Key Source – Remote/FP - TBD - Need to be removed after changing MPEOS

Definition at line 243 of file irMgr.h.

◆ keySrc

IARM_Bus_IRMgr_KeySrc_t { ... } ::_IRKEY_DATA::keySrc

Key Source – FP,IR,Remote

Definition at line 244 of file irMgr.h.

◆ keySourceId

unsigned { ... } ::_IRKEY_DATA::keySourceId

Definition at line 245 of file irMgr.h.

◆ irkey

struct { ... } ::irkey

◆ fpkey

struct { ... } ::fpkey

◆ data

union { ... } _IRMgr_EventData_t::data

◆ timeout [1/2]

unsigned int _IARM_Bus_IRMgr_SetRepeatInterval_Param_t::timeout

Repeat key interval timeout

Definition at line 258 of file irMgr.h.

◆ timeout [2/2]

unsigned int _IARM_Bus_IRMgr_GetRepeatInterval_Param_t::timeout

Repeat key interval timeout value retrived

Definition at line 265 of file irMgr.h.