RDK Documentation (Open Sourced RDK Components)
test_sys_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 <stdio.h>
30 #include <stdlib.h>
31 #include <unistd.h>
32 #include <string.h>
33 #include "libIBus.h"
34 #include "libIBusDaemon.h"
35 #include "sysMgr.h"
36 #include "libIARMCore.h"
37 
38 static void _evtHandler(const char *owner, IARM_EventId_t eventId, void *data, size_t len)
39 {
40  unsigned long messageLength=0;
41 
42  if (strcmp(owner, IARM_BUS_SYSMGR_NAME) == 0) {
43  switch(eventId){
45  {
47  messageLength = eventData->data.xupnpData.deviceInfoLength;
48  printf(" >>>>>>>>>> EVENT_XUPNP_DATA_UPDATE messageLength : %ld \n", messageLength);
49  break;
50  }
51  default:
52  break;
53  }
54  }
55 }
56 
57 int main()
58 {
59  IARM_Result_t retCode = IARM_RESULT_SUCCESS;
61 
62 
63  printf("Client Entering %d\r\n", getpid());
64  IARM_Bus_Init("Sys Client");
66 
68 
69 
70  while(1){
71 
72  sleep(30);
73  eventData.data.xupnpData.deviceInfoLength = 0;
75  (IARM_EventId_t)IARM_BUS_SYSMGR_EVENT_XUPNP_DATA_REQUEST,(void *)&eventData, sizeof(eventData));
76  printf(">>>>> Generate IARM_BUS_SYSMGR_NAME EVENT ::: IARM_BUS_SYSMGR_EVENT_XUPNP_DATA_REQUEST \r\n");
77 
78  sleep(30);
79 
80  }
82  IARM_Bus_Term();
83  printf("Sys Client Exiting\r\n");
84 }
85 
86 
87 /** @} */
88 /** @} */
IARM_Bus_Term
IARM_Result_t IARM_Bus_Term(void)
This API is used to terminate the IARM-Bus library.
sysMgr.h
IARM-Bus Sys Manager Public API.
IARM_BUS_SYSMGR_NAME
#define IARM_BUS_SYSMGR_NAME
Definition: sysMgr.h:110
IARM_BUS_SYSMGR_EVENT_XUPNP_DATA_UPDATE
@ IARM_BUS_SYSMGR_EVENT_XUPNP_DATA_UPDATE
Definition: sysMgr.h:131
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...
_IARM_BUS_SYSMgr_EventData_t
Definition: sysMgr.h:229
IARM_Bus_BroadcastEvent
IARM_Result_t IARM_Bus_BroadcastEvent(const char *ownerName, IARM_EventId_t eventId, void *data, size_t len)
This API is used to publish an Asynchronous event to all IARM client registered for this perticular e...
libIBus.h
RDK IARM-Bus API Declarations.
IARM_BUS_SYSMGR_EVENT_XUPNP_DATA_REQUEST
@ IARM_BUS_SYSMGR_EVENT_XUPNP_DATA_REQUEST
Definition: sysMgr.h:130
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_Init
IARM_Result_t IARM_Bus_Init(const char *name)
This API is used to initialize the IARM-Bus library.
Definition: iarmMgrMocks.cpp:38