RDK Documentation (Open Sourced RDK Components)
mfrMgr.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 mfr
25 * @{
26 **/
27 
28 
29 #include <stdio.h>
30 #include <memory.h>
31 #include <dlfcn.h>
32 #include <unistd.h>
33 #include "mfrMgrInternal.h"
34 #include "mfrMgr.h"
35 #include "libIARMCore.h"
36 #include "mfrTypes.h"
37 #include "nxclient.h"
38 #include "safec_lib.h"
39 
40 IARM_Result_t MFRLib_Start(void)
41 {
42 
43  NxClient_JoinSettings joinSettings;
44  NxClient_AllocSettings allocSettings;
45  int rc;
46  NxClient_GetDefaultJoinSettings(&joinSettings);
47  errno_t safec_rc = -1;
48  safec_rc = strcpy_s(joinSettings.name, sizeof(joinSettings.name), "MFRMgr");
49  if(safec_rc != EOK)
50  {
51  ERR_CHK(safec_rc);
52  return IARM_RESULT_INVALID_PARAM;
53  }
54  printf("register nxclient MFRMgr\r\n");
55  rc = NxClient_Join(&joinSettings);
56  printf("register nxclient MFR Mgr - %d\r\n",rc);
57 
58  return mfrMgr_start();
59 }
60 
61 IARM_Result_t MFRLib_Stop(void)
62 {
63  return IARM_RESULT_SUCCESS;
64 }
65 
66 IARM_Result_t MFRLib_Loop()
67 {
68  time_t curr = 0;
69  while(1)
70  {
71  time(&curr);
72  printf("I-ARM MFR Lib: HeartBeat at %s\r\n", ctime(&curr));
73  sleep(60);
74  }
75  return IARM_RESULT_SUCCESS;
76 }
77 
78 
79 /** @} */
80 /** @} */
MFRLib_Start
IARM_Result_t MFRLib_Start(void)
Starts the MFR lib.
Definition: mfrMgr.c:40
MFRLib_Stop
IARM_Result_t MFRLib_Stop(void)
Terminates the MFR lib.
Definition: mfrMgr.c:61
mfrMgrInternal.h
IARM-Bus MFR Manager Internal API.
MFRLib_Loop
IARM_Result_t MFRLib_Loop()
Listens for component specific events from drivers.
Definition: mfrMgr.c:66