Adding API for fusion sensor 61/36661/1
authorRamasamy <ram.kannan@samsung.com>
Wed, 11 Mar 2015 12:01:30 +0000 (17:31 +0530)
committerRamasamy <ram.kannan@samsung.com>
Wed, 11 Mar 2015 12:01:36 +0000 (17:31 +0530)
- Added new fusion sensor events and included to sensor API
- Adding cmake support for API

Change-Id: Ib3acb6bb7329b84a54abac8fad0373be40dc631f

src/libsensord/CMakeLists.txt
src/libsensord/client_common.cpp
src/libsensord/sensor_fusion.h [new file with mode: 0755]
src/libsensord/sensor_internal.h
src/libsensord/sensor_internal_deprecated.h

index 2a8291f..4949c36 100755 (executable)
@@ -59,5 +59,6 @@ install(FILES sensor_geomagnetic_rv.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/se
 install(FILES sensor_gaming_rv.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sensor/)
 install(FILES sensor_temperature.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sensor/)
 install(FILES sensor_motion.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sensor/)
+install(FILES sensor_fusion.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sensor/)
 install(FILES sensor_deprecated.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sensor/)
 install(FILES ${PROJECT_NAME}.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
index d1f132f..dc00b87 100755 (executable)
@@ -43,6 +43,7 @@ log_element g_log_elements[] = {
        FILL_LOG_ELEMENT(LOG_ID_SENSOR_TYPE, ROTATION_VECTOR_SENSOR, 0, 1),
        FILL_LOG_ELEMENT(LOG_ID_SENSOR_TYPE, GEOMAGNETIC_RV_SENSOR, 0, 1),
        FILL_LOG_ELEMENT(LOG_ID_SENSOR_TYPE, GAMING_RV_SENSOR, 0, 1),
+       FILL_LOG_ELEMENT(LOG_ID_SENSOR_TYPE, FUSION_SENSOR, 0, 1),
 
        FILL_LOG_ELEMENT(LOG_ID_EVENT, GEOMAGNETIC_CALIBRATION_NEEDED_EVENT, 0, 1),
        FILL_LOG_ELEMENT(LOG_ID_EVENT, PROXIMITY_CHANGE_STATE_EVENT, 0,1),
@@ -65,6 +66,7 @@ log_element g_log_elements[] = {
        FILL_LOG_ELEMENT(LOG_ID_EVENT, ROTATION_VECTOR_EVENT_RAW_DATA_REPORT_ON_TIME, 0, 10),
        FILL_LOG_ELEMENT(LOG_ID_EVENT, GEOMAGNETIC_RV_RAW_DATA_EVENT, 0, 10),
        FILL_LOG_ELEMENT(LOG_ID_EVENT, GAMING_RV_RAW_DATA_EVENT, 0, 10),
+       FILL_LOG_ELEMENT(LOG_ID_EVENT, FUSION_EVENT, 0, 10),
 };
 
 typedef unordered_map<unsigned int, log_attr* > log_map;
diff --git a/src/libsensord/sensor_fusion.h b/src/libsensord/sensor_fusion.h
new file mode 100755 (executable)
index 0000000..7539be1
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * libsensord
+ *
+ * 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 __SENSOR_FUSION_H__
+#define __SENSOR_FUSION_H__
+
+//! Pre-defined events for the fusion sensor
+//! Sensor Plugin developer can add more event to their own headers
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/**
+ * @defgroup SENSOR_FUSION Fusion Sensor
+ * @ingroup SENSOR_FRAMEWORK
+ *
+ * These APIs are used to control the Fusion sensor.
+ * @{
+ */
+enum fusion_event_type {
+       FUSION_ORIENTATION_ENABLED = (FUSION_SENSOR << 16) | 0x0001,
+       FUSION_ROTATION_VECTOR_ENABLED = (FUSION_SENSOR << 16) | 0x0002,
+       FUSION_GAMING_ROTATION_VECTOR_ENABLED = (FUSION_SENSOR << 16) | 0x0003,
+       FUSION_GEOMAGNETIC_ROTATION_VECTOR_ENABLED = (FUSION_SENSOR << 16) | 0x0004,
+       FUSION_EVENT = (FUSION_SENSOR << 16) | 0x0005,
+       FUSION_CALIBRATION_NEEDED_EVENT = (FUSION_SENSOR << 16) | 0x0006,
+};
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+//! End of a file
index 4fcb859..844e7af 100755 (executable)
@@ -54,6 +54,7 @@ extern "C"
 #include <sensor_geomagnetic_rv.h>
 #include <sensor_gaming_rv.h>
 #include <sensor_temperature.h>
+#include <sensor_fusion.h>
 
 
 typedef void (*sensor_cb_t)(sensor_t sensor, unsigned int event_type, sensor_data_t *data, void *user_data);
index b7b06fe..4420044 100755 (executable)
@@ -53,6 +53,7 @@ extern "C"
 #include <sensor_gaming_rv.h>
 #include <sensor_motion.h>
 #include <sensor_deprecated.h>
+#include <sensor_fusion.h>
 
 #define MAX_KEY_LEN 30