[Code format] Fixed formating with auto-format tool
[platform/core/api/webapi-plugins.git] / src / sensor / sensor_instance.cc
1 /*
2  * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  *        http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 #include "sensor/sensor_instance.h"
18
19 #include "common/logger.h"
20 #include "common/picojson.h"
21 #include "common/platform_exception.h"
22
23 namespace extension {
24 namespace sensor {
25
26 using namespace common;
27
28 SensorInstance::SensorInstance() : service_(*this) {
29   ScopeLogger();
30   using std::placeholders::_1;
31   using std::placeholders::_2;
32
33 #define REGISTER_METHOD(M) RegisterSyncHandler(#M, std::bind(&SensorInstance::M, this, _1, _2))
34   REGISTER_METHOD(SensorServiceGetAvailableSensors);
35   REGISTER_METHOD(SensorStop);
36   REGISTER_METHOD(SensorSetChangeListener);
37   REGISTER_METHOD(SensorUnsetChangeListener);
38   REGISTER_METHOD(SensorStart);
39   REGISTER_METHOD(SensorGetData);
40   REGISTER_METHOD(SensorGetSensorHardwareInfo);
41 #undef REGISTER_METHOD
42 }
43
44 SensorInstance::~SensorInstance() {
45   ScopeLogger();
46 }
47
48 void SensorInstance::SensorServiceGetAvailableSensors(const picojson::value& args,
49                                                       picojson::object& out) {
50   ScopeLogger();
51   service_.GetAvailableSensors(out);
52 }
53
54 void SensorInstance::SensorStop(const picojson::value& args, picojson::object& out) {
55   ScopeLogger();
56   service_.SensorStop(args, out);
57 }
58
59 void SensorInstance::SensorSetChangeListener(const picojson::value& args, picojson::object& out) {
60   ScopeLogger();
61   service_.SensorSetChangeListener(args, out);
62 }
63
64 void SensorInstance::SensorUnsetChangeListener(const picojson::value& args, picojson::object& out) {
65   ScopeLogger();
66   service_.SensorUnsetChangeListener(args, out);
67 }
68
69 void SensorInstance::SensorStart(const picojson::value& args, picojson::object& out) {
70   ScopeLogger();
71   service_.SensorStart(args, out);
72 }
73
74 void SensorInstance::SensorGetData(const picojson::value& args, picojson::object& out) {
75   ScopeLogger();
76
77   service_.GetSensorData(args, out);
78 }
79
80 void SensorInstance::SensorGetSensorHardwareInfo(const picojson::value& args,
81                                                  picojson::object& out) {
82   ScopeLogger();
83
84   service_.GetSensorHardwareInfo(args, out);
85 }
86
87 }  // namespace sensor
88 }  // namespace extension