RDK Documentation (Open Sourced RDK Components)
test_ir_client.c
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 * @defgroup iarmmgrs
23 * @{
24 * @defgroup test
25 * @{
26 **/
27 
28 
29 #include "libIBus.h"
30 #include "irMgr.h"
31 #include <stdio.h>
32 #include <stdlib.h>
33 #include <unistd.h>
34 
35 
36 static void _handler_IRKey(const char *owner, IARM_EventId_t eventId, void *data, size_t len)
37 {
39  printf("_handler_IRKey event [%d] from [%s] for keyType=[%x]keyCode=[%x]\r\n", eventId, owner, eventData->data.irkey.keyType, eventData->data.irkey.keyCode);
40 
41  if (eventData->data.irkey.keySrc == IARM_BUS_IRMGR_KEYSRC_FP)
42  {
43  printf(" Recived FP Events............. \r\n" );
44  }else if (eventData->data.irkey.keySrc == IARM_BUS_IRMGR_KEYSRC_RF)
45  {
46  printf(" Recived RF Events............. \r\n" );
47  }else
48  {
49  printf(" Recived IR key Events............. \r\n" );
50  }
51 
52 }
53 
54 
55 int main()
56 {
57  printf("EventClient Entering %d\r\n", getpid());
58  IARM_Bus_Init("Client");
59  int i = 0;
62 
63  while(++i < 100) {
64  printf("Client Hearbeat\r\n");
65  sleep(5);
66  }
69  IARM_Bus_Term();
70  printf("Client Exiting\r\n");
71 }
72 
73 
74 /** @} */
75 /** @} */
IARM_Bus_Term
IARM_Result_t IARM_Bus_Term(void)
This API is used to terminate the IARM-Bus library.
IARM_BUS_IRMGR_EVENT_IRKEY
@ IARM_BUS_IRMGR_EVENT_IRKEY
Definition: irMgr.h:220
IARM_BUS_IRMGR_KEYSRC_RF
@ IARM_BUS_IRMGR_KEYSRC_RF
Definition: irMgr.h:230
IARM_BUS_IRMGR_KEYSRC_FP
@ IARM_BUS_IRMGR_KEYSRC_FP
Definition: irMgr.h:228
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
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...
libIBus.h
RDK IARM-Bus API Declarations.
IARM_BUS_IRMGR_NAME
#define IARM_BUS_IRMGR_NAME
Definition: irMgr.h:216
irMgr.h
IARM-Bus IR Manager API.
_IRMgr_EventData_t
Definition: irMgr.h:235
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_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...
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