X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=ug-wifidirect%2Fsrc%2Fwfd_motion_control.c;h=341b844ef278269b45d9ab12abe2e47c773daa0f;hb=59bdd96fe9bf5bb8350a51db2c28e30c7c2f8fd3;hp=d09fd13dea649cf32414b1431c8c96c18333d40f;hpb=5870dd3f1c0879760713757244d7d1b9bab71306;p=apps%2Fnative%2Fug-wifi-direct.git diff --git a/ug-wifidirect/src/wfd_motion_control.c b/ug-wifidirect/src/wfd_motion_control.c index d09fd13..341b844 100755 --- a/ug-wifidirect/src/wfd_motion_control.c +++ b/ug-wifidirect/src/wfd_motion_control.c @@ -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); - } }