} else {
sensor_event_t sensor_events[MAX_SENSOR_EVENT];
unsigned int event_cnt = 0;
-
sensor_events[event_cnt++] = *((sensor_event_t *)seed_event);
virtual_sensors v_sensors = get_active_virtual_sensors();
while (it_v_sensor != v_sensors.end()) {
int synthesized_cnt;
-
v_sensor_events.clear();
-
(*it_v_sensor)->synthesize(*((sensor_event_t *)seed_event), v_sensor_events);
-
synthesized_cnt = v_sensor_events.size();
for (int i = 0; i < synthesized_cnt; ++i)
+++ /dev/null
-/*
- * libsensord-share
- *
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include <fusion_util.h>
-#include <math.h>
-#include <stdlib.h>
-
-int quat_to_matrix(const float *quat, float *R)
-{
- if(quat == NULL || R == NULL)
- return -1;
-
- float q0 = quat[3];
- float q1 = quat[0];
- float q2 = quat[1];
- float q3 = quat[2];
-
- float sq_q1 = 2 * q1 * q1;
- float sq_q2 = 2 * q2 * q2;
- float sq_q3 = 2 * q3 * q3;
- float q1_q2 = 2 * q1 * q2;
- float q3_q0 = 2 * q3 * q0;
- float q1_q3 = 2 * q1 * q3;
- float q2_q0 = 2 * q2 * q0;
- float q2_q3 = 2 * q2 * q3;
- float q1_q0 = 2 * q1 * q0;
-
- R[0] = 1 - sq_q2 - sq_q3;
- R[1] = q1_q2 - q3_q0;
- R[2] = q1_q3 + q2_q0;
- R[3] = q1_q2 + q3_q0;
- R[4] = 1 - sq_q1 - sq_q3;
- R[5] = q2_q3 - q1_q0;
- R[6] = q1_q3 - q2_q0;
- R[7] = q2_q3 + q1_q0;
- R[8] = 1 - sq_q1 - sq_q2;
-
- return 0;
-}
-
+++ /dev/null
-/*
- * libsensord-share
- *
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#ifndef _FUSION_UTIL_H_
-#define _FUSION_UTIL_H_
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-int quat_to_matrix(const float *quat, float *R);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
*
*/
-
#include <sensor_plugin_loader.h>
-
#include <libxml/xmlmemory.h>
#include <libxml/parser.h>
-
#include <sensor_hal.h>
#include <sensor_base.h>
-
#include <dlfcn.h>
#include <dirent.h>
#include <common.h>
#define ROOT_ELEMENT "PLUGIN"
#define TEXT_ELEMENT "text"
#define PATH_ATTR "path"
-
#define HAL_ELEMENT "HAL"
#define SENSOR_ELEMENT "SENSOR"
bool sensor_plugin_loader::insert_module(plugin_type type, const string &path)
{
if (type == PLUGIN_TYPE_HAL) {
- DBG("insert sensor plugin [%s]", path);
+ DBG("insert sensor plugin [%s]", path.c_str());
sensor_hal *module;
void *handle;
class sensor_hal;
class sensor_base;
-class sensor_fusion;
using std::pair;
using std::vector;
*
*/
-typedef vector<sensor_fusion*> fusion_plugins;
-/*
-* a fusion_plugins is a group of fusion plugin
-* <FUSION>
-* ...
-* </FUSION>
-*
-*/
-
class sensor_plugin_loader
{
private:
sensor_hal_plugins m_sensor_hals;
sensor_plugins m_sensors;
- fusion_plugins m_fusions;
public:
static sensor_plugin_loader& get_instance();
{
return csensor_event_dispatcher::get_instance().delete_active_virtual_sensor(this);
}
+
+bool virtual_sensor::push(sensor_event_t const &event)
+{
+ csensor_event_queue::get_instance().push(event);
+ return true;
+}
+
virtual_sensor();
virtual ~virtual_sensor();
- virtual void synthesize(const sensor_event_t& event, vector<sensor_event_t> &outs) = 0;
+ virtual void synthesize(const sensor_event_t &event, vector<sensor_event_t> &outs) = 0;
+ virtual int get_sensor_data(const unsigned int event_type, sensor_data_t &data) = 0;
bool is_virtual(void);
protected:
bool activate(void);
bool deactivate(void);
+
+ bool push(sensor_event_t const &event);
};
#endif