[TBT][Sensor][NonACR][TNEXT-2915,Added new testcasefor pedometer sensor] 59/145859/2
authornibha.sharma <nibha.sharma@samsung.com>
Thu, 24 Aug 2017 05:49:17 +0000 (11:19 +0530)
committerNibha Sharma <nibha.sharma@samsung.com>
Thu, 24 Aug 2017 07:36:46 +0000 (07:36 +0000)
Change-Id: I7d599aa4f6744532ebfcef97ec61e6b283b0cbe0
Signed-off-by: nibha.sharma <nibha.sharma@samsung.com>
release/binary-armv7l/org.tizen.tbtcoreapp-1.0.0-arm.tpk
release/binary-x86/org.tizen.tbtcoreapp-1.0.0-x86.tpk
tbtcoreapp/inc/model/tbt-info.h
tbtcoreapp/inc/utils/app_module_config.h
tbtcoreapp/src/model/tbt-list.c
tbtcoreapp/src/view/tbt-genlist-view.c
tbtcoreapp/src/view/tbt-sensor-view.c [changed mode: 0644->0755]
tbtcoreapp/tizen-manifest.xml

index f445ee34f07ce53ec9f2cc0753a4a2e414284f6e..6821430eb82483f218365434b0a9d352339bda75 100755 (executable)
Binary files a/release/binary-armv7l/org.tizen.tbtcoreapp-1.0.0-arm.tpk and b/release/binary-armv7l/org.tizen.tbtcoreapp-1.0.0-arm.tpk differ
index 5f02fb38e25e53f89137207983385e24e7232935..567c8af88fc7714545be89e0b9a2fbc78a3bcc31 100755 (executable)
Binary files a/release/binary-x86/org.tizen.tbtcoreapp-1.0.0-x86.tpk and b/release/binary-x86/org.tizen.tbtcoreapp-1.0.0-x86.tpk differ
index 6758a118c9aed72dd54b64eef47c90608f3de0dc..3841a301e9493899c90bb94099a420c94f741e6c 100755 (executable)
@@ -135,6 +135,7 @@ typedef enum {
     TBT_APP_SENSOR_ULTRA_VIOLET,
     TBT_APP_SENSOR_MAGNATOMETER,
     TBT_APP_SENSOR_PRESSURE,
+    TBT_APP_SENSOR_PEDOMETER,
 
 
     TBT_APP_ANIMATION_FADE,
index 1f3d356989c1da3488a0b8bbd46e3e475f3daa44..fa957cd2a4d8dc88b6b1cb278c7bd4717d58f460 100755 (executable)
 #define TBT_MODULE_APP_SENSOR_ULTRA_VIOLET
 #define TBT_MODULE_APP_SENSOR_PRESSURE
 #define TBT_MODULE_APP_SENSOR_MAGNATOMETER
+#define TBT_MODULE_APP_SENSOR_PEDOMETER
 
 #define TBT_MODULE_ANIMATION
 #define TBT_MODULE_APP_ANIMATION_FADE
index f57b0c13679a8340bd126d595cbca352149abe70..1fa1f263bfcb00a4f5b14a9f5341c8ef895d9e75 100755 (executable)
@@ -1383,6 +1383,25 @@ static tbt_info tbtapps[] =
                        .features_required = {FEATURE_SENSOR_MAGNETOMETER}
                },
        #endif
+
+       #ifdef TBT_MODULE_APP_SENSOR_PEDOMETER
+
+               //Pedometer
+               {
+                       .name = "Pedometer",
+                       .parent = "Sensor",
+                       .apptype = TBT_APP_SENSOR_PEDOMETER,
+                       .icon_name = "dummy",
+                       .info = "1. Walk with the device about 10 steps or shake the device up and down.<br/>"
+                                       "2. Pedometer state will be updated accordingly",
+                       .result = -1,
+                       .sensor_response_interval = 100,
+                       .sensortype = SENSOR_HUMAN_PEDOMETER,
+                       .units = SENSOR_UNIT_METRE_PER_SECOND_SQUARED,
+                       .required_features_count = 1,
+                       .features_required = {FEATURE_SENSOR_PEDOMETER}
+               },
+       #endif
 #endif
 
 #ifdef TBT_MODULE_ANIMATION
