RDK Documentation (Open Sourced RDK Components)

Description

Data Structures

struct  _MOTION_EVENT
 
struct  _JSON_EVENT
 
struct  _SPEECH_EVENT
 
union  _SPEECH_EVENT.data
 
struct  _SPEECH_END_EVENT.data.end
 
struct  _SPEECH_FRAGMENT_EVENT.data.fragment
 
struct  _SPEECH_BEGIN_EVENT.data.begin
 
struct  _IARM_BUS_VREXMgr_EventData_t
 
union  _IARM_BUS_VREXMgr_EventData_t.data
 
class  JSONParser
 
struct  AudioInfo
 
struct  MotionInfo
 
class  VREXSession
 

Macros

#define IARM_BUS_VREXMGR_NAME   "VREXMgr"
 
#define IARM_BUS_VREXMGR_SPEECH_FRAGMENTLENGTH   1024
 
#define IARM_BUS_VREXMGR_SPEECH_MIME_LENGTH   64
 
#define IARM_BUS_VREXMGR_SPEECH_SUBTYPE_LENGTH   64
 
#define IARM_BUS_VREXMGR_SPEECH_LANG_LENGTH   3
 
#define IARM_BUS_VREXMGR_ERROR_MESSAGE_LENGTH   256
 
#define IARM_BUS_VREXMGR_API_AnnounceFirmware   "AnnounceFirmware"
 
#define INT_LOG(...)   printf(__VA_ARGS__)
 
#define LOG(...)   INT_LOG("VREXMGR: " __VA_ARGS__)
 
#define STATUS_LOG(...)   LOG("IARMSTATUS: " __VA_ARGS__)
 
#define VERSION_TXT_FILE   "/version.txt"
 
#define VERSION_TXT_IMAGENAME   "imagename:"
 
#define MIN(a, b)   (((a)<(b))?(a):(b))
 
#define MAX_IARMSTATUS_COUNT_LENGTH   10
 
#define TEMP_BUFFER_SIZE   20
 
#define DEFAULT_VREX_TIMEOUT   30
 

Typedefs

typedef enum _VREXMgr_EventId_t IARM_Bus_VREXMgr_EventId_t
 
typedef enum _VREXMgr_SpeechType IARM_Bus_VREXMgr_SpeechType_t
 
typedef enum _VREXMgr_SpeechEndReason IARM_Bus_VREXMgr_SpeechEndReason_t
 
typedef enum _VREXMgr_VoiceCallType IARM_Bus_VREXMgr_VoiceCallType_t
 
typedef struct _IARM_BUS_VREXMgr_EventData_t IARM_Bus_VREXMgr_EventData_t
 
typedef enum _VREXMgr_CARD_FWDNLDState_t IARM_Bus_VREXMGR_FWDNLDState_t
 

Enumerations

enum  _VREXMgr_EventId_t
 
enum  _VREXMgr_SpeechType
 
enum  _VREXMgr_SpeechEndReason
 
enum  _VREXMgr_VoiceCallType
 
enum  _VREXMgr_CARD_FWDNLDState_t
 
enum  AudioStreamEndReason
 
enum  SendState
 

Functions

IARM_Result_t IARMSTATUS_Start (void)
 
IARM_Result_t IARMSTATUS_Stop (void)
 
void IARMSTATUS_keyEventHandler (const char *owner, IARM_EventId_t eventId, void *data, size_t len)
 
uint32_t get_status_kill_count ()
 
unsigned char get_battery_level_loaded (unsigned char remoteId)
 
static int parse_null (void *ctx)
 
static int parse_boolean (void *ctx, int boolean)
 
static int parse_number (void *ctx, const char *s, size_t l)
 
static int parse_string (void *ctx, const unsigned char *stringVal, size_t stringLen)
 
static int parse_map_key (void *ctx, const unsigned char *stringVal, size_t stringLen)
 
static int parse_start_map (void *ctx)
 
static int parse_end_map (void *ctx)
 
static int parse_start_array (void *ctx)
 
static int parse_end_array (void *ctx)
 
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. More...
 
int main (int argc, char *argv[])
 
static void _vrexEventHandler (const char *owner, IARM_EventId_t eventId, void *data, size_t len)
 
static void _pairEventHandler (const char *owner, IARM_EventId_t eventId, void *data, size_t len)
 
static void _keyEventHandler (const char *owner, IARM_EventId_t eventId, void *data, size_t len)
 
static bool _sessionExists (unsigned char remoteId)
 
static void _updateSessionTimeout (unsigned char remoteId)
 
