Debugging issues for loading and execution 62/51662/2
authorRamasamy <ram.kannan@samsung.com>
Thu, 12 Nov 2015 02:04:55 +0000 (11:04 +0900)
committerRamasamy <ram.kannan@samsung.com>
Thu, 12 Nov 2015 02:57:46 +0000 (11:57 +0900)
- Accelerometer sensor loads and works correctly.
- The build system is independent for both sensord and sensor-haDebugging issues for loading and execution

Change-Id: Iff3066bfe211cdbd21999940ad5fb44d8483045a

packaging/sensord.spec
src/server/plugins/CMakeLists.txt
src/server/plugins/sensor_module_create.cpp [deleted file]
src/server/plugins/sensor_module_create.cpp.in [new file with mode: 0644]

index 81f613d..03ab16a 100644 (file)
@@ -21,23 +21,24 @@ BuildRequires:  pkgconfig(cynara-client)
 BuildRequires:  pkgconfig(cynara-session)
 
 %define accel_state ON
-%define auto_rotation_state ON
-%define gyro_state ON
-%define proxi_state ON
-%define light_state ON
-%define geo_state ON
-%define pressure_state ON
-%define temperature_state ON
-%define ultraviolet_state ON
-%define orientation_state ON
-%define gravity_state ON
-%define linear_accel_state ON
-%define rv_state ON
-%define geomagnetic_rv_state ON
-%define gaming_rv_state ON
-%define tilt_state ON
-%define uncal_gyro_state ON
-%define bio_led_red_state ON
+%define auto_rotation_state OFF
+%define gyro_state OFF
+%define proxi_state OFF
+%define light_state OFF
+%define geo_state OFF
+%define pressure_state OFF
+%define temperature_state OFF
+%define ultraviolet_state OFF
+%define orientation_state OFF
+%define gravity_state OFF
+%define linear_accel_state OFF
+%define rv_state OFF
+%define rv_raw_state OFF
+%define geomagnetic_rv_state OFF
+%define gaming_rv_state OFF
+%define tilt_state OFF
+%define uncal_gyro_state OFF
+%define bio_led_red_state OFF
 %define build_test_suite ON
 
 %description
@@ -95,7 +96,7 @@ cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DACCEL=%{accel_state} \
        -DGYRO=%{gyro_state} -DPROXI=%{proxi_state} -DLIGHT=%{light_state} \
        -DGEO=%{geo_state} -DPRESSURE=%{pressure_state} -DTEMPERATURE=%{temperature_state} \
        -DORIENTATION=%{orientation_state} -DGRAVITY=%{gravity_state} \
-       -DLINEAR_ACCEL=%{linear_accel_state} -DRV=%{rv_state} \
+       -DLINEAR_ACCEL=%{linear_accel_state} -DRV=%{rv_state} -DRV_RAW=%{rv_raw_state} \
        -DGEOMAGNETIC_RV=%{geomagnetic_rv_state} -DGAMING_RV=%{gaming_rv_state} \
        -DUNCAL_GYRO=%{uncal_gyro_state} -DAUTO_ROTATION=%{auto_rotation_state} \
        -DTILT=%{tilt_state} -DULTRAVIOLET=%{ultraviolet_state} \
index 2f9af09..8ce6ea5 100755 (executable)
@@ -21,83 +21,108 @@ include_directories(${CMAKE_SOURCE_DIR}/src/shared)
 IF("${ACCEL}" STREQUAL "ON")
 include_directories(${CMAKE_SOURCE_DIR}/src/server/plugins/accel)
 list (APPEND PLUGIN_SRCS "accel/accel_sensor.cpp")
+add_definitions(-DENABLE_ACCEL)
 ENDIF()
 IF("${GYRO}" STREQUAL "ON")
 include_directories(${CMAKE_SOURCE_DIR}/src/server/plugins/gyro)
 list (APPEND PLUGIN_SRCS "gyro/gyro_sensor.cpp")
+add_definitions(-DENABLE_GYRO)
 ENDIF()
 IF("${PROXI}" STREQUAL "ON")
 include_directories(${CMAKE_SOURCE_DIR}/src/server/plugins/proxi)
 list (APPEND PLUGIN_SRCS "proxi/proxi_sensor.cpp")
+add_definitions(-DENABLE_PROXI)
 ENDIF()
 IF("${LIGHT}" STREQUAL "ON")
 include_directories(${CMAKE_SOURCE_DIR}/src/server/plugins/light)
 list (APPEND PLUGIN_SRCS "light/light_sensor.cpp")
