4 * Copyright (c) 2017 Samsung Electronics Co., Ltd.
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
10 * http://www.apache.org/licenses/LICENSE-2.0
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.
20 #ifndef __SENSOR_MANAGER_CHANNEL_HANDLER__
21 #define __SENSOR_MANAGER_CHANNEL_HANDLER__
23 #include <sensor_internal.h>
24 #include <sensor_manager.h>
25 #include <channel_handler.h>
30 class sensor_manager::channel_handler : public ipc::channel_handler
33 channel_handler(sensor_manager *manager);
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);
41 void on_sensor_added(ipc::channel *ch, ipc::message &msg);
42 void on_sensor_removed(ipc::channel *ch, ipc::message &msg);
44 void add_sensor_added_cb(sensord_added_cb cb, void *user_data);
45 void remove_sensor_added_cb(sensord_added_cb cb);
47 void add_sensor_removed_cb(sensord_removed_cb cb, void *user_data);
48 void remove_sensor_removed_cb(sensord_removed_cb cb);
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;
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;
61 #endif /* __SENSOR_MANAGER_CHANNEL_HANDLER__ */