Merge branch 'tizen_3.0' into devel/tizen
[platform/core/system/sensord.git] / src / client / client_common.h
1 /*
2  * sensord
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 _CLIENT_COMMON_H_
21 #define _CLIENT_COMMON_H_
22
23 #include <sensor_internal.h>
24 #include <sensor_handle_info.h>
25 #include <reg_event_info.h>
26 #include <sensor_log.h>
27
28 #include <memory>
29
30 #define BASE_GATHERING_INTERVAL 100
31 #define THREAD_TERMINATION -1
32
33 typedef struct {
34         unsigned long long event_id;
35         int handle;
36         sensor_t sensor;
37         unsigned int event_type;
38         sensor_cb_t cb;
39         std::shared_ptr<void> sensor_data;
40         void *user_data;
41         sensor_accuracy_changed_cb_t accuracy_cb;
42         unsigned long long timestamp;
43         int accuracy;
44         void *accuracy_user_data;
45 } client_callback_info;
46
47 const char *get_sensor_name(sensor_id_t sensor_id);
48 const char *get_event_name(unsigned int event_type);
49
50 unsigned int get_calibration_event_type(unsigned int event_type);
51 unsigned int get_log_per_count(sensor_id_t id);
52
53 void print_event_occurrence_log(sensor_handle_info &sensor_handle_info);
54
55 class sensor_info;
56 sensor_info *sensor_to_sensor_info(sensor_t sensor);
57 sensor_t sensor_info_to_sensor(const sensor_info *info);
58
59 #endif /* _CLIENT_COMMON_H_ */