RDK Documentation (Open Sourced RDK Components)
diskMgr.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 /**
23 * @defgroup iarmmgrs
24 * @{
25 * @defgroup disk
26 * @{
27 **/
28 
29 
30 #include <stdio.h>
31 #include <stdint.h>
32 #include <unistd.h>
33 #include <string.h>
34 #include <stdlib.h>
35 #include <time.h>
36 
37 #include "libIBus.h"
38 #include "diskMgr.h"
39 #include "diskMgrInternal.h"
40 
41 
42 IARM_Result_t DISKMgr_Start()
43 {
44 
45  LOG("Entering [%s] - [%s] - disabling io redirect buf\r\n", __FUNCTION__, IARM_BUS_DISKMGR_NAME);
46  setvbuf(stdout, NULL, _IOLBF, 0);
47 
51  return IARM_RESULT_SUCCESS;
52 }
53 
54 IARM_Result_t DISKMgr_Loop()
55 {
56  time_t curr = 0;
57  while(1)
58  {
59  time(&curr);
60  LOG("I-ARM Disk Mgr: HeartBeat at %s\r\n", ctime(&curr));
61  sleep(2000);
62  }
63  return IARM_RESULT_SUCCESS;
64 }
65 
66 
67 IARM_Result_t DISKMgr_Stop(void)
68 {
70  IARM_Bus_Term();
71  return IARM_RESULT_SUCCESS;
72 }
73 
74 
75 
76 
77 /** @} */
78 /** @} */
IARM_Bus_Term
IARM_Result_t IARM_Bus_Term(void)
This API is used to terminate the IARM-Bus library.
IARM_BUS_DISKMGR_EVENT_MAX
@ IARM_BUS_DISKMGR_EVENT_MAX
Definition: diskMgr.h:107
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_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...
DISKMgr_Stop
IARM_Result_t DISKMgr_Stop(void)
Terminates the Disk manager.
Definition: diskMgr.c:67
IARM_BUS_DISKMGR_NAME
#define IARM_BUS_DISKMGR_NAME
Definition: diskMgr.h:100
diskMgrInternal.h
IARM-Bus Disk Manager Internal API.
libIBus.h
RDK IARM-Bus API Declarations.
diskMgr.h
IARM-Bus Disk Manager Public API.
DISKMgr_Loop
IARM_Result_t DISKMgr_Loop()
Listens for component specific events from drivers.
Definition: diskMgr.c:54
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