static bool _loadReceiverId ()
 
static bool _getSTBName ()
 
static void _configureRemotesToWatch ()
 
static void _loadConfiguration ()
 
static bool is_powered_on (void)
 
static IARM_Result_t _PowerPreChange (void *arg)
 
IARM_Result_t VREXMgr_Start ()
 
IARM_Result_t VREXMgr_Loop (void)
 Listens for component specific events from drivers. More...
 
IARM_Result_t VREXMgr_Stop (void)
 Terminates the Sys manager. More...
 
static bool _fileExists (string fileName)
 
static void handleSettingsFromServer (const char *jsonData)
 
static void * speechServerThread (void *session)
 
static size_t voice_writeData (void *buffer, size_t size, size_t nmemb, void *userData)
 
static size_t kk_writeData (void *buffer, size_t size, size_t nmemb, void *userData)
 
static size_t sendState_writeData (void *buffer, size_t size, size_t nmemb, void *userData)
 
static size_t read_chunked_socket_callback (void *buffer, size_t size, size_t nmemb, void *userData)
 
 m_remoteId (remoteId)
 
 m_receiverId (receiverId)
 
 m_appId (appId)
 
 m_stbName (stbName)
 
 m_defaultConversationLength (defaultConversationLength)
 
 m_conversationExpires (std::time(0) -200)
 
 m_curlInitialized (false)
 
 m_logMetrics (true)
 
 m_baseRoute (route)
 
 m_serverSocket (0)
 
 m_dataReadThread (NULL)
 
 m_aspect_ratio (aspect_ratio)
 
 m_guideLanguage (language)
 
 if (rfStatus->bindRemotes[bindRemotesIndex].ShortAddress !=0xFFFF)
 
void VREXSession::changeServerDetails (string route, string aspect_ratio, string language)
 
bool VREXSession::onMotion (MotionInfo)
 
void VREXSession::notifySuccess ()
 
void VREXSession::notifyError (long httpErrorCode, long curlErrorCode, long vrexErrorCode, long rfErrorCode, const char *message, IARM_Bus_VREXMgr_VoiceCallType_t from)
 
void VREXSession::safe_copy (unsigned char *dst, const char *src, size_t len)
 
void VREXSession::addKKResponse (string responseData)
 
void VREXSession::addSpeechResponse (string responseData)
 
void VREXSession::addSendStateResponse (string responseData)
 
bool VREXSession::onStreamStart (AudioInfo audioInfo)
 
void VREXSession::onStreamData (void *src, size_t size)
 
void VREXSession::onStreamEnd (AudioStreamEndReason)
 
void VREXSession::updateExpiration (int expirationWindow)
 
bool VREXSession::sendState (SendState state)
 
size_t VREXSession::serverSocketCallback (void *buffer, size_t size, size_t nmemb)
 
void VREXSession::startTransferServer ()
 
char * VREXSession::getRequestMetrics (CURL *curl, char *)
 
string VREXSession::getPostFieldString ()
 
string VREXSession::getUserAgentString ()
 

Variables

static yajl_callbacks callbacks
 
static int count
 
static pthread_mutex_t tMutexLock
 
static int currentPowerMode = 0
 
static volatile int initialized = 0
 
static volatile bool bVoiceControl =true
 
string guideLanguage =""
 
string aspect_ratio =""
 
map< unsigned char, VREXSessionremotes
 
static string receiverId
 
static string stbName
 
static string defaultRemoteName = "XR11-20"
 
static string defaultRoute = "https://vrex.g.comcast.net/vsp/v1/"
 
static int defaultConversationLength = 180
 
static int defaultExpirationWindow = 60
 
static pthread_mutex_t power_save_mutex
 
char tempBuffer [20]
 

Data Structure Documentation

◆ _MOTION_EVENT

struct _MOTION_EVENT

Definition at line 131 of file vrexMgr.h.

Collaboration diagram for _MOTION_EVENT:
Collaboration graph
Data Fields
double x payload description for the Motion Event

The acceleration values in G's against the various axis

double y
double z

◆ _JSON_EVENT

struct _JSON_EVENT

Definition at line 146 of file vrexMgr.h.

Collaboration diagram for _JSON_EVENT:
Collaboration graph
Data Fields
unsigned char jsonData[256]

◆ _SPEECH_EVENT

struct _SPEECH_EVENT

Definition at line 150 of file vrexMgr.h.

Collaboration diagram for _SPEECH_EVENT:
Collaboration graph
Data Fields
unsigned char type
union _SPEECH_EVENT data

◆ _SPEECH_EVENT.data

union _SPEECH_EVENT.data

Definition at line 152 of file vrexMgr.h.

Collaboration diagram for _SPEECH_EVENT.data:
Collaboration graph
Data Fields
data begin
data fragment
data end

◆ _SPEECH_EVENT::_SPEECH_END_EVENT.data.end

struct _SPEECH_EVENT::_SPEECH_END_EVENT.data.end

Definition at line 171 of file vrexMgr.h.

Collaboration diagram for _SPEECH_END_EVENT.data.end:
Collaboration graph
Data Fields
unsigned char reason The reason for ending.

◆ _SPEECH_EVENT::_SPEECH_FRAGMENT_EVENT.data.fragment

struct _SPEECH_EVENT::_SPEECH_FRAGMENT_EVENT.data.fragment

Definition at line 163 of file vrexMgr.h.

Collaboration diagram for _SPEECH_FRAGMENT_EVENT.data.fragment:
Collaboration graph
Data Fields
unsigned long length The length of the fragment.
unsigned char fragment[1024] The voice data itself.

◆ _SPEECH_EVENT::_SPEECH_BEGIN_EVENT.data.begin

struct _SPEECH_EVENT::_SPEECH_BEGIN_EVENT.data.begin

Definition at line 153 of file vrexMgr.h.

Collaboration diagram for _SPEECH_BEGIN_EVENT.data.begin:
Collaboration graph
Data Fields
unsigned char mimeType[64] The mime type of the data audio/vnd.wave;codec=1 for PCM or audio/x-adpcm for ADPCM see http://www.isi.edu/in-notes/rfc2361.txt wrt mime types.
unsigned char subType[64] The subtype (using exising definitions such as PCM_16_16K, PCM_16_32K, PCM_16_22K)
unsigned char language[3] The language code (ISO-639-1)

◆ _IARM_BUS_VREXMgr_EventData_t

struct _IARM_BUS_VREXMgr_EventData_t

Event Data associated with Sys Managers

Definition at line 179 of file vrexMgr.h.

Collaboration diagram for _IARM_BUS_VREXMgr_EventData_t:
Collaboration graph
Data Fields
unsigned char remoteId A unique identifier of the remote that transmitted the motion command.
union _IARM_BUS_VREXMgr_EventData_t data

◆ _IARM_BUS_VREXMgr_EventData_t.data

union _IARM_BUS_VREXMgr_EventData_t.data

Definition at line 182 of file vrexMgr.h.

Collaboration diagram for _IARM_BUS_VREXMgr_EventData_t.data:
Collaboration graph
Data Fields
_MOTION_EVENT motionEvent
_SPEECH_EVENT speechEvent
_JSON_EVENT jsonEvent

◆ JSONParser

class JSONParser

Definition at line 43 of file jsonParser.h.

Collaboration diagram for JSONParser:
Collaboration graph

Public Member Functions

map< string, varVal * > parse (const unsigned char *)
 
void newKey (string keyName)
 
void newString (string value)
 
void newNull ()
 
void newBool (bool value)
 
void newArray ()
 
void endArray ()
 
map< string, varVal * > parse (const unsigned char *)
 
void newKey (string keyName)
 
void newString (string value)
 
void newNull ()
 
void newBool (bool value)
 
void newArray ()
 
void endArray ()
 

Private Attributes

string m_curKey
 
map< string, varVal * > m_dict
 
stack< list< varVal * > * > m_arrays
 
list< varVal * > * m_array
 

◆ AudioInfo

struct AudioInfo

Definition at line 849 of file deviceUpdateMgrMain.cpp.

Collaboration diagram for AudioInfo:
Collaboration graph
Data Fields
string mimeType
string subType
string language

◆ MotionInfo

struct MotionInfo

Definition at line 61 of file vrexSession.h.

Collaboration diagram for MotionInfo:
Collaboration graph
Data Fields
double x
double y
double z

◆ VREXSession

class VREXSession

Definition at line 82 of file vrexSession.h.

Collaboration diagram for VREXSession:
Collaboration graph

Public Member Functions

bool onMotion (MotionInfo)
 
bool onStreamStart (AudioInfo audioInfo)
 
void onStreamData (void *src, size_t size)
 
void onStreamEnd (AudioStreamEndReason)
 
bool sendState (SendState state)
 
void updateExpiration (int expirationWindow)
 
void startTransferServer ()
 
size_t serverSocketCallback (void *buffer, size_t size, size_t nmemb)
 
void addKKResponse (string responseData)
 
