2 * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
4 * This program is licensed under the terms and conditions of the
5 * Apache License, version 2.0. The full text of the Apache License is at
6 * http://www.apache.org/licenses/LICENSE-2.0
10 //==========================================================================
12 * @file CicoSysConDaemon.cpp
14 * @brief This file is implimention of CicoSysConDaemon class
16 //==========================================================================
22 #include "CicoSysConDaemon.h"
23 #include "ico_syc_error.h"
25 #include "CicoSystemConfig.h"
26 #include "CicoSCServer.h"
27 #include "CicoSCWayland.h"
28 #include "CicoSCWindowController.h"
29 #include "CicoSCInputController.h"
30 #include "CicoSCLifeCycleController.h"
31 #include "CicoSCUser.h"
32 #include "CicoSCUserManager.h"
33 #include "CicoSCResourceManager.h"
34 #include "Cico_aul_listen_app.h"
35 #include "CicoSCVInfoManager.h"
37 //--------------------------------------------------------------------------
39 * @brief default constructor
41 //--------------------------------------------------------------------------
42 CicoSysConDaemon::CicoSysConDaemon()
43 : m_winctrl(NULL), m_inputctrl(NULL), m_resourcemgr(NULL)
45 // ICO_TRA("CicoSysConDaemon::CicoSysConDaemon Enter");
46 // ICO_TRA("CicoSysConDaemon::CicoSysConDaemon Leave");
49 //--------------------------------------------------------------------------
51 * @brief callback function on create
53 * @param [in] user_data The user data passed from the callback
54 * registration function
56 * @return true on success, false on error
58 //--------------------------------------------------------------------------
59 CicoSysConDaemon::~CicoSysConDaemon()
61 // ICO_TRA("CicoSysConDaemon::~CicoSysConDaemon Enter");
62 // ICO_TRA("CicoSysConDaemon::~CicoSysConDaemon Leave");
65 //--------------------------------------------------------------------------
67 * @brief callback function on terminate
69 * @param [in] user_data The user data passed from the callback
70 * registration function
72 //--------------------------------------------------------------------------
74 CicoSysConDaemon::onCreate(void *user_data)
76 ICO_TRA("CicoSysConDaemon::onCreate Enter");
79 int ret = ICO_SYC_EOK;
80 (void) CicoSystemConfig::getInstance();
82 initAulListenXSignal();
84 CicoSCVInfoManager::getInstance()->startup();
86 CicoSCLifeCycleController *lifecycle =
87 CicoSCLifeCycleController::getInstance();
88 m_winctrl = new CicoSCWindowController();
89 m_inputctrl = new CicoSCInputController();
91 m_resourcemgr = new CicoSCResourceManager();
92 m_resourcemgr->setWindowController(m_winctrl);
93 m_resourcemgr->setInputController(m_inputctrl);
94 ret = m_resourcemgr->initialize();
95 if (ICO_SYC_EOK != ret) {
99 m_winctrl->setResourceManager(m_resourcemgr);
101 CicoSCUserManager *usermgr = CicoSCUserManager::getInstance();
102 usermgr->load("/usr/apps/org.tizen.ico.system-controller/res/config/user.xml");
104 CicoSCServer *server = CicoSCServer::getInstance();
105 server->setWindowCtrl(m_winctrl);
106 server->setInputCtrl(m_inputctrl);
107 server->setUserMgr(usermgr);
108 server->setResourceMgr(m_resourcemgr);
109 server->setPolicyMgr(m_resourcemgr->getPolicyManager());
111 server->startup(18081, (const char*)"ico_syc_protocol");
112 ret = CicoSCWayland::getInstance()->initialize();
113 if (ICO_SYC_EOK != ret) {
116 CicoSCWayland::getInstance()->addEcoreMainWlFdHandler();
118 usermgr->initialize();
119 if (true == lifecycle->isAppResource()) {
120 const CicoSCUser* user = usermgr->getLoginUser();
122 if (false == lifecycle->startAppResource(user->name)) {
123 lifecycle->createAppResourceFile(user->name);
128 catch (const std::exception& e) {
129 std::cerr << e.what() << std::endl;
130 ICO_ERR("catch exception %s", e.what());
131 ICO_DBG("CicoSysConDaemon::onCreate Leave(false)");
134 catch (const std::string& str) {
135 std::cerr << str << std::endl;
136 ICO_ERR("catch exception %s", str.c_str());
137 ICO_DBG("CicoSysConDaemon::onCreate Leave(false)");
141 ICO_ERR("catch exception unknown");
142 ICO_DBG("CicoSysConDaemon::onCreate Leave(false)");
146 ICO_TRA("CicoSysConDaemon::onCreate Leave(true)");
147 ICO_PRF("SYS_STARTED Initialization is complete");
152 //--------------------------------------------------------------------------
154 * @brief callback function on terminate
156 * @param [in] user_data The user data passed from the callback
157 * registration function
159 //--------------------------------------------------------------------------
161 CicoSysConDaemon::onTerminate(void *user_data)
163 ICO_TRA("CicoSysConDaemon::onTerminate Enter");
164 CicoSCUserManager *usermgr = CicoSCUserManager::getInstance();
165 usermgr->cloaseUser();
167 CicoSCServer::getInstance()->teardown();
168 CicoSCVInfoManager::getInstance()->teardown();
169 ICO_TRA("CicoSysConDaemon::onTerminate Leave");
172 //--------------------------------------------------------------------------
174 * @brief callback function on pause
176 * @param [in] user_data The user data passed from the callback
177 * registration function
179 //--------------------------------------------------------------------------
181 CicoSysConDaemon::onPause(void *user_data)
183 ICO_TRA("CicoSysConDaemon::onPause Enter");
184 ICO_TRA("CicoSysConDaemon::onPause Leave");
187 //--------------------------------------------------------------------------
189 * @brief callback function on resume
191 * @param [in] user_data The user data passed from the callback
192 * registration function
194 //--------------------------------------------------------------------------
196 CicoSysConDaemon::onResume(void *user_data)
198 ICO_TRA("CicoSysConDaemon::onResume Enter");
199 ICO_TRA("CicoSysConDaemon::onResume Leave");
202 //--------------------------------------------------------------------------
204 * @brief callback function on service
206 * @param [in] service The handle to the service
207 * @param [in] user_data The user data passed from the callback
208 * registration function
210 //--------------------------------------------------------------------------
212 CicoSysConDaemon::onService(service_h service, void *user_data)
214 ICO_TRA("CicoSysConDaemon::onService Enter");
215 ICO_TRA("CicoSysConDaemon::onService Leave");
217 // vim: set expandtab ts=4 sw=4: