Remap the axis enums for ABI compatibility 55/68055/1
authorMu-Woong Lee <muwoong.lee@samsung.com>
Mon, 2 May 2016 04:55:34 +0000 (13:55 +0900)
committerMu-Woong Lee <muwoong.lee@samsung.com>
Mon, 2 May 2016 04:55:34 +0000 (13:55 +0900)
Change-Id: I282db494c388f8c09f58021026b78110acedd231
Signed-off-by: Mu-Woong Lee <muwoong.lee@samsung.com>
include/sensor.h
src/sensor.cpp

index f79b76a..f40013e 100644 (file)
@@ -859,18 +859,18 @@ int sensor_get_max_batch_count(sensor_h sensor, int *max_batch_count);
  */
 typedef enum
 {
-    SENSOR_UTIL_AXIS_X = 0x01,          /**< +X */
-    SENSOR_UTIL_AXIS_Y = 0x02,          /**< +Y */
-    SENSOR_UTIL_AXIS_Z = 0x03,          /**< +Z */
-    SENSOR_UTIL_AXIS_MINUS_X = 0x81,    /**< -X */
-    SENSOR_UTIL_AXIS_MINUS_Y = 0x82,    /**< -Y */
-    SENSOR_UTIL_AXIS_MINUS_Z = 0x83,    /**< -Z */
-    sensor_util_axis_x = 0x01,
-    sensor_util_axis_y = 0x02,
-    sensor_util_axis_z = 0x03,
-    sensor_util_axis_minus_x = 0x81,
-    sensor_util_axis_minus_y = 0x82,
-    sensor_util_axis_minus_z = 0x83,
+    SENSOR_UTIL_AXIS_MINUS_X = 0,  /**< -X */
+    SENSOR_UTIL_AXIS_MINUS_Y,      /**< -Y */
+    SENSOR_UTIL_AXIS_MINUS_Z,      /**< -Z */
+    SENSOR_UTIL_AXIS_X,            /**< +X */
+    SENSOR_UTIL_AXIS_Y,            /**< +Y */
+    SENSOR_UTIL_AXIS_Z,            /**< +Z */
+    sensor_util_axis_minus_x = SENSOR_UTIL_AXIS_MINUS_X,
+    sensor_util_axis_minus_y,
+    sensor_util_axis_minus_z,
+    sensor_util_axis_x,
+    sensor_util_axis_y,
+    sensor_util_axis_z,
 } sensor_util_axis_e;
 
 /**
index ce6b02a..2dc1aef 100644 (file)
@@ -47,6 +47,8 @@
 
 #define SENSOR_LISTENER_MAGIC 0xCAFECAFE
 
+#define CONVERT_AXIS_ENUM(X) ((X) < 3 ? (X) + 0x81 : (X) - 2)
+
 static int sensor_connect(sensor_h sensor, sensor_listener_h listener)
 {
        int id = SENSOR_UNDEFINED_ID;
@@ -811,7 +813,7 @@ int sensor_util_get_inclination(float I[], float* inclination)
 
 int sensor_util_remap_coordinate_system(float inR[], sensor_util_axis_e x, sensor_util_axis_e y, float outR[])
 {
-       if (remapCoordinateSystem(inR, x, y, outR) < 0)
+       if (remapCoordinateSystem(inR, CONVERT_AXIS_ENUM(x), CONVERT_AXIS_ENUM(y), outR) < 0)
                return SENSOR_ERROR_INVALID_PARAMETER;
 
        return SENSOR_ERROR_NONE;