4 * Copyright (c) 2017 Samsung Electronics Co., Ltd.
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
10 * http://www.apache.org/licenses/LICENSE-2.0
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.
20 #ifndef __SENSOR_LISTENER_PROXY_H__
21 #define __SENSOR_LISTENER_PROXY_H__
26 #include "sensor_manager.h"
27 #include "sensor_observer.h"
28 #include "sensor_policy_listener.h"
32 class sensor_listener_proxy : public sensor_observer, sensor_policy_listener {
34 sensor_listener_proxy(uint32_t id,
35 std::string uri, sensor_manager *manager, ipc::channel *ch);
36 ~sensor_listener_proxy();
38 uint32_t get_id(void);
41 int update(const char *uri, std::shared_ptr<ipc::message> msg);
42 int on_attribute_changed(std::shared_ptr<ipc::message> msg);
44 int start(bool policy = false);
45 int stop(bool policy = false);
47 int set_interval(int32_t interval);
48 int get_interval(int32_t& interval);
49 int set_max_batch_latency(int32_t max_batch_latency);
50 int get_max_batch_latency(int32_t& max_batch_latency);
51 int delete_batch_latency(void);
52 int set_passive_mode(bool passive);
53 int set_attribute(int32_t attribute, int32_t value);
54 int get_attribute(int32_t attribute, int32_t *value);
55 int set_attribute(int32_t attribute, const char *value, int len);
56 int get_attribute(int32_t attribute, char **value, int *len);
58 int get_data(sensor_data_t **data, int *len);
59 std::string get_required_privileges(void);
61 /* sensor_policy_listener interface */
62 void on_policy_changed(int policy, int value);
63 bool notify_attribute_changed(int32_t attribute, int32_t value);
64 bool notify_attribute_changed(int32_t attribute, const char *value, int len);
65 bool need_to_notify_attribute_changed();
66 void set_need_to_notify_attribute_changed(bool value);
69 void update_event(std::shared_ptr<ipc::message> msg);
70 void update_accuracy(std::shared_ptr<ipc::message> msg);
71 void apply_sensor_handler_need_to_notify_attribute_changed(sensor_handler* handler);
76 sensor_manager *m_manager;
81 int32_t m_pause_policy;
82 int32_t m_axis_orientation;
83 int32_t m_last_accuracy;
84 bool m_need_to_notify_attribute_changed;
89 #endif /* __SENSOR_LISTENER_PROXY_H__ */