8c34ae5b32cb0915f335ed3ed5b00cb189450d32
[platform/adaptation/tm1/sensor-hal-tm1.git] / src / plugins / accel / accel_sensor_device.h
1 /*
2  * accel_sensor_device
3  *
4  * Copyright (c) 2014 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 _ACCEL_SENSOR_DEVICE_H_
21 #define _ACCEL_SENSOR_DEVICE_H_
22
23 #include <sensor_device_base.h>
24
25 class accel_sensor_device : public sensor_device_base
26 {
27 public:
28         accel_sensor_device();
29         virtual ~accel_sensor_device();
30
31         int get_poll_fd(void);
32         bool get_sensors(std::vector<sensor_handle_t> &sensors);
33         bool enable(uint32_t id);
34         bool disable(uint32_t id);
35         bool set_interval(uint32_t id, unsigned long val);
36         bool set_batch_latency(uint32_t id, unsigned long val);
37         bool set_command(uint32_t id, std::string command, std::string value);
38         bool is_data_ready(void);
39         bool get_sensor_data(uint32_t id, sensor_data_t &data);
40         int get_sensor_event(uint32_t id, sensor_event_t **event);
41         bool get_properties(uint32_t id, sensor_properties_s &properties);
42
43 private:
44         int m_node_handle;
45         int m_x;
46         int m_y;
47         int m_z;
48         unsigned long m_polling_interval;
49         unsigned long long m_fired_time;
50         bool m_sensorhub_controlled;
51
52         std::string m_data_node;
53         std::string m_enable_node;
54         std::string m_interval_node;
55
56         bool update_value_input_event(void);
57         void raw_to_base(sensor_data_t &data);
58 };
59 #endif /*_ACCEL_SENSOR_DEVICE_CLASS_H_*/