2a29dd752ea22119578c627202194c9f862dd595
[platform/adaptation/tw3/sensor-hal-tw3.git] / src / light / light_device.h
1 /*
2  * Copyright (c) 2017 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 __LIGHT_DEVICE_H__
19 #define __LIGHT_DEVICE_H__
20
21 #include <sensor/sensor_hal.h>
22 #include <string>
23 #include <vector>
24
25 class light_device : public sensor_device {
26 public:
27         light_device();
28         virtual ~light_device();
29
30         int get_poll_fd(void);
31         int get_sensors(const sensor_info_t **sensors);
32
33         bool enable(uint32_t id);
34         bool disable(uint32_t id);
35
36         bool set_interval(uint32_t id, unsigned long val);
37
38         int read_fd(uint32_t **ids);
39         int get_data(uint32_t id, sensor_data_t **data, int *length);
40
41 private:
42         int m_node_handle;
43         int m_lux;
44         unsigned long m_polling_interval;
45         unsigned long long m_fired_time;
46         bool m_sensorhub_controlled;
47
48         std::string m_enable_node;
49         std::string m_data_node;
50         std::string m_interval_node;
51
52         std::vector<uint32_t> event_ids;
53
54         bool update_value_lux(void);
55 };
56
57 #endif /* __LIGHT_DEVICE_H__ */