Modified NOTICE file and license version
[apps/native/ug-wifi-direct.git] / ug-wifidirect / src / wfd_motion_control.c
index d09fd13..341b844 100755 (executable)
@@ -3,7 +3,7 @@
  *
  * Copyright 2012 Samsung Electronics Co., Ltd
  *
- * Licensed under the Flora License, Version 1.0 (the "License");
+ * Licensed under the Flora License, Version 1.1 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -39,15 +39,13 @@ static TARGET_VIEW_FOCUS __motion_target_view_focus_get(void *data)
 {
        struct ug_data *ugd = (struct ug_data *)data;
 
-       if ((ugd == NULL) || (ugd->naviframe == NULL)) {
+       if ((ugd == NULL) || (ugd->naviframe == NULL))
                return MOTION_TARGET_VIEW_FOCUS_OFF;
-       }
 
-       if (elm_object_focus_get(ugd->naviframe)) {
+       if (elm_object_focus_get(ugd->naviframe))
                return MOTION_TARGET_VIEW_FOCUS_ON;
-       } else {
+       else
                return MOTION_TARGET_VIEW_FOCUS_OFF;
-       }
 }
 
 
@@ -58,25 +56,24 @@ static void __motion_shake_cb(unsigned int event_type, sensor_event_data_t *even
        gboolean motion_activated = FALSE;
        struct ug_data *ugd = (struct ug_data *) data;
        if (NULL == ugd) {
-               DBG(LOG_ERROR,"NULL pointer!");
+               DBG(LOG_ERROR, "NULL pointer!");
                return;
        }
        TARGET_VIEW_FOCUS focus_state = __motion_target_view_focus_get(ugd);
 
        DBG(LOG_DEBUG, "event type: %d, focus state: %d\n", event_type, focus_state);
 
-       if (focus_state != MOTION_TARGET_VIEW_FOCUS_ON) {
+       if (focus_state != MOTION_TARGET_VIEW_FOCUS_ON)
                return;
-       }
 
        if (vconf_get_bool(VCONFKEY_SETAPPL_MOTION_ACTIVATION,
                        (void *)&motion_activated)) {
-               DBG(LOG_ERROR,"Get motion activation status fail");
+               DBG(LOG_ERROR, "Get motion activation status fail");
                return;
        }
 
        if (FALSE == motion_activated) {
-               DBG(LOG_INFO,"Motion value is false");
+               DBG(LOG_INFO, "Motion value is false");
                return;
        }
 
@@ -87,18 +84,13 @@ static void __motion_shake_cb(unsigned int event_type, sensor_event_data_t *even
        }
 
        if (FALSE == motion_activated) {
-               DBG(LOG_INFO,"Shake status is false");
+               DBG(LOG_INFO, "Shake status is false");
                return;
        }
 
        int ret = -1;
        const char *btn_text = NULL;
 
-       if (NULL == ugd) {
-               DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
-               return;
-       }
-
        wfd_refresh_wifi_direct_state(ugd);
 
        if (NULL == ugd->scan_toolbar) {
@@ -169,14 +161,13 @@ void motion_create(struct ug_data *ugd)
                goto fail;
        }
 
-       DBG(LOG_INFO, "Succesfully, Init Sensor Handle\n");
+       DBG(LOG_INFO, "Successfully, Init Sensor Handle\n");
        return;
 
 fail:
        ret = sf_disconnect(motion_handle);
-       if (ret < 0) {
+       if (ret < 0)
                DBG(LOG_ERROR, "Failed Operation sf_disconnect. [%d]\n", ret);
-       }
 }
 
 void motion_destroy(void)
@@ -189,15 +180,14 @@ void motion_destroy(void)
        }
 
        ret = sf_stop(motion_handle);
-       if (ret < 0) {
+       if (ret < 0)
                DBG(LOG_ERROR, "Failed Operation sf_stop. [%d]\n", ret);
-       }
+
        ret = sf_unregister_event(motion_handle, MOTION_ENGINE_EVENT_SHAKE);
-       if (ret < 0) {
+       if (ret < 0)
                DBG(LOG_ERROR, "Failed Operation sf_unregister_event. [%d]\n", ret);
-       }
+
        ret = sf_disconnect(motion_handle);
-       if (ret < 0) {
+       if (ret < 0)
                DBG(LOG_ERROR, "Failed Operation sf_disconnect. [%d]\n", ret);
-       }
 }