2 * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #include "PrivacyGuardDaemon.h"
19 #include "PrivacyInfoService.h"
20 #include "SocketService.h"
23 #include <CynaraService.h>
26 PrivacyGuardDaemon* PrivacyGuardDaemon::pInstance = NULL;
28 PrivacyGuardDaemon::PrivacyGuardDaemon(void)
29 : pSocketService(NULL)
33 PrivacyGuardDaemon::~PrivacyGuardDaemon(void)
38 PrivacyGuardDaemon::getInstance(void)
40 if (pInstance == NULL)
41 pInstance = new PrivacyGuardDaemon();
46 PrivacyGuardDaemon::initialize(void)
48 if (pSocketService == NULL)
49 pSocketService = new SocketService();
52 if (pCynaraService == NULL)
53 pCynaraService = new CynaraService();
55 pSocketService->initialize();
58 pCynaraService->initialize();
61 PrivacyInfoService::registerCallbacks(pSocketService);
67 PrivacyGuardDaemon::start(void)
71 if (pSocketService == NULL)
72 return PRIV_FLTR_ERROR_NOT_INITIALIZED;
73 res = pSocketService->start();
74 if(res != PRIV_FLTR_ERROR_SUCCESS){
79 if (pCynaraService == NULL)
80 return PRIV_FLTR_ERROR_NOT_INITIALIZED;
81 res = pCynaraService->start();
82 if(res != PRIV_FLTR_ERROR_SUCCESS){
90 PrivacyGuardDaemon::stop(void)
92 pSocketService->stop();
95 pCynaraService->stop();
102 PrivacyGuardDaemon::shutdown(void)
104 pSocketService->shutdown();