RDK Documentation (Open Sourced RDK Components)
vrexMgr.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 
22 /**
23 * @defgroup iarmmgrs
24 * @{
25 * @defgroup vrexmgr
26 * @{
27 **/
28 
29 
30 #include <stdio.h>
31 #include <string.h>
32 #include <unistd.h>
33 #include <fcntl.h>
34 #include <string.h>
35 #include <stdlib.h>
36 #include <time.h>
37 #include <pthread.h>
38 #include <sys/types.h>
39 #include <sys/stat.h>
40 
41 #include <string>
42 #include <sstream>
43 
44 #include <map>
45 #include <utility>
46 
47 #include <curl/curl.h>
48 
49 #include "libIBus.h"
50 #include "iarmUtil.h"
51 #include "vrexMgr.h"
52 #include "jsonParser.h"
53 #include "vrexSession.h"
54 #include "vrexMgrInternal.h"
55 //#include "iarmStatus.h"
56 #include "pwrMgr.h"
57 #include "safec_lib.h"
58 //#include "gpMgr.h"
59 #include "rf4ceMgr.h"
60 
61 #include "comcastIrKeyCodes.h"
62 
63 #include <assert.h>
64 
65 #define VERSION_TXT_FILE "/version.txt"
66 #define VERSION_TXT_IMAGENAME "imagename:"
67 
68 static pthread_mutex_t tMutexLock;
69 static void _vrexEventHandler(const char *owner, IARM_EventId_t eventId, void *data, size_t len);
70 static void _pairEventHandler(const char *owner, IARM_EventId_t eventId, void *data, size_t len);
71 static void _keyEventHandler(const char *owner, IARM_EventId_t eventId, void *data, size_t len);
72 static bool _sessionExists(unsigned char remoteId);
73 static void _updateSessionTimeout(unsigned char remoteId);
74 static bool _loadReceiverId();
75 static bool _getSTBName();
76 static void _configureRemotesToWatch();
77 static void _loadConfiguration();
78 static int currentPowerMode = 0;
79 static bool is_powered_on(void);
80 static IARM_Result_t _PowerPreChange(void *arg);
81 
82 
83 #ifdef RF4CE_GENMSO_API
84 static VREXSession& _findOrNewSession(unsigned char remoteId, MSOBusAPI_RfStatus_t *rfStatus = NULL, int bindRemotesIndex = 0);
85 #elif defined(RF4CE_API)
86 static VREXSession& _findOrNewSession(unsigned char remoteId, rf4ce_RfStatus_t *rfStatus = NULL, int bindRemotesIndex = 0);
87 #elif defined(RF4CE_GPMSO_API)
88 static VREXSession& _findOrNewSession(unsigned char remoteId, gpMSOBusAPI_RfStatus_t *rfStatus = NULL, int bindRemotesIndex = 0);
89 #else
90 #warning "No RF4CE API defined"
91 #endif
92 
93 static volatile int initialized = 0;
94 static volatile bool bVoiceControl=true;
95 string guideLanguage="";
96 string aspect_ratio="";
97 
98 using namespace std;
99 
100 map<unsigned char, VREXSession> remotes;
101 
102 static string receiverId;
103 static string stbName;
104 static string defaultRemoteName = "XR11-20";
105 static string defaultRoute = "https://vrex.g.comcast.net/vsp/v1/";
106 static int defaultConversationLength = 180;
107 static int defaultExpirationWindow = 60;
108 static pthread_mutex_t power_save_mutex;
109 
110 IARM_Result_t VREXMgr_Start()
111 {
112  errno_t rc = -1;
113  char *list[] = { "XR2-", "XR5-", "XR11-", "XR13-" };
114  int i;
115 
116  IARM_Result_t status = IARM_RESULT_SUCCESS;
117 
118  LOG("Entering [%s] - [%s] - disabling io redirect buf\r\n", __FUNCTION__, IARM_BUS_VREXMGR_NAME);
119  setvbuf(stdout, NULL, _IOLBF, 0);
120 
121  if (!initialized) {
122  LOG("I-ARM VREX Mgr: %d\r\n", __LINE__);
123 
124  pthread_mutex_init (&tMutexLock, NULL);
125  pthread_mutex_lock(&tMutexLock);
126 
127  // Unfortunately it doesn't appear that this actually returns a reasonable error on lower level
128  // IARM_Init but on the off chance that gets fixed we can deal with errors reasonably
130  if (status == IARM_RESULT_SUCCESS)
131  status = IARM_Bus_Connect();
132 
133  if (status == IARM_RESULT_SUCCESS) {
135  IARM_Bus_RegisterEventHandler(IARM_BUS_VREXMGR_NAME, IARM_BUS_VREXMGR_EVENT_MOTION, _vrexEventHandler);
136  IARM_Bus_RegisterEventHandler(IARM_BUS_VREXMGR_NAME, IARM_BUS_VREXMGR_EVENT_SPEECH, _vrexEventHandler);
137  IARM_Bus_RegisterEventHandler(IARM_BUS_VREXMGR_NAME, IARM_BUS_VREXMGR_EVENT_SETTINGS, _vrexEventHandler);
138 
139  // We need to "snoop" on pairing events to update our list in case a voice remote
140  // pairs
141 
142 #ifdef RF4CE_GENMSO_API
143  IARM_Bus_RegisterEventHandler(IARM_BUS_RFMGR_NAME, IARM_BUS_RFMGR_EVENT_MSG_IND, _pairEventHandler);
144  IARM_Bus_RegisterEventHandler(IARM_BUS_RFMGR_NAME, IARM_BUS_RFMGR_EVENT_KEY, _keyEventHandler);
145 #elif defined(RF4CE_API)
146  IARM_Bus_RegisterEventHandler(IARM_BUS_RF4CEMGR_NAME, IARM_BUS_RF4CEMGR_EVENT_MSG_IND, _pairEventHandler);
147  IARM_Bus_RegisterEventHandler(IARM_BUS_RF4CEMGR_NAME, IARM_BUS_RF4CEMGR_EVENT_KEY, _keyEventHandler);
148 #elif defined(RF4CE_GPMSO_API)
149  IARM_Bus_RegisterEventHandler(IARM_BUS_GPMGR_NAME, IARM_BUS_GPMGR_EVENT_MSG_IND, _pairEventHandler);
150  IARM_Bus_RegisterEventHandler(IARM_BUS_GPMGR_NAME, IARM_BUS_GPMGR_EVENT_KEY, _keyEventHandler);
151 #else
152 #warning "No RF4CE API defined"
153 #endif
154  //
155  // RF4CEPATCH BEGIN: This is temporary code to correctly configure NVM in the RF4CE driver. Incorrectly moving
156  // some platforms to a the new ranking algorithm has introduced the potential for the remote weighting to
157  // be incorrect in NVM. This belongs in generic RF4CE startup code, but that does not exist. When it is added
158  // in in the RF4CE rearchitecture, this code or the new implementation should be moved to that section.
159  //
160  // This code sets the XRs it expects and their weights. A weight of 6 is the weight given to a particular remote if
161  // it matches up to the STB it is meant for. This information is stored in NVM by GP in new builds. This code
162  // ensures the nvm is correct. A segment of comcast boxes were upgraded to a new weighting algorithm and then
163  // downgraded. This code moves those boxes NVM back to the correct values.
164  //
165  {
166 
167 #ifdef RF4CE_GENMSO_API
168  MSOBusAPI_Packet_t expectedRemotesPacket;
169  expectedRemotesPacket.msgId = MSOBusAPI_MsgId_ExpectedRemotes;
170  expectedRemotesPacket.index = 0;
171  expectedRemotesPacket.length = sizeof(MSOBusAPI_ExpectedRemoteList_t);
172 #elif defined(RF4CE_API)
173  rf4ce_Packet_t expectedRemotesPacket;
174  expectedRemotesPacket.msgId = rf4ce_MsgId_ExpectedRemotes;
175  expectedRemotesPacket.index = 0;
176  expectedRemotesPacket.length = sizeof(rf4ce_ExpectedRemoteList_t);
177 #elif defined(RF4CE_GPMSO_API)
178  gpMSOBusAPI_Packet_t expectedRemotesPacket;
179  expectedRemotesPacket.msgId = gpMSOBusAPI_MsgId_ExpectedRemotes;
180  expectedRemotesPacket.index = 0;
181  expectedRemotesPacket.length = sizeof(gpMSOBusAPI_ExpectedRemoteList_t);
182 #else
183 #warning "No RF4CE API defined"
184 #endif
185  expectedRemotesPacket.msg.ExpectedRemoteList.numOfRemotes = 4;
186 
187  for (i = 0 ; i < 4 ; ++i)
188  {
189  expectedRemotesPacket.msg.ExpectedRemoteList.remotes[i].weight = 6;
190  rc = strcpy_s(expectedRemotesPacket.msg.ExpectedRemoteList.remotes[i].expectedString,sizeof(expectedRemotesPacket.msg.ExpectedRemoteList.remotes[i].expectedString), list[i]);
191  if(rc!=EOK)
192  {
193  ERR_CHK(rc);
194  }
195  }
196 
197 
198 
199 #ifdef RF4CE_GENMSO_API
200  IARM_Bus_Call(IARM_BUS_RFMGR_NAME, IARM_BUS_RFMGR_MsgRequest, (void *)&expectedRemotesPacket, sizeof(expectedRemotesPacket));
201 #elif defined(RF4CE_API)
202  IARM_Bus_Call(IARM_BUS_RF4CEMGR_NAME, IARM_BUS_RF4CEMGR_MsgRequest, (void *)&expectedRemotesPacket, sizeof(expectedRemotesPacket));
203 #elif defined(RF4CE_GPMSO_API)
204  IARM_Bus_Call(IARM_BUS_GPMGR_NAME, IARM_BUS_GPMGR_API_MsgRequest, (void *)&expectedRemotesPacket, sizeof(expectedRemotesPacket));
205 #else
206 #warning "No RF4CE API defined"
207 #endif
208  }
209  //
210  // RF4CEPATCH END
211  //
212  IARM_Bus_RegisterCall(IARM_BUS_COMMON_API_PowerPreChange, _PowerPreChange);
213 
215  IARM_Result_t status=IARM_Bus_Call(IARM_BUS_PWRMGR_NAME, "GetPowerState", (void *) &param, sizeof(param));
216 
217  if(status==IARM_RESULT_SUCCESS){
218  currentPowerMode=param.curState;
219  }
220  else{
221  currentPowerMode=-1; // we dont know yet, check again
222  }
223 
224  __TIMESTAMP(); LOG("_vrexEventHandler startup in power mode %d\n", currentPowerMode);
225 
226  // Load our ReceiverId
227  while (!_loadReceiverId()) {
228  LOG("I-ARM VREX Mgr:BAD DEVICE ID:Waiting 1 second to try again! \n");
229  sleep(1);
230  }
231  // to be safe in case the file is in process of being written at initial boot
232  // grab file again once concidered valid so we are reasonably sure we do not catch
233  // file during a write and only get half the data
234  if(!_loadReceiverId()){
235  LOG("I-ARM VREX Mgr:DEVICE ID READ FAILED - ABORTING");
236  // this should never happen unless file is deleted. If it does exit so we can start again.
237  exit(1);
238  }
239 
240  if (_getSTBName()) {
241  LOG("I-ARM VREX Mgr: stbName is: %s\n", stbName.c_str());
242  } else {
243  LOG("I-ARM VREX Mgr: FAILED in getSTBName()!\n");
244  }
245 
246  // Load and parse config file
247  _loadConfiguration();
248 
249  // Check to see if we have any voice remotes that we need to listen
250  // to key events for to generate knockknock events
251  _configureRemotesToWatch();
252 
253  initialized = 1;
254  }
255 
256  pthread_mutex_unlock(&tMutexLock);
257  LOG("I-ARM VREX Mgr: %d\r\n", __LINE__);
258  }
259  else {
260  LOG("I-ARM VREX Mgr Error case: %d\r\n", __LINE__);
261  status = IARM_RESULT_INVALID_STATE;
262  }
263  return status;
264 }
265 
266 IARM_Result_t VREXMgr_Loop()
267 {
268  time_t curr = 0;
269  int i=0;
270  while(1)
271  {
272  time(&curr);
273  i++;
274  if(i>500){
275  LOG("I-ARM VREX Mgr: HeartBeat at %s\r\n", ctime(&curr));
276  i=0;
277  }
278  fflush(stdout);
279  sleep(1);
280  }
281  return IARM_RESULT_SUCCESS;
282 }
283 
284 
285 IARM_Result_t VREXMgr_Stop(void)
286 {
287  if (initialized) {
288  pthread_mutex_lock(&tMutexLock);
289  IARM_Bus_UnRegisterEventHandler(IARM_BUS_VREXMGR_NAME, IARM_BUS_VREXMGR_EVENT_MOTION);
290  IARM_Bus_UnRegisterEventHandler(IARM_BUS_VREXMGR_NAME, IARM_BUS_VREXMGR_EVENT_SPEECH);
291 
292 #ifdef RF4CE_GENMSO_API
293  IARM_Bus_UnRegisterEventHandler(IARM_BUS_RFMGR_NAME, IARM_BUS_RFMGR_EVENT_MSG_IND);
294  IARM_Bus_UnRegisterEventHandler(IARM_BUS_RFMGR_NAME, IARM_BUS_RFMGR_EVENT_KEY);
295 #elif defined(RF4CE_API)
296  IARM_Bus_UnRegisterEventHandler(IARM_BUS_RF4CEMGR_NAME, IARM_BUS_RF4CEMGR_EVENT_MSG_IND);
297  IARM_Bus_UnRegisterEventHandler(IARM_BUS_RF4CEMGR_NAME, IARM_BUS_RF4CEMGR_EVENT_KEY);
298 #elif defined(RF4CE_GPMSO_API)
299  IARM_Bus_UnRegisterEventHandler(IARM_BUS_GPMGR_NAME, IARM_BUS_GPMGR_EVENT_MSG_IND);
300  IARM_Bus_UnRegisterEventHandler(IARM_BUS_GPMGR_NAME, IARM_BUS_GPMGR_EVENT_KEY);
301 #else
302 #warning "No RF4CE API defined"
303 #endif
305  IARM_Bus_Term();
306  pthread_mutex_unlock(&tMutexLock);
307  pthread_mutex_destroy (&tMutexLock);
308  pthread_mutex_destroy(&power_save_mutex);
309 
310  initialized = 0;
311  return IARM_RESULT_SUCCESS;
312  }
313  else {
314  return IARM_RESULT_INVALID_STATE;
315  }
316 }
317 
318 static bool _fileExists(string fileName)
319 {
320  struct stat buffer;
321  return (stat(fileName.c_str(), &buffer) == 0);
322 }
323 
324 
325 void _keyEventHandler(const char *owner, IARM_EventId_t eventId, void *data, size_t len)
326 {
327  // IARMSTATUS_keyEventHandler(owner, eventId, data, len);
328 
329 #ifdef RF4CE_GENMSO_API
330 #if defined(DEBUG)
331  //LOG("I-ARM VREX Mgr: remoteId <%d> keyHandler (status, code) 0x%lx 0x%lx\n",((MSOBusAPI_UserCommand_t*)data)->remoteId,
332  ((MSOBusAPI_UserCommand_t*)data)->keyStatus,((MSOBusAPI_UserCommand_t*)data)->commandCode);
333 #endif
334  if (((MSOBusAPI_UserCommand_t*)data)->keyStatus == KET_KEYUP && _sessionExists(((MSOBusAPI_UserCommand_t*)data)->remoteId)) {
335  //LOG("I-ARM VREX Mgr: remoteId <%d> keyHandler calling updatesessiontimeout\n",((MSOBusAPI_UserCommand_t*)data)->remoteId);
336  _updateSessionTimeout(((MSOBusAPI_UserCommand_t*)data)->remoteId);
337  }
338 #elif defined(RF4CE_API)
339 #if defined(DEBUG)
340  //LOG("I-ARM VREX Mgr: remoteId <%d> keyHandler (status, code) 0x%lx 0x%lx\n",((rf4ce_UserCommand_t*)data)->remoteId,
341  ((rf4ce_UserCommand_t*)data)->keyStatus,((rf4ce_UserCommand_t*)data)->commandCode);
342 #endif
343  if (((rf4ce_UserCommand_t*)data)->keyStatus == KET_KEYUP && _sessionExists(((rf4ce_UserCommand_t*)data)->remoteId)) {
344  //LOG("I-ARM VREX Mgr: remoteId <%d> keyHandler calling updatesessiontimeout\n",((rf4ce_UserCommand_t*)data)->remoteId);
345  _updateSessionTimeout(((rf4ce_UserCommand_t*)data)->remoteId);
346  }
347 #elif defined(RF4CE_GPMSO_API)
348 #if defined(DEBUG)
349  //LOG("I-ARM VREX Mgr: remoteId <%d> keyHandler (status, code) 0x%lx 0x%lx\n",((gpMSOBusAPI_UserCommand_t*)data)->remoteId,
350  ((gpMSOBusAPI_UserCommand_t*)data)->keyStatus,((gpMSOBusAPI_UserCommand_t*)data)->commandCode);
351 #endif
352  if (((gpMSOBusAPI_UserCommand_t*)data)->keyStatus == KET_KEYUP && _sessionExists(((gpMSOBusAPI_UserCommand_t*)data)->remoteId)) {
353  //LOG("I-ARM VREX Mgr: remoteId <%d> keyHandler calling updatesessiontimeout\n",((gpMSOBusAPI_UserCommand_t*)data)->remoteId);
354  _updateSessionTimeout(((gpMSOBusAPI_UserCommand_t*)data)->remoteId);
355  }
356 #else
357 #warning "No RF4CE API defined"
358 #endif
359 }
360 
361 
362 void _pairEventHandler(const char *owner, IARM_EventId_t eventId, void *data, size_t len)
363 {
364 
365 #ifdef RF4CE_GENMSO_API
366  MSOBusAPI_Packet_t* busMsg;
367  busMsg = (MSOBusAPI_Packet_t*)data;
368 
369  if(len != (busMsg->length + sizeof(MSOBusAPI_Packet_t) - sizeof(MSOBusAPI_Msg_t))) //Message size + header of packet
370  {
371  LOG("I-ARM VREX Mgr: %i pairEventHandler with wrong length rec:%d exp:%d\r\n",eventId, len, (busMsg->length + sizeof(MSOBusAPI_Packet_t) - sizeof(MSOBusAPI_Msg_t)));
372  return;
373  }
374 
375  switch(busMsg->msgId)
376  {
377  case MSOBusAPI_MsgId_ValidationComplete:
378  {
379  switch(busMsg->msg.ValidationStatus.status)
380  {
381  case MSOBusAPI_ValidationResult_Success:
382  {
383  LOG("I-ARM VREX Mgr: New remote paired successfully <%d>", busMsg->msg.UserCommand.remoteId);
384  // Run this again so we pick up the newly paired remote
385  sleep(1);
386  _configureRemotesToWatch();
387  break;
388  }
389  default:
390  break;
391  }
392  break;
393  }
394  default:
395  break;
396  }
397 #elif defined(RF4CE_API)
398  rf4ce_Packet_t* busMsg;
399  busMsg = (rf4ce_Packet_t*)data;
400 
401  if(len != (busMsg->length + sizeof(rf4ce_Packet_t) - sizeof(rf4ce_Msg_t))) //Message size + header of packet
402  {
403  LOG("I-ARM VREX Mgr: %i pairEventHandler with wrong length rec:%d exp:%d\r\n",eventId, len, (busMsg->length + sizeof(rf4ce_Packet_t) - sizeof(rf4ce_Msg_t)));
404  return;
405  }
406 
407  switch(busMsg->msgId)
408  {
409  case rf4ce_MsgId_ValidationComplete:
410  {
411  switch(busMsg->msg.ValidationStatus.status)
412  {
413  case rf4ce_ValidationResult_Success:
414  {
415  LOG("I-ARM VREX Mgr: New remote paired successfully <%d>", busMsg->msg.UserCommand.remoteId);
416  // Run this again so we pick up the newly paired remote
417  sleep(1);
418  _configureRemotesToWatch();
419  break;
420  }
421  default:
422  break;
423  }
424  break;
425  }
426  default:
427  break;
428  }
429 #elif defined(RF4CE_GPMSO_API)
430  gpMSOBusAPI_Packet_t* busMsg;
431  busMsg = (gpMSOBusAPI_Packet_t*)data;
432 
433  if(len != (busMsg->length + sizeof(gpMSOBusAPI_Packet_t) - sizeof(gpMSOBusAPI_Msg_t))) //Message size + header of packet
434  {
435  LOG("I-ARM VREX Mgr: %i pairEventHandler with wrong length rec:%d exp:%d\r\n",eventId, len, (busMsg->length + sizeof(gpMSOBusAPI_Packet_t) - sizeof(gpMSOBusAPI_Msg_t)));
436  return;
437  }
438 
439  switch(busMsg->msgId)
440  {
441  case gpMSOBusAPI_MsgId_ValidationComplete:
442  {
443  switch(busMsg->msg.ValidationStatus.status)
444  {
445  case gpMSOBusAPI_ValidationResult_Success:
446  {
447  LOG("I-ARM VREX Mgr: New remote paired successfully <%d>", busMsg->msg.UserCommand.remoteId);
448  // Run this again so we pick up the newly paired remote
449  sleep(1);
450  _configureRemotesToWatch();
451  break;
452  }
453  default:
454  break;
455  }
456  break;
457  }
458  default:
459  break;
460  }
461 #else
462 #warning "No RF4CE API defined"
463 #endif
464 }
465 
466 
467 static void _updateSessionTimeout(unsigned char remoteId)
468 {
469  VREXSession &vrSession = _findOrNewSession(remoteId);
470  vrSession.updateExpiration(defaultExpirationWindow);
471 }
472 
473 
474 #ifdef RF4CE_GENMSO_API
475 static bool _isVoiceRemote(MSOBusAPI_BindRemote_t boundRemote)
476 {
477  // Can do something fancier later
478  if (defaultRemoteName == boundRemote.Type)
479  return true;
480  else
481  return false;
482 }
483 #elif defined(RF4CE_API)
484 static bool _isVoiceRemote(rf4ce_BindRemote_t boundRemote)
485 {
486  // Can do something fancier later
487  if (defaultRemoteName == boundRemote.Type)
488  return true;
489  else
490  return false;
491 }
492 #elif defined(RF4CE_GPMSO_API)
493 static bool _isVoiceRemote(gpMSOBusAPI_BindRemote_t boundRemote)
494 {
495  // Can do something fancier later
496  if (defaultRemoteName == boundRemote.Type)
497  return true;
498  else
499  return false;
500 }
501 #else
502 #warning "No RF4CE API defined"
503 #endif
504 
505 static void _configureRemotesToWatch()
506 {
507 
508 #ifdef RF4CE_GENMSO_API
509  MSOBusAPI_Packet_t getRequest;
510  getRequest.msgId = MSOBusAPI_MsgId_GetRfStatus;
511  getRequest.length = sizeof(MSOBusAPI_RfStatus_t);
512  getRequest.index = 0;
513 
514  IARM_Bus_Call(IARM_BUS_RFMGR_NAME, IARM_BUS_RFMGR_MsgRequest, (void *)&getRequest, sizeof(getRequest));
515 
516  MSOBusAPI_Packet_t* dbusMsg = &getRequest;
517  MSOBusAPI_Msg_t* av = &(dbusMsg->msg);
518 #elif defined(RF4CE_API)
519  rf4ce_Packet_t getRequest;
520  getRequest.msgId = rf4ce_MsgId_GetRfStatus;
521  getRequest.length = sizeof(rf4ce_RfStatus_t);
522  getRequest.index = 0;
523 
524  IARM_Bus_Call(IARM_BUS_RF4CEMGR_NAME, IARM_BUS_RF4CEMGR_MsgRequest, (void *)&getRequest, sizeof(getRequest));
525 
526  rf4ce_Packet_t* dbusMsg = &getRequest;
527  rf4ce_Msg_t* av = &(dbusMsg->msg);
528 #elif defined(RF4CE_GPMSO_API)
529  gpMSOBusAPI_Packet_t getRequest;
530  getRequest.msgId = gpMSOBusAPI_MsgId_GetRfStatus;
531  getRequest.length = sizeof(gpMSOBusAPI_RfStatus_t);
532  getRequest.index = 0;
533 
534  IARM_Bus_Call(IARM_BUS_GPMGR_NAME, IARM_BUS_GPMGR_API_MsgRequest, (void *)&getRequest, sizeof(getRequest));
535 
536  gpMSOBusAPI_Packet_t* dbusMsg = &getRequest;
537  gpMSOBusAPI_Msg_t* av = &(dbusMsg->msg);
538 #else
539 #warning "No RF4CE API defined"
540 #endif
541  switch(dbusMsg->msgId)
542  {
543 
544 #ifdef RF4CE_GENMSO_API
545  case MSOBusAPI_MsgId_GetRfStatus:
546 #elif defined(RF4CE_API)
547  case rf4ce_MsgId_GetRfStatus:
548 #elif defined(RF4CE_GPMSO_API)
549  case gpMSOBusAPI_MsgId_GetRfStatus:
550 #else
551 #warning "No RF4CE API defined"
552 #endif
553  {
554  int i;
555 
556  //Clear the remotes since we're going to repopulate
557  if(!remotes.empty())
558  {
559  remotes.clear();
560  }
561 
562  //Remotes are ordered 'Most Recently Used' remote first
563 
564 #ifdef RF4CE_GENMSO_API
565  for(i=0; i < MSO_BUS_API_MAX_BINDED_REMOTES-1; i++)
566 #elif defined(RF4CE_API)
567  for(i=0; i < RF4CE_MAX_BINDED_REMOTES-1; i++)
568 #elif defined(RF4CE_GPMSO_API)
569  for(i=0; i < GP_MSO_BUS_API_MAX_BINDED_REMOTES-1; i++)
570 #else
571 #warning "No RF4CE API defined"
572 #endif
573  {
574  // Only for valid entries!!!
575  if(av->RfStatus.bindRemotes[i].ShortAddress != 0xFFFF) {
576 
577  if (_isVoiceRemote(av->RfStatus.bindRemotes[i])) {
578  // We will populate the remote here and test for existence in the keypress event
579  VREXSession &vrSession = _findOrNewSession(av->RfStatus.bindRemotes[i].remoteId, &(av->RfStatus), i);
580  LOG("Remote %d, remoteId <%d> remote_controller_type %s is voice enabled!\n", i, (int)av->RfStatus.bindRemotes[i].remoteId, av->RfStatus.bindRemotes[i].Type);
581  }
582  else {
583  LOG("Remote %d, remoteId <%d> remote_controller_type %s is *not* voice enabled!\n", i, (int)av->RfStatus.bindRemotes[i].remoteId, av->RfStatus.bindRemotes[i].Type);
584  }
585  }
586 
587 #if defined(DEBUG)
588  //Only print valid entries
589  if(av->RfStatus.bindRemotes[i].ShortAddress != 0xFFFF)
590  {
591  LOG("Remote %d remote_fw_version %d.%d.%d.%d\n",i ,av->RfStatus.bindRemotes[i].VersionInfoSw[0], \
592  av->RfStatus.bindRemotes[i].VersionInfoSw[1], \
593  av->RfStatus.bindRemotes[i].VersionInfoSw[2], \
594  av->RfStatus.bindRemotes[i].VersionInfoSw[3]);
595  LOG("Remote %d remote_hw_revision %d.%d.%d.%d\n",i \
596  ,av->RfStatus.bindRemotes[i].VersionInfoHw.manufacturer, \
597  av->RfStatus.bindRemotes[i].VersionInfoHw.model, \
598  av->RfStatus.bindRemotes[i].VersionInfoHw.hwRevision, \
599  av->RfStatus.bindRemotes[i].VersionInfoHw.lotCode);
600 
601  LOG("Remote %d remote_battery_voltage %i.%i V\n", i, (UInt16)((av->RfStatus.bindRemotes[i].BatteryLevelLoaded >> 6) & 0x03), (UInt16)(((av->RfStatus.bindRemotes[i].BatteryLevelLoaded & 0x3F)*100) >> 6));
602  LOG("Remote %d remoteId <%d> remote_controller_type %s\n", i, av->RfStatus.bindRemotes[i].remoteId, av->RfStatus.bindRemotes[i].Type);
603 
604  }
605 #endif
606  }
607  break;
608  }
609  default:
610  break;
611  }
612 }
613 
614 static void _loadConfiguration()
615 {
616  FILE *fp = NULL;
617 
618  string confName = "vrexPrefs.json";
619  string filePath;
620 
621  // Check if file exists in /opt
622  filePath = "/opt/" + confName;
623 
624  if (!_fileExists(filePath)) {
625  filePath = "/mnt/nfs/env/" + confName;
626  }
627 
628  if (!_fileExists(filePath)) {
629  LOG("I-ARM VREX Mgr: Configuration error. Configuration file(s) missing, using defaults\n");
630  }
631  else if ((fp = fopen(filePath.c_str(), "r")) != NULL) {
632  LOG("I-ARM VREX Mgr: Reading configuration from <%s>\n", filePath.c_str());
633 
634  string confData;
635  char buf[2048];
636 
637  while (!feof(fp) && confData.length() < 65535) {
638  memset(buf, 0, sizeof(buf));
639  if(0 >= fread(buf, 1, sizeof(buf)-1, fp))
640  {
641  LOG("Error: fread returned Negative or Zero value");
642  }
643  else
644  {
645  confData.append(buf);
646  }
647  }
648 
649  if (fp)
650  fclose(fp);
651 
652  LOG("I-ARM VREX Mgr: Configuration Read <%s>\n", confData.c_str());
653 
654  JSONParser parser;
655  map<string, JSONParser::varVal *> configuration;
656 
657  configuration = parser.parse((const unsigned char *)confData.c_str());
658 
659  if (configuration["remoteName"]!=NULL) {
660  LOG("I-ARM VREX Mgr: Found remote name from config\n");
661  defaultRemoteName = configuration["remoteName"]->str;
662  }
663  else {
664  LOG("I-ARM VREX Mgr: No valid remoteName from config using coded default\n");
665  }
666  if (configuration["route"]!=NULL) {
667  LOG("I-ARM VREX Mgr: Found ROUTE from config\n");
668  defaultRoute = configuration["route"]->str;
669  }
670  else {
671  LOG("I-ARM VREX Mgr: No valid ROUTE from config using coded default\n");
672  }
673  if (configuration["defaultConversationLength"]!=NULL) {
674  LOG("I-ARM VREX Mgr: Found defaultConversationLength from config\n");
675  defaultConversationLength = atoi(configuration["defaultConversationLength"]->str.c_str());
676  }
677  else {
678  LOG("I-ARM VREX Mgr: No valid defaultConversationLength from config using coded default\n");
679  }
680  if (configuration["defaultExpirationWindow"]!=NULL) {
681  LOG("I-ARM VREX Mgr: Found defaultExpirationWindow from config\n");
682  defaultExpirationWindow = atoi(configuration["defaultExpirationWindow"]->str.c_str());
683  }
684  else {
685  LOG("I-ARM VREX Mgr: No valid defaultExpirationWindow from config using coded default\n");
686  }
687  }
688  LOG("I-ARM VREX Mgr: default route is: <%s>\n", defaultRoute.c_str());
689  LOG("I-ARM VREX Mgr: default conversation length is: <%d> seconds\n", defaultConversationLength);
690  LOG("I-ARM VREX Mgr: default expiration window is: <%d> seconds\n", defaultExpirationWindow);
691  LOG("I-ARM VREX Mgr: default remote name is: <%s>\n", defaultRemoteName.c_str());
692 }
693 
694 static bool _loadReceiverId()
695 {
696  // Try to use authService first
697  FILE *fp;
698  bool found = true;
699  char buffer[128];
700  int bytesRead = 0;
701 
702  if ((fp = fopen("/opt/www/authService/deviceid.dat", "r")) != NULL ||
703  (fp = fopen("/opt/www/whitebox/wbdevice.dat", "r")) != NULL) {
704  bytesRead = fread(&buffer[0], 1, sizeof(buffer)-1, fp);
705  receiverId.assign(buffer, bytesRead);
706  LOG("I-ARM VREX Mgr:Device ID %s\n", receiverId.c_str());
707  found=true;
708  }
709  else
710  {
711  LOG("I-ARM VREX Mgr: Could not find device id file! \n");
712  found = false;
713  }
714 
715  if (fp)
716  fclose(fp);
717 
718  return found;
719 }
720 
721 static bool _getSTBName()
722 {
723  bool bOk = false;
724  // Use the root "version.txt"
725  FILE* fp = fopen(VERSION_TXT_FILE, "r");
726  if (fp != NULL) {
727  long filesize = 0;
728  unsigned char* buffer = NULL;
729  size_t imageNameLength = strlen(VERSION_TXT_IMAGENAME);
730 
731  fseek(fp, 0L, SEEK_END);
732  filesize = ftell(fp);
733  if (filesize > (long)imageNameLength) {
734  fseek(fp, 0L, SEEK_SET);
735  buffer = new unsigned char[filesize + 1];
736  if (buffer != NULL) {
737  memset((void*)buffer, 0, filesize + 1);
738  if (fread(buffer, filesize, 1, fp) > 0) {
739  buffer[filesize] = 0;
740  std::string contents((const char*)buffer);
741  size_t startpos = contents.find(VERSION_TXT_IMAGENAME);
742  if (startpos != std::string::npos) {
743  size_t endpos = 0;
744  contents = contents.substr(startpos + imageNameLength);
745  endpos = contents.find_first_of("_\r\n");
746  if (endpos != std::string::npos) {
747  stbName = contents.substr(0, endpos);
748  bOk = true;
749  } else {
750  LOG("I-ARM VREX Mgr: getSTBName: Could not find value of %s!\n", VERSION_TXT_IMAGENAME);
751  }
752  } else {
753  LOG("I-ARM VREX Mgr: getSTBName: Could not find %s in file!\n", VERSION_TXT_IMAGENAME);
754  }
755  } else {
756  delete[] buffer;
757  LOG("I-ARM VREX Mgr: getSTBName: Could not read from file!\n");
758  }
759  } else {
760  LOG("I-ARM VREX Mgr: getSTBName: Could not allocate buffer of size %ld!\n", filesize);
761  }
762  } else {
763  LOG("I-ARM VREX Mgr: getSTBName: File size of %ld is too small!\n", filesize);
764  }
765 
766  fclose(fp);
767  } else {
768  LOG("I-ARM VREX Mgr: getSTBName: Could not open file %s!\n", VERSION_TXT_FILE);
769  }
770 
771  if (!bOk) {
772  stbName = "unknown";
773  }
774 
775  return bOk;
776 }
777 
778 static bool _sessionExists(unsigned char remoteId)
779 {
780  return remotes.count(remoteId) == 0 ? false : true;
781 }
782 
783 
784 #ifdef RF4CE_GENMSO_API
785 static VREXSession& _findOrNewSession(unsigned char remoteId, MSOBusAPI_RfStatus_t *rfStatus, int bindRemotesIndex)
786 {
787  if (remotes.count(remoteId) == 0) {
788  // Can't find it? Put it in
789  VREXSession newSession(remoteId, receiverId, defaultConversationLength, defaultRoute,aspect_ratio, guideLanguage, rfStatus, bindRemotesIndex, stbName);
790  remotes[remoteId] = newSession;
791  }
792  return remotes[remoteId];
793 }
794 #elif defined(RF4CE_API)
795 static VREXSession& _findOrNewSession(unsigned char remoteId, rf4ce_RfStatus_t *rfStatus, int bindRemotesIndex)
796 {
797  if (remotes.count(remoteId) == 0) {
798  // Can't find it? Put it in
799  VREXSession newSession(remoteId, receiverId, defaultConversationLength, defaultRoute, aspect_ratio, guideLanguage, rfStatus, bindRemotesIndex, stbName);
800  remotes[remoteId] = newSession;
801  }
802  return remotes[remoteId];
803 }
804 #elif defined(RF4CE_GPMSO_API)
805 static VREXSession& _findOrNewSession(unsigned char remoteId, gpMSOBusAPI_RfStatus_t *rfStatus, int bindRemotesIndex)
806 {
807  if (remotes.count(remoteId) == 0) {
808  // Can't find it? Put it in
809  VREXSession newSession(remoteId, receiverId, defaultConversationLength, defaultRoute, aspect_ratio, guideLanguage, rfStatus, bindRemotesIndex, stbName);
810  remotes[remoteId] = newSession;
811  }
812  return remotes[remoteId];
813 }
814 #else
815 #warning "No RF4CE API defined"
816 #endif
817 
818 static void handleSettingsFromServer(const char *jsonData){
819  JSONParser parser;
820  string paramData=jsonData;
821  map<string, JSONParser::varVal *> settings;
822  settings = parser.parse((const unsigned char *) jsonData);
823 
824  if(settings["VoiceControlOptIn"]!=NULL)
825  {
826  __TIMESTAMP();LOG("got VoiceControlOptIn %i",settings["VoiceControlOptIn"]->boolean);
827  bVoiceControl=settings["VoiceControlOptIn"]->boolean;
828  }
829  if(settings["parameters"]!=NULL){
830 // __TIMESTAMP();LOG("got parameters %s",settings["parameters"]->str.c_str());
831  settings = parser.parse((const unsigned char *) settings["parameters"]->str.c_str());
832  }else{
833  int start=paramData.find("{",2);
834  int end=paramData.find("}",2);
835  paramData=paramData.substr(start,end);
836 // __TIMESTAMP();LOG("got parameter string %s",paramData.c_str());
837  settings = parser.parse((const unsigned char *) paramData.c_str());
838  }
839 
840 
841  if(settings["vrexURL"]!=NULL)
842  {
843  __TIMESTAMP();LOG("got vrexURL %s",settings["vrexURL"]->str.c_str());
844  defaultRoute=settings["vrexURL"]->str;
845  }
846 
847  if(settings["GuideLanguage"]!=NULL)
848  {
849  __TIMESTAMP();LOG("got GuideLanguage %s",settings["GuideLanguage"]->str.c_str());
850  guideLanguage=settings["GuideLanguage"]->str;
851  }
852 
853  if(settings["aspect_ratio"]!=NULL)
854  {
855  __TIMESTAMP();LOG("got aspect_ratio %s",settings["aspect_ratio"]->str.c_str());
856  aspect_ratio=settings["aspect_ratio"]->str;
857  }
858 
859  typedef std::map<unsigned char, VREXSession>::iterator it_type;
860  for(it_type iterator = remotes.begin(); iterator != remotes.end(); iterator++) {
861  iterator->second.changeServerDetails(defaultRoute, aspect_ratio,guideLanguage);
862  }
863 }
864 
865 
866 static void _vrexEventHandler(const char *owner, IARM_EventId_t eventId, void *data, size_t len)
867 {
868  __TIMESTAMP(); LOG("_vrexEventHandler event - %d", eventId);
869 
870  /*Handle only VREX Manager Events */
871  if (strcmp(owner, IARM_BUS_VREXMGR_NAME) == 0)
872  {
873  _JSON_EVENT *eEvent;
874  _MOTION_EVENT *mEvent;
875  _SPEECH_EVENT *sEvent;
876 
877  pthread_mutex_lock(&tMutexLock);
878 
880  unsigned char remoteId = vrexEventData->remoteId;
881 
882 
883 
884  if (is_powered_on()==false){
885  __TIMESTAMP(); LOG("_vrexEventHandler standyby mode - No Action");
886 // IARM_Bus_VREXMgr_EventData_t eventData;
887 // memset(&eventData, 0, sizeof(eventData));
888 // eventData.remoteId = remoteId;
889 // eventData.data.errorEvent.responseCode = 0;
890 // eventData.data.errorEvent.returnCode = 0;
891 // strcpy((char *) eventData.data.errorEvent.message, "system in Standby Mode");
892 // __TIMESTAMP(); LOG("_vrexEventHandler standyby mode - sending error");
893 // IARM_Result_t retval = IARM_Bus_BroadcastEvent(IARM_BUS_VREXMGR_NAME,
894 // (IARM_EventId_t) IARM_BUS_VREXMGR_EVENT_ERROR, (void *) &eventData, sizeof(eventData));
895 // if (retval == IARM_RESULT_SUCCESS)
896 // {
897 // __TIMESTAMP(); LOG("Error Event sent successfully");
898 // }
899 // else
900 // {
901 // __TIMESTAMP(); LOG("Error Event problem, %i ", retval);
902 // }
903  pthread_mutex_unlock(&tMutexLock);
904  return;
905  }
906 
907  switch(eventId) {
908  case IARM_BUS_VREXMGR_EVENT_SETTINGS:
909  __TIMESTAMP();LOG("got IARM_BUS_VREXMGR_EVENT_SETTINGS:%s",vrexEventData->data.jsonEvent.jsonData);
910 
911  handleSettingsFromServer((const char *)(vrexEventData->data.jsonEvent.jsonData));
912  break;
913 
914  case IARM_BUS_VREXMGR_EVENT_MOTION:
915  {
916  if (bVoiceControl==false){
917  __TIMESTAMP(); LOG("_vrexEventHandler voice disabled - No Action");
918  pthread_mutex_unlock(&tMutexLock);
919  return;
920  }
921 
922  mEvent = (_MOTION_EVENT *)&vrexEventData->data.motionEvent;
923  __TIMESTAMP();LOG("_vrexEventHandler Motion Event x=%lf, y=%lf, z=%lf", mEvent->x, mEvent->y, mEvent->z);
924  MotionInfo motion = { mEvent->x, mEvent->y, mEvent->z };
925  VREXSession &vrSession = _findOrNewSession(remoteId);
926  if(!vrSession.onMotion(motion)) {
927  __TIMESTAMP();LOG("Error attempting Knock Knock request!\n");
928  }
929  }
930  break;
931  case IARM_BUS_VREXMGR_EVENT_SPEECH:
932  {
933  if (bVoiceControl==false){
934  __TIMESTAMP(); LOG("_vrexEventHandler voice disabled - No Action");
935  pthread_mutex_unlock(&tMutexLock);
936  return;
937  }
938  sEvent = (_SPEECH_EVENT *)&vrexEventData->data.speechEvent;
939  switch(sEvent->type) {
940  case IARM_BUS_VREXMGR_SPEECH_BEGIN:
941  {
942  __TIMESTAMP();LOG("_vrexEventHandler Speech Begin Event");
943  VREXSession &vrSession = _findOrNewSession(remoteId);
944 
945  AudioInfo audioInfo;
946  audioInfo.mimeType = (char *)sEvent->data.begin.mimeType;
947  audioInfo.subType = (char *)sEvent->data.begin.subType;
948  audioInfo.language = (char *)sEvent->data.begin.language;
949 
950  // If not defined set it to English
951  if (audioInfo.language.empty()) audioInfo.language = "en";
952 
953  __TIMESTAMP();LOG("AudioInfo: mime: <%s>, subType: <%s>, language: <%s> ",
954  audioInfo.mimeType.c_str(), audioInfo.subType.c_str(), audioInfo.language.c_str());
955  if(vrSession.onStreamStart(audioInfo)) {
956  vrSession.sendState(BeginRecording);
957  }
958  else {
959  __TIMESTAMP();LOG("_vrexEventHandler onStreamStart failed");
960  vrSession.sendState(FinishedRecordingWithErrors);
961  }
962  }
963  break;
964  case IARM_BUS_VREXMGR_SPEECH_FRAGMENT:
965  {
966  if (bVoiceControl==false){
967  __TIMESTAMP(); LOG("_vrexEventHandler voice disabled - No Action");
968  pthread_mutex_unlock(&tMutexLock);
969  return;
970  }
971  VREXSession &vrSession = _findOrNewSession(remoteId);
972  vrSession.onStreamData(&(sEvent->data.fragment.fragment[0]), sEvent->data.fragment.length);
973  __TIMESTAMP();LOG("_vrexEventHandler Speech Fragment Event \n");
974  }
975  break;
976  case IARM_BUS_VREXMGR_SPEECH_END:
977  {
978  if (bVoiceControl==false){
979  __TIMESTAMP(); LOG("_vrexEventHandler voice disabled - No Action");
980  pthread_mutex_unlock(&tMutexLock);
981  return;
982  }
983  __TIMESTAMP();LOG("_vrexEventHandler Speech End Event \n");
984  VREXSession &vrSession = _findOrNewSession(remoteId);
985  vrSession.onStreamEnd((AudioStreamEndReason)sEvent->data.end.reason);
986  vrSession.sendState(FinishedRecording);
987  }
988  break;
989  default:
990  __TIMESTAMP();LOG("_vrexEventHandler Error, Unknown Speech Event \n");
991  break;
992  }
993  }
994  break;
995  default:
996  __TIMESTAMP();LOG("_vrexEventHandler unknown event type \n");
997  break;
998  }
999 
1000  pthread_mutex_unlock(&tMutexLock);
1001  }
1002  else {
1003  __TIMESTAMP();LOG("_vrexEventHandler event type not meant for me <%s>...\n", owner);
1004  }
1005 }
1006 
1007 static bool is_powered_on(void)
1008 {
1009  if(currentPowerMode==-1)
1010  {
1012  IARM_Result_t status=IARM_Bus_Call(IARM_BUS_PWRMGR_NAME, "GetPowerState", (void *) &param, sizeof(param));
1013 
1014  if(status==IARM_RESULT_SUCCESS){
1015  currentPowerMode=param.curState;
1016  }
1017  else{
1018  currentPowerMode=-1; // we dont know yet, check again
1019  }
1020  }
1021  return currentPowerMode;
1022 }
1023 
1024 /**
1025  * Set the state of the logger based on the power state events
1026  */
1027 static IARM_Result_t _PowerPreChange(void *arg)
1028 {
1029  IARM_Bus_CommonAPI_PowerPreChange_Param_t *param = (IARM_Bus_CommonAPI_PowerPreChange_Param_t *) arg;
1030  IARM_Result_t result = IARM_RESULT_SUCCESS;
1031 
1032  __TIMESTAMP(); STATUS_LOG("PowerPreChange state to %d (STANDBY %d ::ON %d)\n", param->newState, IARM_BUS_PWRMGR_POWERSTATE_STANDBY,
1033  IARM_BUS_PWRMGR_POWERSTATE_ON);
1034 
1035  pthread_mutex_lock(&power_save_mutex);
1036  currentPowerMode = param->newState;
1037 
1038  pthread_mutex_unlock(&power_save_mutex);
1039  __TIMESTAMP(); STATUS_LOG("PowerPreChange set state to %d \n", currentPowerMode);
1040 
1041  return result;
1042 }
1043 
1044 
1045 /** @} */
1046 /** @} */
IARM_BUS_PWRMGR_NAME
#define IARM_BUS_PWRMGR_NAME
Definition: pwrMgr.h:54
VREXSession
Definition: vrexSession.h:82
JSONParser
Definition: jsonParser.h:43
AudioInfo
Definition: deviceUpdateMgrMain.cpp:849
IARM_BUS_VREXMGR_EVENT_MAX
@ IARM_BUS_VREXMGR_EVENT_MAX
Definition: vrexMgr.h:115
IARM_Bus_Term
IARM_Result_t IARM_Bus_Term(void)
This API is used to terminate the IARM-Bus library.
_IARM_BUS_VREXMgr_EventData_t::remoteId
unsigned char remoteId
A unique identifier of the remote that transmitted the motion command.
Definition: vrexMgr.h:181
_IARM_Bus_PWRMgr_GetPowerState_Param_t
Structure which holds the current power state of the CPE.
Definition: pwrMgr.h:173
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
IARM_BUS_VREXMGR_NAME
#define IARM_BUS_VREXMGR_NAME
Definition: vrexMgr.h:99
IARM_Bus_RegisterEvent
IARM_Result_t IARM_Bus_RegisterEvent(IARM_EventId_t maxEventId)
This API is used to register all the events that are published by the application.
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
vrexMgr.h
IARM-Bus VREX Manager Public API.
_PowerPreChange
static IARM_Result_t _PowerPreChange(void *arg)
Definition: vrexMgr.cpp:1027
VREXMgr_Loop
IARM_Result_t VREXMgr_Loop()
Listens for component specific events from drivers.
Definition: vrexMgr.cpp:266
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_Disconnect
IARM_Result_t IARM_Bus_Disconnect(void)
This API disconnect Application from IARM Bus so the application will not receive any IARM event or R...
_SPEECH_EVENT
Definition: vrexMgr.h:150
libIBus.h
RDK IARM-Bus API Declarations.
_MOTION_EVENT
Definition: vrexMgr.h:131
pwrMgr.h
IARM-Bus Power Manager Public API.
_JSON_EVENT
Definition: vrexMgr.h:146
VREXMgr_Stop
IARM_Result_t VREXMgr_Stop(void)
Terminates the Sys manager.
Definition: vrexMgr.cpp:285
IARM_Bus_Connect
IARM_Result_t IARM_Bus_Connect(void)
This API is used to connect application to the IARM bus daemon. After connected, the application can ...
Definition: iarmMgrMocks.cpp:33
_IARM_BUS_VREXMgr_EventData_t
Definition: vrexMgr.h:179
_MOTION_EVENT::x
double x
payload description for the Motion Event
Definition: vrexMgr.h:134
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...
MotionInfo
Definition: vrexSession.h:61
IARM_Bus_Init
IARM_Result_t IARM_Bus_Init(const char *name)
This API is used to initialize the IARM-Bus library.
Definition: iarmMgrMocks.cpp:38