+add_definitions(-DENABLE_LIGHT)
 ENDIF()
 IF("${GEO}" STREQUAL "ON")
 include_directories(${CMAKE_SOURCE_DIR}/src/server/plugins/geo)
 list (APPEND PLUGIN_SRCS "geo/geo_sensor.cpp")
+add_definitions(-DENABLE_GEO)
 ENDIF()
 IF("${AUTO_ROTATION}" STREQUAL "ON")
 include_directories(${CMAKE_SOURCE_DIR}/src/server/plugins/auto_rotation)
-list (APPEND PLUGIN_SRCS "auto_rotation/auto_rotation_sensor.cpp")
 list (APPEND PLUGIN_SRCS "auto_rotation/auto_rotation_alg.cpp")
 list (APPEND PLUGIN_SRCS "auto_rotation/auto_rotation_alg_emul.cpp")
+list (APPEND PLUGIN_SRCS "auto_rotation/auto_rotation_sensor.cpp")
+add_definitions(-DENABLE_AUTO_ROTATION)
 ENDIF()
 IF("${PRESSURE}" STREQUAL "ON")
 include_directories(${CMAKE_SOURCE_DIR}/src/server/plugins/pressure)
 list (APPEND PLUGIN_SRCS "pressure/pressure_sensor.cpp")
+add_definitions(-DENABLE_PRESSURE)
 ENDIF()
 IF("${TEMPERATURE}" STREQUAL "ON")
 include_directories(${CMAKE_SOURCE_DIR}/src/server/plugins/temperature)
 list (APPEND PLUGIN_SRCS "temperature/temperature_sensor.cpp")
-ENDIF()
-IF("${HUMIDITY}" STREQUAL "ON")
-include_directories(${CMAKE_SOURCE_DIR}/src/server/plugins/humidity)
-list (APPEND PLUGIN_SRCS "humidity/humidity_sensor.cpp")
+add_definitions(-DENABLE_TEMPERATURE)
 ENDIF()
 IF("${ULTRAVIOLET}" STREQUAL "ON")
 include_directories(${CMAKE_SOURCE_DIR}/src/server/plugins/ultraviolet)
 list (APPEND PLUGIN_SRCS "ultraviolet/ultraviolet_sensor.cpp")
+add_definitions(-DENABLE_ULTRAVIOLET)
 ENDIF()
 IF("${BIO_LED_RED}" STREQUAL "ON")
 include_directories(${CMAKE_SOURCE_DIR}/src/server/plugins/bio_led_red)
 list (APPEND PLUGIN_SRCS "bio_led_red/bio_led_red_sensor.cpp")
+add_definitions(-DENABLE_BIO_LED_RED)
 ENDIF()
 IF("${ORIENTATION}" STREQUAL "ON")
 set(SENSOR_FUSION_ENABLE "1")
 set(ORIENTATION_ENABLE "1")
+add_definitions(-DENABLE_SENSOR_FUSION)
+add_definitions(-DENABLE_ORIENTATION)
 ENDIF()
 IF("${RV}" STREQUAL "ON")
 set(SENSOR_FUSION_ENABLE "1")
 set(RV_ENABLE "1")
+add_definitions(-DENABLE_SENSOR_FUSION)
+add_definitions(-DENABLE_RV)
 ENDIF()
 IF("${GEOMAGNETIC_RV}" STREQUAL "ON")
 set(SENSOR_FUSION_ENABLE "1")
 set(GEOMAGNETIC_RV_ENABLE "1")
+add_definitions(-DENABLE_SENSOR_FUSION)
+add_definitions(-DENABLE_GEOMAGNETIC_RV)
 ENDIF()
 IF("${GAMING_RV}" STREQUAL "ON")
 set(SENSOR_FUSION_ENABLE "1")
 set(GAMING_RV_ENABLE "1")
+add_definitions(-DENABLE_SENSOR_FUSION)
+add_definitions(-DENABLE_GAMING_RV)
 ENDIF()
 IF("${TILT}" STREQUAL "ON")
 set(SENSOR_FUSION_ENABLE "1")
 set(TILT_ENABLE "1")
+add_definitions(-DENABLE_SENSOR_FUSION)
+add_definitions(-DENABLE_TILT)
 ENDIF()
 IF("${UNCAL_GYRO}" STREQUAL "ON")
 set(SENSOR_FUSION_ENABLE "1")
 set(UNCAL_GYRO_ENABLE "1")
