sensor-framework : Initial commit
[platform/core/system/sensord.git] / src / libsensord / csensor_handle_info.h
1 /*
2  * libsensord
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 CSENSOR_HANDLE_INFO_H_
21 #define CSENSOR_HANDLE_INFO_H_
22
23 #include <creg_event_info.h>
24 #include <command_channel.h>
25 #include <common.h>
26 #include <string.h>
27 #include <map>
28 #include <vector>
29
30 using std::map;
31 using std::vector;
32
33 typedef map<unsigned int, creg_event_info> event_info_map;
34
35 class csensor_handle_info
36 {
37 public:
38         int m_handle;
39         sensor_type_t m_sensor_type;
40         int m_sensor_state;
41         int m_sensor_option;
42         int bad_accuracy;
43
44         csensor_handle_info();
45         ~csensor_handle_info();
46
47         bool add_reg_event_info(const unsigned int event_type, const unsigned int interval,
48                                                         const sensor_callback_func_t callback, void *cb_data);
49         bool delete_reg_event_info(const unsigned int event_type);
50
51         bool change_reg_event_interval(const unsigned int event_type, const unsigned int interval);
52
53         bool get_reg_event_info(const unsigned int event_type, creg_event_info &event_info);
54         void get_reg_event_types(event_type_vector &event_types);
55         unsigned int get_min_interval(void);
56         unsigned int get_reg_event_count(void);
57
58         void clear_all_events(void);
59         static unsigned long long renew_event_id(void);
60 private:
61         event_info_map m_reg_event_infos;
62         static unsigned long long m_event_id;
63 };
64
65 #endif /* CSENSOR_HANDLE_INFO_H_ */