sensord: send accuracy changed event to listeners
[platform/core/system/sensord.git] / src / server / sensor_listener_proxy.h
1 /*
2  * sensord
3  *
4  * Copyright (c) 2017 Samsung Electronics Co., Ltd.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  */
19
20 #ifndef __SENSOR_LISTENER_PROXY_H__
21 #define __SENSOR_LISTENER_PROXY_H__
22
23 #include <channel.h>
24 #include <message.h>
25
26 #include "sensor_manager.h"
27 #include "sensor_observer.h"
28
29 namespace sensor {
30
31 class sensor_listener_proxy : public sensor_observer {
32 public:
33         sensor_listener_proxy(uint32_t id,
34                         std::string uri, sensor_manager *manager, ipc::channel *ch);
35         ~sensor_listener_proxy();
36
37         uint32_t get_id(void);
38
39         /* sensor observer */
40         int update(const char *uri, ipc::message *msg);
41
42         int start(void);
43         int stop(void);
44
45         int set_interval(unsigned int interval);
46         int set_max_batch_latency(unsigned int max_batch_latency);
47         int set_passive_mode(bool passive);
48         int set_attribute(int attribute, int value);
49         int set_attribute(int attribute, const char *value, int len);
50         int flush(void);
51         int get_data(sensor_data_t **data, int *len);
52         std::string get_required_privileges(void);
53
54 private:
55         void update_event(ipc::message *msg);
56         void update_accuracy(ipc::message *msg);
57
58         uint32_t m_id;
59         std::string m_uri;
60
61         sensor_manager *m_manager;
62         ipc::channel *m_ch;
63
64         bool m_passive;
65         int m_pause_policy;
66         int m_axis_orientation;
67         int m_last_accuracy;
68 };
69
70 }
71
72 #endif /* __SENSOR_LISTENER_PROXY_H__ */