+add_definitions(-DENABLE_SENSOR_FUSION)
+add_definitions(-DENABLE_UNCAL_GYRO)
 ENDIF()
 IF("${GRAVITY}" STREQUAL "ON")
 set(SENSOR_FUSION_ENABLE "1")
 set(ORIENTATION_ENABLE "1")
 set(GRAVITY_ENABLE "1")
+add_definitions(-DENABLE_SENSOR_FUSION)
+add_definitions(-DENABLE_ORIENTATION)
+add_definitions(-DENABLE_GRAVITY)
 ENDIF()
 IF("${LINEAR_ACCEL}" STREQUAL "ON")
 set(SENSOR_FUSION_ENABLE "1")
 set(ORIENTATION_ENABLE "1")
 set(GRAVITY_ENABLE "1")
-set(LINEAR_ACCELERATION_ENABLE "1")
+set(LINEAR_ACCEL_ENABLE "1")
+add_definitions(-DENABLE_SENSOR_FUSION)
+add_definitions(-DENABLE_ORIENTATION)
+add_definitions(-DENABLE_GRAVITY)
+add_definitions(-DENABLE_LINEAR_ACCEL)
 ENDIF()
 IF("${SENSOR_FUSION_ENABLE}" STREQUAL "1")
 include_directories(${CMAKE_SOURCE_DIR}/src/server/plugins/sensor_fusion)
