sensord: add/change enums and types for avoiding build-break
[platform/core/system/sensord.git] / src / gyro / gyro_sensor_hal.h
1 /*
2  * gyro_sensor_hal
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 _GYRO_SENSOR_HAL_H_
21 #define _GYRO_SENSOR_HAL_H_
22
23 #include <sensor_hal.h>
24 #include <string>
25 #include <iio_common.h>
26
27 #define MAX_FREQ_COUNT          16
28 #define MAX_SCALING_COUNT       16
29
30 using std::string;
31
32 class gyro_sensor_hal : public sensor_hal
33 {
34 public:
35         gyro_sensor_hal();
36         virtual ~gyro_sensor_hal();
37         string get_model_id(void);
38         sensor_type_t get_type(void);
39         bool enable(void);
40         bool disable(void);
41         bool set_interval(unsigned long ms_interval);
42         bool is_data_ready(bool wait);
43         virtual int get_sensor_data(sensor_data_t &data);
44         virtual bool get_properties(sensor_properties_s &properties);
45
46 private:
47         int m_x;
48         int m_y;
49         int m_z;
50         int m_node_handle;
51         unsigned long m_polling_interval;
52         unsigned long long m_fired_time;
53
54         int m_scale_factor_count;
55         int m_sample_freq_count;
56         int m_sample_freq[MAX_FREQ_COUNT];
57         double m_scale_factor[MAX_SCALING_COUNT];
58         char *m_data;
59         int m_scan_size;
60         struct channel_parameters *m_channels;
61
62         string m_trigger_name;
63         string m_trigger_path;
64         string m_buffer_enable_node_path;
65         string m_buffer_length_node_path;
66         string m_available_freq_node_path;
67         string m_available_scale_node_path;
68         string m_gyro_dir;
69         vector<string> m_generic_channel_names;
70
71         string m_model_id;
72         string m_vendor;
73         string m_chip_name;
74
75         int m_resolution;
76         float m_raw_data_unit;
77
78         string m_data_node;
79         string m_interval_node;
80
81         bool m_sensorhub_controlled;
82
83         cmutex m_value_mutex;
84
85         bool update_value(bool wait);
86         bool setup_trigger(const char* trig_name, bool verify);
87         bool setup_buffer(int enable);
88         bool enable_resource(bool enable);
89         bool add_gyro_channels_to_array(void);
90         bool setup_channels(void);
91         bool setup_trigger(char* trig_name, bool verify);
92         void decode_data(void);
93
94 };
95 #endif /*_GYRO_SENSOR_HAL_CLASS_H_*/