4 * Copyright (c) 2014 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_PLUGIN_LOADER_H_
21 #define _SENSOR_PLUGIN_LOADER_H_
23 #include <sensor_common.h>
38 using std::istringstream;
40 #define PLUGINS_FILE_PATH "/usr/etc/sensor_plugins.xml"
42 typedef multimap<sensor_type_t, sensor_hal *> sensor_hal_plugins;
44 * a hal_plugins is a group of hal plugin
51 typedef multimap<sensor_type_t, sensor_base *> sensor_plugins;
53 * a sensor_plugins is a group of sensor plugin
60 typedef vector<sensor_fusion *> fusion_plugins;
62 * a fusion_plugins is a group of fusion plugin
69 class sensor_plugin_loader
72 sensor_plugin_loader();
74 void *load_module(const char *path);
75 bool insert_module(const char *node_name, const char *path);
76 void show_sensor_info(void);
78 sensor_hal_plugins m_sensor_hals;
79 sensor_plugins m_sensors;
80 fusion_plugins m_fusions;
83 static sensor_plugin_loader &get_instance() {
84 static sensor_plugin_loader inst;
87 bool load_plugins(const string &plugins_path = PLUGINS_FILE_PATH);
89 sensor_hal *get_sensor_hal(sensor_type_t type);
90 vector<sensor_hal *> get_sensor_hals(sensor_type_t type);
92 sensor_base *get_sensor(sensor_type_t type);
93 vector<sensor_base *> get_sensors(sensor_type_t type);
95 vector<sensor_base *> get_virtual_sensors(void);
97 sensor_fusion *get_fusion(void);
98 vector<sensor_fusion *> get_fusions(void);
102 #endif /*_SENSOR_PLUGIN_LOADER_H_*/