4 * Copyright 2012 Samsung Electronics Co., Ltd
6 * Licensed under the Flora License, Version 1.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.tizenopensource.org/license
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
22 #define UG_MODULE_API __attribute__ ((visibility("default")))
28 #include <sys/utsname.h>
31 #include <Elementary.h>
32 #include <ui-gadget-module.h>
33 #include <app_control.h>
36 #include "wfd_ug_view.h"
37 #include "wfd_client.h"
38 #ifdef MOTION_CONTROL_ENABLE
39 #include "wfd_motion_control.h"
42 void initialize_gen_item_class();
44 struct ug_data *global_ugd = NULL;
46 struct ug_data *wfd_get_ug_data()
51 static void __wfd_main_vconf_change_cb(keynode_t *key, void *data)
54 WFD_RET_IF(NULL == key, "ERROR : key is NULL !!\n");
55 WFD_RET_IF(NULL == data, "ERROR : data is NULL");
56 struct ug_data *ugd = (struct ug_data *) data;
58 char *vconf_name = vconf_keynode_get_name(key);
60 if (!g_strcmp0(vconf_name, VCONFKEY_SETAPPL_DEVICE_NAME_STR)){
61 char *name_value = NULL;
62 name_value = vconf_get_str(VCONFKEY_SETAPPL_DEVICE_NAME_STR);
63 WFD_RET_IF (!name_value, "Get string is failed");
64 DBG(LOG_INFO,"name : %s", name_value);
66 if (ugd->device_name_item && g_strcmp0(ugd->dev_name, name_value))
67 wfd_ug_view_refresh_glitem(ugd->device_name_item);
71 DBG(LOG_ERROR, "vconf_name is error");
77 static void _wifi_on_state_cb(keynode_t *key, void *data)
79 WFD_RET_IF(NULL == key, "ERROR : key is NULL !!\n");
80 WFD_RET_IF(NULL == data, "ERROR : data is NULL");
82 struct ug_data *ugd = (struct ug_data *)data;
85 if (vconf_get_int(VCONFKEY_WIFI_STATE, &wifi_state) < 0) {
86 DBG(LOG_ERROR, "Failed to get vconf VCONFKEY_WIFI_STATE\n");
90 DBG(LOG_INFO, "WiFi State [%d]\n", wifi_state);
91 if (wifi_state > VCONFKEY_WIFI_OFF && wifi_state < VCONFKEY_WIFI_STATE_MAX) {
92 if (WIFI_DIRECT_ERROR_NONE != wifi_direct_get_state(&ugd->wfd_status)) {
93 DBG(LOG_ERROR, "Failed to Get WiFi Direct State");
96 if (ugd->wfd_status <= WIFI_DIRECT_STATE_DEACTIVATING) {
97 DBG(LOG_INFO, "Activate WiFi Direct...");
98 if (FALSE != wfd_client_switch_on(ugd)) {
99 DBG(LOG_ERROR, "Failed to Activate WiFi Direct");
107 static void __wfd_hotspot_mode_vconf_change_cb(keynode_t *key, void *data)
109 DBG(LOG_INFO, "__wfd_hotspot_mode_vconf_change_cb");
110 if (NULL == key || NULL == data) {
111 DBG(LOG_INFO, "Invalid parameters \n");
114 struct ug_data *ugd = (struct ug_data *) data;
115 int hotspot_mode = 0;
118 res = vconf_get_int(VCONFKEY_MOBILE_HOTSPOT_MODE, &hotspot_mode);
120 DBG(LOG_INFO, "Failed to get vconf value for PLMN(%d)", res);
123 DBG(LOG_INFO, "__wfd_hotspot_mode_vconf_change_cb mode %d", hotspot_mode);
125 if (VCONFKEY_MOBILE_HOTSPOT_MODE_NONE == hotspot_mode) {
126 if (NULL != ugd->act_popup) {
127 evas_object_del(ugd->act_popup);
129 #ifdef WFD_ON_OFF_GENLIST
130 wfd_ug_refresh_on_off_check(ugd);
132 } else if (hotspot_mode == VCONFKEY_MOBILE_HOTSPOT_MODE_WIFI ||
133 hotspot_mode == VCONFKEY_MOBILE_HOTSPOT_MODE_WIFI_AP) {
134 if (NULL != ugd->warn_popup) {
135 evas_object_del(ugd->warn_popup);
136 ugd->warn_popup = NULL;
143 * This function let the ug create backgroud
145 * @param[in] ugd the pointer to the parent object
146 * @param[in] ugd the pointer to the main data structure
148 static Evas_Object *_create_bg(Evas_Object *parent, char *style)
153 bg = elm_bg_add(parent);
154 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
155 elm_object_style_set(bg, style);
156 evas_object_show(bg);
163 * This function let the ug create full view
165 * @param[in] ugd the pointer to the parent object
166 * @param[in] ugd the pointer to the main data structure
168 static Evas_Object *_create_fullview(Evas_Object *parent, struct ug_data *ugd)
173 if (parent == NULL) {
174 DBG(LOG_ERROR, "Incorrenct parameter");
178 /* Create Full view */
179 base = elm_layout_add(parent);
181 DBG(LOG_ERROR, "Failed to add layout");
185 elm_layout_theme_set(base, "layout", "application", "default");
186 evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
187 evas_object_size_hint_align_set(base, EVAS_HINT_FILL, EVAS_HINT_FILL);
194 * This function let the ug create frame view
196 * @param[in] ugd the pointer to the parent object
197 * @param[in] ugd the pointer to the main data structure
199 static Evas_Object *_create_frameview(Evas_Object *parent, struct ug_data *ugd)
204 if (parent == NULL) {
205 DBG(LOG_ERROR, "Incorrenct parameter");
209 /* Create Frame view */
210 base = elm_layout_add(parent);
212 DBG(LOG_ERROR, "Failed to add layout");
216 elm_layout_theme_set(base, "layout", "application", "default");
217 evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
218 evas_object_size_hint_align_set(base, EVAS_HINT_FILL, EVAS_HINT_FILL);
225 * This function let the ug destroy the ug
227 * @param[in] data the pointer to the main data structure
229 void wfd_destroy_ug(void *data)
232 struct ug_data *ugd = (struct ug_data *) data;
234 #ifdef WFD_DBUS_LAUNCH
235 if (ugd->dbus_cancellable != NULL) {
236 g_cancellable_cancel(ugd->dbus_cancellable);
237 g_object_unref(ugd->dbus_cancellable);
238 ugd->dbus_cancellable = NULL;
240 g_object_unref(ugd->conn);
243 DBG(LOG_INFO, "Cancelled dbus call");
248 DBG(LOG_INFO, "dbus_cancellable is NULL");
249 ug_destroy_me(ugd->ug);
256 static void wfd_ug_layout_del_cb(void *data , Evas *e, Evas_Object *obj, void *event_info)
260 struct ug_data *ugd = (struct ug_data *) data;
262 DBG(LOG_ERROR, "Incorrect parameter(NULL)");
266 wfd_client_free_raw_discovered_peers(ugd);
267 wfd_ug_view_free_peers(ugd);
268 destroy_wfd_ug_view(ugd);
273 #ifdef WFD_DBUS_LAUNCH
275 * This function let the ug initialize wfd
277 * @param[in] data the pointer to the main data structure
278 * @param[in] evas the pointer to the evas canvas
279 * @param[in] obj the pointer to the evas object
280 * @param[in] event_info the pointer to the event information
282 static void _wfd_init_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info)
286 struct ug_data *ugd = (struct ug_data *)data;
287 WFD_RET_IF(ugd == NULL || ugd->base == NULL, "Incorrect parameter(NULL)\n");
289 evas_object_event_callback_del(ugd->base, EVAS_CALLBACK_SHOW, _wfd_init_cb);
291 res = launch_wifi_direct_manager(ugd);
293 DBG(LOG_ERROR, "Failed to launch wifi direct manager\n");
301 static void *on_create(ui_gadget_h ug, enum ug_mode mode, app_control_h control, void *priv)
315 bindtextdomain(PACKAGE, LOCALEDIR);
317 ugd->win = ug_get_window();
323 if (elm_win_wm_rotation_supported_get(ugd->win)) {
324 int rots[4] = {0, 90, 180, 270};
325 elm_win_wm_rotation_available_rotations_set(ugd->win, (const int *)(&rots), 4);
328 /* check the input parameters from app at first */
330 ugd->device_filter = -1; /* show all devices */
331 ugd->is_auto_exit = false;
332 ugd->is_multi_connect = true;
333 ugd->is_init_ok = false;
334 ugd->title = strdup(D_("IDS_WIFI_BODY_WI_FI_DIRECT_ABB"));
338 char *device_filter = NULL;
339 char *auto_exit = NULL;
340 char *multi_connect = NULL;
342 char* viewtype = NULL;
345 * get the control name
346 * default value: Wi-Fi Direct
348 ret = app_control_get_extra_data(control, "wfds", &wfds);
349 if (ret == APP_CONTROL_ERROR_NONE && wfds) {
350 DBG_SECURE(LOG_INFO, "Wfds name: %s", wfds);
351 ugd->wfds = strdup(wfds);
352 WFD_IF_FREE_MEM(wfds);
355 ret = app_control_get_extra_data(control, "viewtype", &viewtype);
356 if(ret == APP_CONTROL_ERROR_NONE && viewtype) {
357 DBG(LOG_INFO, "viewtype: %s\n", viewtype);
358 ugd->view_type = strdup(viewtype);
359 WFD_IF_FREE_MEM(viewtype);
363 * get the device filter
364 * default value: NULL
366 ret = app_control_get_extra_data(control, "device_filter", &device_filter);
367 if (ret == APP_CONTROL_ERROR_NONE && device_filter) {
368 DBG(LOG_INFO, "Device filter: %s", device_filter);
369 if (0 == strncmp(device_filter, "computer", 8)) {
370 ugd->device_filter = WFD_DEVICE_TYPE_COMPUTER;
371 } else if (0 == strncmp(device_filter, "input_device", 12)) {
372 ugd->device_filter = WFD_DEVICE_TYPE_INPUT_DEVICE;
373 } else if (0 == strncmp(device_filter, "printer", 6)) {
374 ugd->device_filter = WFD_DEVICE_TYPE_PRINTER;
375 } else if (0 == strncmp(device_filter, "camera", 6)) {
376 ugd->device_filter = WFD_DEVICE_TYPE_CAMERA;
377 } else if (0 == strncmp(device_filter, "storage", 7)) {
378 ugd->device_filter = WFD_DEVICE_TYPE_STORAGE;
379 } else if (0 == strncmp(device_filter, "network_infra", 13)) {
380 ugd->device_filter = WFD_DEVICE_TYPE_NW_INFRA;
381 } else if (0 == strncmp(device_filter, "display", 7)) {
382 ugd->device_filter = WFD_DEVICE_TYPE_DISPLAYS;
383 } else if (0 == strncmp(device_filter, "multimedia_device", 17)) {
384 ugd->device_filter = WFD_DEVICE_TYPE_MM_DEVICES;
385 } else if (0 == strncmp(device_filter, "game_device", 11)) {
386 ugd->device_filter = WFD_DEVICE_TYPE_GAME_DEVICES;
387 } else if (0 == strncmp(device_filter, "telephone", 9)) {
388 ugd->device_filter = WFD_DEVICE_TYPE_TELEPHONE;
389 } else if (0 == strncmp(device_filter, "audio", 5)) {
390 ugd->device_filter = WFD_DEVICE_TYPE_AUDIO;
392 ugd->device_filter = WFD_DEVICE_TYPE_OTHER;
394 WFD_IF_FREE_MEM(device_filter);
398 * get whether support auto exit after connection
399 * default value: false
401 ret = app_control_get_extra_data(control, "auto_exit", &auto_exit);
402 if (ret == APP_CONTROL_ERROR_NONE && auto_exit) {
403 DBG(LOG_INFO, "Auto exit: %s", auto_exit);
404 if (0 == strncmp(auto_exit, "on", 2)) {
405 ugd->is_auto_exit = true;
407 ugd->is_auto_exit = false;
409 WFD_IF_FREE_MEM(auto_exit);
413 * get whether support multi connection,
414 * default value: true
416 ret = app_control_get_extra_data(control, "multi_connect", &multi_connect);
417 if (ret == APP_CONTROL_ERROR_NONE && multi_connect) {
418 DBG(LOG_INFO, "Multi connection: %s", multi_connect);
419 if (0 == strncmp(multi_connect, "off", 2)) {
420 ugd->is_multi_connect = false;
422 ugd->is_multi_connect = true;
424 WFD_IF_FREE_MEM(multi_connect);
428 * get the title of UG
429 * default value: Wi-Fi Direct
431 ret = app_control_get_extra_data(control, "title_string", &title);
432 if (ret == APP_CONTROL_ERROR_NONE && title) {
433 DBG(LOG_INFO, "Title of UG: %s", title);
434 WFD_IF_FREE_MEM(ugd->title);
435 ugd->title = strdup(title);
436 WFD_IF_FREE_MEM(title);
440 if (mode == UG_MODE_FULLVIEW) {
441 ugd->base = _create_fullview(ugd->win, ugd);
443 ugd->base = _create_frameview(ugd->win, ugd);
447 evas_object_event_callback_add(ugd->base, EVAS_CALLBACK_DEL, wfd_ug_layout_del_cb, ugd);
448 ugd->bg = _create_bg(ugd->win, "group_list");
449 elm_object_part_content_set(ugd->base, "elm.swallow.bg", ugd->bg);
451 DBG(LOG_ERROR, "Failed to create base layout\n");
455 /* check status of wifi-direct from vconf */
456 wfd_status = wfd_get_vconf_status();
457 if (wfd_status < 0) {
462 initialize_gen_item_class();
463 create_wfd_ug_view(ugd);
464 wfd_ug_view_init_genlist(ugd, true);
465 #ifdef MOTION_CONTROL_ENABLE
470 * if not deactivated, do initialization at once;
471 * otherwise, do initialization later
473 if (wfd_status != VCONFKEY_WIFI_DIRECT_DEACTIVATED) {
474 init_wfd_client(ugd);
476 ugd->wfd_status = WIFI_DIRECT_STATE_DEACTIVATED;
478 #ifdef WFD_DBUS_LAUNCH
479 evas_object_event_callback_add(ugd->base, EVAS_CALLBACK_SHOW, _wfd_init_cb, ugd);
481 ret = init_wfd_client(ugd);
482 WFD_RETV_IF(ret != 0, NULL, "Failed to initialize WFD client library\n");
484 /* Activate WiFi Direct */
485 DBG(LOG_INFO, "Activating WiFi Direct...");
486 if (ugd->wfd_status <= WIFI_DIRECT_STATE_DEACTIVATING) {
487 ret = wfd_client_switch_on(ugd);
488 WFD_RETV_IF(ret != 0, NULL, "Failed to activate WFD\n");
492 ret = vconf_notify_key_changed(VCONFKEY_SETAPPL_DEVICE_NAME_STR,
493 __wfd_main_vconf_change_cb, ugd);
495 DBG(LOG_ERROR, "Failed to set vconf notification callback(VCONFKEY_SETAPPL_DEVICE_NAME_STR)");
499 ret = vconf_notify_key_changed(VCONFKEY_WIFI_STATE, _wifi_on_state_cb, ugd);
501 DBG(LOG_ERROR, "Failed to set vconf notification callback(VCONFKEY_WIFI_STATE)");
506 ret = vconf_notify_key_changed(VCONFKEY_MOBILE_HOTSPOT_MODE,
507 __wfd_hotspot_mode_vconf_change_cb, ugd);
509 DBG(LOG_ERROR, "Failed to set vconf notification callback(MOBILE_HOTSPOT_MODE)");
516 static void on_start(ui_gadget_h ug, app_control_h control, void *priv)
528 struct utsname kernel_info;
529 res = uname(&kernel_info);
531 DBG(LOG_ERROR, "Failed to detect target type\n");
533 DBG_SECURE(LOG_INFO, "HW ID of this device [%s]\n", kernel_info.machine);
534 if (strncmp(kernel_info.machine, "arm", 3) != 0) {
535 wfd_ug_warn_popup(ugd, D_("IDS_ST_POP_NOT_SUPPORTED"), POPUP_TYPE_TERMINATE_NOT_SUPPORT);
543 static void on_pause(ui_gadget_h ug, app_control_h control, void *priv)
547 WFD_RET_IF(ug == NULL || priv == NULL, "The param is NULL\n");
548 struct ug_data *ugd = priv;
549 ugd->is_paused = true;
551 wfd_refresh_wifi_direct_state(ugd);
552 DBG(LOG_INFO, "on pause, wfd status: %d\n", ugd->wfd_status);
554 if ((WIFI_DIRECT_STATE_DISCOVERING == ugd->wfd_status) &&
555 (WIFI_DIRECT_ERROR_NONE != wifi_direct_cancel_discovery())) {
556 DBG(LOG_ERROR, "Failed to send cancel discovery state [%d]\n", ugd->wfd_status);
561 ugd->wfd_discovery_status = WIFI_DIRECT_DISCOVERY_STOPPED;
566 static void on_resume(ui_gadget_h ug, app_control_h control, void *priv)
570 WFD_RET_IF(ug == NULL || priv == NULL, "The param is NULL\n");
571 struct ug_data *ugd = priv;
572 ugd->is_paused = false;
574 wfd_refresh_wifi_direct_state(ugd);
575 DBG(LOG_INFO, "on resume, status: %d\n", ugd->wfd_status);
576 ugd->wfd_discovery_status = WIFI_DIRECT_DISCOVERY_STOPPED;
578 elm_genlist_realized_items_update(ugd->genlist);
580 if (ugd->wfd_status > WIFI_DIRECT_STATE_DEACTIVATED && ugd->wfd_status < WIFI_DIRECT_STATE_CONNECTED) {
581 DBG(LOG_INFO, "Start discovery again\n");
582 ugd->wfd_discovery_status = WIFI_DIRECT_DISCOVERY_SOCIAL_CHANNEL_START;
583 ret = wifi_direct_start_discovery_specific_channel(false, 1, WIFI_DIRECT_DISCOVERY_SOCIAL_CHANNEL);
584 if (ret != WIFI_DIRECT_ERROR_NONE) {
585 ugd->wfd_discovery_status = WIFI_DIRECT_DISCOVERY_NONE;
586 DBG(LOG_ERROR, "Failed to start discovery. [%d]\n", ret);
587 wifi_direct_cancel_discovery();
594 static void on_destroy(ui_gadget_h ug, app_control_h control, void *priv)
598 WFD_RET_IF(ug == NULL || priv == NULL, "The param is NULL\n");
600 struct ug_data *ugd = priv;
602 WFD_RET_IF(ugd->base == NULL, "The param is NULL\n");
604 #ifdef MOTION_CONTROL_ENABLE
608 /* DeInit WiFi Direct */
609 ret = deinit_wfd_client(ugd);
611 DBG(LOG_ERROR,"Failed to DeInit WiFi Direct");
614 if (ugd->scan_toolbar) {
615 wfd_ug_view_refresh_button(ugd->scan_toolbar,
616 D_("IDS_WIFI_SK4_SCAN"), FALSE);
619 ret = vconf_ignore_key_changed(VCONFKEY_SETAPPL_DEVICE_NAME_STR,
620 __wfd_main_vconf_change_cb);
622 DBG(LOG_ERROR,"Failed to ignore vconf key callback\n");
626 ret = vconf_ignore_key_changed(VCONFKEY_WIFI_STATE, _wifi_on_state_cb);
628 DBG(LOG_ERROR,"Failed to ignore vconf key callback\n");
632 ret = vconf_ignore_key_changed(VCONFKEY_MOBILE_HOTSPOT_MODE,
633 __wfd_hotspot_mode_vconf_change_cb);
635 DBG(LOG_ERROR,"Failed to ignore vconf key callback MOBILE_HOTSPOT_MODE\n");
638 wfd_ug_view_free_peers(ugd);
639 WFD_IF_FREE_MEM(ugd->title);
640 WFD_IF_FREE_MEM(ugd->wfds);
641 WFD_IF_FREE_MEM(ugd->view_type);
643 WFD_IF_DEL_OBJ(ugd->bg);
645 #ifdef WFD_DBUS_LAUNCH
647 evas_object_event_callback_del(ugd->base, EVAS_CALLBACK_SHOW, _wfd_init_cb);
649 WFD_IF_DEL_OBJ(ugd->base);
650 DBG(LOG_INFO, "WFD client deregistered");
656 static void on_message(ui_gadget_h ug, app_control_h msg, app_control_h control, void *priv)
659 char* app_msg = NULL;
660 struct ug_data *ugd = priv;
663 DBG(LOG_ERROR, "The param is NULL\n");
668 app_control_get_extra_data(msg, "msg", &app_msg);
669 DBG(LOG_DEBUG, "Msg from app: %s", app_msg);
671 if (!strcmp(app_msg, "destroy")) {
672 if(!ugd->rename_popup) {
673 DBG(LOG_INFO, "Destroying UG.");
674 wfd_ug_view_free_peers(ugd);
678 WFD_IF_FREE_MEM(app_msg);
683 static void on_event(ui_gadget_h ug, enum ug_event event, app_control_h control, void *priv)
688 DBG(LOG_ERROR, "The param is NULL\n");
693 case UG_EVENT_LOW_MEMORY:
694 DBG(LOG_INFO, "UG_EVENT_LOW_MEMORY\n");
696 case UG_EVENT_LOW_BATTERY:
697 DBG(LOG_INFO, "UG_EVENT_LOW_BATTERY\n");
699 case UG_EVENT_LANG_CHANGE:
700 DBG(LOG_INFO, "UG_EVENT_LANG_CHANGE\n");
702 case UG_EVENT_ROTATE_PORTRAIT:
704 DBG(LOG_INFO, "UG_EVENT_ROTATE_PORTRAIT\n");
706 case UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN:
707 DBG(LOG_INFO, "UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN\n");
709 case UG_EVENT_ROTATE_LANDSCAPE:
711 DBG(LOG_INFO, "UG_EVENT_ROTATE_LANDSCAPE\n");
713 case UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN:
715 DBG(LOG_INFO, "UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN\n");
718 DBG(LOG_INFO, "default\n");
725 static void on_key_event(ui_gadget_h ug, enum ug_key_event event, app_control_h control, void *priv)
730 DBG(LOG_ERROR, "The param is NULL\n");
735 case UG_KEY_EVENT_END:
736 DBG(LOG_INFO, "UG_KEY_EVENT_END\n");
745 UG_MODULE_API int UG_MODULE_INIT(struct ug_module_ops *ops)
751 DBG(LOG_ERROR, "The param is NULL\n");
755 ugd = calloc(1, sizeof(struct ug_data));
757 DBG(LOG_ERROR, "Failed to allocate memory for UG data\n");
763 ops->create = on_create;
764 ops->start = on_start;
765 ops->pause = on_pause;
766 ops->resume = on_resume;
767 ops->destroy = on_destroy;
768 ops->message = on_message;
769 ops->event = on_event;
770 ops->key_event = on_key_event;
772 ops->opt = UG_OPT_INDICATOR_ENABLE;
778 UG_MODULE_API void UG_MODULE_EXIT(struct ug_module_ops *ops)
785 DBG(LOG_ERROR, "The param is NULL\n");
791 WFD_IF_FREE_MEM(ugd);
796 UG_MODULE_API int setting_plugin_reset(app_control_h control, void *priv)
800 wifi_direct_state_e state;
802 res = wifi_direct_initialize();
803 if (res != WIFI_DIRECT_ERROR_NONE) {
804 DBG(LOG_ERROR, "Failed to initialize wifi direct. [%d]\n", res);
808 res = wifi_direct_get_state(&state);
809 if (res != WIFI_DIRECT_ERROR_NONE) {
810 DBG(LOG_ERROR, "Failed to get link status. [%d]\n", res);
814 if (state < WIFI_DIRECT_STATE_ACTIVATING) {
815 DBG(LOG_INFO, "No need to reset Wi-Fi Direct.\n");
817 /*if connected, disconnect all devices*/
818 if (WIFI_DIRECT_STATE_CONNECTED == state) {
819 res = wifi_direct_disconnect_all();
820 if (res != WIFI_DIRECT_ERROR_NONE) {
821 DBG(LOG_ERROR, "Failed to send disconnection request to all. [%d]\n", res);
826 res = wifi_direct_deactivate();
827 if (res != WIFI_DIRECT_ERROR_NONE) {
828 DBG(LOG_ERROR, "Failed to reset Wi-Fi Direct. [%d]\n", res);
833 res = wifi_direct_deinitialize();
834 if (res != WIFI_DIRECT_ERROR_NONE) {
835 DBG(LOG_ERROR, "Failed to deinitialize wifi direct. [%d]\n", res);
843 UG_MODULE_API int setting_plugin_search_init(app_control_h control, void *priv, char** applocale)
847 *applocale = strdup(PACKAGE);
850 Eina_List **pplist = (Eina_List**)priv;
852 node = setting_plugin_search_item_add("IDS_WIFI_BUTTON_MULTI_CONNECT", "viewtype:IDS_WIFI_BUTTON_MULTI_CONNECT", NULL, 5, NULL);
853 *pplist = eina_list_append(*pplist, node);