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_H__
21 #define __SENSOR_MANAGER_H__
25 #include <unordered_map>
27 #include "event_loop.h"
29 #include "sensor_handler.h"
30 #include "sensor_observer.h"
31 #include "sensor_loader.h"
33 #include "physical_sensor_handler.h"
34 #include "fusion_sensor_handler.h"
35 #include "external_sensor_handler.h"
39 class sensor_manager {
41 sensor_manager(ipc::event_loop *loop);
47 bool is_supported(const std::string uri);
49 bool register_sensor(sensor_handler *sensor);
50 void deregister_sensor(const std::string uri);
52 sensor_handler *get_sensor_by_type(const std::string uri);
53 sensor_handler *get_sensor(const std::string uri);
54 std::vector<sensor_handler *> get_sensors(void);
56 size_t serialize(int sock_fd, char **bytes);
59 typedef std::map<std::string, sensor_handler *> sensor_map_t;
61 void create_physical_sensors(
62 device_sensor_registry_t &devices,
63 physical_sensor_registry_t &psensors);
64 void create_fusion_sensors(fusion_sensor_registry_t &vsensors);
65 void create_external_sensors(external_sensor_registry_t &vsensors);
67 void init_sensors(void);
68 void register_handler(physical_sensor_handler *sensor);
72 ipc::event_loop *m_loop;
73 sensor_loader m_loader;
74 sensor_map_t m_sensors;
79 #endif /* __SENSOR_MANAGER_H__ */