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;
143 Ea_Theme_Color_Table *_color_table_set(void)
145 Ea_Theme_Color_Table *table;
147 table = ea_theme_color_table_new(COLOR_TABLE);
148 DBG(LOG_INFO, "Wi-Fi direct color table : %p", table);
149 ea_theme_colors_set(table, EA_THEME_STYLE_DEFAULT);
154 Ea_Theme_Font_Table *_font_table_set(void)
156 Ea_Theme_Font_Table *table;
158 table = ea_theme_color_table_new(FONT_TABLE);
159 DBG(LOG_INFO, "Wi-Fi direct font table : %p", table);
160 ea_theme_fonts_set(table);
166 * This function let the ug create backgroud
168 * @param[in] ugd the pointer to the parent object
169 * @param[in] ugd the pointer to the main data structure
171 static Evas_Object *_create_bg(Evas_Object *parent, char *style)
176 bg = elm_bg_add(parent);
177 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
178 elm_object_style_set(bg, style);
179 evas_object_show(bg);
186 * This function let the ug create full view
188 * @param[in] ugd the pointer to the parent object
189 * @param[in] ugd the pointer to the main data structure
191 static Evas_Object *_create_fullview(Evas_Object *parent, struct ug_data *ugd)
196 if (parent == NULL) {
197 DBG(LOG_ERROR, "Incorrenct parameter");
201 /* Create Full view */
202 base = elm_layout_add(parent);
204 DBG(LOG_ERROR, "Failed to add layout");
208 elm_layout_theme_set(base, "layout", "application", "default");
209 evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
210 evas_object_size_hint_align_set(base, EVAS_HINT_FILL, EVAS_HINT_FILL);
217 * This function let the ug create frame view
219 * @param[in] ugd the pointer to the parent object
220 * @param[in] ugd the pointer to the main data structure
222 static Evas_Object *_create_frameview(Evas_Object *parent, struct ug_data *ugd)
227 if (parent == NULL) {
228 DBG(LOG_ERROR, "Incorrenct parameter");
232 /* Create Frame view */
233 base = elm_layout_add(parent);
235 DBG(LOG_ERROR, "Failed to add layout");
239 elm_layout_theme_set(base, "layout", "application", "default");
240 evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
241 evas_object_size_hint_align_set(base, EVAS_HINT_FILL, EVAS_HINT_FILL);
248 * This function let the ug destroy the ug
250 * @param[in] data the pointer to the main data structure
252 void wfd_destroy_ug(void *data)
255 struct ug_data *ugd = (struct ug_data *) data;
257 #ifdef WFD_DBUS_LAUNCH
258 if (ugd->dbus_cancellable != NULL) {
259 g_cancellable_cancel(ugd->dbus_cancellable);
260 g_object_unref(ugd->dbus_cancellable);
261 ugd->dbus_cancellable = NULL;
263 g_object_unref(ugd->conn);
266 DBG(LOG_INFO, "Cancelled dbus call");
271 DBG(LOG_INFO, "dbus_cancellable is NULL");
272 ug_destroy_me(ugd->ug);
279 static void wfd_ug_layout_del_cb(void *data , Evas *e, Evas_Object *obj, void *event_info)
283 struct ug_data *ugd = (struct ug_data *) data;
285 DBG(LOG_ERROR, "Incorrect parameter(NULL)");
289 wfd_client_free_raw_discovered_peers(ugd);
290 wfd_ug_view_free_peers(ugd);
291 destroy_wfd_ug_view(ugd);
296 #ifdef WFD_DBUS_LAUNCH
298 * This function let the ug initialize wfd
300 * @param[in] data the pointer to the main data structure
301 * @param[in] evas the pointer to the evas canvas
302 * @param[in] obj the pointer to the evas object
303 * @param[in] event_info the pointer to the event information
305 static void _wfd_init_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info)
309 struct ug_data *ugd = (struct ug_data *)data;
310 WFD_RET_IF(ugd == NULL || ugd->base == NULL, "Incorrect parameter(NULL)\n");
312 evas_object_event_callback_del(ugd->base, EVAS_CALLBACK_SHOW, _wfd_init_cb);
314 res = launch_wifi_direct_manager(ugd);
316 DBG(LOG_ERROR, "Failed to launch wifi direct manager\n");
324 static void *on_create(ui_gadget_h ug, enum ug_mode mode, app_control_h control, void *priv)
329 int rots[4] = { 0, 90, 180, 270 };
339 bindtextdomain(PACKAGE, LOCALEDIR);
341 ugd->win = ug_get_window();
346 elm_win_wm_rotation_available_rotations_set(ugd->win, rots, 1);
349 /* check the input parameters from app at first */
351 ugd->device_filter = -1; /* show all devices */
352 ugd->is_auto_exit = false;
353 ugd->is_multi_connect = true;
354 ugd->is_init_ok = false;
355 ugd->title = strdup(_("IDS_WIFI_BODY_WI_FI_DIRECT_ABB"));
359 char *device_filter = NULL;
360 char *auto_exit = NULL;
361 char *multi_connect = NULL;
363 char* viewtype = NULL;
366 * get the control name
367 * default value: Wi-Fi Direct
369 ret = app_control_get_extra_data(control, "wfds", &wfds);
370 if (ret == APP_CONTROL_ERROR_NONE && wfds) {
371 DBG_SECURE(LOG_INFO, "Wfds name: %s", wfds);
372 ugd->wfds = strdup(wfds);
373 WFD_IF_FREE_MEM(wfds);
376 ret = app_control_get_extra_data(control, "viewtype", &viewtype);
377 if(ret == APP_CONTROL_ERROR_NONE && viewtype) {
378 DBG(LOG_INFO, "viewtype: %s\n", viewtype);
379 ugd->view_type = strdup(viewtype);
380 WFD_IF_FREE_MEM(viewtype);
384 * get the device filter
385 * default value: NULL
387 ret = app_control_get_extra_data(control, "device_filter", &device_filter);
388 if (ret == APP_CONTROL_ERROR_NONE && device_filter) {
389 DBG(LOG_INFO, "Device filter: %s", device_filter);
390 if (0 == strncmp(device_filter, "computer", 8)) {
391 ugd->device_filter = WFD_DEVICE_TYPE_COMPUTER;
392 } else if (0 == strncmp(device_filter, "input_device", 12)) {
393 ugd->device_filter = WFD_DEVICE_TYPE_INPUT_DEVICE;
394 } else if (0 == strncmp(device_filter, "printer", 6)) {
395 ugd->device_filter = WFD_DEVICE_TYPE_PRINTER;
396 } else if (0 == strncmp(device_filter, "camera", 6)) {
397 ugd->device_filter = WFD_DEVICE_TYPE_CAMERA;
398 } else if (0 == strncmp(device_filter, "storage", 7)) {
399 ugd->device_filter = WFD_DEVICE_TYPE_STORAGE;
400 } else if (0 == strncmp(device_filter, "network_infra", 13)) {
401 ugd->device_filter = WFD_DEVICE_TYPE_NW_INFRA;
402 } else if (0 == strncmp(device_filter, "display", 7)) {
403 ugd->device_filter = WFD_DEVICE_TYPE_DISPLAYS;
404 } else if (0 == strncmp(device_filter, "multimedia_device", 17)) {
405 ugd->device_filter = WFD_DEVICE_TYPE_MM_DEVICES;
406 } else if (0 == strncmp(device_filter, "game_device", 11)) {
407 ugd->device_filter = WFD_DEVICE_TYPE_GAME_DEVICES;
408 } else if (0 == strncmp(device_filter, "telephone", 9)) {
409 ugd->device_filter = WFD_DEVICE_TYPE_TELEPHONE;
410 } else if (0 == strncmp(device_filter, "audio", 5)) {
411 ugd->device_filter = WFD_DEVICE_TYPE_AUDIO;
413 ugd->device_filter = WFD_DEVICE_TYPE_OTHER;
415 WFD_IF_FREE_MEM(device_filter);
419 * get whether support auto exit after connection
420 * default value: false
422 ret = app_control_get_extra_data(control, "auto_exit", &auto_exit);
423 if (ret == APP_CONTROL_ERROR_NONE && auto_exit) {
424 DBG(LOG_INFO, "Auto exit: %s", auto_exit);
425 if (0 == strncmp(auto_exit, "on", 2)) {
426 ugd->is_auto_exit = true;
428 ugd->is_auto_exit = false;
430 WFD_IF_FREE_MEM(auto_exit);
434 * get whether support multi connection,
435 * default value: true
437 ret = app_control_get_extra_data(control, "multi_connect", &multi_connect);
438 if (ret == APP_CONTROL_ERROR_NONE && multi_connect) {
439 DBG(LOG_INFO, "Multi connection: %s", multi_connect);
440 if (0 == strncmp(multi_connect, "off", 2)) {
441 ugd->is_multi_connect = false;
443 ugd->is_multi_connect = true;
445 WFD_IF_FREE_MEM(multi_connect);
449 * get the title of UG
450 * default value: Wi-Fi Direct
452 ret = app_control_get_extra_data(control, "title_string", &title);
453 if (ret == APP_CONTROL_ERROR_NONE && title) {
454 DBG(LOG_INFO, "Title of UG: %s", title);
455 WFD_IF_FREE_MEM(ugd->title);
456 ugd->title = strdup(title);
457 WFD_IF_FREE_MEM(title);
461 if (mode == UG_MODE_FULLVIEW) {
462 ugd->base = _create_fullview(ugd->win, ugd);
464 ugd->base = _create_frameview(ugd->win, ugd);
468 evas_object_event_callback_add(ugd->base, EVAS_CALLBACK_DEL, wfd_ug_layout_del_cb, ugd);
469 ugd->bg = _create_bg(ugd->win, "group_list");
470 elm_object_part_content_set(ugd->base, "elm.swallow.bg", ugd->bg);
472 DBG(LOG_ERROR, "Failed to create base layout\n");
476 /* check status of wifi-direct from vconf */
477 wfd_status = wfd_get_vconf_status();
478 if (wfd_status < 0) {
482 /* Enablee Changeable UI feature */
483 ea_theme_changeable_ui_enabled_set(EINA_TRUE);
485 ugd->color_table = _color_table_set();
486 ugd->font_table = _font_table_set();
489 initialize_gen_item_class();
490 create_wfd_ug_view(ugd);
491 wfd_ug_view_init_genlist(ugd, true);
492 #ifdef MOTION_CONTROL_ENABLE
497 * if not deactivated, do initialization at once;
498 * otherwise, do initialization later
500 if (wfd_status != VCONFKEY_WIFI_DIRECT_DEACTIVATED) {
501 init_wfd_client(ugd);
503 ugd->wfd_status = WIFI_DIRECT_STATE_DEACTIVATED;
505 #ifdef WFD_DBUS_LAUNCH
506 evas_object_event_callback_add(ugd->base, EVAS_CALLBACK_SHOW, _wfd_init_cb, ugd);
508 ret = init_wfd_client(ugd);
509 WFD_RETV_IF(ret != 0, NULL, "Failed to initialize WFD client library\n");
511 /* Activate WiFi Direct */
512 DBG(LOG_INFO, "Activating WiFi Direct...");
513 if (ugd->wfd_status <= WIFI_DIRECT_STATE_DEACTIVATING) {
514 ret = wfd_client_switch_on(ugd);
515 WFD_RETV_IF(ret != 0, NULL, "Failed to activate WFD\n");
519 ret = vconf_notify_key_changed(VCONFKEY_SETAPPL_DEVICE_NAME_STR,
520 __wfd_main_vconf_change_cb, ugd);
522 DBG(LOG_ERROR, "Failed to set vconf notification callback(VCONFKEY_SETAPPL_DEVICE_NAME_STR)");
526 ret = vconf_notify_key_changed(VCONFKEY_WIFI_STATE, _wifi_on_state_cb, ugd);
528 DBG(LOG_ERROR, "Failed to set vconf notification callback(VCONFKEY_WIFI_STATE)");
533 ret = vconf_notify_key_changed(VCONFKEY_MOBILE_HOTSPOT_MODE,
534 __wfd_hotspot_mode_vconf_change_cb, ugd);
536 DBG(LOG_ERROR, "Failed to set vconf notification callback(MOBILE_HOTSPOT_MODE)");
543 static void on_start(ui_gadget_h ug, app_control_h control, void *priv)
555 struct utsname kernel_info;
556 res = uname(&kernel_info);
558 DBG(LOG_ERROR, "Failed to detect target type\n");
560 DBG_SECURE(LOG_INFO, "HW ID of this device [%s]\n", kernel_info.machine);
561 if (strncmp(kernel_info.machine, "arm", 3) != 0) {
562 wfd_ug_warn_popup(ugd, _("IDS_ST_POP_NOT_SUPPORTED"), POPUP_TYPE_TERMINATE_NOT_SUPPORT);
570 static void on_pause(ui_gadget_h ug, app_control_h control, void *priv)
574 WFD_RET_IF(ug == NULL || priv == NULL, "The param is NULL\n");
575 struct ug_data *ugd = priv;
576 ugd->is_paused = true;
578 wfd_refresh_wifi_direct_state(ugd);
579 DBG(LOG_INFO, "on pause, wfd status: %d\n", ugd->wfd_status);
581 if ((WIFI_DIRECT_STATE_DISCOVERING == ugd->wfd_status) &&
582 (WIFI_DIRECT_ERROR_NONE != wifi_direct_cancel_discovery())) {
583 DBG(LOG_ERROR, "Failed to send cancel discovery state [%d]\n", ugd->wfd_status);
588 ugd->wfd_discovery_status = WIFI_DIRECT_DISCOVERY_STOPPED;
593 static void on_resume(ui_gadget_h ug, app_control_h control, void *priv)
597 WFD_RET_IF(ug == NULL || priv == NULL, "The param is NULL\n");
598 struct ug_data *ugd = priv;
599 ugd->is_paused = false;
601 wfd_refresh_wifi_direct_state(ugd);
602 DBG(LOG_INFO, "on resume, status: %d\n", ugd->wfd_status);
603 ugd->wfd_discovery_status = WIFI_DIRECT_DISCOVERY_STOPPED;
605 elm_genlist_realized_items_update(ugd->genlist);
607 if (ugd->wfd_status > WIFI_DIRECT_STATE_DEACTIVATED && ugd->wfd_status < WIFI_DIRECT_STATE_CONNECTED) {
608 DBG(LOG_INFO, "Start discovery again\n");
609 ugd->wfd_discovery_status = WIFI_DIRECT_DISCOVERY_SOCIAL_CHANNEL_START;
610 ret = wifi_direct_start_discovery_specific_channel(false, 1, WIFI_DIRECT_DISCOVERY_SOCIAL_CHANNEL);
611 if (ret != WIFI_DIRECT_ERROR_NONE) {
612 ugd->wfd_discovery_status = WIFI_DIRECT_DISCOVERY_NONE;
613 DBG(LOG_ERROR, "Failed to start discovery. [%d]\n", ret);
614 wifi_direct_cancel_discovery();
621 static void on_destroy(ui_gadget_h ug, app_control_h control, void *priv)
625 WFD_RET_IF(ug == NULL || priv == NULL, "The param is NULL\n");
627 struct ug_data *ugd = priv;
629 WFD_RET_IF(ugd->base == NULL, "The param is NULL\n");
631 #ifdef MOTION_CONTROL_ENABLE
635 /* DeInit WiFi Direct */
636 ret = deinit_wfd_client(ugd);
638 DBG(LOG_ERROR,"Failed to DeInit WiFi Direct");
641 if (ugd->scan_toolbar) {
642 wfd_ug_view_refresh_button(ugd->scan_toolbar,
643 _("IDS_WIFI_SK4_SCAN"), FALSE);
646 ret = vconf_ignore_key_changed(VCONFKEY_SETAPPL_DEVICE_NAME_STR,
647 __wfd_main_vconf_change_cb);
649 DBG(LOG_ERROR,"Failed to ignore vconf key callback\n");
653 ret = vconf_ignore_key_changed(VCONFKEY_WIFI_STATE, _wifi_on_state_cb);
655 DBG(LOG_ERROR,"Failed to ignore vconf key callback\n");
659 ret = vconf_ignore_key_changed(VCONFKEY_MOBILE_HOTSPOT_MODE,
660 __wfd_hotspot_mode_vconf_change_cb);
662 DBG(LOG_ERROR,"Failed to ignore vconf key callback MOBILE_HOTSPOT_MODE\n");
665 wfd_ug_view_free_peers(ugd);
666 WFD_IF_FREE_MEM(ugd->title);
667 WFD_IF_FREE_MEM(ugd->wfds);
668 WFD_IF_FREE_MEM(ugd->view_type);
670 WFD_IF_DEL_OBJ(ugd->bg);
672 #ifdef WFD_DBUS_LAUNCH
674 evas_object_event_callback_del(ugd->base, EVAS_CALLBACK_SHOW, _wfd_init_cb);
676 WFD_IF_DEL_OBJ(ugd->base);
677 DBG(LOG_INFO, "WFD client deregistered");
683 static void on_message(ui_gadget_h ug, app_control_h msg, app_control_h control, void *priv)
686 char* app_msg = NULL;
687 struct ug_data *ugd = priv;
690 DBG(LOG_ERROR, "The param is NULL\n");
695 app_control_get_extra_data(msg, "msg", &app_msg);
696 DBG(LOG_DEBUG, "Msg from app: %s", app_msg);
698 if (!strcmp(app_msg, "destroy")) {
699 if(!ugd->rename_popup) {
700 DBG(LOG_INFO, "Destroying UG.");
701 wfd_ug_view_free_peers(ugd);
705 WFD_IF_FREE_MEM(app_msg);
710 static void on_event(ui_gadget_h ug, enum ug_event event, app_control_h control, void *priv)
715 DBG(LOG_ERROR, "The param is NULL\n");
720 case UG_EVENT_LOW_MEMORY:
721 DBG(LOG_INFO, "UG_EVENT_LOW_MEMORY\n");
723 case UG_EVENT_LOW_BATTERY:
724 DBG(LOG_INFO, "UG_EVENT_LOW_BATTERY\n");
726 case UG_EVENT_LANG_CHANGE:
727 DBG(LOG_INFO, "UG_EVENT_LANG_CHANGE\n");
729 case UG_EVENT_ROTATE_PORTRAIT:
731 DBG(LOG_INFO, "UG_EVENT_ROTATE_PORTRAIT\n");
733 case UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN:
734 DBG(LOG_INFO, "UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN\n");
736 case UG_EVENT_ROTATE_LANDSCAPE:
738 DBG(LOG_INFO, "UG_EVENT_ROTATE_LANDSCAPE\n");
740 case UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN:
742 DBG(LOG_INFO, "UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN\n");
745 DBG(LOG_INFO, "default\n");
752 static void on_key_event(ui_gadget_h ug, enum ug_key_event event, app_control_h control, void *priv)
757 DBG(LOG_ERROR, "The param is NULL\n");
762 case UG_KEY_EVENT_END:
763 DBG(LOG_INFO, "UG_KEY_EVENT_END\n");
772 UG_MODULE_API int UG_MODULE_INIT(struct ug_module_ops *ops)
778 DBG(LOG_ERROR, "The param is NULL\n");
782 ugd = calloc(1, sizeof(struct ug_data));
784 DBG(LOG_ERROR, "Failed to allocate memory for UG data\n");
790 ops->create = on_create;
791 ops->start = on_start;
792 ops->pause = on_pause;
793 ops->resume = on_resume;
794 ops->destroy = on_destroy;
795 ops->message = on_message;
796 ops->event = on_event;
797 ops->key_event = on_key_event;
799 ops->opt = UG_OPT_INDICATOR_ENABLE;
805 UG_MODULE_API void UG_MODULE_EXIT(struct ug_module_ops *ops)
812 DBG(LOG_ERROR, "The param is NULL\n");
818 WFD_IF_FREE_MEM(ugd);
823 UG_MODULE_API int setting_plugin_reset(app_control_h control, void *priv)
827 wifi_direct_state_e state;
829 res = wifi_direct_initialize();
830 if (res != WIFI_DIRECT_ERROR_NONE) {
831 DBG(LOG_ERROR, "Failed to initialize wifi direct. [%d]\n", res);
835 res = wifi_direct_get_state(&state);
836 if (res != WIFI_DIRECT_ERROR_NONE) {
837 DBG(LOG_ERROR, "Failed to get link status. [%d]\n", res);
841 if (state < WIFI_DIRECT_STATE_ACTIVATING) {
842 DBG(LOG_INFO, "No need to reset Wi-Fi Direct.\n");
844 /*if connected, disconnect all devices*/
845 if (WIFI_DIRECT_STATE_CONNECTED == state) {
846 res = wifi_direct_disconnect_all();
847 if (res != WIFI_DIRECT_ERROR_NONE) {
848 DBG(LOG_ERROR, "Failed to send disconnection request to all. [%d]\n", res);
853 res = wifi_direct_deactivate();
854 if (res != WIFI_DIRECT_ERROR_NONE) {
855 DBG(LOG_ERROR, "Failed to reset Wi-Fi Direct. [%d]\n", res);
860 res = wifi_direct_deinitialize();
861 if (res != WIFI_DIRECT_ERROR_NONE) {
862 DBG(LOG_ERROR, "Failed to deinitialize wifi direct. [%d]\n", res);
870 UG_MODULE_API int setting_plugin_search_init(app_control_h control, void *priv, char** applocale)
874 *applocale = strdup("ug-setting-wifidirect-efl");
877 Eina_List **pplist = (Eina_List**)priv;
879 node = setting_plugin_search_item_add("IDS_WIFI_BUTTON_MULTI_CONNECT", "viewtype:IDS_WIFI_BUTTON_MULTI_CONNECT", NULL, 5, NULL);
880 *pplist = eina_list_append(*pplist, node);