@@ -2907,7 +2926,7 @@ void tbt_list_init()
     {
         info->result = 0;
                #ifdef TBT_MODULE_SENSOR
-        if(info->apptype == TBT_APP_SENSOR_ACCELEROMETER || info->apptype == TBT_APP_SENSOR_GYROSCOPE || info->apptype == TBT_APP_SENSOR_PROXIMITY || info->apptype == TBT_APP_SENSOR_MAGNATOMETER || info->apptype == TBT_APP_SENSOR_LIGHT || info->apptype == TBT_APP_SENSOR_PRESSURE || info->apptype == TBT_APP_SENSOR_ULTRA_VIOLET)
+        if(info->apptype == TBT_APP_SENSOR_ACCELEROMETER || info->apptype == TBT_APP_SENSOR_GYROSCOPE || info->apptype == TBT_APP_SENSOR_PROXIMITY || info->apptype == TBT_APP_SENSOR_MAGNATOMETER || info->apptype == TBT_APP_SENSOR_LIGHT || info->apptype == TBT_APP_SENSOR_PRESSURE || info->apptype == TBT_APP_SENSOR_ULTRA_VIOLET || info->apptype == TBT_APP_SENSOR_PEDOMETER)
        {
                float resolution = 1.0;
                int ret;
index 5166958cf6a7e0e48c43d5fec4ddbb7ad86f64bb..bb64d8eb1ce3383cc294173bc80ffcab830e5c61 100755 (executable)
@@ -883,6 +883,10 @@ static void _gl_item_selected_cb(void *data, Evas_Object *obj EINA_UNUSED, void
                        case TBT_APP_SENSOR_PRESSURE:
                                sensor_view_add(view->navi, info, it);
                                break;
+
+                       case TBT_APP_SENSOR_PEDOMETER:
+                               sensor_view_add(view->navi, info, it);
+                               break;
                #endif
 
                #ifdef TBT_MODULE_ANIMATION
old mode 100644 (file)
new mode 100755 (executable)
index 33fbb5d..ab0a1d0
@@ -136,6 +136,8 @@ struct _sensor_view
        Evas_Object *ultraviolet_image;
        Evas_Object *ultraviolet_label;
 
+       Evas_Object *pedometer_label;
+
        Evas_Object *fork_x;
        Evas_Object *fork_y;
        Evas_Object *fork_z;
@@ -373,6 +375,11 @@ sensor_view *sensor_view_add(Evas_Object *navi, tbt_info *tbt_info, Elm_Object_I
                tbt_info->layout_group = "magnatometer_sensor_viewer";
                tbt_info->layout_file = get_edje_path("sensor_viewer.edj");
        }
+       else if(tbt_info->apptype == TBT_APP_SENSOR_PEDOMETER)
+       {
+               tbt_info->layout_group = "ultra_violet_sensor_viewer";
+               tbt_info->layout_file = get_edje_path("sensor_viewer.edj");
+       }
        else
        {
                tbt_info->layout_group = "sensor_viewer";
@@ -546,6 +553,14 @@ sensor_view *sensor_view_add(Evas_Object *navi, tbt_info *tbt_info, Elm_Object_I
                elm_object_part_content_set(this->view->layout, "image_view3", label);
 
        }
+       else if(this->sensor_info->apptype == TBT_APP_SENSOR_PEDOMETER)
+       {
+               get_screen_resolution(this);
+
+               this->pedometer_label = ui_utils_label_add(this->view->layout, "");
+               elm_object_part_content_set(this->view->layout, "text_view", this->pedometer_label);
+               sensor_get_default_sensor(SENSOR_HUMAN_PEDOMETER, &this->sensor_info->sensor);
+       }
 
        this->glview = gles_cube_view_init(this);
        if(this->glview == NULL)
@@ -557,9 +572,6 @@ sensor_view *sensor_view_add(Evas_Object *navi, tbt_info *tbt_info, Elm_Object_I
        this->genlist = genlist_create(this);
        RETVM_IF(NULL == this->genlist, NULL, "genlist_create is null");
 
-
-
-
        sensor_value_items_create(this);
        sensor_value_items_prepare(this);
 
@@ -581,8 +593,10 @@ sensor_view *sensor_view_add(Evas_Object *navi, tbt_info *tbt_info, Elm_Object_I
 static void sensor_start(sensor_view *view)
 {
        RETM_IF(NULL == view, "view is NULL");
-
+       DBG("Inside sensor_start");
        sensor_error_e err = SENSOR_ERROR_NONE;
+       //sensor_get_default_sensor(SENSOR_HUMAN_PEDOMETER, &view->sensor_info->sensor);
+       
     err = sensor_create_listener(view->sensor_info->sensor, &view->sensor_listener);
     RETM_IF(err != SENSOR_ERROR_NONE, "sensor_create_listener failed(%s)", get_sensor_error(err));
     RETM_IF(NULL == view->sensor_listener, "Sensor listener is NULL!");
@@ -806,6 +820,23 @@ static void genlist_sensor_value_items_update(sensor_view *view, float *values)
       rotate_image(view->fork_y, y);
       rotate_image(view->fork_z, z);
        }
+       else if(view->sensor_info->apptype == TBT_APP_SENSOR_PEDOMETER)
+       {
+               DBG("Distance: %f %f %f %f %f %f %f", values[0], values[1], values[2],values[3],values[4],values[5],values[6],values[7]);
+
+               if(values[6] == 0.0f)
+               {
+                       ui_utils_label_set_text(view->pedometer_label, "SENSOR_PEDOMETER_STATE_STOP", "left");
+               }
+               else if(values[6] ==3.0f || values[6] == 3.7f)
+               {
+                       ui_utils_label_set_text(view->pedometer_label, "SENSOR_PEDOMETER_STATE_RUN", "left");
+               }
+               else if(values[6] == 1.5f || values[6] == 2.0f)
+               {
+                       ui_utils_label_set_text(view->pedometer_label, "SENSOR_PEDOMETER_STATE_WALK", "left");
+               }
+       }
 }
 
 
@@ -1469,6 +1500,7 @@ static void _sensor_listener_cb(sensor_h sensor, sensor_event_s *sensor_data, vo
  */
 static void _sensor_view_transition_finished_cb(void *data, Evas_Object *obj, void *event_info)
 {
+       DBG("Inside _sensor_view_transition_finished_cb");
        sensor_view *view = NULL;
        view = (sensor_view*)data;
        RETM_IF(NULL == view, "view is NULL");
@@ -1518,6 +1550,10 @@ static bool is_sensor_supported(sensor_view *view)
        {
                type= SENSOR_ULTRAVIOLET;
        }
+       else if(view->view->tbt_info->apptype == TBT_APP_SENSOR_PEDOMETER)
+       {
+               type= SENSOR_HUMAN_PEDOMETER;
+       }
        int ret = sensor_is_supported(type, &supported);
        RETVM_IF(SENSOR_ERROR_NONE!=ret, false,"sensor_is_supported failed: %s",get_sensor_error(ret));
 
index ee6c530f3cf8bd9b759a519833a48a3c880a7ae5..6a202dea0d9c79c5dd12f7bd3d1533b710c88989 100644 (file)
@@ -6,6 +6,7 @@
         <icon>tbtcoreapp.png</icon>
     </ui-application>
     <privileges>
+        <privilege>http://tizen.org/privilege/healthinfo</privilege>
         <privilege>http://tizen.org/privilege/contact.read</privilege>
         <privilege>http://tizen.org/privilege/datasharing</privilege>
         <privilege>http://tizen.org/privilege/packagemanager.info</privilege>