@@ -148,6 +173,8 @@ include_directories(${CMAKE_SOURCE_DIR}/src/server/plugins/rotation_vector/rv_ra
 list (APPEND PLUGIN_SRCS "rotation_vector/rv_raw/rv_raw_sensor.cpp")
 ENDIF()
 
+configure_file(sensor_module_create.cpp.in sensor_module_create.cpp)
+
 add_library(${PROJECT_NAME} SHARED
        sensor_module_create.cpp
        ${PLUGIN_SRCS}
diff --git a/src/server/plugins/sensor_module_create.cpp b/src/server/plugins/sensor_module_create.cpp
deleted file mode 100644 (file)
index e82b08f..0000000
+++ /dev/null
@@ -1,284 +0,0 @@
-#define ACCEL strcmp("@ACCEL@", "ON")
-#define AUTO_ROTATION strcmp("@AUTO_ROTATION@", "ON")
-#define GYRO strcmp("@GYRO@", "ON")
-#define PROXI strcmp("@PROXI@", "ON")
-#define LIGHT strcmp("@LIGHT@", "ON")
-#define GEO strcmp("@GEO@", "ON")
-#define PRESSURE strcmp("@PRESSURE@", "ON")
-#define TEMPERATURE strcmp("@TEMPERATURE@", "ON")
-#define ULTRAVIOLET strcmp("@ULTRAVIOLET@", "ON")
-#define ORIENTATION strcmp("@ORIENTATION@", "ON")
-#define GRAVITY strcmp("@GRAVITY@", "ON")
-#define LINEAR_ACCEL strcmp("@LINEAR_ACCEL@", "ON")
-#define GEOMAGNETIC_RV strcmp("@GEOMAGNETIC_RV@", "ON")
-#define GAMING_RV strcmp("@GAMING_RV@", "ON")
-#define RV strcmp("@RV@", "ON")
-#define TILT strcmp("@TILT@", "ON")
-#define UNCAL_GYRO strcmp("@UNCAL_GYRO@", "ON")
-#define BIO_LED_RED strcmp("@BIO_LED_RED@", "ON")
-#define RV_RAW strcmp("@RV_RAW@", "ON")
-
-#if $ACCEL == 1
-#include <accel_sensor.h>
-#endif
-#if $GYRO == 1
-#include <gyro_sensor.h>
-#endif
-#if $PROXI == 1
-#include <proxi_sensor.h>
-#endif
-#if $LIGHT == 1
-#include <light_sensor.h>
-#endif
-#if $GEO == 1
-#include <geo_sensor.h>
-#endif
-#if $AUTO_ROTATION == 1
-#include <auto_rotation_sensor.h>
-#endif
-#if $PRESSURE == 1
-#include <pressure_sensor.h>
-#endif
-#if $TEMPERATURE == 1
-#include <temperature_sensor.h>
-#endif
-#if $HUMIDITY == 1
-#include <humidity_sensor.h>
-#endif
-#if $ULTRAVIOLET == 1
-#include <ultraviolet_sensor.h>
-#endif
-#if $BIO_LED_RED == 1
-#include <bio_led_red_sensor.h>
-#endif
-#if $ORIENTATION == 1
-#include <orientation_sensor.h>
-#endif
-#if $GEOMAGNETIC_RV == 1
-#include <geomagnetic_rv_sensor.h>
-#endif
-#if $GAMING_RV == 1
-#include <gaming_rv_sensor.h>
-#endif
-#if $TILT == 1
-#include <tilt_sensor.h>
-#endif
-#if $UNCAL_GYRO == 1
-#include <uncal_gyro_sensor.h>
-#endif
-#if $GRAVITY == 1
-#include <gravity_sensor.h>
-#endif
-#if $LINEAR_ACCEL == 1
-#include <linear_accel_sensor.h>
-#endif
-#if $RV == 1
-#include <rv_sensor.h>
-#endif
-#if $RV_RAW == 1
-#include <rv_raw_sensor.h>
-#endif
-
-#include <sf_common.h>
-
-extern "C" sensor_module* create(void)
-{
-       sensor_module *module = new(std::nothrow) sensor_module;
-       retvm_if(!module, NULL, "Failed to allocate memory");
-
-#if $ACCEL == 1
-       accel_sensor *accel_sensor = NULL;
-       try {
-               accel_sensor = new(std::nothrow) accel_sensor;
-       } catch (int err) {
-               ERR("Failed to create accel_sensor module, err: %d, cause: %s", err, strerror(err));
-       }
-       if (!accel_sensor)
-               module->sensors.push_back(accel_sensor);
-#endif
-#if $AUTO_ROTATION == 1
-       auto_rotation_sensor *auto_rotation_sensor = NULL;
-       try {
-               auto_rotation_sensor = new(std::nothrow) auto_rotation_sensor;
-       } catch (int err) {
-               ERR("Failed to create auto_rotation_sensor module, err: %d, cause: %s", err, strerror(err));
-       }
-       if (!auto_rotation_sensor)
-               module->sensors.push_back(auto_rotation_sensor);
-#endif
-#if $GYRO == 1
-       gyro_sensor *gyro_sensor = NULL;
-       try {
-               gyro_sensor = new(std::nothrow) gyro_sensor;
-       } catch (int err) {
-               ERR("Failed to create gyro_sensor module, err: %d, cause: %s", err, strerror(err));
-       }
-       if (!gyro_sensor)
-               module->sensors.push_back(gyro_sensor);
-#endif
-#if $PROXI == 1
-       proxi_sensor *proxi_sensor = NULL;
-       try {
-               proxi_sensor = new(std::nothrow) proxi_sensor;
-       } catch (int err) {
-               ERR("Failed to create proxi_sensor module, err: %d, cause: %s", err, strerror(err));
-       }
-       if (!proxi_sensor)
-               module->sensors.push_back(proxi_sensor);
-#endif
-#if $LIGHT == 1
-       light_sensor *light_sensor = NULL;
-       try {
-               light_sensor = new(std::nothrow) light_sensor;
-       } catch (int err) {
-               ERR("Failed to create light_sensor module, err: %d, cause: %s", err, strerror(err));
-       }
-       if (!light_sensor)
-               module->sensors.push_back(light_sensor);
-#endif
-#if $GEO == 1
-       geo_sensor *geo_sensor = NULL;
-       try {
-               geo_sensor = new(std::nothrow) geo_sensor;
-       } catch (int err) {
-               ERR("Failed to create geo_sensor module, err: %d, cause: %s", err, strerror(err));
-       }
-       if (!geo_sensor)
-               module->sensors.push_back(geo_sensor);
-#endif
-#if $PRESSURE == 1
-       pressure_sensor *pressure_sensor = NULL;
-       try {
-               pressure_sensor = new(std::nothrow) pressure_sensor;
-       } catch (int err) {
-               ERR("Failed to create pressure_sensor module, err: %d, cause: %s", err, strerror(err));
-       }
-       if (!pressure_sensor)
-               module->sensors.push_back(pressure_sensor);
-#endif
-#if $TEMPERATURE == 1
-
-       temperature_sensor *temperature_sensor = NULL;
-       try {
-               temperature_sensor = new(std::nothrow) temperature_sensor;
-       } catch (int err) {
-               ERR("Failed to create temperature_sensor module, err: %d, cause: %s", err, strerror(err));
-       }
-       if (!temperature_sensor)
-               module->sensors.push_back(temperature_sensor);
-
-#endif
-#if $ULTRAVIOLET == 1
-       ultraviolet_sensor *ultraviolet_sensor = NULL;
-       try {
-               ultraviolet_sensor = new(std::nothrow) ultraviolet_sensor;
-       } catch (int err) {
-               ERR("Failed to create ultraviolet_sensor module, err: %d, cause: %s", err, strerror(err));
-       }
-       if (!ultraviolet_sensor)
-               module->sensors.push_back(ultraviolet_sensor);
-#endif
-#if $ORIENTATION == 1
-       orientation_sensor *orientation_sensor = NULL;
-       try {
-               orientation_sensor = new(std::nothrow) orientation_sensor;
-       } catch (int err) {
-               ERR("Failed to create orientation_sensor module, err: %d, cause: %s", err, strerror(err));
-       }
-       if (!orientation_sensor)
-               module->sensors.push_back(orientation_sensor);
-#endif
-#if $GRAVITY == 1
-       gravity_sensor *gravity_sensor = NULL;
-       try {
-               gravity_sensor = new(std::nothrow) gravity_sensor;
-       } catch (int err) {
-               ERR("Failed to create gravity_sensor module, err: %d, cause: %s", err, strerror(err));
-       }
-       if (!gravity_sensor)
-               module->sensors.push_back(gravity_sensor);
-#endif
-#if $LINEAR_ACCEL == 1
-       linear_accel_sensor *linear_accel_sensor = NULL;
-       try {
-               linear_accel_sensor = new(std::nothrow) linear_accel_sensor;
-       } catch (int err) {
-               ERR("Failed to create linear_accel_sensor module, err: %d, cause: %s", err, strerror(err));
-       }
-       if (!linear_accel_sensor)
-               module->sensors.push_back(linear_accel_sensor);
-#endif
-#if $GEOMAGNETIC_RV == 1
-       geomagnetic_rv_sensor *geomagnetic_rv_sensor = NULL;
-       try {
-               geomagnetic_rv_sensor = new(std::nothrow) geomagnetic_rv_sensor;
-       } catch (int err) {
-               ERR("Failed to create geomagnetic_rv_sensor module, err: %d, cause: %s", err, strerror(err));
-       }
-       if (!geomagnetic_rv_sensor)
-               module->sensors.push_back(geomagnetic_rv_sensor);
-#endif
-#if $GAMING_RV == 1
-       gaming_rv_sensor *gaming_rv_sensor = NULL;
-       try {
-               gaming_rv_sensor = new(std::nothrow) gaming_rv_sensor;
-       } catch (int err) {
-               ERR("Failed to create gaming_rv_sensor module, err: %d, cause: %s", err, strerror(err));
-       }
-       if (!gaming_rv_sensor)
-               module->sensors.push_back(gaming_rv_sensor);
-#endif
-#if $RV == 1
-       rv_sensor *rv_sensor = NULL;
-       try {
-               rv_sensor = new(std::nothrow) rv_sensor;
-       } catch (int err) {
-               ERR("Failed to create rv_sensor module, err: %d, cause: %s", err, strerror(err));
-       }
-       if (!rv_sensor)
-               module->sensors.push_back(rv_sensor);
-#endif
-#if $TILT == 1
-       tilt_sensor *tilt_sensor = NULL;
-       try {
-               tilt_sensor = new(std::nothrow) tilt_sensor;
-       } catch (int err) {
-               ERR("Failed to create tilt_sensor module, err: %d, cause: %s", err, strerror(err));
-       }
-       if (!tilt_sensor)
-               module->sensors.push_back(tilt_sensor);
-#endif
-#if $UNCAL_GYRO == 1
-       uncal_gyro_sensor *uncal_gyro_sensor = NULL;
-       try {
-               uncal_gyro_sensor = new(std::nothrow) uncal_gyro_sensor;
-       } catch (int err) {
-               ERR("Failed to create uncal_gyro_sensor module, err: %d, cause: %s", err, strerror(err));
-       }
-       if (!uncal_gyro_sensor)
-               module->sensors.push_back(uncal_gyro_sensor);
-#endif
-#if $BIO_LED_RED == 1
-       bio_led_red_sensor *bio_led_red_sensor = NULL;
-       try {
-               bio_led_red_sensor = new(std::nothrow) bio_led_red_sensor;
-       } catch (int err) {
-               ERR("Failed to create bio_led_red_sensor module, err: %d, cause: %s", err, strerror(err));
-       }
-       if (!bio_led_red_sensor)
-               module->sensors.push_back(bio_led_red_sensor);
-#endif
-#if $RV_RAW == 1
-       rv_raw_sensor *rv_raw_sensor = NULL;
-       try {
-               rv_raw_sensor = new(std::nothrow) rv_raw_sensor;
-       } catch (int err) {
-               ERR("Failed to create rv_raw_sensor module, err: %d, cause: %s", err, strerror(err));
-       }
-       if (!rv_raw_sensor)
-               module->sensors.push_back(rv_raw_sensor);
-
-#endif
-
-       return module;
-}
diff --git a/src/server/plugins/sensor_module_create.cpp.in b/src/server/plugins/sensor_module_create.cpp.in
new file mode 100644 (file)
index 0000000..2008bb5
--- /dev/null
@@ -0,0 +1,288 @@
+#ifdef ENABLE_ACCEL
+#include <accel_sensor.h>
+#endif
+#ifdef ENABLE_GYRO
+#include <gyro_sensor.h>
+#endif
+#ifdef ENABLE_PROXI
+#include <proxi_sensor.h>
+#endif
+#ifdef ENABLE_LIGHT
+#include <light_sensor.h>
+#endif
+#ifdef ENABLE_GEO
+#include <geo_sensor.h>
+#endif
+#ifdef ENABLE_AUTO_ROTATION
+#include <auto_rotation_sensor.h>
+#endif
+#ifdef ENABLE_PRESSURE
+#include <pressure_sensor.h>
+#endif
+#ifdef ENABLE_TEMPERATURE
+#include <temperature_sensor.h>
+#endif
+#ifdef ENABLE_ULTRAVIOLET
+#include <ultraviolet_sensor.h>
+#endif
+#ifdef ENABLE_BIO_LED_RED
+#include <bio_led_red_sensor.h>
+#endif
+#ifdef ENABLE_ORIENTATION
+#include <orientation_sensor.h>
+#endif
+#ifdef ENABLE_GEOMAGNETIC_RV
+#include <geomagnetic_rv_sensor.h>
+#endif
+#ifdef ENABLE_GAMING_RV
+#include <gaming_rv_sensor.h>
+#endif
+#ifdef ENABLE_TILT
+#include <tilt_sensor.h>
+#endif
+#ifdef ENABLE_UNCAL_GYRO
+#include <uncal_gyro_sensor.h>
+#endif
+#ifdef ENABLE_GRAVITY
+#include <gravity_sensor.h>
+#endif
+#ifdef ENABLE_LINEAR_ACCEL
+#include <linear_accel_sensor.h>
+#endif
+#ifdef ENABLE_RV
+#include <rv_sensor.h>
+#endif
+#ifdef ENABLE_RV_RAW
+#include <rv_raw_sensor.h>
+#endif
+
+#include <sf_common.h>
+
+extern "C" sensor_module* create(void)
+{
+       sensor_module *module = new(std::nothrow) sensor_module;
+       retvm_if(!module, NULL, "Failed to allocate memory");
+
+#ifdef ENABLE_ACCEL
+       accel_sensor *accel_sensor_ptr = NULL;
+       try {
+               accel_sensor_ptr = new(std::nothrow) accel_sensor;
+       } catch (int err) {
+               ERR("Failed to create accel_sensor module, err: %d, cause: %s", err, strerror(err));
+       }
+       if (accel_sensor_ptr != NULL) {
+               module->sensors.push_back(accel_sensor_ptr);
+       }
+#endif
+
+#ifdef ENABLE_AUTO_ROTATION
+       auto_rotation_sensor *auto_rotation_sensor_ptr = NULL;
+       try {
+               auto_rotation_sensor_ptr = new(std::nothrow) auto_rotation_sensor;
+       } catch (int err) {
+               ERR("Failed to create auto_rotation_sensor module, err: %d, cause: %s", err, strerror(err));
+       }
+       if (auto_rotation_sensor_ptr != NULL)
+               module->sensors.push_back(auto_rotation_sensor_ptr);
+#endif
+
+#ifdef ENABLE_GYRO
+       gyro_sensor *gyro_sensor_ptr = NULL;
+       try {
+               gyro_sensor_ptr = new(std::nothrow) gyro_sensor;
+       } catch (int err) {
+               ERR("Failed to create gyro_sensor module, err: %d, cause: %s", err, strerror(err));
+       }
+       if (gyro_sensor_ptr != NULL)
+               module->sensors.push_back(gyro_sensor_ptr);
+#endif
+
+#ifdef ENABLE_PROXI
+       proxi_sensor *proxi_sensor_ptr = NULL;
+       try {
+               proxi_sensor_ptr = new(std::nothrow) proxi_sensor;
+       } catch (int err) {
+               ERR("Failed to create proxi_sensor module, err: %d, cause: %s", err, strerror(err));
+       }
+       if (proxi_sensor_ptr != NULL)
+               module->sensors.push_back(proxi_sensor_ptr);
+#endif
+
+#ifdef ENABLE_LIGHT
+       light_sensor *light_sensor_ptr = NULL;
+       try {
+               light_sensor_ptr = new(std::nothrow) light_sensor;
+       } catch (int err) {
+               ERR("Failed to create light_sensor module, err: %d, cause: %s", err, strerror(err));
+       }
+       if (light_sensor_ptr != NULL)
+               module->sensors.push_back(light_sensor_ptr);
+#endif
+
+#ifdef ENABLE_GEO
+       geo_sensor *geo_sensor_ptr = NULL;
+       try {
+               geo_sensor_ptr = new(std::nothrow) geo_sensor;
+       } catch (int err) {
+               ERR("Failed to create geo_sensor module, err: %d, cause: %s", err, strerror(err));
+       }
+       if (geo_sensor_ptr != NULL)
+               module->sensors.push_back(geo_sensor_ptr);
+#endif
+
+#ifdef ENABLE_PRESSURE
+       pressure_sensor *pressure_sensor_ptr = NULL;
+       try {
+               pressure_sensor_ptr = new(std::nothrow) pressure_sensor;
+       } catch (int err) {
+               ERR("Failed to create pressure_sensor module, err: %d, cause: %s", err, strerror(err));
+       }
+       if (pressure_sensor_ptr != NULL)
+               module->sensors.push_back(pressure_sensor_ptr);
+#endif
+
+#ifdef ENABLE_TEMPERATURE
+       temperature_sensor *temperature_sensor_ptr = NULL;
+       try {
+               temperature_sensor_ptr = new(std::nothrow) temperature_sensor;
+       } catch (int err) {
+               ERR("Failed to create temperature_sensor module, err: %d, cause: %s", err, strerror(err));
+       }
+       if (temperature_sensor_ptr != NULL)
+               module->sensors.push_back(temperature_sensor_ptr);
+#endif
+
+#ifdef ENABLE_ULTRAVIOLET
+       ultraviolet_sensor *ultraviolet_sensor_ptr = NULL;
+       try {
+               ultraviolet_sensor_ptr = new(std::nothrow) ultraviolet_sensor;
+       } catch (int err) {
+               ERR("Failed to create ultraviolet_sensor module, err: %d, cause: %s", err, strerror(err));
+       }
+       if (ultraviolet_sensor_ptr != NULL)
+               module->sensors.push_back(ultraviolet_sensor_ptr);
+#endif
+
+#ifdef DENABLE_SENSOR_FUSION
+       fusion_sensor *fusion_sensor_ptr = NULL;
+       try {
+               fusion_sensor_ptr = new(std::nothrow) fusion_sensor;
+       } catch (int err) {
+               ERR("Failed to create fusion_sensor module, err: %d, cause: %s", err, strerror(err));
+       }
+       if (fusion_sensor_ptr != NULL)
+               module->sensors.push_back(fusion_sensor_ptr);
+#endif
+
+#ifdef ENABLE_ORIENTATION
+       orientation_sensor *orientation_sensor_ptr = NULL;
+       try {
+               orientation_sensor_ptr = new(std::nothrow) orientation_sensor;
+       } catch (int err) {
+               ERR("Failed to create orientation_sensor module, err: %d, cause: %s", err, strerror(err));
+       }
+       if (orientation_sensor_ptr != NULL)
+               module->sensors.push_back(orientation_sensor_ptr);
+#endif
+
+#ifdef ENABLE_GRAVITY
+       gravity_sensor *gravity_sensor_ptr = NULL;
+       try {
+               gravity_sensor_ptr = new(std::nothrow) gravity_sensor;
+       } catch (int err) {
+               ERR("Failed to create gravity_sensor module, err: %d, cause: %s", err, strerror(err));
+       }
+       if (gravity_sensor_ptr != NULL)
+               module->sensors.push_back(gravity_sensor_ptr);
+#endif
+
+#ifdef ENABLE_LINEAR_ACCEL
+       linear_accel_sensor *linear_accel_sensor_ptr = NULL;
+       try {
+               linear_accel_sensor_ptr = new(std::nothrow) linear_accel_sensor;
+       } catch (int err) {
+               ERR("Failed to create linear_accel_sensor module, err: %d, cause: %s", err, strerror(err));
+       }
+       if (linear_accel_sensor_ptr != NULL)
+               module->sensors.push_back(linear_accel_sensor_ptr);
+#endif
+
+#ifdef ENABLE_GEOMAGNETIC_RV
+       geomagnetic_rv_sensor *geomagnetic_rv_sensor_ptr = NULL;
+       try {
+               geomagnetic_rv_sensor_ptr = new(std::nothrow) geomagnetic_rv_sensor;
+       } catch (int err) {
+               ERR("Failed to create geomagnetic_rv_sensor module, err: %d, cause: %s", err, strerror(err));
+       }
+       if (geomagnetic_rv_sensor_ptr != NULL)
+               module->sensors.push_back(geomagnetic_rv_sensor_ptr);
+#endif
+
+#ifdef ENABLE_GAMING_RV
+       gaming_rv_sensor *gaming_rv_sensor_ptr = NULL;
+       try {
+               gaming_rv_sensor_ptr = new(std::nothrow) gaming_rv_sensor;
+       } catch (int err) {
+               ERR("Failed to create gaming_rv_sensor module, err: %d, cause: %s", err, strerror(err));
+       }
+       if (gaming_rv_sensor_ptr != NULL)
+               module->sensors.push_back(gaming_rv_sensor_ptr);
+#endif
+
+#ifdef ENABLE_RV
+       rv_sensor *rv_sensor_ptr = NULL;
+       try {
+               rv_sensor_ptr = new(std::nothrow) rv_sensor;
+       } catch (int err) {
+               ERR("Failed to create rv_sensor module, err: %d, cause: %s", err, strerror(err));
+       }
+       if (rv_sensor_ptr != NULL)
+               module->sensors.push_back(rv_sensor_ptr);
+#endif
+
+#ifdef ENABLE_TILT
+       tilt_sensor *tilt_sensor_ptr = NULL;
+       try {
+               tilt_sensor_ptr = new(std::nothrow) tilt_sensor;
+       } catch (int err) {
+               ERR("Failed to create tilt_sensor module, err: %d, cause: %s", err, strerror(err));
+       }
+       if (tilt_sensor_ptr != NULL)
+               module->sensors.push_back(tilt_sensor_ptr);
+#endif
+
+#ifdef ENABLE_UNCAL_GYRO
+       uncal_gyro_sensor *uncal_gyro_sensor_ptr = NULL;
+       try {
+               uncal_gyro_sensor_ptr = new(std::nothrow) uncal_gyro_sensor;
+       } catch (int err) {
+               ERR("Failed to create uncal_gyro_sensor module, err: %d, cause: %s", err, strerror(err));
+       }
+       if (uncal_gyro_sensor_ptr != NULL)
+               module->sensors.push_back(uncal_gyro_sensor_ptr);
+#endif
+
+#ifdef ENABLE_BIO_LED_RED
+       bio_led_red_sensor *bio_led_red_sensor_ptr = NULL;
+       try {
+               bio_led_red_sensor_ptr = new(std::nothrow) bio_led_red_sensor;
+       } catch (int err) {
+               ERR("Failed to create bio_led_red_sensor module, err: %d, cause: %s", err, strerror(err));
+       }
+       if (bio_led_red_sensor_ptr != NULL)
+               module->sensors.push_back(bio_led_red_sensor_ptr);
+#endif
+
+#ifdef ENABLE_RV_RAW
+       rv_raw_sensor *rv_raw_sensor_ptr = NULL;
+       try {
+               rv_raw_sensor_ptr = new(std::nothrow) rv_raw_sensor;
+       } catch (int err) {
+               ERR("Failed to create rv_raw_sensor module, err: %d, cause: %s", err, strerror(err));
+       }
+       if (rv_raw_sensor_ptr != NULL)
+               module->sensors.push_back(rv_raw_sensor_ptr);
+#endif
+
+       return module;
+}