2 * Copyright (c) 2016 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #ifndef _PRESSURE_DEVICE_H_
19 #define _PRESSURE_DEVICE_H_
21 #include <hal/hal-sensor-interface.h>
26 class pressure_device : public sensor_device {
29 virtual ~pressure_device();
31 int get_poll_fd(void);
32 int get_sensors(const sensor_info_t **sensors);
34 bool enable(uint32_t id);
35 bool disable(uint32_t id);
37 bool set_interval(uint32_t id, unsigned long val);
39 int read_fd(uint32_t **ids);
40 int get_data(uint32_t id, sensor_data_t **data, int *length);
46 float m_sea_level_pressure;
47 unsigned long m_polling_interval;
48 unsigned long long m_fired_time;
49 bool m_sensorhub_controlled;
52 std::string m_data_node;
53 std::string m_enable_node;
54 std::string m_interval_node;
56 std::function<bool(void)> update_value;
58 std::vector<uint32_t> event_ids;
60 bool update_value_input_event(void);
61 bool update_value_iio(void);
63 void raw_to_base(sensor_data_t *data);
64 float pressure_to_altitude(float pressure);
66 #endif /*_PRESSURE_DEVICE_H_*/