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>
35 #include <wifi-direct.h>
37 #include "wfd_ug_view.h"
38 #include "wfd_client.h"
39 #ifdef MOTION_CONTROL_ENABLE
40 #include "wfd_motion_control.h"
43 void initialize_gen_item_class();
45 struct ug_data *global_ugd = NULL;
47 struct ug_data *wfd_get_ug_data()
52 static void __wfd_main_vconf_change_cb(keynode_t *key, void *data)
55 WFD_RET_IF(NULL == key, "ERROR : key is NULL !!\n");
56 WFD_RET_IF(NULL == data, "ERROR : data is NULL");
57 struct ug_data *ugd = (struct ug_data *) data;
59 char *vconf_name = vconf_keynode_get_name(key);
61 if (!g_strcmp0(vconf_name, VCONFKEY_SETAPPL_DEVICE_NAME_STR)){
62 char *name_value = NULL;
63 name_value = vconf_get_str(VCONFKEY_SETAPPL_DEVICE_NAME_STR);
64 WFD_RET_IF (!name_value, "Get string is failed");
65 DBG(LOG_INFO,"name : %s", name_value);
67 if (ugd->device_name_item && g_strcmp0(ugd->dev_name, name_value))
68 wfd_ug_view_refresh_glitem(ugd->device_name_item);
72 DBG(LOG_ERROR, "vconf_name is error");
78 static void _wifi_on_state_cb(keynode_t *key, void *data)
80 WFD_RET_IF(NULL == key, "ERROR : key is NULL !!\n");
81 WFD_RET_IF(NULL == data, "ERROR : data is NULL");
83 struct ug_data *ugd = (struct ug_data *)data;
86 if (vconf_get_int(VCONFKEY_WIFI_STATE, &wifi_state) < 0) {
87 DBG(LOG_ERROR, "Failed to get vconf VCONFKEY_WIFI_STATE\n");
91 DBG(LOG_INFO, "WiFi State [%d]\n", wifi_state);
92 if (wifi_state > VCONFKEY_WIFI_OFF && wifi_state < VCONFKEY_WIFI_STATE_MAX) {
93 if (WIFI_DIRECT_ERROR_NONE != wifi_direct_get_state(&ugd->wfd_status)) {
94 DBG(LOG_ERROR, "Failed to Get WiFi Direct State");
97 if (ugd->wfd_status <= WIFI_DIRECT_STATE_DEACTIVATING) {
98 DBG(LOG_INFO, "Activate WiFi Direct...");
99 if (FALSE != wfd_client_switch_on(ugd)) {
100 DBG(LOG_ERROR, "Failed to Activate WiFi Direct");
108 static void __wfd_hotspot_mode_vconf_change_cb(keynode_t *key, void *data)
110 DBG(LOG_INFO, "__wfd_hotspot_mode_vconf_change_cb");
111 if (NULL == key || NULL == data) {
112 DBG(LOG_INFO, "Invalid parameters \n");
115 struct ug_data *ugd = (struct ug_data *) data;
116 int hotspot_mode = 0;
119 res = vconf_get_int(VCONFKEY_MOBILE_HOTSPOT_MODE, &hotspot_mode);
121 WDS_LOGE("Failed to get vconf value for PLMN(%d)", res);
124 DBG(LOG_INFO, "__wfd_hotspot_mode_vconf_change_cb mode %d", hotspot_mode);
126 if (VCONFKEY_MOBILE_HOTSPOT_MODE_NONE == hotspot_mode) {
127 if (NULL != ugd->act_popup) {
128 evas_object_del(ugd->act_popup);
130 #ifdef WFD_ON_OFF_GENLIST
131 wfd_ug_refresh_on_off_check(ugd);
133 } else if (hotspot_mode == VCONFKEY_MOBILE_HOTSPOT_MODE_WIFI ||
134 hotspot_mode == VCONFKEY_MOBILE_HOTSPOT_MODE_WIFI_AP) {
135 if (NULL != ugd->warn_popup) {
136 evas_object_del(ugd->warn_popup);
137 ugd->warn_popup = NULL;
144 * This function let the ug create backgroud
146 * @param[in] ugd the pointer to the parent object
147 * @param[in] ugd the pointer to the main data structure
149 static Evas_Object *_create_bg(Evas_Object *parent, char *style)
154 bg = elm_bg_add(parent);
155 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
156 elm_object_style_set(bg, style);
157 evas_object_show(bg);
164 * This function let the ug create full view
166 * @param[in] ugd the pointer to the parent object
167 * @param[in] ugd the pointer to the main data structure
169 static Evas_Object *_create_fullview(Evas_Object *parent, struct ug_data *ugd)
174 if (parent == NULL) {
175 DBG(LOG_ERROR, "Incorrenct parameter");
179 /* Create Full view */
180 base = elm_layout_add(parent);
182 DBG(LOG_ERROR, "Failed to add layout");
186 elm_layout_theme_set(base, "layout", "application", "default");
187 evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
188 evas_object_size_hint_align_set(base, EVAS_HINT_FILL, EVAS_HINT_FILL);
195 * This function let the ug create frame view
197 * @param[in] ugd the pointer to the parent object
198 * @param[in] ugd the pointer to the main data structure
200 static Evas_Object *_create_frameview(Evas_Object *parent, struct ug_data *ugd)
205 if (parent == NULL) {
206 DBG(LOG_ERROR, "Incorrenct parameter");
210 /* Create Frame view */
211 base = elm_layout_add(parent);
213 DBG(LOG_ERROR, "Failed to add layout");
217 elm_layout_theme_set(base, "layout", "application", "default");
218 evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
219 evas_object_size_hint_align_set(base, EVAS_HINT_FILL, EVAS_HINT_FILL);
226 * This function let the ug destroy the ug
228 * @param[in] data the pointer to the main data structure
230 void wfd_destroy_ug(void *data)
233 struct ug_data *ugd = (struct ug_data *) data;
235 #ifdef WFD_DBUS_LAUNCH
236 if (ugd->dbus_cancellable != NULL) {
237 g_cancellable_cancel(ugd->dbus_cancellable);
238 g_object_unref(ugd->dbus_cancellable);
239 ugd->dbus_cancellable = NULL;
241 g_object_unref(ugd->conn);
244 DBG(LOG_INFO, "Cancelled dbus call");
249 DBG(LOG_INFO, "dbus_cancellable is NULL");
250 ug_destroy_me(ugd->ug);
257 static void wfd_ug_layout_del_cb(void *data , Evas *e, Evas_Object *obj, void *event_info)
261 struct ug_data *ugd = (struct ug_data *) data;
263 DBG(LOG_ERROR, "Incorrect parameter(NULL)");
267 wfd_client_free_raw_discovered_peers(ugd);
268 wfd_ug_view_free_peers(ugd);
269 destroy_wfd_ug_view(ugd);
274 #ifdef WFD_DBUS_LAUNCH
276 * This function let the ug initialize wfd
278 * @param[in] data the pointer to the main data structure
279 * @param[in] evas the pointer to the evas canvas
280 * @param[in] obj the pointer to the evas object
281 * @param[in] event_info the pointer to the event information
283 static void _wfd_init_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info)
287 struct ug_data *ugd = (struct ug_data *)data;
288 WFD_RET_IF(ugd == NULL || ugd->base == NULL, "Incorrect parameter(NULL)\n");
290 evas_object_event_callback_del(ugd->base, EVAS_CALLBACK_SHOW, _wfd_init_cb);
292 res = launch_wifi_direct_manager(ugd);
294 DBG(LOG_ERROR, "Failed to launch wifi direct manager\n");
302 static void *on_create(ui_gadget_h ug, enum ug_mode mode, app_control_h control, void *priv)
307 int rots[4] = { 0, 90, 180, 270 };
317 bindtextdomain(PACKAGE, LOCALEDIR);
319 ugd->win = ug_get_window();
324 elm_win_wm_rotation_available_rotations_set(ugd->win, rots, 1);
327 /* check the input parameters from app at first */
329 ugd->device_filter = -1; /* show all devices */
330 ugd->is_auto_exit = false;
331 ugd->is_multi_connect = true;
332 ugd->is_init_ok = false;
333 ugd->title = strdup(_("IDS_WIFI_BODY_WI_FI_DIRECT_ABB"));
337 char *device_filter = NULL;
338 char *auto_exit = NULL;
339 char *multi_connect = NULL;
341 char* viewtype = NULL;
344 * get the control name
345 * default value: Wi-Fi Direct
347 ret = app_control_get_extra_data(control, "wfds", &wfds);
348 if (ret == APP_CONTROL_ERROR_NONE && wfds) {
349 DBG_SECURE(LOG_INFO, "Wfds name: %s", wfds);
350 ugd->wfds = strdup(wfds);
351 WFD_IF_FREE_MEM(wfds);
354 ret = app_control_get_extra_data(control, "viewtype", &viewtype);
355 if(ret == APP_CONTROL_ERROR_NONE && viewtype) {
356 DBG(LOG_INFO, "viewtype: %s\n", viewtype);
357 ugd->view_type = strdup(viewtype);
358 WFD_IF_FREE_MEM(viewtype);
362 * get the device filter
363 * default value: NULL
365 ret = app_control_get_extra_data(control, "device_filter", &device_filter);
366 if (ret == APP_CONTROL_ERROR_NONE && device_filter) {
367 DBG(LOG_INFO, "Device filter: %s", device_filter);
368 if (0 == strncmp(device_filter, "computer", 8)) {
369 ugd->device_filter = WFD_DEVICE_TYPE_COMPUTER;
370 } else if (0 == strncmp(device_filter, "input_device", 12)) {
371 ugd->device_filter = WFD_DEVICE_TYPE_INPUT_DEVICE;
372 } else if (0 == strncmp(device_filter, "printer", 6)) {
373 ugd->device_filter = WFD_DEVICE_TYPE_PRINTER;
374 } else if (0 == strncmp(device_filter, "camera", 6)) {
375 ugd->device_filter = WFD_DEVICE_TYPE_CAMERA;
376 } else if (0 == strncmp(device_filter, "storage", 7)) {
377 ugd->device_filter = WFD_DEVICE_TYPE_STORAGE;
378 } else if (0 == strncmp(device_filter, "network_infra", 13)) {
379 ugd->device_filter = WFD_DEVICE_TYPE_NW_INFRA;
380 } else if (0 == strncmp(device_filter, "display", 7)) {
381 ugd->device_filter = WFD_DEVICE_TYPE_DISPLAYS;
382 } else if (0 == strncmp(device_filter, "multimedia_device", 17)) {
383 ugd->device_filter = WFD_DEVICE_TYPE_MM_DEVICES;
384 } else if (0 == strncmp(device_filter, "game_device", 11)) {
385 ugd->device_filter = WFD_DEVICE_TYPE_GAME_DEVICES;
386 } else if (0 == strncmp(device_filter, "telephone", 9)) {
387 ugd->device_filter = WFD_DEVICE_TYPE_TELEPHONE;
388 } else if (0 == strncmp(device_filter, "audio", 5)) {
389 ugd->device_filter = WFD_DEVICE_TYPE_AUDIO;
391 ugd->device_filter = WFD_DEVICE_TYPE_OTHER;
393 WFD_IF_FREE_MEM(device_filter);
397 * get whether support auto exit after connection
398 * default value: false
400 ret = app_control_get_extra_data(control, "auto_exit", &auto_exit);
401 if (ret == APP_CONTROL_ERROR_NONE && auto_exit) {
402 DBG(LOG_INFO, "Auto exit: %s", auto_exit);
403 if (0 == strncmp(auto_exit, "on", 2)) {
404 ugd->is_auto_exit = true;
406 ugd->is_auto_exit = false;
408 WFD_IF_FREE_MEM(auto_exit);
412 * get whether support multi connection,
413 * default value: true
415 ret = app_control_get_extra_data(control, "multi_connect", &multi_connect);
416 if (ret == APP_CONTROL_ERROR_NONE && multi_connect) {
417 DBG(LOG_INFO, "Multi connection: %s", multi_connect);
418 if (0 == strncmp(multi_connect, "off", 2)) {
419 ugd->is_multi_connect = false;
421 ugd->is_multi_connect = true;
423 WFD_IF_FREE_MEM(multi_connect);
427 * get the title of UG
428 * default value: Wi-Fi Direct
430 ret = app_control_get_extra_data(control, "title_string", &title);
431 if (ret == APP_CONTROL_ERROR_NONE && title) {
432 DBG(LOG_INFO, "Title of UG: %s", title);
433 WFD_IF_FREE_MEM(ugd->title);
434 ugd->title = strdup(title);
435 WFD_IF_FREE_MEM(title);
439 if (mode == UG_MODE_FULLVIEW) {
440 ugd->base = _create_fullview(ugd->win, ugd);
442 ugd->base = _create_frameview(ugd->win, ugd);
446 evas_object_event_callback_add(ugd->base, EVAS_CALLBACK_DEL, wfd_ug_layout_del_cb, ugd);
447 ugd->bg = _create_bg(ugd->win, "group_list");
448 elm_object_part_content_set(ugd->base, "elm.swallow.bg", ugd->bg);
450 DBG(LOG_ERROR, "Failed to create base layout\n");
454 /* check status of wifi-direct from vconf */
455 wfd_status = wfd_get_vconf_status();
456 if (wfd_status < 0) {
461 initialize_gen_item_class();
462 create_wfd_ug_view(ugd);
463 wfd_ug_view_init_genlist(ugd, true);
464 #ifdef MOTION_CONTROL_ENABLE
469 * if not deactivated, do initialization at once;
470 * otherwise, do initialization later
472 if (wfd_status != VCONFKEY_WIFI_DIRECT_DEACTIVATED) {
473 init_wfd_client(ugd);
475 ugd->wfd_status = WIFI_DIRECT_STATE_DEACTIVATED;
477 #ifdef WFD_DBUS_LAUNCH
478 evas_object_event_callback_add(ugd->base, EVAS_CALLBACK_SHOW, _wfd_init_cb, ugd);
480 ret = init_wfd_client(ugd);
481 WFD_RETV_IF(ret != 0, NULL, "Failed to initialize WFD client library\n");
483 /* Activate WiFi Direct */
484 DBG(LOG_INFO, "Activating WiFi Direct...");
485 if (ugd->wfd_status <= WIFI_DIRECT_STATE_DEACTIVATING) {
486 ret = wfd_client_switch_on(ugd);
487 WFD_RETV_IF(ret != 0, NULL, "Failed to activate WFD\n");
491 ret = vconf_notify_key_changed(VCONFKEY_SETAPPL_DEVICE_NAME_STR,
492 __wfd_main_vconf_change_cb, ugd);
494 DBG(LOG_ERROR, "Failed to set vconf notification callback(VCONFKEY_SETAPPL_DEVICE_NAME_STR)");
498 ret = vconf_notify_key_changed(VCONFKEY_WIFI_STATE, _wifi_on_state_cb, ugd);
500 DBG(LOG_ERROR, "Failed to set vconf notification callback(VCONFKEY_WIFI_STATE)");
505 ret = vconf_notify_key_changed(VCONFKEY_MOBILE_HOTSPOT_MODE,
506 __wfd_hotspot_mode_vconf_change_cb, ugd);
508 DBG(LOG_ERROR, "Failed to set vconf notification callback(MOBILE_HOTSPOT_MODE)");
515 static void on_start(ui_gadget_h ug, app_control_h control, void *priv)
527 struct utsname kernel_info;
528 res = uname(&kernel_info);
530 DBG(LOG_ERROR, "Failed to detect target type\n");
532 DBG_SECURE(LOG_INFO, "HW ID of this device [%s]\n", kernel_info.machine);
533 if (strncmp(kernel_info.machine, "arm", 3) != 0) {
534 wfd_ug_warn_popup(ugd, _("IDS_ST_POP_NOT_SUPPORTED"), POPUP_TYPE_TERMINATE_NOT_SUPPORT);
542 static void on_pause(ui_gadget_h ug, app_control_h control, void *priv)
546 WFD_RET_IF(ug == NULL || priv == NULL, "The param is NULL\n");
547 struct ug_data *ugd = priv;
548 ugd->is_paused = true;
550 wfd_refresh_wifi_direct_state(ugd);
551 DBG(LOG_INFO, "on pause, wfd status: %d\n", ugd->wfd_status);
553 if ((WIFI_DIRECT_STATE_DISCOVERING == ugd->wfd_status) &&
554 (WIFI_DIRECT_ERROR_NONE != wifi_direct_cancel_discovery())) {
555 DBG(LOG_ERROR, "Failed to send cancel discovery state [%d]\n", ugd->wfd_status);
560 ugd->wfd_discovery_status = WIFI_DIRECT_DISCOVERY_STOPPED;
565 static void on_resume(ui_gadget_h ug, app_control_h control, void *priv)
569 WFD_RET_IF(ug == NULL || priv == NULL, "The param is NULL\n");
570 struct ug_data *ugd = priv;
571 ugd->is_paused = false;
573 wfd_refresh_wifi_direct_state(ugd);
574 DBG(LOG_INFO, "on resume, status: %d\n", ugd->wfd_status);
575 ugd->wfd_discovery_status = WIFI_DIRECT_DISCOVERY_STOPPED;
577 elm_genlist_realized_items_update(ugd->genlist);
579 if (ugd->wfd_status > WIFI_DIRECT_STATE_DEACTIVATED && ugd->wfd_status < WIFI_DIRECT_STATE_CONNECTED) {
580 DBG(LOG_INFO, "Start discovery again\n");
581 ugd->wfd_discovery_status = WIFI_DIRECT_DISCOVERY_SOCIAL_CHANNEL_START;
582 ret = wifi_direct_start_discovery_specific_channel(false, 1, WIFI_DIRECT_DISCOVERY_SOCIAL_CHANNEL);
583 if (ret != WIFI_DIRECT_ERROR_NONE) {
584 ugd->wfd_discovery_status = WIFI_DIRECT_DISCOVERY_NONE;
585 DBG(LOG_ERROR, "Failed to start discovery. [%d]\n", ret);
586 wifi_direct_cancel_discovery();
593 static void on_destroy(ui_gadget_h ug, app_control_h control, void *priv)
597 WFD_RET_IF(ug == NULL || priv == NULL, "The param is NULL\n");
599 struct ug_data *ugd = priv;
601 WFD_RET_IF(ugd->base == NULL, "The param is NULL\n");
603 #ifdef MOTION_CONTROL_ENABLE
607 /* DeInit WiFi Direct */
608 ret = deinit_wfd_client(ugd);
610 DBG(LOG_ERROR,"Failed to DeInit WiFi Direct");
613 if (ugd->scan_toolbar) {
614 wfd_ug_view_refresh_button(ugd->scan_toolbar,
615 _("IDS_WIFI_SK4_SCAN"), FALSE);
618 ret = vconf_ignore_key_changed(VCONFKEY_SETAPPL_DEVICE_NAME_STR,
619 __wfd_main_vconf_change_cb);
621 DBG(LOG_ERROR,"Failed to ignore vconf key callback\n");
625 ret = vconf_ignore_key_changed(VCONFKEY_WIFI_STATE, _wifi_on_state_cb);
627 DBG(LOG_ERROR,"Failed to ignore vconf key callback\n");
631 ret = vconf_ignore_key_changed(VCONFKEY_MOBILE_HOTSPOT_MODE,
632 __wfd_hotspot_mode_vconf_change_cb);
634 DBG(LOG_ERROR,"Failed to ignore vconf key callback MOBILE_HOTSPOT_MODE\n");
637 wfd_ug_view_free_peers(ugd);
638 WFD_IF_FREE_MEM(ugd->title);
639 WFD_IF_FREE_MEM(ugd->wfds);
640 WFD_IF_FREE_MEM(ugd->view_type);
642 WFD_IF_DEL_OBJ(ugd->bg);
644 #ifdef WFD_DBUS_LAUNCH
646 evas_object_event_callback_del(ugd->base, EVAS_CALLBACK_SHOW, _wfd_init_cb);
648 WFD_IF_DEL_OBJ(ugd->base);
649 DBG(LOG_INFO, "WFD client deregistered");
655 static void on_message(ui_gadget_h ug, app_control_h msg, app_control_h control, void *priv)
658 char* app_msg = NULL;
659 struct ug_data *ugd = priv;
662 DBG(LOG_ERROR, "The param is NULL\n");
667 app_control_get_extra_data(msg, "msg", &app_msg);
668 DBG(LOG_DEBUG, "Msg from app: %s", app_msg);
670 if (!strcmp(app_msg, "destroy")) {
671 if(!ugd->rename_popup) {
672 DBG(LOG_INFO, "Destroying UG.");
673 wfd_ug_view_free_peers(ugd);
677 WFD_IF_FREE_MEM(app_msg);
682 static void on_event(ui_gadget_h ug, enum ug_event event, app_control_h control, void *priv)
687 DBG(LOG_ERROR, "The param is NULL\n");
692 case UG_EVENT_LOW_MEMORY:
693 DBG(LOG_INFO, "UG_EVENT_LOW_MEMORY\n");
695 case UG_EVENT_LOW_BATTERY:
696 DBG(LOG_INFO, "UG_EVENT_LOW_BATTERY\n");
698 case UG_EVENT_LANG_CHANGE:
699 DBG(LOG_INFO, "UG_EVENT_LANG_CHANGE\n");
701 case UG_EVENT_ROTATE_PORTRAIT:
703 DBG(LOG_INFO, "UG_EVENT_ROTATE_PORTRAIT\n");
705 case UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN:
706 DBG(LOG_INFO, "UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN\n");
708 case UG_EVENT_ROTATE_LANDSCAPE:
710 DBG(LOG_INFO, "UG_EVENT_ROTATE_LANDSCAPE\n");
712 case UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN:
714 DBG(LOG_INFO, "UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN\n");
717 DBG(LOG_INFO, "default\n");
724 static void on_key_event(ui_gadget_h ug, enum ug_key_event event, app_control_h control, void *priv)
729 DBG(LOG_ERROR, "The param is NULL\n");
734 case UG_KEY_EVENT_END:
735 DBG(LOG_INFO, "UG_KEY_EVENT_END\n");
744 UG_MODULE_API int UG_MODULE_INIT(struct ug_module_ops *ops)
750 DBG(LOG_ERROR, "The param is NULL\n");
754 ugd = calloc(1, sizeof(struct ug_data));
756 DBG(LOG_ERROR, "Failed to allocate memory for UG data\n");
762 ops->create = on_create;
763 ops->start = on_start;
764 ops->pause = on_pause;
765 ops->resume = on_resume;
766 ops->destroy = on_destroy;
767 ops->message = on_message;
768 ops->event = on_event;
769 ops->key_event = on_key_event;
771 ops->opt = UG_OPT_INDICATOR_ENABLE;
777 UG_MODULE_API void UG_MODULE_EXIT(struct ug_module_ops *ops)
784 DBG(LOG_ERROR, "The param is NULL\n");
790 WFD_IF_FREE_MEM(ugd);
795 UG_MODULE_API int setting_plugin_reset(app_control_h control, void *priv)
799 wifi_direct_state_e state;
801 res = wifi_direct_initialize();
802 if (res != WIFI_DIRECT_ERROR_NONE) {
803 DBG(LOG_ERROR, "Failed to initialize wifi direct. [%d]\n", res);
807 res = wifi_direct_get_state(&state);
808 if (res != WIFI_DIRECT_ERROR_NONE) {
809 DBG(LOG_ERROR, "Failed to get link status. [%d]\n", res);
813 if (state < WIFI_DIRECT_STATE_ACTIVATING) {
814 DBG(LOG_INFO, "No need to reset Wi-Fi Direct.\n");
816 /*if connected, disconnect all devices*/
817 if (WIFI_DIRECT_STATE_CONNECTED == state) {
818 res = wifi_direct_disconnect_all();
819 if (res != WIFI_DIRECT_ERROR_NONE) {
820 DBG(LOG_ERROR, "Failed to send disconnection request to all. [%d]\n", res);
825 res = wifi_direct_deactivate();
826 if (res != WIFI_DIRECT_ERROR_NONE) {
827 DBG(LOG_ERROR, "Failed to reset Wi-Fi Direct. [%d]\n", res);
832 res = wifi_direct_deinitialize();
833 if (res != WIFI_DIRECT_ERROR_NONE) {
834 DBG(LOG_ERROR, "Failed to deinitialize wifi direct. [%d]\n", res);
842 UG_MODULE_API int setting_plugin_search_init(app_control_h control, void *priv, char** applocale)
846 *applocale = strdup("ug-setting-wifidirect-efl");
849 Eina_List **pplist = (Eina_List**)priv;
851 node = setting_plugin_search_item_add("IDS_WIFI_BUTTON_MULTI_CONNECT", "viewtype:IDS_WIFI_BUTTON_MULTI_CONNECT", NULL, 5, NULL);
852 *pplist = eina_list_append(*pplist, node);