Use hal-sensor-types
[platform/hal/backend/emulator/sensor-emulator.git] / src / hrm / hrm_device.h
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17
18 #ifndef _HRM_DEVICE_H_
19 #define _HRM_DEVICE_H_
20
21 #include <hal/hal-sensor-types.h>
22 #include <string>
23 #include <vector>
24 #include <functional>
25
26 class hrm_device : public sensor_device {
27 public:
28         hrm_device();
29         virtual ~hrm_device();
30
31         int get_poll_fd(void);
32         int get_sensors(const sensor_info_t **sensors);
33
34         bool enable(uint32_t id);
35         bool disable(uint32_t id);
36
37         bool set_interval(uint32_t id, unsigned long val);
38
39         int read_fd(uint32_t **ids);
40         int get_data(uint32_t id, sensor_data_t **data, int *length);
41
42 private:
43         int m_node_handle;
44         int m_hr;
45         int m_spo2;
46         int m_peek_to_peek;
47         float m_snr;
48         unsigned long m_polling_interval;
49         unsigned long long m_fired_time;
50         bool m_interval_supported;
51         bool m_sensorhub_controlled;
52
53         int m_method;
54         std::string m_data_node;
55         std::string m_enable_node;
56         std::string m_interval_node;
57
58         std::function<bool(void)> update_value;
59
60         std::vector<uint32_t> event_ids;
61
62         bool update_value_input_event(void);
63
64         void raw_to_base(sensor_data_t *data);
65 };
66 #endif /*_HRM_DEVICE_H_*/