stefan pushed a commit to branch master.

commit 25843ac65e058a5119cbc4742682d79ce778c2ba
Author: Stefan Schmidt <[email protected]>
Date:   Thu Apr 11 11:58:13 2013 +0100

    eeze/sensor/tizen: Fix bug where we set the wrong sensor type to the object.
    
    Eeze sensor and Tizen types can't be in sync as the order have been changed
    several times in Tizen already. We need to keep the order stable for ABI
    compliance though after 1.8.
    
    While we did the translation in one direction we did not in the other. Fix
    this bug that shows now.
---
 src/modules/eeze/sensor/tizen/tizen.c | 71 ++++++++++++++++++++++++++++++++++-
 1 file changed, 70 insertions(+), 1 deletion(-)

diff --git a/src/modules/eeze/sensor/tizen/tizen.c 
b/src/modules/eeze/sensor/tizen/tizen.c
index 50cabae..9dfe34d 100644
--- a/src/modules/eeze/sensor/tizen/tizen.c
+++ b/src/modules/eeze/sensor/tizen/tizen.c
@@ -96,6 +96,75 @@ eeze_to_tizen(Eeze_Sensor_Type type)
      }
 }
 
+/* Reverse mapping from Tizen to eeze sensor types */
+static Eeze_Sensor_Type
+tizen_to_eeze(sesnor_type_e type)
+{
+   switch (type)
+     {
+      case SENSOR_ACCELEROMETER:
+        return EEZE_SENSOR_TYPE_ACCELEROMETER;
+
+      case SENSOR_GRAVITY:
+        return EEZE_SENSOR_TYPE_GRAVITY;
+
+      case SENSOR_LINEAR_ACCELERATION:
+        return EEZE_SENSOR_TYPE_LINEAR_ACCELERATION;
+
+      case SENSOR_DEVICE_ORIENTATION:
+        return EEZE_SENSOR_TYPE_DEVICE_ORIENTATION;
+
+      case SENSOR_MAGNETIC:
+        return EEZE_SENSOR_TYPE_MAGNETIC;
+
+      case SENSOR_ORIENTATION:
+        return EEZE_SENSOR_TYPE_ORIENTATION;
+
+      case SENSOR_GYROSCOPE:
+        return EEZE_SENSOR_TYPE_GYROSCOPE;
+
+      case SENSOR_LIGHT:
+        return EEZE_SENSOR_TYPE_LIGHT;
+
+      case SENSOR_PROXIMITY:
+        return EEZE_SENSOR_TYPE_PROXIMITY;
+
+      case SENSOR_MOTION_SNAP:
+        return EEZE_SENSOR_TYPE_MOTION_SNAP;
+
+      case SENSOR_MOTION_SHAKE:
+        return EEZE_SENSOR_TYPE_MOTION_SHAKE;
+
+      case SENSOR_MOTION_DOUBLETAP:
+        return EEZE_SENSOR_TYPE_MOTION_DOUBLETAP;
+
+      case SENSOR_MOTION_PANNING:
+        return EEZE_SENSOR_TYPE_MOTION_PANNING;
+
+      case SENSOR_MOTION_PANNING_BROWSE:
+        return EEZE_SENSOR_TYPE_MOTION_PANNING_BROWSE;
+
+      case SENSOR_MOTION_TILT:
+        return EEZE_SENSOR_TYPE_MOTION_TILT;
+
+      case SENSOR_MOTION_FACEDOWN:
+        return EEZE_SENSOR_TYPE_MOTION_FACEDOWN;
+
+      case SENSOR_MOTION_DIRECTCALL:
+        return EEZE_SENSOR_TYPE_MOTION_DIRECT_CALL;
+
+      case SENSOR_MOTION_SMART_ALERT:
+        return EEZE_SENSOR_TYPE_MOTION_SMART_ALERT;
+
+      case SENSOR_MOTION_NO_MOVE:
+        return EEZE_SENSOR_TYPE_MOTION_NO_MOVE;
+
+      default:
+        ERR("No matching eeze sensor type available.");
+        return -1;
+     }
+}
+
 /* All following callback function work with the same scheme.
  * They are callbacks coming in from the tizen system sensor library. With the
  * data we receive we update the matching sensor object to always have the
@@ -1230,7 +1299,7 @@ eeze_sensor_tizen_sensors_find(void)
         if (supported)
           {
              Eeze_Sensor_Obj *obj = calloc(1, sizeof(Eeze_Sensor_Obj));
-             obj->type = type;
+             obj->type = tizen_to_eeze(type);
              esensor_module->sensor_list = 
eina_list_append(esensor_module->sensor_list, obj);
           }
      }

-- 

------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter

Reply via email to