2 * Copyright (c) 2017 Samsung Electronics Co., Ltd.
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.
17 #include <ServerUtil.h>
18 #include <SensorRecorderTypesPrivate.h>
19 #include <SensorRecorderService.h>
20 #include "MethodCallHandler.h"
21 #include "SensorDatabase.h"
22 #include "SensorTimer.h"
23 #include "legacy/SensorProvider.h"
24 #include "legacy/RecorderClientInfo.h"
28 SensorRecorderService::SensorRecorderService() :
33 SensorRecorderService::~SensorRecorderService()
37 void SensorRecorderService::setServiceRunner(IServiceRunner* runner)
39 __serviceRunner = runner;
42 bool SensorRecorderService::isUserService()
47 const char* SensorRecorderService::getServiceName()
49 return CTX_SENSOR_RECORDER;
52 const char* SensorRecorderService::getMethodSpecs()
54 return CTX_SENSOR_RECORDER_SPEC;
57 bool SensorRecorderService::prepare()
59 RecorderClientInfo::setHostService(this);
61 if (!SensorDatabase::open(util::getActiveUid()))
65 SensorProvider::init();
70 void SensorRecorderService::cleanup()
72 SensorProvider::release();
73 SensorTimer::release();
74 SensorDatabase::close();
77 void SensorRecorderService::onUserActivated()
81 void SensorRecorderService::onUserDeactivated()
85 IMethodCallHandler* SensorRecorderService::createMethodCallHandler(IClient* client)
87 return new MethodCallHandler(client);
90 GDBusConnection* SensorRecorderService::getConnection()
92 return __serviceRunner->getConnection();