Merge "sensord: change unclear classes to inner class" into devel/tizen
[platform/core/system/sensord.git] / src / client / sensor_manager_channel_handler.h
1 /*
2  * sensord
3  *
4  * Copyright (c) 2017 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 __SENSOR_MANAGER_CHANNEL_HANDLER__
21 #define __SENSOR_MANAGER_CHANNEL_HANDLER__
22
23 #include <sensor_internal.h>
24 #include <sensor_manager.h>
25 #include <channel_handler.h>
26 #include <map>
27
28 namespace sensor {
29
30 class sensor_manager::channel_handler : public ipc::channel_handler
31 {
32 public:
33         channel_handler(sensor_manager *manager);
34
35         void connected(ipc::channel *ch);
36         void disconnected(ipc::channel *ch);
37         void read(ipc::channel *ch, ipc::message &msg);
38         void read_complete(ipc::channel *ch);
39         void error_caught(ipc::channel *ch, int error);
40
41         void on_sensor_added(ipc::channel *ch, ipc::message &msg);
42         void on_sensor_removed(ipc::channel *ch, ipc::message &msg);
43
44         void add_sensor_added_cb(sensord_added_cb cb, void *user_data);
45         void remove_sensor_added_cb(sensord_added_cb cb);
46
47         void add_sensor_removed_cb(sensord_removed_cb cb, void *user_data);
48         void remove_sensor_removed_cb(sensord_removed_cb cb);
49
50 private:
51         typedef std::map<sensord_added_cb, void *> sensor_added_cb_list_t;
52         typedef std::map<sensord_removed_cb, void *> sensor_removed_cb_list_t;
53
54         sensor_manager *m_manager;
55         sensor_added_cb_list_t m_sensor_added_callbacks;
56         sensor_removed_cb_list_t m_sensor_removed_callbacks;
57 };
58
59 }
60
61 #endif /* __SENSOR_MANAGER_CHANNEL_HANDLER__ */