void addSpeechResponse (string responseData)
 
void addSendStateResponse (string responseData)
 
void changeServerDetails (string route, string aspect_ratio, string language)
 

Private Member Functions

char * getRequestMetrics (CURL *curl, char *)
 
void notifySuccess ()
 
void notifyError (long httpErrorCode, long curlErrorCode, long vrexErrorCode, long rfErrorCode, const char *message, IARM_Bus_VREXMgr_VoiceCallType_t from)
 
void safe_copy (unsigned char *dst, const char *src, size_t len)
 
void getDynamicStbAndRemoteinfo ()
 
string getPostFieldString ()
 
string getUserAgentString ()
 

Private Attributes

string m_userId
 
string m_appId
 
string m_receiverId
 
string m_rf4ceMacAddress
 
string m_remoteBatteryVoltage
 
string m_iArmStatusKillCount
 
string m_rdkImage
 
string m_remoteType
 
string m_remoteSoftwareVersion
 
string m_remoteHardwareVersion
 
string m_stbName
 
string m_conversationId
 
string m_baseRoute
 
string m_aspect_ratio
 
string m_guideLanguage
 
unsigned char m_remoteId
 
int m_defaultConversationLength
 
time_t m_conversationExpires
 
AudioInfo m_audioInfo
 
bool m_curlInitialized
 
bool m_logMetrics
 
string m_kkResponse
 
string m_sendStateResponse
 
string m_speechResponse
 
string m_serverSocketName
 
int m_serverSocket
 
int m_clientSocket
 
pthread_t m_dataReadThread
 
pthread_cond_t m_cond
 
pthread_mutex_t m_mutex
 
map< string, JSONParser::varVal * > m_parameters
 
map< string, JSONParser::varVal * > m_speechResults
 
map< SendState, string > m_sendStates
 

Macro Definition Documentation

◆ IARM_BUS_VREXMGR_NAME

#define IARM_BUS_VREXMGR_NAME   "VREXMgr"

IARM BUS name for VREX manager

Definition at line 99 of file vrexMgr.h.

Typedef Documentation

◆ IARM_Bus_VREXMgr_EventId_t

Published Events from sys manager

◆ IARM_Bus_VREXMgr_EventData_t

Event Data associated with Sys Managers

◆ IARM_Bus_VREXMGR_FWDNLDState_t

Possible Firmware Download state

Enumeration Type Documentation

◆ _VREXMgr_EventId_t

Published Events from sys manager

Enumerator
IARM_BUS_VREXMGR_EVENT_MAX 

Max Event Id

Definition at line 109 of file vrexMgr.h.

◆ _VREXMgr_CARD_FWDNLDState_t

Possible Firmware Download state

Definition at line 191 of file vrexMgr.h.

Function Documentation

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

Parameters
[in]ownerNamewell-known name of the application that publish the RPC call.
[in]methodNamewell-known name of the RPC method.
[in]argIt is the data structure holding input & output parameters of the invocation.
[in]argLenThe size of the data pointed by arg parameter.
Returns
Error Code.
Return values
IARM_RESULT_SUCCESSIndicates the call was successful.
IARM_RESULT_INVALID_PARAMIndicates invalid input parameter.
IARM_RESULT_INVALID_STATEIndicates the IARM_Bus was either not initialised nor connected.
IARM_RESULT_IPCCORE_FAILIndicates failure of the underlying IPC.
IARM_RESULT_OOMIndicates failure to allocate memory.

Definition at line 57 of file iarm_bus.c.

◆ _PowerPreChange()

static IARM_Result_t _PowerPreChange ( void *  arg)
static

Set the state of the logger based on the power state events

Definition at line 1027 of file vrexMgr.cpp.

◆ VREXMgr_Loop()

IARM_Result_t VREXMgr_Loop ( void  )

Listens for component specific events from drivers.

Returns
Error code if fails.

Definition at line 266 of file vrexMgr.cpp.

◆ VREXMgr_Stop()

IARM_Result_t VREXMgr_Stop ( void  )

Terminates the Sys manager.

This function disconnects Sys Manager from the iarm bus and terminates it.

Returns
Error code if stop fails.

Definition at line 285 of file vrexMgr.cpp.

Variable Documentation

◆ callbacks

yajl_callbacks callbacks
static
Initial value:
= {
parse_null,
parse_boolean,
NULL,
NULL,
parse_number,
parse_string,
parse_start_map,
parse_map_key,
parse_end_map,
parse_start_array,
parse_end_array
}

Definition at line 138 of file jsonParser.cpp.