4 * Copyright (c) 2014 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 _GYRO_SENSOR_HAL_H_
21 #define _GYRO_SENSOR_HAL_H_
23 #include <sensor_hal.h>
25 #include <iio_common.h>
27 #define MAX_FREQ_COUNT 16
28 #define MAX_SCALING_COUNT 16
32 class gyro_sensor_hal : public sensor_hal
36 virtual ~gyro_sensor_hal();
37 string get_model_id(void);
38 sensor_type_t get_type(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);
51 unsigned long m_polling_interval;
52 unsigned long long m_fired_time;
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];
60 struct channel_parameters *m_channels;
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;
69 vector<string> m_generic_channel_names;
76 float m_raw_data_unit;
79 string m_interval_node;
81 bool m_sensorhub_controlled;
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);
95 #endif /*_GYRO_SENSOR_HAL_CLASS_H_*/