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)
306 int rots[4] = { 0, 90, 180, 270 };
316 bindtextdomain(PACKAGE, LOCALEDIR);
318 ugd->win = ug_get_window();
324 if (elm_win_wm_rotation_supported_get(ugd->win)) {
325 int rots[4] = {0, 90, 180, 270};
326 elm_win_wm_rotation_available_rotations_set(ugd->win, (const int *)(&rots), 4);
329 /* check the input parameters from app at first */
331 ugd->device_filter = -1; /* show all devices */
332 ugd->is_auto_exit = false;
333 ugd->is_multi_connect = true;
334 ugd->is_init_ok = false;
335 ugd->title = strdup(_("IDS_WIFI_BODY_WI_FI_DIRECT_ABB"));
339 char *device_filter = NULL;
340 char *auto_exit = NULL;
341 char *multi_connect = NULL;
343 char* viewtype = NULL;
346 * get the control name
347 * default value: Wi-Fi Direct
349 ret = app_control_get_extra_data(control, "wfds", &wfds);
350 if (ret == APP_CONTROL_ERROR_NONE && wfds) {
351 DBG_SECURE(LOG_INFO, "Wfds name: %s", wfds);
352 ugd->wfds = strdup(wfds);
353 WFD_IF_FREE_MEM(wfds);
356 ret = app_control_get_extra_data(control, "viewtype", &viewtype);
357 if(ret == APP_CONTROL_ERROR_NONE && viewtype) {
358 DBG(LOG_INFO, "viewtype: %s\n", viewtype);
359 ugd->view_type = strdup(viewtype);
360 WFD_IF_FREE_MEM(viewtype);
364 * get the device filter
365 * default value: NULL
367 ret = app_control_get_extra_data(control, "device_filter", &device_filter);
368 if (ret == APP_CONTROL_ERROR_NONE && device_filter) {
369 DBG(LOG_INFO, "Device filter: %s", device_filter);
370 if (0 == strncmp(device_filter, "computer", 8)) {
371 ugd->device_filter = WFD_DEVICE_TYPE_COMPUTER;
372 } else if (0 == strncmp(device_filter, "input_device", 12)) {
373 ugd->device_filter = WFD_DEVICE_TYPE_INPUT_DEVICE;
374 } else if (0 == strncmp(device_filter, "printer", 6)) {
375 ugd->device_filter = WFD_DEVICE_TYPE_PRINTER;
376 } else if (0 == strncmp(device_filter, "camera", 6)) {
377 ugd->device_filter = WFD_DEVICE_TYPE_CAMERA;
378 } else if (0 == strncmp(device_filter, "storage", 7)) {
379 ugd->device_filter = WFD_DEVICE_TYPE_STORAGE;
380 } else if (0 == strncmp(device_filter, "network_infra", 13)) {
381 ugd->device_filter = WFD_DEVICE_TYPE_NW_INFRA;
382 } else if (0 == strncmp(device_filter, "display", 7)) {
383 ugd->device_filter = WFD_DEVICE_TYPE_DISPLAYS;
384 } else if (0 == strncmp(device_filter, "multimedia_device", 17)) {
385 ugd->device_filter = WFD_DEVICE_TYPE_MM_DEVICES;
386 } else if (0 == strncmp(device_filter, "game_device", 11)) {
387 ugd->device_filter = WFD_DEVICE_TYPE_GAME_DEVICES;
388 } else if (0 == strncmp(device_filter, "telephone", 9)) {
389 ugd->device_filter = WFD_DEVICE_TYPE_TELEPHONE;
390 } else if (0 == strncmp(device_filter, "audio", 5)) {
391 ugd->device_filter = WFD_DEVICE_TYPE_AUDIO;
393 ugd->device_filter = WFD_DEVICE_TYPE_OTHER;
395 WFD_IF_FREE_MEM(device_filter);
399 * get whether support auto exit after connection
400 * default value: false
402 ret = app_control_get_extra_data(control, "auto_exit", &auto_exit);
403 if (ret == APP_CONTROL_ERROR_NONE && auto_exit) {
404 DBG(LOG_INFO, "Auto exit: %s", auto_exit);
405 if (0 == strncmp(auto_exit, "on", 2)) {
406 ugd->is_auto_exit = true;
408 ugd->is_auto_exit = false;
410 WFD_IF_FREE_MEM(auto_exit);
414 * get whether support multi connection,
415 * default value: true
417 ret = app_control_get_extra_data(control, "multi_connect", &multi_connect);
418 if (ret == APP_CONTROL_ERROR_NONE && multi_connect) {
419 DBG(LOG_INFO, "Multi connection: %s", multi_connect);
420 if (0 == strncmp(multi_connect, "off", 2)) {
421 ugd->is_multi_connect = false;
423 ugd->is_multi_connect = true;
425 WFD_IF_FREE_MEM(multi_connect);
429 * get the title of UG
430 * default value: Wi-Fi Direct
432 ret = app_control_get_extra_data(control, "title_string", &title);
433 if (ret == APP_CONTROL_ERROR_NONE && title) {
434 DBG(LOG_INFO, "Title of UG: %s", title);
435 WFD_IF_FREE_MEM(ugd->title);
436 ugd->title = strdup(title);
437 WFD_IF_FREE_MEM(title);
441 if (mode == UG_MODE_FULLVIEW) {
442 ugd->base = _create_fullview(ugd->win, ugd);
444 ugd->base = _create_frameview(ugd->win, ugd);
448 evas_object_event_callback_add(ugd->base, EVAS_CALLBACK_DEL, wfd_ug_layout_del_cb, ugd);
449 ugd->bg = _create_bg(ugd->win, "group_list");
450 elm_object_part_content_set(ugd->base, "elm.swallow.bg", ugd->bg);
452 DBG(LOG_ERROR, "Failed to create base layout\n");
456 /* check status of wifi-direct from vconf */
457 wfd_status = wfd_get_vconf_status();
458 if (wfd_status < 0) {
463 initialize_gen_item_class();
464 create_wfd_ug_view(ugd);
465 wfd_ug_view_init_genlist(ugd, true);
466 #ifdef MOTION_CONTROL_ENABLE
471 * if not deactivated, do initialization at once;
472 * otherwise, do initialization later
474 if (wfd_status != VCONFKEY_WIFI_DIRECT_DEACTIVATED) {
475 init_wfd_client(ugd);
477 ugd->wfd_status = WIFI_DIRECT_STATE_DEACTIVATED;
479 #ifdef WFD_DBUS_LAUNCH
480 evas_object_event_callback_add(ugd->base, EVAS_CALLBACK_SHOW, _wfd_init_cb, ugd);
482 ret = init_wfd_client(ugd);
483 WFD_RETV_IF(ret != 0, NULL, "Failed to initialize WFD client library\n");
485 /* Activate WiFi Direct */
486 DBG(LOG_INFO, "Activating WiFi Direct...");
487 if (ugd->wfd_status <= WIFI_DIRECT_STATE_DEACTIVATING) {
488 ret = wfd_client_switch_on(ugd);
489 WFD_RETV_IF(ret != 0, NULL, "Failed to activate WFD\n");
493 ret = vconf_notify_key_changed(VCONFKEY_SETAPPL_DEVICE_NAME_STR,
494 __wfd_main_vconf_change_cb, ugd);
496 DBG(LOG_ERROR, "Failed to set vconf notification callback(VCONFKEY_SETAPPL_DEVICE_NAME_STR)");
500 ret = vconf_notify_key_changed(VCONFKEY_WIFI_STATE, _wifi_on_state_cb, ugd);
502 DBG(LOG_ERROR, "Failed to set vconf notification callback(VCONFKEY_WIFI_STATE)");
507 ret = vconf_notify_key_changed(VCONFKEY_MOBILE_HOTSPOT_MODE,
508 __wfd_hotspot_mode_vconf_change_cb, ugd);
510 DBG(LOG_ERROR, "Failed to set vconf notification callback(MOBILE_HOTSPOT_MODE)");
517 static void on_start(ui_gadget_h ug, app_control_h control, void *priv)
529 struct utsname kernel_info;
530 res = uname(&kernel_info);
532 DBG(LOG_ERROR, "Failed to detect target type\n");
534 DBG_SECURE(LOG_INFO, "HW ID of this device [%s]\n", kernel_info.machine);
535 if (strncmp(kernel_info.machine, "arm", 3) != 0) {
536 wfd_ug_warn_popup(ugd, _("IDS_ST_POP_NOT_SUPPORTED"), POPUP_TYPE_TERMINATE_NOT_SUPPORT);
544 static void on_pause(ui_gadget_h ug, app_control_h control, void *priv)
548 WFD_RET_IF(ug == NULL || priv == NULL, "The param is NULL\n");
549 struct ug_data *ugd = priv;
550 ugd->is_paused = true;
552 wfd_refresh_wifi_direct_state(ugd);
553 DBG(LOG_INFO, "on pause, wfd status: %d\n", ugd->wfd_status);
555 if ((WIFI_DIRECT_STATE_DISCOVERING == ugd->wfd_status) &&
556 (WIFI_DIRECT_ERROR_NONE != wifi_direct_cancel_discovery())) {
557 DBG(LOG_ERROR, "Failed to send cancel discovery state [%d]\n", ugd->wfd_status);
562 ugd->wfd_discovery_status = WIFI_DIRECT_DISCOVERY_STOPPED;
567 static void on_resume(ui_gadget_h ug, app_control_h control, void *priv)
571 WFD_RET_IF(ug == NULL || priv == NULL, "The param is NULL\n");
572 struct ug_data *ugd = priv;
573 ugd->is_paused = false;
575 wfd_refresh_wifi_direct_state(ugd);
576 DBG(LOG_INFO, "on resume, status: %d\n", ugd->wfd_status);
577 ugd->wfd_discovery_status = WIFI_DIRECT_DISCOVERY_STOPPED;
579 elm_genlist_realized_items_update(ugd->genlist);
581 if (ugd->wfd_status > WIFI_DIRECT_STATE_DEACTIVATED && ugd->wfd_status < WIFI_DIRECT_STATE_CONNECTED) {
582 DBG(LOG_INFO, "Start discovery again\n");
583 ugd->wfd_discovery_status = WIFI_DIRECT_DISCOVERY_SOCIAL_CHANNEL_START;
584 ret = wifi_direct_start_discovery_specific_channel(false, 1, WIFI_DIRECT_DISCOVERY_SOCIAL_CHANNEL);
585 if (ret != WIFI_DIRECT_ERROR_NONE) {
586 ugd->wfd_discovery_status = WIFI_DIRECT_DISCOVERY_NONE;
587 DBG(LOG_ERROR, "Failed to start discovery. [%d]\n", ret);
588 wifi_direct_cancel_discovery();
595 static void on_destroy(ui_gadget_h ug, app_control_h control, void *priv)
599 WFD_RET_IF(ug == NULL || priv == NULL, "The param is NULL\n");
601 struct ug_data *ugd = priv;
603 WFD_RET_IF(ugd->base == NULL, "The param is NULL\n");
605 #ifdef MOTION_CONTROL_ENABLE
609 /* DeInit WiFi Direct */
610 ret = deinit_wfd_client(ugd);
612 DBG(LOG_ERROR,"Failed to DeInit WiFi Direct");
615 if (ugd->scan_toolbar) {
616 wfd_ug_view_refresh_button(ugd->scan_toolbar,
617 _("IDS_WIFI_SK4_SCAN"), FALSE);
620 ret = vconf_ignore_key_changed(VCONFKEY_SETAPPL_DEVICE_NAME_STR,
621 __wfd_main_vconf_change_cb);
623 DBG(LOG_ERROR,"Failed to ignore vconf key callback\n");
627 ret = vconf_ignore_key_changed(VCONFKEY_WIFI_STATE, _wifi_on_state_cb);
629 DBG(LOG_ERROR,"Failed to ignore vconf key callback\n");
633 ret = vconf_ignore_key_changed(VCONFKEY_MOBILE_HOTSPOT_MODE,
634 __wfd_hotspot_mode_vconf_change_cb);
636 DBG(LOG_ERROR,"Failed to ignore vconf key callback MOBILE_HOTSPOT_MODE\n");
639 wfd_ug_view_free_peers(ugd);
640 WFD_IF_FREE_MEM(ugd->title);
641 WFD_IF_FREE_MEM(ugd->wfds);
642 WFD_IF_FREE_MEM(ugd->view_type);
644 WFD_IF_DEL_OBJ(ugd->bg);
646 #ifdef WFD_DBUS_LAUNCH
648 evas_object_event_callback_del(ugd->base, EVAS_CALLBACK_SHOW, _wfd_init_cb);
650 WFD_IF_DEL_OBJ(ugd->base);
651 DBG(LOG_INFO, "WFD client deregistered");
657 static void on_message(ui_gadget_h ug, app_control_h msg, app_control_h control, void *priv)
660 char* app_msg = NULL;
661 struct ug_data *ugd = priv;
664 DBG(LOG_ERROR, "The param is NULL\n");
669 app_control_get_extra_data(msg, "msg", &app_msg);
670 DBG(LOG_DEBUG, "Msg from app: %s", app_msg);
672 if (!strcmp(app_msg, "destroy")) {
673 if(!ugd->rename_popup) {
674 DBG(LOG_INFO, "Destroying UG.");
675 wfd_ug_view_free_peers(ugd);
679 WFD_IF_FREE_MEM(app_msg);
684 static void on_event(ui_gadget_h ug, enum ug_event event, app_control_h control, void *priv)
689 DBG(LOG_ERROR, "The param is NULL\n");
694 case UG_EVENT_LOW_MEMORY:
695 DBG(LOG_INFO, "UG_EVENT_LOW_MEMORY\n");
697 case UG_EVENT_LOW_BATTERY:
698 DBG(LOG_INFO, "UG_EVENT_LOW_BATTERY\n");
700 case UG_EVENT_LANG_CHANGE:
701 DBG(LOG_INFO, "UG_EVENT_LANG_CHANGE\n");
703 case UG_EVENT_ROTATE_PORTRAIT:
705 DBG(LOG_INFO, "UG_EVENT_ROTATE_PORTRAIT\n");
707 case UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN:
708 DBG(LOG_INFO, "UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN\n");
710 case UG_EVENT_ROTATE_LANDSCAPE:
712 DBG(LOG_INFO, "UG_EVENT_ROTATE_LANDSCAPE\n");
714 case UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN:
716 DBG(LOG_INFO, "UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN\n");
719 DBG(LOG_INFO, "default\n");
726 static void on_key_event(ui_gadget_h ug, enum ug_key_event event, app_control_h control, void *priv)
731 DBG(LOG_ERROR, "The param is NULL\n");
736 case UG_KEY_EVENT_END:
737 DBG(LOG_INFO, "UG_KEY_EVENT_END\n");
746 UG_MODULE_API int UG_MODULE_INIT(struct ug_module_ops *ops)
752 DBG(LOG_ERROR, "The param is NULL\n");
756 ugd = calloc(1, sizeof(struct ug_data));
758 DBG(LOG_ERROR, "Failed to allocate memory for UG data\n");
764 ops->create = on_create;
765 ops->start = on_start;
766 ops->pause = on_pause;
767 ops->resume = on_resume;
768 ops->destroy = on_destroy;
769 ops->message = on_message;
770 ops->event = on_event;
771 ops->key_event = on_key_event;
773 ops->opt = UG_OPT_INDICATOR_ENABLE;
779 UG_MODULE_API void UG_MODULE_EXIT(struct ug_module_ops *ops)
786 DBG(LOG_ERROR, "The param is NULL\n");
792 WFD_IF_FREE_MEM(ugd);
797 UG_MODULE_API int setting_plugin_reset(app_control_h control, void *priv)
801 wifi_direct_state_e state;
803 res = wifi_direct_initialize();
804 if (res != WIFI_DIRECT_ERROR_NONE) {
805 DBG(LOG_ERROR, "Failed to initialize wifi direct. [%d]\n", res);
809 res = wifi_direct_get_state(&state);
810 if (res != WIFI_DIRECT_ERROR_NONE) {
811 DBG(LOG_ERROR, "Failed to get link status. [%d]\n", res);
815 if (state < WIFI_DIRECT_STATE_ACTIVATING) {
816 DBG(LOG_INFO, "No need to reset Wi-Fi Direct.\n");
818 /*if connected, disconnect all devices*/
819 if (WIFI_DIRECT_STATE_CONNECTED == state) {
820 res = wifi_direct_disconnect_all();
821 if (res != WIFI_DIRECT_ERROR_NONE) {
822 DBG(LOG_ERROR, "Failed to send disconnection request to all. [%d]\n", res);
827 res = wifi_direct_deactivate();
828 if (res != WIFI_DIRECT_ERROR_NONE) {
829 DBG(LOG_ERROR, "Failed to reset Wi-Fi Direct. [%d]\n", res);
834 res = wifi_direct_deinitialize();
835 if (res != WIFI_DIRECT_ERROR_NONE) {
836 DBG(LOG_ERROR, "Failed to deinitialize wifi direct. [%d]\n", res);
844 UG_MODULE_API int setting_plugin_search_init(app_control_h control, void *priv, char** applocale)
848 *applocale = strdup("ug-setting-wifidirect-efl");
851 Eina_List **pplist = (Eina_List**)priv;
853 node = setting_plugin_search_item_add("IDS_WIFI_BUTTON_MULTI_CONNECT", "viewtype:IDS_WIFI_BUTTON_MULTI_CONNECT", NULL, 5, NULL);
854 *pplist = eina_list_append(*pplist, node);