sensord: fix incorrect return type
[platform/core/system/sensord.git] / src / server / client_sensor_record.h
1 /*
2  * sensord
3  *
4  * Copyright (c) 2013 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_SENSOR_RECORD_H_
21 #define _CLIENT_SENSOR_RECORD_H_
22
23 #include <sensor_common.h>
24 #include <sensor_types.h>
25 #include <sensor_usage.h>
26 #include <csocket.h>
27 #include <unordered_map>
28 #include <string>
29
30 typedef std::unordered_map<sensor_id_t, sensor_usage> sensor_usage_map;
31
32 class client_sensor_record {
33 public:
34         client_sensor_record();
35         ~client_sensor_record();
36
37         void set_client_id(int client_id);
38
39         void set_client_info(pid_t pid, const std::string &name);
40         const char* get_client_info(void);
41
42         void set_permission(int permission);
43         int get_permission(void);
44
45         bool register_event(sensor_id_t sensor_id, unsigned int event_type);
46         bool unregister_event(sensor_id_t sensor_id, unsigned int event_type);
47
48         bool set_batch(sensor_id_t sensor_id, unsigned int interval, unsigned int latency);
49         bool get_batch(sensor_id_t sensor_id, unsigned int &interval, unsigned int &latency);
50         bool set_pause_policy(sensor_id_t sensor_id, int pause_policy);
51
52         bool set_start(sensor_id_t sensor_id, bool start);
53         bool is_started(sensor_id_t sensor_id);
54
55         bool is_listening_event(sensor_id_t sensor_id, unsigned int event_type);
56         bool has_sensor_usage(void);
57         bool has_sensor_usage(sensor_id_t sensor_id);
58
59         bool get_registered_events(sensor_id_t sensor_id, event_type_vector &event_vec);
60
61         bool add_sensor_usage(sensor_id_t sensor_id);
62         bool remove_sensor_usage(sensor_id_t sensor_id);
63
64         void set_event_socket(const csocket &socket);
65         void get_event_socket(csocket &socket);
66         bool close_event_socket(void);
67
68 private:
69         int m_client_id;
70         pid_t m_pid;
71         int m_permission;
72         std::string m_client_info;
73         csocket m_event_socket;
74         sensor_usage_map m_sensor_usages;
75 };
76
77 #endif /* _CLIENT_SENSOR_RECORD_H_ */