Gesture: reorganize the namespace of motion_engine 75/48275/1
authorMu-Woong <muwoong.lee@samsung.com>
Thu, 17 Sep 2015 04:37:25 +0000 (13:37 +0900)
committerMu-Woong <muwoong.lee@samsung.com>
Thu, 17 Sep 2015 04:37:25 +0000 (13:37 +0900)
Change-Id: I3b7b99ac7235fb4c2c8bd14e140bc0023d9f2d9e
Signed-off-by: Mu-Woong <muwoong.lee@samsung.com>
include/gesture_recognition.h
src/gesture/gesture.cpp
src/gesture/motion_engine.cpp
src/gesture/motion_engine.h

index e4f2de0..65b3f2a 100644 (file)
@@ -94,18 +94,18 @@ typedef enum {
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  */
 typedef enum {
-       GESTURE_EVENT_NONE              = 0,    /**< The gesture is not detected */
-       GESTURE_EVENT_DETECTED  = 1,    /**< The gesture is detected */
+       GESTURE_EVENT_NONE              = 0,    /**< Detected nothing */
+       GESTURE_EVENT_DETECTED  = 1,    /**< Detected the gesture */
 
-       GESTURE_SHAKE_DETECTED  = 1,    /**< Shake gesture is detected */
-       GESTURE_SHAKE_FINISHED  = 2,    /**< Shake gesture finished */
+       GESTURE_SHAKE_DETECTED  = 1,    /**< Shake gesture started */
+       GESTURE_SHAKE_FINISHED  = 2,    /**< Shake gesture stopped */
 
-       GESTURE_SNAP_X_NEGATIVE = 1,    /**< -X snap is detected */
-       GESTURE_SNAP_X_POSITIVE = 2,    /**< +X snap is detected */
-       GESTURE_SNAP_Y_NEGATIVE = 3,    /**< -Y snap is detected */
-       GESTURE_SNAP_Y_POSITIVE = 4,    /**< +Y snap is detected */
-       GESTURE_SNAP_Z_NEGATIVE = 5,    /**< -Z snap is detected */
-       GESTURE_SNAP_Z_POSITIVE = 6,    /**< +Z snap is detected */
+       GESTURE_SNAP_X_NEGATIVE = 1,    /**< Detected -X snap */
+       GESTURE_SNAP_X_POSITIVE = 2,    /**< Detected +X snap */
+       GESTURE_SNAP_Y_NEGATIVE = 3,    /**< Detected -Y snap */
+       GESTURE_SNAP_Y_POSITIVE = 4,    /**< Detected +Y snap */
+       GESTURE_SNAP_Z_NEGATIVE = 5,    /**< Detected -Z snap */
+       GESTURE_SNAP_Z_POSITIVE = 6,    /**< Detected +Z snap */
 } gesture_event_e;
 
 /**
index 2c34c85..f609090 100644 (file)
@@ -25,6 +25,8 @@
 #include "motion_engine.h"
 #include "gesture.h"
 
+using namespace ctx::gesture;
+
 static ctx::handle_map_t<_cx_gesture_h> handle_map;
 
 void cx_gesture_deliver_data(int req_id, _cx_gesture_data data, double timestamp, int error)
@@ -51,14 +53,14 @@ EXTAPI int gesture_is_supported(gesture_type_e gesture, bool* supported)
        ASSERT_SUPPORTED(FEATURE_KEY_GESTURE);
        ASSERT_NULL(supported);
 
-       if (!ctx::gesture::me_check_coverage(gesture))
-               return GESTURE_ERROR_NONE;
+       int ret = GESTURE_ERROR_NONE;
 
-       int ret = ctx::gesture::me_is_supported(gesture);
-       if (ret == GESTURE_ERROR_NONE)
-               *supported = true;
+       if (motion_engine::check_coverage(gesture)) {
+               ret = motion_engine::is_supported(gesture);
+               *supported = (ret == GESTURE_ERROR_NONE);
+       }
 
-       return GESTURE_ERROR_NONE;
+       return ret;
 }
 
 EXTAPI int gesture_create(gesture_h *handle)
@@ -109,8 +111,8 @@ EXTAPI int gesture_start_recognition(gesture_h handle, gesture_type_e gesture, g
 
        int ret;
 
-       if (ctx::gesture::me_check_coverage(gesture)) {
-               ret = ctx::gesture::me_start(handle, gesture, option);
+       if (motion_engine::check_coverage(gesture)) {
+               ret = motion_engine::start(handle, gesture, option);
        } else {
                ret = GESTURE_ERROR_INVALID_PARAMETER;
        }
@@ -128,8 +130,8 @@ EXTAPI int gesture_stop_recognition(gesture_h handle)
        int ret = GESTURE_ERROR_NOT_STARTED;
 
        if (handle_map.find(handle->req_id) != NULL) {
-               if (ctx::gesture::me_check_coverage(handle->gesture))
-                       ctx::gesture::me_stop(handle);
+               if (motion_engine::check_coverage(handle->gesture))
+                       motion_engine::stop(handle);
 
                handle_map.remove(handle->req_id);
                ret = GESTURE_ERROR_NONE;
index fb2ae38..1c01997 100644 (file)
@@ -159,7 +159,7 @@ static int get_me_option(int mode)
        return CTX_VALUE_UNDEFINED;
 }
 
-bool ctx::gesture::me_check_coverage(int motion)
+bool ctx::gesture::motion_engine::check_coverage(int motion)
 {
        switch (motion) {
        case GESTURE_SHAKE:
@@ -177,7 +177,7 @@ bool ctx::gesture::me_check_coverage(int motion)
        }
 }
 
-int ctx::gesture::me_is_supported(int motion)
+int ctx::gesture::motion_engine::is_supported(int motion)
 {
        int handle = -1, res;
        int ev_type     = get_event_type(motion);
@@ -187,7 +187,7 @@ int ctx::gesture::me_is_supported(int motion)
        return res;
 }
 
-int ctx::gesture::me_start(_cx_gesture_h *handle, int gesture, int option)
+int ctx::gesture::motion_engine::start(_cx_gesture_h *handle, int gesture, int option)
 {
        int ev_type     = get_event_type(gesture);
        int me_opt      = get_me_option(option);
@@ -206,7 +206,7 @@ int ctx::gesture::me_start(_cx_gesture_h *handle, int gesture, int option)
        return GESTURE_ERROR_NONE;
 }
 
-int ctx::gesture::me_stop(_cx_gesture_h *handle)
+int ctx::gesture::motion_engine::stop(_cx_gesture_h *handle)
 {
        LOGI("Stopping MotionEngine Event %d", handle->me_event);
 
index 82f8003..36f3ec7 100644 (file)
 #include <stdbool.h>
 #include "gesture.h"
 
-namespace ctx { namespace gesture{
+namespace ctx { namespace gesture { namespace motion_engine {
 
-       bool me_check_coverage(int gesture);
-       int me_is_supported(int gesture);
-       int me_start(_cx_gesture_h *handle, int gesture, int mode);
-       int me_stop(_cx_gesture_h *handle);
+       bool check_coverage(int gesture);
+       int is_supported(int gesture);
+       int start(_cx_gesture_h *handle, int gesture, int mode);
+       int stop(_cx_gesture_h *handle);
 
-} }    /* namespace ctx::gesture */
+} } }
 
 #endif /* End of _CX_GESTURE_MOTION_ENGINE_H_ */