RDK Documentation (Open Sourced RDK Components)
deepSleepMgrMain.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 deepsleepmgr
26 * @{
27 **/
28 
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 #include <stdio.h>
34 #include <sys/types.h>
35 #include <unistd.h>
36 #include "plat_power.h"
37 #ifdef __cplusplus
38 }
39 #endif
40 
41 
42 #include "deepSleepMgr.h"
43 #include "deepsleeplogger.h"
44 #include "deepSleepInternal.h"
45 #ifdef RDK_LOGGER_ENABLED
46 
47 int b_rdk_logger_enabled = 0;
48 
49 void logCallback(const char *buff)
50 {
51  LOG("%s",buff);
52 }
53 #endif
54 
55 #ifdef ENABLE_SD_NOTIFY
56 #include <systemd/sd-daemon.h>
57 #endif
58 
59 
60 int main(int argc, char *argv[])
61 {
62  const char* debugConfigFile = NULL;
63  int itr=0;
64 
65  while (itr < argc)
66  {
67  if(strcmp(argv[itr],"--debugconfig")==0)
68  {
69  itr++;
70  if (itr < argc)
71  {
72  debugConfigFile = argv[itr];
73  }
74  else
75  {
76  break;
77  }
78  }
79  itr++;
80  }
81 
82 #ifdef RDK_LOGGER_ENABLED
83 
84  if(rdk_logger_init(debugConfigFile) == 0) b_rdk_logger_enabled = 1;
85  IARM_Bus_RegisterForLog(logCallback);
86 
87 #endif
88 
89 
90  DeepSleepMgr_Start(argc, argv);
91 
92  #ifdef ENABLE_SD_NOTIFY
93  sd_notifyf(0, "READY=1\n"
94  "STATUS=DeepSleepMgr is Successfully Initialized\n"
95  "MAINPID=%lu", (unsigned long) getpid());
96  #endif
97 
98  DeepSleepMgr_Loop();
99  DeepSleepMgr_Stop();
100  return 0;
101 }
102 
103 
104 
105 
106 /** @} */
107 /** @} */
rdk_logger_init
rdk_Error rdk_logger_init(const char *debugConfigFile)
Initialize the logger. Sets up the environment variable storage by parsing debug configuration file t...
Definition: rdk_logger_init.c:57