summaryrefslogtreecommitdiff
path: root/ug-wifidirect
diff options
context:
space:
mode:
Diffstat (limited to 'ug-wifidirect')
-rw-r--r--ug-wifidirect/CMakeLists.txt41
-rw-r--r--ug-wifidirect/include/wfd_client.h80
-rw-r--r--ug-wifidirect/include/wfd_ug.h110
-rw-r--r--ug-wifidirect/include/wfd_ug_view.h81
-rw-r--r--ug-wifidirect/po/CMakeLists.txt24
-rw-r--r--ug-wifidirect/po/POTFILES.in2
-rw-r--r--ug-wifidirect/po/en.po71
-rw-r--r--ug-wifidirect/po/en_GB.po71
-rw-r--r--ug-wifidirect/po/en_US.po71
-rw-r--r--ug-wifidirect/po/ja.po71
-rw-r--r--ug-wifidirect/po/ko_KR.po71
-rw-r--r--ug-wifidirect/po/ug-wifi-qdirect.pot324
-rwxr-xr-xug-wifidirect/po/update-po.sh60
-rw-r--r--ug-wifidirect/po/zh_CN.po71
-rwxr-xr-xug-wifidirect/resources/images/00_list_bar_press_1x80.pngbin0 -> 2872 bytes
-rwxr-xr-xug-wifidirect/resources/images/31_BT_device_headset.pngbin0 -> 1591 bytes
-rwxr-xr-xug-wifidirect/resources/images/31_BT_device_keyboard.pngbin0 -> 1692 bytes
-rwxr-xr-xug-wifidirect/resources/images/31_BT_device_mouse.pngbin0 -> 889 bytes
-rwxr-xr-xug-wifidirect/resources/images/31_BT_device_printer.pngbin0 -> 647 bytes
-rwxr-xr-xug-wifidirect/resources/images/31_BT_device_unknown.pngbin0 -> 1462 bytes
-rwxr-xr-xug-wifidirect/resources/images/A09_Connect.pngbin0 -> 3428 bytes
-rwxr-xr-xug-wifidirect/resources/images/A09_NoDevice.pngbin0 -> 4279 bytes
-rwxr-xr-xug-wifidirect/resources/images/A09_device_My_laptop.pngbin0 -> 3370 bytes
-rwxr-xr-xug-wifidirect/resources/images/A09_device_computer.pngbin0 -> 3093 bytes
-rwxr-xr-xug-wifidirect/resources/images/A09_device_mobile.pngbin0 -> 3032 bytes
-rw-r--r--ug-wifidirect/resources/wfd_ug.edc248
-rw-r--r--ug-wifidirect/src/wfd_client.c842
-rw-r--r--ug-wifidirect/src/wfd_ug.c366
-rw-r--r--ug-wifidirect/src/wfd_ug_view.c874
29 files changed, 3478 insertions, 0 deletions
diff --git a/ug-wifidirect/CMakeLists.txt b/ug-wifidirect/CMakeLists.txt
new file mode 100644
index 0000000..5f901e3
--- /dev/null
+++ b/ug-wifidirect/CMakeLists.txt
@@ -0,0 +1,41 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(ug-setting-wifidirect-efl C)
+
+SET(PREFIX "/opt/ug")
+SET(LIBDIR "${PREFIX}/lib")
+SET(RESDIR "${PREFIX}/res")
+SET(EDJDIR "${RESDIR}/edje/${PROJECT_NAME}")
+SET(IMGDIR "${RESDIR}/images/${PROJECT_NAME}")
+
+SET(SRCS
+ src/wfd_ug.c
+ src/wfd_ug_view.c
+ src/wfd_client.c
+)
+
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)
+
+
+SET(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} -fvisibility=hidden -Wall")
+SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
+SET(CMAKE_C_FLAGS_RELEASE "-O2")
+
+ADD_DEFINITIONS("-DPREFIX=\"${PREFIX}\"")
+ADD_DEFINITIONS("-DRESDIR=\"${RESDIR}\"")
+
+ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS})
+SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION 0.1.0)
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS})
+
+ADD_CUSTOM_TARGET(wfd_ug.edj
+ COMMAND edje_cc -id ${CMAKE_CURRENT_SOURCE_DIR}/resources/images
+ ${CMAKE_CURRENT_SOURCE_DIR}/resources/wfd_ug.edc ${CMAKE_BINARY_DIR}/wfd_ug.edj
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/resources/wfd_ug.edc
+)
+ADD_DEPENDENCIES(${PROJECT_NAME} wfd_ug.edj)
+
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIBDIR})
+INSTALL(FILES ${CMAKE_BINARY_DIR}/wfd_ug.edj DESTINATION ${EDJDIR})
+INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/resources/images/ DESTINATION ${IMGDIR} FILES_MATCHING PATTERN "*.png")
+
+ADD_SUBDIRECTORY(po)
diff --git a/ug-wifidirect/include/wfd_client.h b/ug-wifidirect/include/wfd_client.h
new file mode 100644
index 0000000..fb7bf72
--- /dev/null
+++ b/ug-wifidirect/include/wfd_client.h
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * This file declares Wi-Fi direct client functions.
+ *
+ * @file wfd_client.h
+ * @author Gibyoung Kim (lastkgb.kim@samsung.com)
+ * @version 0.1
+ */
+
+
+#ifndef __WFD_CLIENT_H__
+#define __WFD_CLIENT_H__
+
+
+typedef enum
+{
+ WFD_DEVICE_TYPE_COMPUTER = WIFI_DIRECT_PRIMARY_DEVICE_TYPE_COMPUTER,
+ WFD_DEVICE_TYPE_INPUT_DEVICE = WIFI_DIRECT_PRIMARY_DEVICE_TYPE_INPUT_DEVICE,
+ WFD_DEVICE_TYPE_PRINTER = WIFI_DIRECT_PRIMARY_DEVICE_TYPE_PRINTER,
+ WFD_DEVICE_TYPE_CAMERA = WIFI_DIRECT_PRIMARY_DEVICE_TYPE_CAMERA,
+ WFD_DEVICE_TYPE_STORAGE = WIFI_DIRECT_PRIMARY_DEVICE_TYPE_STORAGE,
+ WFD_DEVICE_TYPE_NW_INFRA = WIFI_DIRECT_PRIMARY_DEVICE_TYPE_NETWORK_INFRA,
+ WFD_DEVICE_TYPE_DISPLAYS = WIFI_DIRECT_PRIMARY_DEVICE_TYPE_DISPLAY,
+ WFD_DEVICE_TYPE_MM_DEVICES =
+ WIFI_DIRECT_PRIMARY_DEVICE_TYPE_MULTIMEDIA_DEVICE,
+ WFD_DEVICE_TYPE_GAME_DEVICES = WIFI_DIRECT_PRIMARY_DEVICE_TYPE_GAME_DEVICE,
+ WFD_DEVICE_TYPE_TELEPHONE = WIFI_DIRECT_PRIMARY_DEVICE_TYPE_TELEPHONE,
+ WFD_DEVICE_TYPE_AUDIO = WIFI_DIRECT_PRIMARY_DEVICE_TYPE_AUDIO,
+ WFD_DEVICE_TYPE_OTHER = WIFI_DIRECT_PRIMARY_DEVICE_TYPE_OTHER,
+} device_type_e;
+
+typedef enum
+{
+ WFD_LINK_STATUS_DEACTIVATED = WIFI_DIRECT_STATE_DEACTIVATED,
+ WFD_LINK_STATUS_DEACTIVATING = WIFI_DIRECT_STATE_DEACTIVATING,
+ WFD_LINK_STATUS_ACTIVATING = WIFI_DIRECT_STATE_ACTIVATING,
+ WFD_LINK_STATUS_ACTIVATED = WIFI_DIRECT_STATE_ACTIVATED,
+ WFD_LINK_STATUS_DISCOVERING = WIFI_DIRECT_STATE_DISCOVERING,
+ WFD_LINK_STATUS_CONNECTING = WIFI_DIRECT_STATE_CONNECTING,
+ WFD_LINK_STATUS_DISCONNECTING = WIFI_DIRECT_STATE_DISCONNECTING,
+ WFD_LINK_STATUS_CONNECTED = WIFI_DIRECT_STATE_CONNECTED,
+ WFD_LINK_STATUS_GROUP_OWNER = WIFI_DIRECT_STATE_GROUP_OWNER,
+} link_status_e;
+
+typedef enum
+{
+ PEER_CONN_STATUS_DISCONNECTED,
+ PEER_CONN_STATUS_DISCONNECTING,
+ PEER_CONN_STATUS_CONNECTING = PEER_CONN_STATUS_DISCONNECTING,
+ PEER_CONN_STATUS_CONNECTED,
+} conn_status_e;
+
+int wfd_get_vconf_status(void *data);
+int wfd_wifi_off();
+int init_wfd_client(void *data);
+int deinit_wfd_client(void *data);
+int wfd_client_get_link_status(void);
+int wfd_client_start_discovery(void *data);
+int wfd_client_switch_on(void *data);
+int wfd_client_switch_off(void *data);
+int wfd_client_swtch_force(void *data, int onoff);
+int wfd_client_connect(const char *mac_addr);
+int wfd_client_disconnect(const char *mac_addr);
+
+#endif /* __WFD_CLIENT_H__ */
diff --git a/ug-wifidirect/include/wfd_ug.h b/ug-wifidirect/include/wfd_ug.h
new file mode 100644
index 0000000..8918654
--- /dev/null
+++ b/ug-wifidirect/include/wfd_ug.h
@@ -0,0 +1,110 @@
+/*
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * This file declares structure for Wi-Fi direct UI Gadget.
+ *
+ * @file wfd_ug.h
+ * @author Gibyoung Kim (lastkgb.kim@samsung.com)
+ * @version 0.1
+ */
+
+
+#ifndef __WFD_UG_H__
+#define __WFD_UG_H__
+
+#include <dlog.h>
+
+#define PACKAGE "ug-setting-wifidirect-efl"
+#define LOCALEDIR "/opt/ug/res/locale"
+
+#define DIRECT_TAG "wfd_ug"
+#define DBG(log_level, format, args...) \
+ LOG(log_level, DIRECT_TAG, "[%s()][%d] " format, __FUNCTION__, __LINE__, ##args)
+
+#define __FUNC_ENTER__ DBG(LOG_VERBOSE, "+\n")
+#define __FUNC_EXIT__ DBG(LOG_VERBOSE, "-\n")
+
+#define VCONF_WFD_ONOFF "db/wifi_direct/onoff"
+#define VCONF_WFD_CONNECTION_STATUS "db/wifi_direct/connection_status"
+#define VCONF_WFD_APNAME "db/setting/device_name"
+#define VCONF_WFD_PASSWORD "db/mobile_hotspot/wifi_key"
+#define VCONF_WFD_PREV_STATUS "db/wifi_direct/prev_status"
+
+#define assertm_if(expr, fmt, arg...) do { \
+ if(expr) { \
+ DBG(LOG_VERBOSE, " ##(%s) -> %s() assert!!## "fmt, #expr, __FUNCTION__, ##arg); \
+ assert(1); \
+ } \
+} while (0)
+
+#define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
+#define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x"
+
+#define AP_NAME_LENGTH_MAX 32
+#define AP_PASSWORD_LENGTH_MAX 64
+#define AP_PASSWORD_LENGTH_MIN 8
+#define AP_REJECT_CHAR_LIST "=,"
+
+#define DEFAULT_DEV_NAME "Tizen"
+#define MAC_LENGTH 18
+#define SSID_LENGTH 32
+#define MAX_PEER_NUM 10
+
+#define _(s) dgettext(PACKAGE, s)
+#define N_(s) dgettext_noop(s)
+#define S_(s) dgettext("sys_string", s)
+
+
+typedef struct
+{
+ char ssid[SSID_LENGTH];
+ unsigned int category;
+ char mac_addr[MAC_LENGTH];
+ char if_addr[MAC_LENGTH];
+ int conn_status;
+ Elm_Object_Item *gl_item;
+} device_type_s;
+
+struct ug_data
+{
+ Evas_Object *base;
+ struct ui_gadget *ug;
+
+ Evas_Object *win;
+ Evas_Object *bg;
+ Evas_Object *naviframe;
+ Evas_Object *genlist;
+ Elm_Object_Item *head;
+ Elm_Object_Item *noitem;
+ Elm_Object_Item *scan_btn;
+ Evas_Object *popup;
+ Evas_Object *act_popup;
+ Evas_Object *warn_popup;
+
+ int head_text_mode;
+
+ device_type_s *peers;
+ int peer_cnt;
+
+ int wfd_onoff;
+ int wfd_status;
+ char *dev_name;
+ char *dev_pass;
+};
+
+
+#endif /* __WFD_UG_H__ */
diff --git a/ug-wifidirect/include/wfd_ug_view.h b/ug-wifidirect/include/wfd_ug_view.h
new file mode 100644
index 0000000..755dd37
--- /dev/null
+++ b/ug-wifidirect/include/wfd_ug_view.h
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * This file declares functions for view of Wi-Fi direct UI Gadget.
+ *
+ * @file wfd_ug_view.h
+ * @author Gibyoung Kim (lastkgb.kim@samsung.com)
+ * @version 0.1
+ */
+
+
+#ifndef __WFD_UG_VIEW_H__
+#define __WFD_UG_VIEW_H__
+
+#define EDJDIR "/opt/ug/res/edje/ug-setting-wifidirect-efl"
+#define WFD_UG_EDJ_PATH EDJDIR"/wfd_ug.edj"
+#define WFD_IMG_DIR "/opt/ug/res/images/ug-setting-wifidirect-efl"
+
+#define WFD_ICON_DEVICE_PC WFD_IMG_DIR"/A09_device_computer.png"
+#define WFD_ICON_DEVICE_KEYBOARD WFD_IMG_DIR"/31_BT_device_keyboard.png"
+#define WFD_ICON_DEVICE_PRINTER WFD_IMG_DIR"/31_BT_device_printer.png"
+#define WFD_ICON_DEVICE_UNKNOWN WFD_IMG_DIR"/31_BT_device_unknown.png"
+#define WFD_ICON_DEVICE_PHONE WFD_IMG_DIR"/A09_device_mobile.png"
+#define WFD_ICON_DEVICE_HEADSET WFD_IMG_DIR"/31_BT_device_headset.png"
+
+#define WFD_ICON_DEVICE_MOUSE WFD_IMG_DIR"/31_BT_device_mouse.png"
+
+#define WFD_ICON_CONNECTED WFD_IMG_DIR"/A09_Connect.png"
+
+
+enum
+{
+ HEAD_TEXT_TYPE_DIRECT,
+ HEAD_TEXT_TYPE_DEACTIVATING,
+ HEAD_TEXT_TYPE_ACTIVATING,
+ HEAD_TEXT_TYPE_ACTIVATED,
+ HEAD_TEXT_TYPE_SCANING,
+};
+
+enum
+{
+ POPUP_TYPE_WIFI_OFF,
+ POPUP_TYPE_HOTSPOT_OFF,
+
+ POPUP_TYPE_ACTIVATE_FAIL,
+ POPUP_TYPE_DEACTIVATE_FAIL,
+
+ POPUP_TYPE_LINK_TIMEOUT,
+ POPUP_TYPE_AUTH_FAIL,
+ POPUP_TYPE_LINK_FAIL,
+ POPUP_TYPE_UNKNOWN_ERROR,
+
+ POPUP_TYPE_TERMINATE,
+};
+
+void create_wfd_ug_view(void *data);
+void destroy_wfd_ug_view(void *data);
+void wfd_ug_view_refresh_glitem(void *obj);
+void wfd_ug_view_refresh_button(void *obj, int enable);
+void wfd_ug_view_update_peers(void *data);
+void wfd_ug_view_free_peers(void *data);
+void wfd_ug_act_popup(void *data, const char *message, int popup_type);
+void wfg_ug_act_popup_remove(void *data);
+void wfd_ug_warn_popup(void *data, const char *message, int popup_type);
+void wfg_ug_warn_popup_remove(void *data);
+
+#endif /* __WFD_UG_VIEW_H__ */
diff --git a/ug-wifidirect/po/CMakeLists.txt b/ug-wifidirect/po/CMakeLists.txt
new file mode 100644
index 0000000..55ae9ee
--- /dev/null
+++ b/ug-wifidirect/po/CMakeLists.txt
@@ -0,0 +1,24 @@
+# for i18n
+
+SET(POFILES en.po en_GB.po ko_KR.po)
+
+SET(MSGFMT "/usr/bin/msgfmt")
+
+FOREACH(pofile ${POFILES})
+ SET(pofile ${CMAKE_CURRENT_SOURCE_DIR}/${pofile})
+ MESSAGE("PO: ${pofile}")
+ GET_FILENAME_COMPONENT(absPofile ${pofile} ABSOLUTE)
+ GET_FILENAME_COMPONENT(lang ${absPofile} NAME_WE)
+ SET(moFile ${CMAKE_CURRENT_BINARY_DIR}/${lang}.mo)
+ ADD_CUSTOM_COMMAND(
+ OUTPUT ${moFile}
+ COMMAND ${MSGFMT} -o ${moFile} ${absPofile}
+ DEPENDS ${absPofile}
+ )
+ INSTALL(FILES ${moFile}
+ DESTINATION /opt/ug/res/locale/${lang}/LC_MESSAGES RENAME ${PROJECT_NAME}.mo)
+ SET(moFiles ${moFiles} ${moFile})
+ENDFOREACH(pofile)
+
+MESSAGE(".mo files: ${moFiles}")
+ADD_CUSTOM_TARGET(po ALL DEPENDS ${moFiles})
diff --git a/ug-wifidirect/po/POTFILES.in b/ug-wifidirect/po/POTFILES.in
new file mode 100644
index 0000000..6e6a4b0
--- /dev/null
+++ b/ug-wifidirect/po/POTFILES.in
@@ -0,0 +1,2 @@
+# List of source files containing translatable strings.
+wifi_direct_strings.h
diff --git a/ug-wifidirect/po/en.po b/ug-wifidirect/po/en.po
new file mode 100644
index 0000000..2dbaeb8
--- /dev/null
+++ b/ug-wifidirect/po/en.po
@@ -0,0 +1,71 @@
+msgid "IDS_WFD_HEADER_WIFI_DIRECT"
+msgstr "Wi-Fi Direct"
+
+msgid "IDS_WFD_BODY_DEACTIVATING"
+msgstr "Deactivating Wi-Fi Direct..."
+
+msgid "IDS_WFD_BODY_ACTIVATING"
+msgstr "Activating Wi-Fi Direct..."
+
+msgid "IDS_WFD_BODY_SCANNING"
+msgstr "Scanning..."
+
+msgid "IDS_WFD_BODY_ACTIVATED"
+msgstr "Wi-Fi Direct activated"
+
+msgid "IDS_WFD_BODY_DEVICE_NAME"
+msgstr "Device name"
+
+msgid "IDS_WFD_BODY_AVAILABLE_DEVICES"
+msgstr "Available Devices"
+
+msgid "IDS_WFD_BODY_WIFI_DIRECT_DEVICES"
+msgstr "Wi-Fi Direct Devices"
+
+msgid "IDS_WFD_BODY_NO_DEVICES"
+msgstr "No devices"
+
+msgid "IDS_WFD_BODY_HELP"
+msgstr "HELP"
+
+msgid "IDS_WFD_POP_CONNECTING"
+msgstr "Connecting..."
+
+msgid "IDS_WFD_POP_CONNECTED"
+msgstr "Connected"
+
+msgid "IDS_WFD_BUTTON_SCAN"
+msgstr "Scan"
+
+msgid "IDS_WFD_BUTTON_STOPSCAN"
+msgstr "Stop"
+
+msgid "IDS_WFD_POP_ACTIVATE_FAIL"
+msgstr "Failed to activate Wi-Fi Direct"
+
+msgid "IDS_WFD_POP_DEACTIVATE_FAIL"
+msgstr "Failed to deactivate Wi-Fi Direct"
+
+msgid "IDS_WFD_POP_CONNECTING_TIMEOUT"
+msgstr "Connecting is timeout"
+
+msgid "IDS_WFD_POP_AUTH_FAIL"
+msgstr "Authentication failure"
+
+msgid "IDS_WFD_POP_LINK_FAIL"
+msgstr "Link creation failure"
+
+msgid "IDS_WFD_POP_UNKNOWN_ERROR"
+msgstr "Unknown error"
+
+msgid "IDS_WFD_POP_WIFI_OFF"
+msgstr "This will turn off Wi-Fi client operation.<br>Continue?"
+
+msgid "IDS_WFD_POP_HOTSPOT_OFF"
+msgstr "This will turn off Portable Wi-Fi hotspots operation.<br>Continue?"
+
+msgid "IDS_WFD_POP_NOT_SUPPORTED_DEVICE"
+msgstr "This device do not support<br>Wi-Fi Direct Service"
+
+msgid "IDS_WFD_POP_PROBLEM_WITH_WFD"
+msgstr "This device have some problem with<br>Wi-Fi Direct Service"
diff --git a/ug-wifidirect/po/en_GB.po b/ug-wifidirect/po/en_GB.po
new file mode 100644
index 0000000..2dbaeb8
--- /dev/null
+++ b/ug-wifidirect/po/en_GB.po
@@ -0,0 +1,71 @@
+msgid "IDS_WFD_HEADER_WIFI_DIRECT"
+msgstr "Wi-Fi Direct"
+
+msgid "IDS_WFD_BODY_DEACTIVATING"
+msgstr "Deactivating Wi-Fi Direct..."
+
+msgid "IDS_WFD_BODY_ACTIVATING"
+msgstr "Activating Wi-Fi Direct..."
+
+msgid "IDS_WFD_BODY_SCANNING"
+msgstr "Scanning..."
+
+msgid "IDS_WFD_BODY_ACTIVATED"
+msgstr "Wi-Fi Direct activated"
+
+msgid "IDS_WFD_BODY_DEVICE_NAME"
+msgstr "Device name"
+
+msgid "IDS_WFD_BODY_AVAILABLE_DEVICES"
+msgstr "Available Devices"
+
+msgid "IDS_WFD_BODY_WIFI_DIRECT_DEVICES"
+msgstr "Wi-Fi Direct Devices"
+
+msgid "IDS_WFD_BODY_NO_DEVICES"
+msgstr "No devices"
+
+msgid "IDS_WFD_BODY_HELP"
+msgstr "HELP"
+
+msgid "IDS_WFD_POP_CONNECTING"
+msgstr "Connecting..."
+
+msgid "IDS_WFD_POP_CONNECTED"
+msgstr "Connected"
+
+msgid "IDS_WFD_BUTTON_SCAN"
+msgstr "Scan"
+
+msgid "IDS_WFD_BUTTON_STOPSCAN"
+msgstr "Stop"
+
+msgid "IDS_WFD_POP_ACTIVATE_FAIL"
+msgstr "Failed to activate Wi-Fi Direct"
+
+msgid "IDS_WFD_POP_DEACTIVATE_FAIL"
+msgstr "Failed to deactivate Wi-Fi Direct"
+
+msgid "IDS_WFD_POP_CONNECTING_TIMEOUT"
+msgstr "Connecting is timeout"
+
+msgid "IDS_WFD_POP_AUTH_FAIL"
+msgstr "Authentication failure"
+
+msgid "IDS_WFD_POP_LINK_FAIL"
+msgstr "Link creation failure"
+
+msgid "IDS_WFD_POP_UNKNOWN_ERROR"
+msgstr "Unknown error"
+
+msgid "IDS_WFD_POP_WIFI_OFF"
+msgstr "This will turn off Wi-Fi client operation.<br>Continue?"
+
+msgid "IDS_WFD_POP_HOTSPOT_OFF"
+msgstr "This will turn off Portable Wi-Fi hotspots operation.<br>Continue?"
+
+msgid "IDS_WFD_POP_NOT_SUPPORTED_DEVICE"
+msgstr "This device do not support<br>Wi-Fi Direct Service"
+
+msgid "IDS_WFD_POP_PROBLEM_WITH_WFD"
+msgstr "This device have some problem with<br>Wi-Fi Direct Service"
diff --git a/ug-wifidirect/po/en_US.po b/ug-wifidirect/po/en_US.po
new file mode 100644
index 0000000..2dbaeb8
--- /dev/null
+++ b/ug-wifidirect/po/en_US.po
@@ -0,0 +1,71 @@
+msgid "IDS_WFD_HEADER_WIFI_DIRECT"
+msgstr "Wi-Fi Direct"
+
+msgid "IDS_WFD_BODY_DEACTIVATING"
+msgstr "Deactivating Wi-Fi Direct..."
+
+msgid "IDS_WFD_BODY_ACTIVATING"
+msgstr "Activating Wi-Fi Direct..."
+
+msgid "IDS_WFD_BODY_SCANNING"
+msgstr "Scanning..."
+
+msgid "IDS_WFD_BODY_ACTIVATED"
+msgstr "Wi-Fi Direct activated"
+
+msgid "IDS_WFD_BODY_DEVICE_NAME"
+msgstr "Device name"
+
+msgid "IDS_WFD_BODY_AVAILABLE_DEVICES"
+msgstr "Available Devices"
+
+msgid "IDS_WFD_BODY_WIFI_DIRECT_DEVICES"
+msgstr "Wi-Fi Direct Devices"
+
+msgid "IDS_WFD_BODY_NO_DEVICES"
+msgstr "No devices"
+
+msgid "IDS_WFD_BODY_HELP"
+msgstr "HELP"
+
+msgid "IDS_WFD_POP_CONNECTING"
+msgstr "Connecting..."
+
+msgid "IDS_WFD_POP_CONNECTED"
+msgstr "Connected"
+
+msgid "IDS_WFD_BUTTON_SCAN"
+msgstr "Scan"
+
+msgid "IDS_WFD_BUTTON_STOPSCAN"
+msgstr "Stop"
+
+msgid "IDS_WFD_POP_ACTIVATE_FAIL"
+msgstr "Failed to activate Wi-Fi Direct"
+
+msgid "IDS_WFD_POP_DEACTIVATE_FAIL"
+msgstr "Failed to deactivate Wi-Fi Direct"
+
+msgid "IDS_WFD_POP_CONNECTING_TIMEOUT"
+msgstr "Connecting is timeout"
+
+msgid "IDS_WFD_POP_AUTH_FAIL"
+msgstr "Authentication failure"
+
+msgid "IDS_WFD_POP_LINK_FAIL"
+msgstr "Link creation failure"
+
+msgid "IDS_WFD_POP_UNKNOWN_ERROR"
+msgstr "Unknown error"
+
+msgid "IDS_WFD_POP_WIFI_OFF"
+msgstr "This will turn off Wi-Fi client operation.<br>Continue?"
+
+msgid "IDS_WFD_POP_HOTSPOT_OFF"
+msgstr "This will turn off Portable Wi-Fi hotspots operation.<br>Continue?"
+
+msgid "IDS_WFD_POP_NOT_SUPPORTED_DEVICE"
+msgstr "This device do not support<br>Wi-Fi Direct Service"
+
+msgid "IDS_WFD_POP_PROBLEM_WITH_WFD"
+msgstr "This device have some problem with<br>Wi-Fi Direct Service"
diff --git a/ug-wifidirect/po/ja.po b/ug-wifidirect/po/ja.po
new file mode 100644
index 0000000..2dbaeb8
--- /dev/null
+++ b/ug-wifidirect/po/ja.po
@@ -0,0 +1,71 @@
+msgid "IDS_WFD_HEADER_WIFI_DIRECT"
+msgstr "Wi-Fi Direct"
+
+msgid "IDS_WFD_BODY_DEACTIVATING"
+msgstr "Deactivating Wi-Fi Direct..."
+
+msgid "IDS_WFD_BODY_ACTIVATING"
+msgstr "Activating Wi-Fi Direct..."
+
+msgid "IDS_WFD_BODY_SCANNING"
+msgstr "Scanning..."
+
+msgid "IDS_WFD_BODY_ACTIVATED"
+msgstr "Wi-Fi Direct activated"
+
+msgid "IDS_WFD_BODY_DEVICE_NAME"
+msgstr "Device name"
+
+msgid "IDS_WFD_BODY_AVAILABLE_DEVICES"
+msgstr "Available Devices"
+
+msgid "IDS_WFD_BODY_WIFI_DIRECT_DEVICES"
+msgstr "Wi-Fi Direct Devices"
+
+msgid "IDS_WFD_BODY_NO_DEVICES"
+msgstr "No devices"
+
+msgid "IDS_WFD_BODY_HELP"
+msgstr "HELP"
+
+msgid "IDS_WFD_POP_CONNECTING"
+msgstr "Connecting..."
+
+msgid "IDS_WFD_POP_CONNECTED"
+msgstr "Connected"
+
+msgid "IDS_WFD_BUTTON_SCAN"
+msgstr "Scan"
+
+msgid "IDS_WFD_BUTTON_STOPSCAN"
+msgstr "Stop"
+
+msgid "IDS_WFD_POP_ACTIVATE_FAIL"
+msgstr "Failed to activate Wi-Fi Direct"
+
+msgid "IDS_WFD_POP_DEACTIVATE_FAIL"
+msgstr "Failed to deactivate Wi-Fi Direct"
+
+msgid "IDS_WFD_POP_CONNECTING_TIMEOUT"
+msgstr "Connecting is timeout"
+
+msgid "IDS_WFD_POP_AUTH_FAIL"
+msgstr "Authentication failure"
+
+msgid "IDS_WFD_POP_LINK_FAIL"
+msgstr "Link creation failure"
+
+msgid "IDS_WFD_POP_UNKNOWN_ERROR"
+msgstr "Unknown error"
+
+msgid "IDS_WFD_POP_WIFI_OFF"
+msgstr "This will turn off Wi-Fi client operation.<br>Continue?"
+
+msgid "IDS_WFD_POP_HOTSPOT_OFF"
+msgstr "This will turn off Portable Wi-Fi hotspots operation.<br>Continue?"
+
+msgid "IDS_WFD_POP_NOT_SUPPORTED_DEVICE"
+msgstr "This device do not support<br>Wi-Fi Direct Service"
+
+msgid "IDS_WFD_POP_PROBLEM_WITH_WFD"
+msgstr "This device have some problem with<br>Wi-Fi Direct Service"
diff --git a/ug-wifidirect/po/ko_KR.po b/ug-wifidirect/po/ko_KR.po
new file mode 100644
index 0000000..f4525a2
--- /dev/null
+++ b/ug-wifidirect/po/ko_KR.po
@@ -0,0 +1,71 @@
+msgid "IDS_WFD_HEADER_WIFI_DIRECT"
+msgstr "Wi-Fi Direct"
+
+msgid "IDS_WFD_BODY_DEACTIVATING"
+msgstr "Wi-Fi Direct 끄는 중..."
+
+msgid "IDS_WFD_BODY_ACTIVATING"
+msgstr "Wi-Fi Direct 켜는 중..."
+
+msgid "IDS_WFD_BODY_SCANNING"
+msgstr "검색 중..."
+
+msgid "IDS_WFD_BODY_ACTIVATED"
+msgstr "Wi-Fi Direct가 켜졌습니다."
+
+msgid "IDS_WFD_BODY_DEVICE_NAME"
+msgstr "장치명"
+
+msgid "IDS_WFD_BODY_AVAILABLE_DEVICES"
+msgstr "사용 가능한 장치들"
+
+msgid "IDS_WFD_BODY_WIFI_DIRECT_DEVICES"
+msgstr "Wi-Fi Direct 장치들"
+
+msgid "IDS_WFD_BODY_NO_DEVICES"
+msgstr "장치가 없습니다."
+
+msgid "IDS_WFD_BODY_HELP"
+msgstr "도움말"
+
+msgid "IDS_WFD_POP_CONNECTING"
+msgstr "연결중..."
+
+msgid "IDS_WFD_POP_CONNECTED"
+msgstr "연결되었습니다."
+
+msgid "IDS_WFD_BUTTON_SCAN"
+msgstr "검색"
+
+msgid "IDS_WFD_BUTTON_STOPSCAN"
+msgstr "중지"
+
+msgid "IDS_WFD_POP_ACTIVATE_FAIL"
+msgstr "Wi-Fi Direct를 켜지 못했습니다."
+
+msgid "IDS_WFD_POP_DEACTIVATE_FAIL"
+msgstr "Wi-Fi Direct를 끄지 못했습니다."
+
+msgid "IDS_WFD_POP_CONNECTING_TIMEOUT"
+msgstr "연결시간 초과"
+
+msgid "IDS_WFD_POP_AUTH_FAIL"
+msgstr "인증 실패"
+
+msgid "IDS_WFD_POP_LINK_FAIL"
+msgstr "연결 생성 실패"
+
+msgid "IDS_WFD_POP_UNKNOWN_ERROR"
+msgstr "알수 없는 오류"
+
+msgid "IDS_WFD_POP_WIFI_OFF"
+msgstr "Wi-Fi 연결이 끊어집니다.<br>계속하시겠습니까?"
+
+msgid "IDS_WFD_POP_HOTSPOT_OFF"
+msgstr "Wi-Fi 핫스팟이 끊어집니다.<br>계속하시겠습니까?"
+
+msgid "IDS_WFD_POP_NOT_SUPPORTED_DEVICE"
+msgstr "Wi-Fi Direct Service를 지원하지 않는 장치입니다."
+
+msgid "IDS_WFD_POP_PROBLEM_WITH_WFD"
+msgstr "Wi-Fi Direct Service에 문제가 있습니다."
diff --git a/ug-wifidirect/po/ug-wifi-qdirect.pot b/ug-wifidirect/po/ug-wifi-qdirect.pot
new file mode 100644
index 0000000..4ca8881
--- /dev/null
+++ b/ug-wifidirect/po/ug-wifi-qdirect.pot
@@ -0,0 +1,324 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2010-09-29 15:49+0900\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: sources/mainApp/viewers/view_detail.c:448
+msgid "IP address"
+msgstr ""
+
+#: sources/mainApp/viewers/view_detail.c:454
+msgid "Auto IP"
+msgstr ""
+
+#: sources/mainApp/viewers/view_detail.c:464
+msgid "Static IP"
+msgstr ""
+
+#: sources/mainApp/viewers/view_detail.c:474
+msgid "DHCP IP"
+msgstr ""
+
+#: sources/mainApp/viewers/view_detail.c:522
+msgid "Proxy setting"
+msgstr ""
+
+#: sources/mainApp/viewers/view_detail.c:530
+msgid "Proxy address"
+msgstr ""
+
+#: sources/mainApp/viewers/view_detail.c:533
+msgid "0.0.0.0:80"
+msgstr ""
+
+#: sources/mainApp/viewers/view_detail.c:555
+msgid "Details"
+msgstr ""
+
+#: sources/mainApp/viewers/view_detail.c:561
+msgid "Name"
+msgstr ""
+
+#: sources/mainApp/viewers/view_detail.c:572
+msgid "Signal stringth"
+msgstr ""
+
+#: sources/mainApp/viewers/view_detail.c:577
+msgid "Excellent"
+msgstr ""
+
+#: sources/mainApp/viewers/view_detail.c:579
+msgid "Normal"
+msgstr ""
+
+#: sources/mainApp/viewers/view_detail.c:581
+msgid "Week"
+msgstr ""
+
+#: sources/mainApp/viewers/view_detail.c:591
+msgid "Sequrity type"
+msgstr ""
+
+#: sources/mainApp/viewers/view_detail.c:594
+msgid "No security"
+msgstr ""
+
+#: sources/mainApp/viewers/view_detail.c:597
+msgid "WEP"
+msgstr ""
+
+#: sources/mainApp/viewers/view_detail.c:600
+msgid "WPA-PSK"
+msgstr ""
+
+#: sources/mainApp/viewers/view_detail.c:603
+msgid "WPA2-PSK"
+msgstr ""
+
+#: sources/mainApp/viewers/view_detail.c:606
+msgid "WPA-EAP"
+msgstr ""
+
+#: sources/mainApp/viewers/view_detail.c:609
+msgid "WPA2-EAP"
+msgstr ""
+
+#: sources/mainApp/viewers/view_detail.c:612
+msgid "WPA-PSK WPA2-PSK"
+msgstr ""
+
+#: sources/mainApp/viewers/view_detail.c:615
+msgid "WPA-EAP WPA2-EAP"
+msgstr ""
+
+#: sources/mainApp/viewers/view_detail.c:645
+msgid "Channel"
+msgstr ""
+
+#: sources/mainApp/viewers/view_detail.c:657
+msgid "AP Mac"
+msgstr ""
+
+#: sources/mainApp/viewers/view_autoip.c:54
+#: sources/mainApp/viewers/view_staticip.c:96
+#: sources/mainApp/viewers/view_dhcpip.c:53
+msgid "IP Address"
+msgstr ""
+
+#: sources/mainApp/viewers/view_autoip.c:70
+#: sources/mainApp/viewers/view_staticip.c:112
+#: sources/mainApp/viewers/view_dhcpip.c:69
+msgid "Subnet mask"
+msgstr ""
+
+#: sources/mainApp/viewers/view_autoip.c:86
+#: sources/mainApp/viewers/view_staticip.c:128
+#: sources/mainApp/viewers/view_dhcpip.c:85
+msgid "Gateway address"
+msgstr ""
+
+#: sources/mainApp/viewers/view_autoip.c:102
+#: sources/mainApp/viewers/view_staticip.c:145
+#: sources/mainApp/viewers/view_dhcpip.c:101
+msgid "DNS 1"
+msgstr ""
+
+#: sources/mainApp/viewers/view_autoip.c:118
+#: sources/mainApp/viewers/view_staticip.c:161
+#: sources/mainApp/viewers/view_dhcpip.c:117
+msgid "DNS 2"
+msgstr ""
+
+#: sources/mainApp/viewers/view_ime_password.c:74
+#: sources/mainApp/viewers/view_ime_hidden.c:73
+#: sources/mainApp/viewers/view_ime_proxy.c:77
+#: sources/mainApp/viewers/view_ime_statics.c:77
+msgid " "
+msgstr ""
+
+#: sources/mainApp/viewers/view_ime_password.c:78
+msgid "Input your password"
+msgstr ""
+
+#: sources/mainApp/viewers/view_ime_hidden.c:77
+msgid "Input AP name"
+msgstr ""
+
+#: sources/mainApp/viewers/view_ime_proxy.c:81
+msgid "Enter proxy address"
+msgstr ""
+
+#: sources/mainApp/viewers/view_ime_statics.c:193
+msgid "Enter IP address"
+msgstr ""
+
+#: sources/mainApp/viewers/view_ime_statics.c:230
+msgid "Enter Subnet mask"
+msgstr ""
+
+#: sources/mainApp/viewers/view_ime_statics.c:266
+msgid "Enter Gateway address"
+msgstr ""
+
+#: sources/mainApp/viewers/view_ime_statics.c:304
+msgid "Enter DNS 1"
+msgstr ""
+
+#: sources/mainApp/viewers/view_ime_statics.c:340
+msgid "Enter DNS 2"
+msgstr ""
+
+#: sources/mainApp/viewers/view_others.c:86
+msgid "by Hidden network"
+msgstr ""
+
+#: sources/mainApp/viewers/view_others.c:95
+msgid "by Protected Access"
+msgstr ""
+
+#. ad->layout_manager_object = layout_manager_create(ad->win_main);
+#: sources/mainApp/states/01_wifi_state_none/state.c:269
+#: sources/libraries/UIManager/viewerManager/wifi-components.c:37
+msgid "Wi-Fi"
+msgstr ""
+
+#. edje_object_signal_emit(ad->icon, "sig/icon/on", "image/icon");
+#: sources/mainApp/states/11_wifi_state_powering_off/state.c:37
+#: sources/libraries/UIManager/winsetWrapper/wifi-popup.c:211
+msgid "Failed to deactivate Wi-Fi"
+msgstr ""
+
+#: sources/libraries/UIManager/winset-wrapper/main/header.c:24
+msgid "Settings"
+msgstr ""
+
+#: sources/libraries/UIManager/winset-wrapper/main/header.c:53
+msgid "Default Style"
+msgstr ""
+
+#. edje_object_signal_emit(_EDJ(object->content),
+#. "processing_ani_stop",
+#. "listview_header_radio_button");
+#. edje_object_part_text_set(_EDJ(object->content), "listview_header_title", _("Wi-Fi Off"));
+#: sources/libraries/UIManager/winset-wrapper/main/header.c:97
+msgid "Wi-Fi Off"
+msgstr ""
+
+#. edje_object_signal_emit(_EDJ(object->content),
+#. "processing_ani_stop",
+#. "listview_header_radio_button");
+#. edje_object_part_text_set(_EDJ(object->content), "listview_header_title", _("Wi-Fi On"));
+#: sources/libraries/UIManager/winset-wrapper/main/header.c:112
+msgid "Wi-Fi On"
+msgstr ""
+
+#. edje_object_part_text_set(_EDJ(object->content), "listview_header_title", _("Wi-Fi Activating ..."));
+#. edje_object_signal_emit(_EDJ(object->content), "processing_ani_start", "listview_header_radio_button");
+#. edje_object_signal_emit(_EDJ(object->content), "header_check_hide", "header_check_hide");
+#: sources/libraries/UIManager/winset-wrapper/main/header.c:124
+msgid "Wi-Fi Activating ... "
+msgstr ""
+
+#. edje_object_part_text_set(_EDJ(object->content), "listview_header_title", _("Searching ..."));
+#: sources/libraries/UIManager/winset-wrapper/main/header.c:134
+msgid "Searching ... "
+msgstr ""
+
+#. edje_object_part_text_set(_EDJ(object->content), "listview_header_title", _("Wi-Fi Connecting ..."));
+#: sources/libraries/UIManager/winset-wrapper/main/header.c:142
+msgid "Wi-Fi Connecting ... "
+msgstr ""
+
+#. edje_object_part_text_set(_EDJ(object->content), "listview_header_title", _("Wi-Fi Connected"));
+#: sources/libraries/UIManager/winset-wrapper/main/header.c:152
+msgid "Wi-Fi Connected "
+msgstr ""
+
+#. edje_object_part_text_set(_EDJ(object->content), "listview_header_title", _("Wi-Fi Disconnecting ..."));
+#: sources/libraries/UIManager/winset-wrapper/main/header.c:163
+msgid "Wi-Fi Disconnecting ..."
+msgstr ""
+
+#. edje_object_part_text_set(_EDJ(object->content), "listview_header_title", _("Deactivating..."));
+#: sources/libraries/UIManager/winset-wrapper/main/header.c:172
+msgid "Deactivating ..."
+msgstr ""
+
+#: sources/libraries/UIManager/winset-wrapper/main/button.c:9
+msgid "WPS PBC"
+msgstr ""
+
+#: sources/libraries/UIManager/winset-wrapper/main/button.c:14
+msgid "WPS PIN"
+msgstr ""
+
+#: sources/libraries/UIManager/winset-wrapper/main/popup.c:110
+#: sources/libraries/UIManager/winsetWrapper/wifi-popup.c:437
+msgid "Authentication failed."
+msgstr ""
+
+#: sources/libraries/UIManager/winset-wrapper/main/popup.c:113
+#: sources/libraries/UIManager/winsetWrapper/wifi-popup.c:441
+msgid "IP configuration failed."
+msgstr ""
+
+#: sources/libraries/UIManager/winset-wrapper/main/popup.c:116
+#: sources/libraries/UIManager/winset-wrapper/main/popup.c:119
+#: sources/libraries/UIManager/winsetWrapper/wifi-popup.c:433
+#: sources/libraries/UIManager/winsetWrapper/wifi-popup.c:445
+msgid "Failed to Connect"
+msgstr ""
+
+#: sources/libraries/UIManager/winset-wrapper/main/popup.c:139
+msgid "No Wi-Fi AP found"
+msgstr ""
+
+#: sources/libraries/UIManager/winset-wrapper/main/popup.c:168
+msgid "Wi-Fi engine problem <br> wlan_client_get_state func"
+msgstr ""
+
+#: sources/libraries/UIManager/winset-wrapper/main/popup.c:174
+msgid "Wi-Fi engine problem <br> profile have not password"
+msgstr ""
+
+#. ad->bt = bt;
+#: sources/libraries/UIManager/winsetWrapper/wifi-popup.c:112
+msgid "Cancel"
+msgstr ""
+
+#: sources/libraries/UIManager/winsetWrapper/wifi-popup.c:129
+msgid "WiFi Deactivating"
+msgstr ""
+
+#: sources/libraries/UIManager/winsetWrapper/wifi-popup.c:143
+msgid "WiFi Activating"
+msgstr ""
+
+#: sources/libraries/UIManager/winsetWrapper/wifi-popup.c:168
+msgid "Failed to activate Wi-Fi"
+msgstr ""
+
+#: sources/libraries/UIManager/winsetWrapper/wifi-popup.c:225
+msgid "Searching..."
+msgstr ""
+
+#: sources/libraries/UIManager/winsetWrapper/wifi-popup.c:415
+msgid "Connection Lost"
+msgstr ""
+
+#: sources/libraries/UIManager/winsetWrapper/wifi-util.c:37
+msgid "FONT_NAME"
+msgstr ""
diff --git a/ug-wifidirect/po/update-po.sh b/ug-wifidirect/po/update-po.sh
new file mode 100755
index 0000000..06d3c38
--- /dev/null
+++ b/ug-wifidirect/po/update-po.sh
@@ -0,0 +1,60 @@
+#!/bin/sh
+
+PACKAGE=ug-setting-wifidirect
+SRCROOT=..
+POTFILES=POTFILES.in
+
+#ALL_LINGUAS= am az be ca cs da de el en_CA en_GB es et fi fr hr hu it ja ko lv mk ml ms nb ne nl pa pl pt pt_BR ru rw sk sl sr sr@Latn sv ta tr uk vi zh_CN zh_TW
+ALL_LINGUAS="en_US en_GB ja ko zh_CN"
+
+XGETTEXT=/usr/bin/xgettext
+MSGMERGE=/usr/bin/msgmerge
+
+echo -n "Make ${PACKAGE}.pot "
+if [ ! -e $POTFILES ] ; then
+ echo "$POTFILES not found"
+ exit 1
+fi
+
+$XGETTEXT --default-domain=${PACKAGE} --directory=${SRCROOT} \
+ --add-comments --keyword=_ --keyword=N_ --files-from=$POTFILES
+if [ $? -ne 0 ]; then
+ echo "error"
+ exit 1
+fi
+
+if [ ! -f ${PACKAGE}.po ]; then
+ echo "No such file: ${PACKAGE}.po"
+ exit 1
+fi
+
+rm -f ${PACKAGE}.pot && mv ${PACKAGE}.po ${PACKAGE}.pot
+echo "done"
+
+for LANG in $ALL_LINGUAS; do
+ echo "$LANG : "
+
+ if [ ! -e $LANG.po ] ; then
+ sed 's/CHARSET/UTF-8/g' ${PACKAGE}.pot > ${LANG}.po
+ echo "${LANG}.po created"
+ else
+ if $MSGMERGE ${LANG}.po ${PACKAGE}.pot -o ${LANG}.new.po ; then
+ if cmp ${LANG}.po ${LANG}.new.po > /dev/null 2>&1; then
+ rm -f ${LANG}.new.po
+ else
+ if mv -f ${LANG}.new.po ${LANG}.po; then
+ echo ""
+ else
+ echo "msgmerge for $LANG.po failed: cannot move $LANG.new.po to $LANG.po" 1>&2
+ rm -f ${LANG}.new.po
+ exit 1
+ fi
+ fi
+ else
+ echo "msgmerge for $LANG failed!"
+ rm -f ${LANG}.new.po
+ fi
+ fi
+ echo ""
+done
+
diff --git a/ug-wifidirect/po/zh_CN.po b/ug-wifidirect/po/zh_CN.po
new file mode 100644
index 0000000..2dbaeb8
--- /dev/null
+++ b/ug-wifidirect/po/zh_CN.po
@@ -0,0 +1,71 @@
+msgid "IDS_WFD_HEADER_WIFI_DIRECT"
+msgstr "Wi-Fi Direct"
+
+msgid "IDS_WFD_BODY_DEACTIVATING"
+msgstr "Deactivating Wi-Fi Direct..."
+
+msgid "IDS_WFD_BODY_ACTIVATING"
+msgstr "Activating Wi-Fi Direct..."
+
+msgid "IDS_WFD_BODY_SCANNING"
+msgstr "Scanning..."
+
+msgid "IDS_WFD_BODY_ACTIVATED"
+msgstr "Wi-Fi Direct activated"
+
+msgid "IDS_WFD_BODY_DEVICE_NAME"
+msgstr "Device name"
+
+msgid "IDS_WFD_BODY_AVAILABLE_DEVICES"
+msgstr "Available Devices"
+
+msgid "IDS_WFD_BODY_WIFI_DIRECT_DEVICES"
+msgstr "Wi-Fi Direct Devices"
+
+msgid "IDS_WFD_BODY_NO_DEVICES"
+msgstr "No devices"
+
+msgid "IDS_WFD_BODY_HELP"
+msgstr "HELP"
+
+msgid "IDS_WFD_POP_CONNECTING"
+msgstr "Connecting..."
+
+msgid "IDS_WFD_POP_CONNECTED"
+msgstr "Connected"
+
+msgid "IDS_WFD_BUTTON_SCAN"
+msgstr "Scan"
+
+msgid "IDS_WFD_BUTTON_STOPSCAN"
+msgstr "Stop"
+
+msgid "IDS_WFD_POP_ACTIVATE_FAIL"
+msgstr "Failed to activate Wi-Fi Direct"
+
+msgid "IDS_WFD_POP_DEACTIVATE_FAIL"
+msgstr "Failed to deactivate Wi-Fi Direct"
+
+msgid "IDS_WFD_POP_CONNECTING_TIMEOUT"
+msgstr "Connecting is timeout"
+
+msgid "IDS_WFD_POP_AUTH_FAIL"
+msgstr "Authentication failure"
+
+msgid "IDS_WFD_POP_LINK_FAIL"
+msgstr "Link creation failure"
+
+msgid "IDS_WFD_POP_UNKNOWN_ERROR"
+msgstr "Unknown error"
+
+msgid "IDS_WFD_POP_WIFI_OFF"
+msgstr "This will turn off Wi-Fi client operation.<br>Continue?"
+
+msgid "IDS_WFD_POP_HOTSPOT_OFF"
+msgstr "This will turn off Portable Wi-Fi hotspots operation.<br>Continue?"
+
+msgid "IDS_WFD_POP_NOT_SUPPORTED_DEVICE"
+msgstr "This device do not support<br>Wi-Fi Direct Service"
+
+msgid "IDS_WFD_POP_PROBLEM_WITH_WFD"
+msgstr "This device have some problem with<br>Wi-Fi Direct Service"
diff --git a/ug-wifidirect/resources/images/00_list_bar_press_1x80.png b/ug-wifidirect/resources/images/00_list_bar_press_1x80.png
new file mode 100755
index 0000000..1dc6e15
--- /dev/null
+++ b/ug-wifidirect/resources/images/00_list_bar_press_1x80.png
Binary files differ
diff --git a/ug-wifidirect/resources/images/31_BT_device_headset.png b/ug-wifidirect/resources/images/31_BT_device_headset.png
new file mode 100755
index 0000000..0150a55
--- /dev/null
+++ b/ug-wifidirect/resources/images/31_BT_device_headset.png
Binary files differ
diff --git a/ug-wifidirect/resources/images/31_BT_device_keyboard.png b/ug-wifidirect/resources/images/31_BT_device_keyboard.png
new file mode 100755
index 0000000..8d16510
--- /dev/null
+++ b/ug-wifidirect/resources/images/31_BT_device_keyboard.png
Binary files differ
diff --git a/ug-wifidirect/resources/images/31_BT_device_mouse.png b/ug-wifidirect/resources/images/31_BT_device_mouse.png
new file mode 100755
index 0000000..a994030
--- /dev/null
+++ b/ug-wifidirect/resources/images/31_BT_device_mouse.png
Binary files differ
diff --git a/ug-wifidirect/resources/images/31_BT_device_printer.png b/ug-wifidirect/resources/images/31_BT_device_printer.png
new file mode 100755
index 0000000..ea025b1
--- /dev/null
+++ b/ug-wifidirect/resources/images/31_BT_device_printer.png
Binary files differ
diff --git a/ug-wifidirect/resources/images/31_BT_device_unknown.png b/ug-wifidirect/resources/images/31_BT_device_unknown.png
new file mode 100755
index 0000000..70699f1
--- /dev/null
+++ b/ug-wifidirect/resources/images/31_BT_device_unknown.png
Binary files differ
diff --git a/ug-wifidirect/resources/images/A09_Connect.png b/ug-wifidirect/resources/images/A09_Connect.png
new file mode 100755
index 0000000..ef2821d
--- /dev/null
+++ b/ug-wifidirect/resources/images/A09_Connect.png
Binary files differ
diff --git a/ug-wifidirect/resources/images/A09_NoDevice.png b/ug-wifidirect/resources/images/A09_NoDevice.png
new file mode 100755
index 0000000..5b859c0
--- /dev/null
+++ b/ug-wifidirect/resources/images/A09_NoDevice.png
Binary files differ
diff --git a/ug-wifidirect/resources/images/A09_device_My_laptop.png b/ug-wifidirect/resources/images/A09_device_My_laptop.png
new file mode 100755
index 0000000..5e2f10a
--- /dev/null
+++ b/ug-wifidirect/resources/images/A09_device_My_laptop.png
Binary files differ
diff --git a/ug-wifidirect/resources/images/A09_device_computer.png b/ug-wifidirect/resources/images/A09_device_computer.png
new file mode 100755
index 0000000..6c4a633
--- /dev/null
+++ b/ug-wifidirect/resources/images/A09_device_computer.png
Binary files differ
diff --git a/ug-wifidirect/resources/images/A09_device_mobile.png b/ug-wifidirect/resources/images/A09_device_mobile.png
new file mode 100755
index 0000000..a671a84
--- /dev/null
+++ b/ug-wifidirect/resources/images/A09_device_mobile.png
Binary files differ
diff --git a/ug-wifidirect/resources/wfd_ug.edc b/ug-wifidirect/resources/wfd_ug.edc
new file mode 100644
index 0000000..e05691d
--- /dev/null
+++ b/ug-wifidirect/resources/wfd_ug.edc
@@ -0,0 +1,248 @@
+collections {
+ group {
+ name: "progress_popup";
+ parts {
+ part {
+ name: "base";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ min: 426 270;
+ fixed: 1 1;
+ rel1 { relative: 0 0; /*offset: 0 0;*/ }
+ rel2 { relative: 1 1; /*offset: -1 -1;*/ }
+ color: 0 0 0 0;
+ }
+ }
+
+ part {
+ name: "popup_pb";
+ type: SWALLOW;
+ description {
+ state: "default" 0.0;
+ min: 118 100;
+ max: 118 100;
+ rel1 { relative: 0.0 0.0; }
+ rel2 { relative: 0.2 1.0; }
+ }
+ }
+ part {
+ name: "popup_progress_text";
+ type: SWALLOW;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.2 0.1; to: "base";}
+ rel2 { relative: 1.0 0.9; to: "base";}
+ }
+ }
+ }
+ }
+
+ group { name: "elm/genlist/item/variable_height/default/default";
+ alias: "elm/genlist/item_odd/variable_height/default/default";
+
+ data.item: "stacking" "above";
+ data.item: "selectraise" "on";
+ data.item: "texts" "elm.text";
+ data.item: "contents" "elm.icon";
+ data.item: "treesize" "20";
+ images {
+ image: "00_list_bar_press_1x80.png" COMP;
+ }
+ parts {
+ part { name: "base";
+ type: RECT;
+ repeat_events: 1;
+ scale: 1;
+ description { state: "default" 0.0;
+ min: 0 0;
+ color: 0 0 0 0;
+ }
+ }
+
+ part { name: "bg_image";
+ clip_to: "disclip";
+ mouse_events: 0;
+ description { state: "default" 0.0;
+ visible: 0;
+ image.normal: "00_list_bar_press_1x80.png";
+ }
+ description { state: "selected" 0.0;
+ inherit: "default" 0.0;
+ visible: 1;
+ }
+ }
+
+ part { name: "bottom_line";
+ type: RECT;
+ clip_to: "disclip";
+ mouse_events: 0;
+ description { state: "default" 0.0;
+ min: 0 1;
+ fixed: 0 1;
+ visible: 1;
+ color: 212 212 212 255;
+ rel1 {
+ relative: 0.0 1.0;
+ offset: 0 -1;
+ }
+ }
+ }
+
+ part { name: "elm.padding.left";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 15 0;
+ fixed: 1 0;
+ visible: 0;
+ rel2.relative: 0.0 1.0;
+ align: 0.0 0.0;
+ }
+ }
+
+ part { name: "elm.padding.right";
+ type: RECT;
+ scale: 1;
+ description { state: "default" 0.0;
+ min: 15 0;
+ fixed: 1 0;
+ visible: 0;
+ rel1.relative: 1.0 0.0;
+ align: 1.0 0.0;
+ }
+ }
+
+ part { name: "elm.padding.top";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 0 10;
+ fixed: 0 1;
+ visible: 0;
+ rel2.relative: 1.0 0.0;
+ align: 0.0 0.0;
+ }
+ }
+
+ part { name: "elm.padding.bottom";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 0 10;
+ fixed: 0 1;
+ visible: 0;
+ rel1.relative: 0.0 1.0;
+ align: 0.0 1.0;
+ }
+ }
+
+ part { name: "elm.text";
+ clip_to: "text_clip";
+ type: TEXTBLOCK;
+ mouse_events: 0;
+ scale: 1;
+ description { state: "default" 0.0;
+ align: 0.0 0.5;
+ min: 460 0;
+ fixed: 1 0;
+ rel1 {
+ relative: 1 1.0;
+ to_x: "elm.padding.left";
+ to_y: "elm.padding.top";
+ }
+ rel2 {
+ relative: 1 0.0;
+ to_x: "elm.padding.left";
+ to_y: "elm.padding.bottom";
+ }
+ text {
+ style: textblock_style_variable_height;
+ min: 1 1;
+ align: 0 0.5;
+ }
+ }
+ }
+ part { name: "text_clip";
+ clip_to: "disclip";
+ type: RECT;
+ description { state: "default" 0.0;
+ align: 0.0 0.5;
+ rel1 {
+ relative: 1 1;
+ to_x: "elm.padding.left";
+ to_y: "elm.padding.top";
+ }
+ rel2 {
+ relative: 0 0;
+ to_x: "elm.padding.right";
+ to_y: "elm.padding.bottom";
+ }
+ }
+ }
+ part { name: "elm.icon";
+ clip_to: "disclip";
+ type: SWALLOW;
+ mouse_events: 1;
+ scale: 1;
+ description { state: "default" 0.0;
+ align: 0.5 0.5;
+ rel1 {
+ relative: 1 1;
+ to_x: "elm.padding.left";
+ to_y: "elm.padding.top";
+ }
+ rel2 {
+ relative: 0 0;
+ to_x: "elm.padding.right";
+ to_y: "elm.padding.bottom";
+ }
+ }
+ }
+
+ part { name: "disclip";
+ type: RECT;
+ description { state: "default" 0.0;
+ rel1.to: "base";
+ rel2.to: "base";
+ }
+ description { state: "disabled" 0.0;
+ inherit: "default" 0.0;
+// color: 255 255 255 64;
+ color: 0 0 0 0;
+ }
+ }
+
+ }
+ programs {
+ program { name: "go_active";
+ signal: "elm,state,selected";
+ source: "elm";
+ action: STATE_SET "selected" 0.0;
+ target: "bg_image";
+ }
+ program { name: "go_passive";
+ signal: "elm,state,unselected";
+ source: "elm";
+ action: STATE_SET "default" 0.0;
+ target: "bg_image";
+ transition: LINEAR 0.1;
+ }
+ program { name: "go_disabled";
+ signal: "elm,state,disabled";
+ source: "elm";
+ action: STATE_SET "disabled" 0.0;
+ target: "disclip";
+ }
+ program { name: "go_enabled";
+ signal: "elm,state,enabled";
+ source: "elm";
+ action: STATE_SET "default" 0.0;
+ target: "disclip";
+ }
+ }
+ }
+}
diff --git a/ug-wifidirect/src/wfd_client.c b/ug-wifidirect/src/wfd_client.c
new file mode 100644
index 0000000..255baa9
--- /dev/null
+++ b/ug-wifidirect/src/wfd_client.c
@@ -0,0 +1,842 @@
+/*
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * This file implements Wi-Fi direct client functions.
+ *
+ * @file wfd_client.c
+ * @author Gibyoung Kim (lastkgb.kim@samsung.com)
+ * @version 0.1
+ */
+
+#include <stdio.h>
+#include <stdbool.h>
+#include <libintl.h>
+
+#include <Elementary.h>
+#include <pmapi.h>
+#include <vconf.h>
+#include <network-cm-intf.h>
+#include <network-wifi-intf.h>
+#include <wifi-direct.h>
+
+#include "wfd_ug.h"
+#include "wfd_ug_view.h"
+#include "wfd_client.h"
+
+
+
+
+static void _wifi_state_cb(keynode_t *key, void *data)
+{
+ __FUNC_ENTER__;
+ struct ug_data *ugd = (struct ug_data*) data;
+ int res;
+ int wifi_state;
+
+ res = vconf_get_int(VCONFKEY_WIFI_STATE, &wifi_state);
+ if (res != 0)
+ {
+ DBG(LOG_ERROR, "Failed to get wifi state from vconf. [%d]\n", res);
+ return;
+ }
+
+ if (wifi_state == VCONFKEY_WIFI_OFF)
+ {
+ DBG(LOG_VERBOSE, "WiFi is turned off\n");
+ wfd_client_swtch_force(ugd, TRUE);
+ }
+ else
+ {
+ DBG(LOG_VERBOSE, "WiFi is turned on\n");
+ }
+
+ res = net_deregister_client();
+ if (res != NET_ERR_NONE)
+ {
+ DBG(LOG_ERROR, "Failed to deregister network client. [%d]\n", res);
+ }
+
+ __FUNC_EXIT__;
+}
+
+static void _network_event_cb(net_event_info_t *event_info, void *user_data)
+{
+ __FUNC_ENTER__;
+ DBG(LOG_VERBOSE, "Event from network. [%d]\n", event_info->Event);
+ __FUNC_EXIT__;
+}
+
+int wfd_wifi_off(void *data)
+{
+ __FUNC_ENTER__;
+ struct ug_data *ugd = (struct ug_data*) data;
+ int res;
+
+ res = vconf_notify_key_changed(VCONFKEY_WIFI_STATE, _wifi_state_cb, ugd);
+ if (res == -1)
+ {
+ DBG(LOG_ERROR, "Failed to register vconf callback\n");
+ return -1;
+ }
+ DBG(LOG_VERBOSE, "Vconf key callback is registered\n");
+ res = net_register_client((net_event_cb_t) _network_event_cb, NULL);
+ if (res != NET_ERR_NONE)
+ {
+ DBG(LOG_ERROR, "Failed to register network client. [%d]\n", res);
+ return -1;
+ }
+ DBG(LOG_VERBOSE, "Network client is registered\n");
+ res = net_wifi_power_off();
+ if (res != NET_ERR_NONE)
+ {
+ DBG(LOG_ERROR, "Failed to turn off wifi. [%d]\n", res);
+ return -1;
+ }
+ DBG(LOG_VERBOSE, "WiFi power off\n");
+ __FUNC_EXIT__;
+ return 0;
+}
+
+static device_type_s *wfd_client_find_peer_by_ssid(void *data, const char *ssid)
+{
+ __FUNC_ENTER__;
+ struct ug_data *ugd = (struct ug_data *) data;
+ int i;
+
+ if (ugd == NULL)
+ {
+ DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
+ return NULL;
+ }
+
+ for (i = 0; i < ugd->peer_cnt; i++)
+ {
+ DBG(LOG_VERBOSE, "check %dth peer\n", i);
+ if (!strcmp(ugd->peers[i].ssid, ssid))
+ {
+ DBG(LOG_VERBOSE, "found peer. [%d]\n", i);
+ __FUNC_EXIT__;
+ return &ugd->peers[i];
+ }
+ }
+ __FUNC_EXIT__;
+
+ return NULL;
+}
+
+static device_type_s *wfd_client_find_peer_by_mac(void *data,
+ const char *mac_addr)
+{
+ __FUNC_ENTER__;
+ struct ug_data *ugd = (struct ug_data *) data;
+ int i;
+
+ if (ugd == NULL)
+ {
+ DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
+ return NULL;
+ }
+
+ for (i = 0; i < ugd->peer_cnt; i++)
+ {
+ DBG(LOG_VERBOSE, "check %dth peer\n", i);
+ if (!strncmp
+ (mac_addr, (const char *) ugd->peers[i].mac_addr, MAC_LENGTH))
+ {
+ DBG(LOG_VERBOSE, "found peer. [%d]\n", i);
+ __FUNC_EXIT__;
+ return &ugd->peers[i];
+ }
+ }
+ __FUNC_EXIT__;
+
+ return NULL;
+}
+
+void _activation_cb(int error_code, wifi_direct_device_state_e device_state,
+ void *user_data)
+{
+ __FUNC_ENTER__;
+ int res;
+ wifi_direct_state_e wfd_status;
+ struct ug_data *ugd = (struct ug_data *) user_data;
+
+ wifi_direct_get_state(&wfd_status);
+ DBG(LOG_VERBOSE, "WFD status [%d]", wfd_status);
+ ugd->wfd_status = wfd_status;
+
+ switch (device_state)
+ {
+ case WIFI_DIRECT_DEVICE_STATE_ACTIVATED:
+ DBG(LOG_VERBOSE, "WIFI_DIRECT_DEVICE_STATE_ACTIVATED\n");
+ if(error_code != WIFI_DIRECT_ERROR_NONE)
+ {
+ DBG(LOG_ERROR, "Error in Activation/Deactivation [%d]\n", error_code);
+ wfd_ug_warn_popup(ugd, _("IDS_WFD_POP_ACTIVATE_FAIL"), POPUP_TYPE_ACTIVATE_FAIL);
+
+ ugd->head_text_mode = HEAD_TEXT_TYPE_DIRECT;
+ ugd->wfd_onoff = 0;
+ wfd_ug_view_refresh_glitem(ugd->head);
+ return;
+ }
+
+ ugd->head_text_mode = HEAD_TEXT_TYPE_ACTIVATED;
+ ugd->wfd_onoff = 1;
+ wfd_ug_view_refresh_glitem(ugd->head);
+ res = vconf_set_int("db/wifi_direct/onoff", ugd->wfd_onoff);
+ if (res != 0)
+ {
+ DBG(LOG_ERROR, "Failed to set vconf value for WFD onoff status\n");
+ }
+ wfg_ug_act_popup_remove(ugd);
+
+ res = vconf_ignore_key_changed(VCONFKEY_WIFI_STATE, _wifi_state_cb);
+ if (res == -1)
+ {
+ DBG(LOG_ERROR,
+ "Failed to ignore vconf key callback for wifi state\n");
+ }
+
+ res = wifi_direct_start_discovery(FALSE, 0);
+ if (res != WIFI_DIRECT_ERROR_NONE)
+ {
+ DBG(LOG_ERROR, "Failed to start discovery. [%d]\n", res);
+ }
+ break;
+ DBG(LOG_VERBOSE, "Discovery is started\n");
+ case WIFI_DIRECT_DEVICE_STATE_DEACTIVATED:
+ DBG(LOG_VERBOSE, "WIFI_DIRECT_DEVICE_STATE_DEACTIVATED\n");
+ if(error_code != WIFI_DIRECT_ERROR_NONE)
+ {
+ DBG(LOG_ERROR, "Error in Activation/Deactivation [%d]\n", error_code);
+ wfd_ug_warn_popup(ugd, _("IDS_WFD_POP_DEACTIVATE_FAIL"), POPUP_TYPE_DEACTIVATE_FAIL);
+ ugd->head_text_mode = HEAD_TEXT_TYPE_DIRECT;
+ ugd->wfd_onoff = 1;
+ wfd_ug_view_refresh_glitem(ugd->head);
+ return;
+ }
+
+ ugd->head_text_mode = HEAD_TEXT_TYPE_DIRECT;
+ ugd->wfd_onoff = 0;
+ wfd_ug_view_refresh_glitem(ugd->head);
+ res = vconf_set_int("db/wifi_direct/onoff", ugd->wfd_onoff);
+ if (res != 0)
+ {
+ DBG(LOG_ERROR, "Failed to set vconf value for WFD onoff status\n");
+ }
+ wfd_ug_view_free_peers(ugd);
+ wfd_ug_view_update_peers(ugd);
+ break;
+ default:
+ break;
+ }
+ wfd_ug_view_refresh_button(ugd->scan_btn, ugd->wfd_onoff);
+
+ __FUNC_EXIT__;
+ return;
+}
+
+static int peer_cnt;
+static int connected_cnt;
+static int discovered_cnt;
+
+bool _wfd_discoverd_peer_cb(wifi_direct_discovered_peer_info_s * peer,
+ void *user_data)
+{
+ __FUNC_ENTER__;
+ device_type_s *peers = (device_type_s *) user_data;
+
+ DBG(LOG_VERBOSE, "%dth discovered peer. [%s]\n", peer_cnt, peer->ssid);
+ if (peer->is_connected == TRUE)
+ return FALSE;
+ memcpy(peers[peer_cnt].ssid, peer->ssid, SSID_LENGTH);
+ peers[peer_cnt].ssid[31] = '\0';
+ DBG(LOG_VERBOSE, "\tSSID: [%s]\n", peers[peer_cnt].ssid);
+ peers[peer_cnt].category = peer->primary_device_type;
+ DBG(LOG_VERBOSE, "\tPeer category [%d] -> [%d]\n", peer->primary_device_type, peers[peer_cnt].category);
+ strncpy(peers[peer_cnt].mac_addr, peer->mac_address, MAC_LENGTH);
+ strncpy(peers[peer_cnt].if_addr, peer->interface_address, MAC_LENGTH);
+ peers[peer_cnt].conn_status = PEER_CONN_STATUS_DISCONNECTED;
+ DBG(LOG_VERBOSE, "\tStatus: [%d]\n", peers[peer_cnt].conn_status);
+ peer_cnt++;
+
+ free(peer->ssid);
+ free(peer->mac_address);
+ free(peer->interface_address);
+ free(peer);
+ __FUNC_EXIT__;
+ return TRUE;
+}
+
+bool _wfd_connected_peer_cb(wifi_direct_connected_peer_info_s * peer,
+ void *user_data)
+{
+ __FUNC_ENTER__;
+ device_type_s *peers = (device_type_s *) user_data;
+
+ DBG(LOG_VERBOSE, "%dth connected peer. [%s]\n", peer_cnt, peer->ssid);
+ memcpy(peers[peer_cnt].ssid, peer->ssid, SSID_LENGTH);
+ peers[peer_cnt].ssid[31] = '\0';
+ DBG(LOG_VERBOSE, "\tSSID: [%s]\n", peers[peer_cnt].ssid);
+ peers[peer_cnt].category = peer->primary_device_type;
+ DBG(LOG_VERBOSE, "\tCategory: [%d]\n", peers[peer_cnt].category);
+ strncpy(peers[peer_cnt].mac_addr, peer->mac_address, MAC_LENGTH);
+ strncpy(peers[peer_cnt].if_addr, peer->interface_address, MAC_LENGTH);
+ peers[peer_cnt].conn_status = PEER_CONN_STATUS_CONNECTED;
+ DBG(LOG_VERBOSE, "\tStatus: [%d]\n", peers[peer_cnt].conn_status);
+ peer_cnt++;
+
+ free(peer->ssid);
+ free(peer->mac_address);
+ free(peer->interface_address);
+ free(peer);
+ __FUNC_EXIT__;
+ return TRUE;
+}
+
+void _discover_cb(int error_code, wifi_direct_discovery_state_e discovery_state,
+ void *user_data)
+{
+ __FUNC_ENTER__;
+ struct ug_data *ugd = (struct ug_data *) user_data;
+ int res;
+ device_type_s *peers = NULL;
+
+ if (ugd == NULL)
+ {
+ DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
+ return;
+ }
+
+ peers = calloc(MAX_PEER_NUM, sizeof(device_type_s));
+
+ if (discovery_state == WIFI_DIRECT_ONLY_LISTEN_STARTED)
+ {
+ ugd->head_text_mode = HEAD_TEXT_TYPE_DIRECT;
+ }
+ else if (discovery_state == WIFI_DIRECT_DISCOVERY_STARTED)
+ {
+ ugd->head_text_mode = HEAD_TEXT_TYPE_SCANING;
+ }
+ wfd_ug_view_refresh_glitem(ugd->head);
+
+ if (ugd->wfd_status < WFD_LINK_STATUS_ACTIVATED
+ || ugd->wfd_status > WFD_LINK_STATUS_GROUP_OWNER)
+ {
+ return;
+ }
+ else
+ {
+ peer_cnt = 0;
+ }
+
+ if (ugd->wfd_status >= WFD_LINK_STATUS_CONNECTED)
+ {
+ DBG(LOG_VERBOSE, "getting connected peer..\n");
+ res =
+ wifi_direct_foreach_connected_peers(_wfd_connected_peer_cb,
+ (void *) peers);
+ if (res != WIFI_DIRECT_ERROR_NONE)
+ {
+ connected_cnt = 0;
+ DBG(LOG_ERROR, "get discovery result failed: %d\n", res);
+ }
+ }
+
+ if (discovery_state == WIFI_DIRECT_DISCOVERY_FOUND)
+ {
+ DBG(LOG_VERBOSE, "Peer is found\n");
+ ugd->head_text_mode = HEAD_TEXT_TYPE_DIRECT;
+ wfd_ug_view_refresh_glitem(ugd->head);
+
+ if (ugd->wfd_status >= WFD_LINK_STATUS_ACTIVATED)
+ {
+ DBG(LOG_VERBOSE, "getting discovered peer..\n");
+ res =
+ wifi_direct_foreach_discovered_peers(_wfd_discoverd_peer_cb,
+ (void *) peers);
+ if (res != WIFI_DIRECT_ERROR_NONE)
+ {
+ discovered_cnt = 0;
+ DBG(LOG_ERROR, "get discovery result failed: %d\n", res);
+ }
+ }
+ }
+
+ wfd_ug_view_free_peers(ugd);
+
+ ugd->peers = peers;
+ ugd->peer_cnt = peer_cnt;
+
+ wfd_ug_view_update_peers(ugd);
+ DBG(LOG_VERBOSE, "%d peers are updated\n", peer_cnt);
+
+ __FUNC_EXIT__;
+ return;
+}
+
+void _connection_cb(int error_code,
+ wifi_direct_connection_state_e connection_state,
+ const char *mac_address, void *user_data)
+{
+ __FUNC_ENTER__;
+ DBG(LOG_VERBOSE, "Connection event [%d], error_code [%d]\n",
+ connection_state, error_code);
+ struct ug_data *ugd = (struct ug_data *) user_data;
+ device_type_s *peer = NULL;
+ bool owner = FALSE;
+ int res = 0;
+
+ if (mac_address == NULL)
+ {
+ DBG(LOG_ERROR, "Incorrect parameter(peer mac is NULL)\n");
+ return;
+ }
+ DBG(LOG_VERBOSE, "Connection event from %s", mac_address);
+
+ peer = wfd_client_find_peer_by_mac(ugd, mac_address);
+ if (peer == NULL)
+ {
+ DBG(LOG_ERROR, "Failed to find peer [mac: %s]\n", mac_address);
+ return;
+ }
+
+ switch (connection_state)
+ {
+ case WIFI_DIRECT_CONNECTION_RSP:
+ DBG(LOG_VERBOSE, "WIFI_DIRECT_CONNECTION_RSP\n");
+
+ if (error_code == WIFI_DIRECT_ERROR_NONE)
+ {
+ ugd->wfd_status = WFD_LINK_STATUS_CONNECTED;
+ peer->conn_status = PEER_CONN_STATUS_CONNECTED;
+ res = wifi_direct_is_group_owner(&owner);
+ if (res == WIFI_DIRECT_ERROR_NONE)
+ {
+ if (!owner)
+ wfd_ug_view_refresh_button(ugd->scan_btn, FALSE);
+ }
+ else
+ {
+ DBG(LOG_ERROR,
+ "Failed to get whether client is group owner. [%d]\n", res);
+ }
+ }
+ else
+ {
+ peer->conn_status = PEER_CONN_STATUS_DISCONNECTED;
+ wifi_direct_start_discovery(FALSE, 0);
+ }
+ break;
+ case WIFI_DIRECT_DISCONNECTION_RSP:
+ case WIFI_DIRECT_DISCONNECTION_IND:
+ case WIFI_DIRECT_DISASSOCIATION_IND:
+ DBG(LOG_VERBOSE, "WIFI_DIRECT_DISCONNECTION_X\n");
+ if (error_code != WIFI_DIRECT_ERROR_NONE)
+ {
+ return;
+ }
+
+ peer->conn_status = PEER_CONN_STATUS_DISCONNECTED;
+
+ ugd->wfd_status = WFD_LINK_STATUS_ACTIVATED;
+ ugd->head_text_mode = HEAD_TEXT_TYPE_ACTIVATED;
+
+ wfd_ug_view_refresh_button(ugd->scan_btn, TRUE);
+ wifi_direct_start_discovery(FALSE, 0);
+ ugd->wfd_status = WFD_LINK_STATUS_DISCOVERING;
+ ugd->head_text_mode = HEAD_TEXT_TYPE_SCANING;
+ wfd_ug_view_refresh_glitem(ugd->head);
+ break;
+ case WIFI_DIRECT_CONNECTION_IN_PROGRESS:
+ DBG(LOG_VERBOSE, "WIFI_DIRECT_CONNECTION_IN_PROGRESS\n");
+ peer->conn_status = PEER_CONN_STATUS_CONNECTING;
+ break;
+ case WIFI_DIRECT_CONNECTION_REQ:
+ case WIFI_DIRECT_CONNECTION_WPS_REQ:
+ DBG(LOG_VERBOSE, "WIFI_DIRECT_CLI_EVENT_CONNECTION_REQ\n");
+ break;
+ default:
+ break;
+ }
+
+ if (peer != NULL)
+ wfd_ug_view_refresh_glitem(peer->gl_item);
+
+ __FUNC_EXIT__;
+ return;
+}
+
+int wfd_get_vconf_status(void *data)
+{
+ __FUNC_ENTER__;
+ struct ug_data *ugd = (struct ug_data *) data;
+ int res;
+ char *dev_name;
+
+ res = vconf_get_int("db/wifi_direct/onoff", &ugd->wfd_onoff);
+ if (res != 0)
+ {
+ DBG(LOG_ERROR, "vconf_get_int is failed\n");
+ }
+ DBG(LOG_VERBOSE, "VCONF_WFD_ONOFF : %d\n", ugd->wfd_onoff);
+
+ dev_name = vconf_get_str(VCONFKEY_SETAPPL_DEVICE_NAME_STR);
+ if (dev_name == NULL)
+ {
+ ugd->dev_name = strdup(DEFAULT_DEV_NAME);
+ DBG(LOG_ERROR, "The AP name is NULL(setting default value)\n");
+ }
+ else
+ {
+ ugd->dev_name = strdup(dev_name);
+ free(dev_name);
+ }
+
+ __FUNC_EXIT__;
+
+ return 0;
+}
+
+int init_wfd_client(void *data)
+{
+ __FUNC_ENTER__;
+ struct ug_data *ugd = (struct ug_data *) data;
+ int res = 0;
+ wifi_direct_state_e wfd_status;
+
+ res = wifi_direct_initialize();
+ if (res != WIFI_DIRECT_ERROR_NONE)
+ {
+ DBG(LOG_ERROR, "Failed to initialize wifi direct. [%d]\n", res);
+ return -1;
+ }
+
+ res = wifi_direct_set_device_state_changed_cb(_activation_cb, (void *) ugd);
+ res =
+ wifi_direct_set_discovery_state_changed_cb(_discover_cb, (void *) ugd);
+ res =
+ wifi_direct_set_connection_state_changed_cb(_connection_cb,
+ (void *) ugd);
+
+ res = wifi_direct_get_state(&wfd_status);
+ if (res != WIFI_DIRECT_ERROR_NONE)
+ {
+ DBG(LOG_ERROR, "Failed to get link status. [%d]\n", res);
+ return -1;
+ }
+ ugd->wfd_status = wfd_status;
+ DBG(LOG_VERBOSE, "WFD link status. [%d]\n", wfd_status);
+
+ if (wfd_status > WIFI_DIRECT_STATE_ACTIVATING)
+ {
+ vconf_set_int("db/wifi_direct/onoff", 1);
+ ugd->wfd_onoff = 1;
+ }
+ else
+ {
+ vconf_set_int("db/wifi_direct/onoff", 0);
+ ugd->wfd_onoff = 0;
+ }
+ wfd_ug_view_refresh_glitem(ugd->head);
+ wfd_ug_view_refresh_button(ugd->scan_btn, ugd->wfd_onoff);
+
+ if(wfd_status >= WIFI_DIRECT_STATE_CONNECTED)
+ {
+ device_type_s *peers = NULL;
+
+ peers = calloc(MAX_PEER_NUM, sizeof(device_type_s));
+ res = wifi_direct_foreach_connected_peers(_wfd_connected_peer_cb, (void*) peers);
+ if(res != WIFI_DIRECT_ERROR_NONE)
+ {
+ connected_cnt = 0;
+ DBG(LOG_ERROR, "get discovery result failed: %d\n", res);
+ }
+ wfd_ug_view_free_peers(ugd);
+
+ ugd->peers = peers;
+ ugd->peer_cnt = peer_cnt;
+
+ wfd_ug_view_update_peers(ugd);
+ DBG(LOG_VERBOSE, "%d peers are updated\n", peer_cnt);
+ }
+
+ if (wfd_status > WIFI_DIRECT_STATE_ACTIVATING)
+ {
+ int wifi_state;
+ vconf_get_int(VCONFKEY_WIFI_STATE, &wifi_state);
+
+ if (wifi_state < VCONFKEY_WIFI_CONNECTED)
+ {
+ res = wifi_direct_start_discovery(FALSE, 0);
+ if (res != WIFI_DIRECT_ERROR_NONE)
+ {
+ DBG(LOG_ERROR, "Failed to start discovery. [%d]\n", res);
+ }
+ DBG(LOG_VERBOSE, "Discovery is started\n");
+ }
+ else
+ {
+ wfd_ug_act_popup(ugd, _("IDS_WFD_POP_WIFI_OFF"),
+ POPUP_TYPE_WIFI_OFF);
+ }
+ }
+
+ __FUNC_EXIT__;
+
+ return 0;
+}
+
+int deinit_wfd_client(void *data)
+{
+ __FUNC_ENTER__;
+ int res = 0;
+ wifi_direct_state_e status = 0;
+
+ wifi_direct_get_state(&status);
+
+ if (status == WIFI_DIRECT_STATE_DISCOVERING)
+ {
+ DBG(LOG_VERBOSE, "Stop discovery before deregister client\n");
+ wifi_direct_cancel_discovery();
+ }
+
+ res = wifi_direct_deinitialize();
+ if (res != WIFI_DIRECT_ERROR_NONE)
+ {
+ DBG(LOG_ERROR, "Failed to deregister client. [%d]\n", res);
+ }
+
+ res = vconf_ignore_key_changed(VCONFKEY_WIFI_STATE, _wifi_state_cb);
+ if (res == -1)
+ {
+ DBG(LOG_ERROR, "Failed to ignore vconf key callback for wifi state\n");
+ }
+
+ res = net_deregister_client();
+ if (res != NET_ERR_NONE)
+ {
+ DBG(LOG_ERROR, "Failed to deregister network client. [%d]\n", res);
+ }
+
+
+ __FUNC_EXIT__;
+
+ return 0;
+}
+
+int wfd_client_get_link_status()
+{
+ __FUNC_ENTER__;
+ wifi_direct_state_e status;
+ int res;
+
+ res = wifi_direct_get_state(&status);
+ if (res != WIFI_DIRECT_ERROR_NONE)
+ {
+ DBG(LOG_ERROR, "Failed to get link status from wfd-server. [%d]", res);
+ return -1;
+ }
+
+ __FUNC_EXIT__;
+ return status;
+}
+
+int wfd_client_switch_on(void *data)
+{
+ __FUNC_ENTER__;
+ struct ug_data *ugd = (struct ug_data *) data;
+ int res;
+
+ DBG(LOG_VERBOSE, "WFD status [%d]\n", ugd->wfd_status);
+
+ if (ugd->wfd_status < WFD_LINK_STATUS_ACTIVATING)
+ {
+ ugd->wfd_status = WFD_LINK_STATUS_ACTIVATING;
+
+ int wifi_state;
+ res = vconf_get_int(VCONFKEY_WIFI_STATE, &wifi_state);
+ if (res != 0)
+ {
+ DBG(LOG_ERROR, "Failed to get wifi state from vconf. [%d]\n", res);
+ return -1;
+ }
+
+ if (wifi_state > VCONFKEY_WIFI_OFF)
+ {
+ DBG(LOG_VERBOSE, "WiFi is connected, so have to turn off WiFi");
+ wfd_ug_act_popup(ugd, _("IDS_WFD_POP_WIFI_OFF"),
+ POPUP_TYPE_WIFI_OFF);
+ }
+ else
+ {
+ res = wifi_direct_activate();
+ if (res != WIFI_DIRECT_ERROR_NONE)
+ {
+ DBG(LOG_ERROR,
+ "Failed to activate Wi-Fi Direct. error code = [%d]\n",
+ res);
+ wfd_ug_warn_popup(ugd, _("IDS_WFD_POP_ACTIVATE_FAIL"), POPUP_TYPE_TERMINATE);
+
+ ugd->head_text_mode = HEAD_TEXT_TYPE_DIRECT;
+ wfd_ug_view_refresh_glitem(ugd->head);
+ return -1;
+ }
+ }
+ }
+ else
+ {
+ DBG(LOG_VERBOSE, "Wi-Fi Direct is already activated\n");
+ }
+
+ __FUNC_EXIT__;
+ return 0;
+}
+
+int wfd_client_switch_off(void *data)
+{
+ __FUNC_ENTER__;
+ struct ug_data *ugd = (struct ug_data *) data;
+ int res;
+
+ DBG(LOG_VERBOSE, "WFD status [%d]\n", ugd->wfd_status);
+
+ if (ugd->wfd_status < WFD_LINK_STATUS_ACTIVATING)
+ {
+ DBG(LOG_VERBOSE, "Wi-Fi Direct is already deactivated\n");
+ }
+ else
+ {
+ ugd->wfd_status = WFD_LINK_STATUS_DEACTIVATING;
+
+ res = wifi_direct_deactivate();
+ if (res != WIFI_DIRECT_ERROR_NONE)
+ {
+ DBG(LOG_ERROR,
+ "Failed to deactivate Wi-Fi Direct. error code = [%d]\n", res);
+ wfd_ug_warn_popup(ugd, _("IDS_WFD_POP_DEACTIVATE_FAIL"), POPUP_TYPE_TERMINATE);
+
+ ugd->head_text_mode = HEAD_TEXT_TYPE_DIRECT;
+ wfd_ug_view_refresh_glitem(ugd->head);
+ return -1;
+ }
+ }
+
+ __FUNC_EXIT__;
+ return 0;
+}
+
+int wfd_client_swtch_force(void *data, int onoff)
+{
+ __FUNC_ENTER__;
+ struct ug_data *ugd = (struct ug_data*) data;
+ int res;
+
+ if (onoff)
+ {
+ res = wifi_direct_activate();
+ if (res != WIFI_DIRECT_ERROR_NONE)
+ {
+ DBG(LOG_ERROR,
+ "Failed to activate Wi-Fi Direct. error code = [%d]\n", res);
+ wfd_ug_warn_popup(ugd, _("IDS_WFD_POP_ACTIVATE_FAIL"), POPUP_TYPE_TERMINATE);
+
+ ugd->head_text_mode = HEAD_TEXT_TYPE_DIRECT;
+ wfd_ug_view_refresh_glitem(ugd->head);
+ return -1;
+ }
+ }
+ else
+ {
+ res = wifi_direct_deactivate();
+ if (res != WIFI_DIRECT_ERROR_NONE)
+ {
+ DBG(LOG_ERROR,
+ "Failed to deactivate Wi-Fi Direct. error code = [%d]\n", res);
+ wfd_ug_warn_popup(ugd, _("IDS_WFD_POP_DEACTIVATE_FAIL"), POPUP_TYPE_TERMINATE);
+
+ ugd->head_text_mode = HEAD_TEXT_TYPE_DIRECT;
+ wfd_ug_view_refresh_glitem(ugd->head);
+ return -1;
+ }
+ }
+ __FUNC_EXIT__;
+ return 0;
+}
+
+int wfd_client_start_discovery(void *data)
+{
+ __FUNC_ENTER__;
+ int res;
+ wifi_direct_state_e status;
+
+ wifi_direct_get_state(&status);
+ if (status >= WIFI_DIRECT_STATE_ACTIVATED)
+ {
+ res = wifi_direct_start_discovery(FALSE, 0);
+ if (res != WIFI_DIRECT_ERROR_NONE)
+ {
+ DBG(LOG_ERROR, "Failed to start wfd discovery. [%d]", res);
+ }
+ }
+ __FUNC_EXIT__;
+
+ return 0;
+}
+
+int wfd_client_connect(const char *mac_addr)
+{
+ __FUNC_ENTER__;
+ int res;
+
+ res = wifi_direct_connect(mac_addr);
+ if (res != WIFI_DIRECT_ERROR_NONE)
+ {
+ DBG(LOG_ERROR, "Failed to send connection request. [%d]\n", res);
+ return -1;
+ }
+ __FUNC_EXIT__;
+ return 0;
+}
+
+int wfd_client_disconnect(const char *mac_addr)
+{
+ __FUNC_ENTER__;
+ int res;
+
+ if (mac_addr == NULL)
+ {
+ res = wifi_direct_disconnect_all();
+ if (res != WIFI_DIRECT_ERROR_NONE)
+ {
+ DBG(LOG_ERROR,
+ "Failed to send disconnection request to all. [%d]\n", res);
+ return -1;
+ }
+ }
+ else
+ {
+ res = wifi_direct_disconnect(mac_addr);
+ if (res != WIFI_DIRECT_ERROR_NONE)
+ {
+ DBG(LOG_ERROR, "Failed to send disconnection request. [%d]\n", res);
+ return -1;
+ }
+ }
+ __FUNC_EXIT__;
+ return 0;
+}
diff --git a/ug-wifidirect/src/wfd_ug.c b/ug-wifidirect/src/wfd_ug.c
new file mode 100644
index 0000000..cfbbf49
--- /dev/null
+++ b/ug-wifidirect/src/wfd_ug.c
@@ -0,0 +1,366 @@
+/*
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * This file implements Wi-Fi direct UI Gadget.
+ *
+ * @file wfd_ug.c
+ * @author Gibyoung Kim (lastkgb.kim@samsung.com)
+ * @version 0.1
+ */
+
+
+#ifndef UG_MODULE_API
+#define UG_MODULE_API __attribute__ ((visibility("default")))
+#endif
+
+
+#include <sys/time.h>
+#include <libintl.h>
+#include <sys/utsname.h>
+
+#include <Elementary.h>
+#include <ui-gadget-module.h>
+#include <wifi-direct.h>
+
+#include "wfd_ug.h"
+#include "wfd_ug_view.h"
+#include "wfd_client.h"
+
+
+static Evas_Object *_create_bg(Evas_Object *parent, char *style)
+{
+ __FUNC_ENTER__;
+ Evas_Object *bg;
+
+ bg = elm_bg_add(parent);
+ evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_object_style_set(bg, style);
+ elm_win_resize_object_add(parent, bg);
+ evas_object_show(bg);
+
+ __FUNC_EXIT__;
+ return bg;
+}
+
+static Evas_Object *_create_fullview(Evas_Object *parent, struct ug_data *ugd)
+{
+ __FUNC_ENTER__;
+ Evas_Object *base;
+
+ if (parent == NULL)
+ {
+ DBG(LOG_ERROR, "Incorrenct parameter");
+ return NULL;
+ }
+
+ base = elm_layout_add(parent);
+ if (!base)
+ {
+ DBG(LOG_ERROR, "Failed to add layout");
+ return NULL;
+ }
+
+ elm_layout_theme_set(base, "layout", "application", "default");
+ evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(base, EVAS_HINT_FILL, EVAS_HINT_FILL);
+
+ __FUNC_EXIT__;
+ return base;
+}
+
+static Evas_Object *_create_frameview(Evas_Object * parent, struct ug_data *ugd)
+{
+ __FUNC_ENTER__;
+ Evas_Object *base;
+
+ if (parent == NULL)
+ {
+ DBG(LOG_ERROR, "Incorrenct parameter");
+ return NULL;
+ }
+
+ base = elm_layout_add(parent);
+ if (!base)
+ {
+ DBG(LOG_ERROR, "Failed to add layout");
+ return NULL;
+ }
+
+ elm_layout_theme_set(base, "layout", "application", "default");
+ evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(base, EVAS_HINT_FILL, EVAS_HINT_FILL);
+
+ __FUNC_EXIT__;
+ return base;
+}
+
+static void *on_create(struct ui_gadget *ug, enum ug_mode mode, bundle * data,
+ void *priv)
+{
+ __FUNC_ENTER__;
+ struct ug_data *ugd;
+
+ if (!ug || !priv)
+ return NULL;
+
+ ugd = priv;
+ ugd->ug = ug;
+
+ bindtextdomain(PACKAGE, LOCALEDIR);
+
+ ugd->win = ug_get_parent_layout(ug);
+ if (!ugd->win)
+ return NULL;
+
+ if (mode == UG_MODE_FULLVIEW)
+ ugd->base = _create_fullview(ugd->win, ugd);
+ else
+ ugd->base = _create_frameview(ugd->win, ugd);
+
+ if (ugd->base)
+ {
+ ugd->bg = _create_bg(ugd->win, "group_list");
+ elm_object_part_content_set(ugd->base, "elm.swallow.bg", ugd->bg);
+ }
+ else
+ {
+ DBG(LOG_ERROR, "Failed to create base layout\n");
+ return NULL;
+ }
+
+ wfd_get_vconf_status(ugd);
+
+ create_wfd_ug_view(ugd);
+ evas_object_show(ugd->base);
+
+ __FUNC_EXIT__;
+ return ugd->base;
+}
+
+static void on_start(struct ui_gadget *ug, bundle * data, void *priv)
+{
+ __FUNC_ENTER__;
+ struct ug_data *ugd;
+ int res;
+
+ if (!ug || !priv)
+ return;
+
+ ugd = priv;
+
+ struct utsname kernel_info;
+ res = uname(&kernel_info);
+ if(res != 0)
+ {
+ DBG(LOG_ERROR, "Failed to detect target type\n");
+ }
+ else
+ {
+ DBG(LOG_VERBOSE, "Node name of this device [%s]\n", kernel_info.nodename);
+ DBG(LOG_VERBOSE, "HW ID of this device [%s]\n", kernel_info.machine);
+ if(strcmp(kernel_info.nodename, "SLP_PQ") == 0 ||
+ strncmp(kernel_info.machine, "arm", 3) != 0)
+ {
+ wfd_ug_warn_popup(ugd, _("IDS_WFD_POP_NOT_SUPPORTED_DEVICE"), POPUP_TYPE_TERMINATE);
+ return;
+ }
+ }
+
+ res = init_wfd_client(ugd);
+ if(res != 0)
+ {
+ DBG(LOG_ERROR, "Failed to initialize WFD client library\n");
+ wfd_ug_warn_popup(ugd, _("IDS_WFD_POP_PROBLEM_WITH_WFD"), POPUP_TYPE_TERMINATE);
+ }
+
+ __FUNC_EXIT__;
+}
+
+static void on_pause(struct ui_gadget *ug, bundle * data, void *priv)
+{
+ __FUNC_ENTER__;
+ __FUNC_EXIT__;
+}
+
+static void on_resume(struct ui_gadget *ug, bundle * data, void *priv)
+{
+ __FUNC_ENTER__;
+ __FUNC_EXIT__;
+}
+
+static void on_destroy(struct ui_gadget *ug, bundle * data, void *priv)
+{
+ __FUNC_ENTER__;
+
+ if (!ug || !priv)
+ {
+ DBG(LOG_ERROR, "The param is NULL\n");
+ return;
+ }
+
+ struct ug_data *ugd = priv;
+ if (ugd == NULL || ugd->base == NULL)
+ {
+ DBG(LOG_ERROR, "The param is NULL\n");
+ return;
+ }
+
+ deinit_wfd_client(ugd);
+ DBG(LOG_VERBOSE, "WFD client deregistered");
+
+ destroy_wfd_ug_view(ugd);
+
+ if (ugd->bg)
+ {
+ evas_object_del(ugd->bg);
+ ugd->bg = NULL;
+ }
+
+ if (ugd->base)
+ {
+ evas_object_del(ugd->base);
+ ugd->base = NULL;
+ }
+
+ __FUNC_EXIT__;
+ return;
+}
+
+static void on_message(struct ui_gadget *ug, bundle * msg, bundle * data,
+ void *priv)
+{
+ __FUNC_ENTER__;
+ __FUNC_EXIT__;
+}
+
+static void on_event(struct ui_gadget *ug, enum ug_event event, bundle * data,
+ void *priv)
+{
+ __FUNC_ENTER__;
+
+ if (!ug || !priv)
+ {
+ DBG(LOG_ERROR, "The param is NULL\n");
+ return;
+ }
+
+ switch (event)
+ {
+ case UG_EVENT_LOW_MEMORY:
+ DBG(LOG_VERBOSE, "UG_EVENT_LOW_MEMORY\n");
+ break;
+ case UG_EVENT_LOW_BATTERY:
+ DBG(LOG_VERBOSE, "UG_EVENT_LOW_BATTERY\n");
+ break;
+ case UG_EVENT_LANG_CHANGE:
+ DBG(LOG_VERBOSE, "UG_EVENT_LANG_CHANGE\n");
+ break;
+ case UG_EVENT_ROTATE_PORTRAIT:
+ DBG(LOG_VERBOSE, "UG_EVENT_ROTATE_PORTRAIT\n");
+ break;
+ case UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN:
+ DBG(LOG_VERBOSE, "UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN\n");
+ break;
+ case UG_EVENT_ROTATE_LANDSCAPE:
+ DBG(LOG_VERBOSE, "UG_EVENT_ROTATE_LANDSCAPE\n");
+ break;
+ case UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN:
+ DBG(LOG_VERBOSE, "UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN\n");
+ break;
+ default:
+ DBG(LOG_VERBOSE, "default\n");
+ break;
+ }
+
+ __FUNC_EXIT__;
+}
+
+static void on_key_event(struct ui_gadget *ug, enum ug_key_event event,
+ bundle * data, void *priv)
+{
+ __FUNC_ENTER__;
+
+ if (!ug || !priv)
+ {
+ DBG(LOG_ERROR, "The param is NULL\n");
+ return;
+ }
+
+ switch (event)
+ {
+ case UG_KEY_EVENT_END:
+ DBG(LOG_VERBOSE, "UG_KEY_EVENT_END\n");
+ break;
+ default:
+ break;
+ }
+
+ __FUNC_EXIT__;
+}
+
+UG_MODULE_API int UG_MODULE_INIT(struct ug_module_ops *ops)
+{
+ __FUNC_ENTER__;
+ struct ug_data *ugd;
+
+ if (!ops)
+ {
+ DBG(LOG_ERROR, "The param is NULL\n");
+ return -1;
+ }
+
+ ugd = calloc(1, sizeof(struct ug_data));
+ if (ugd == NULL)
+ {
+ DBG(LOG_ERROR, "Failed to allocate memory for UG data\n");
+ return -1;
+ }
+
+ ops->create = on_create;
+ ops->start = on_start;
+ ops->pause = on_pause;
+ ops->resume = on_resume;
+ ops->destroy = on_destroy;
+ ops->message = on_message;
+ ops->event = on_event;
+ ops->key_event = on_key_event;
+ ops->priv = ugd;
+ ops->opt = UG_OPT_INDICATOR_ENABLE;
+
+ __FUNC_EXIT__;
+ return 0;
+}
+
+UG_MODULE_API void UG_MODULE_EXIT(struct ug_module_ops *ops)
+{
+ __FUNC_ENTER__;
+
+ struct ug_data *ugd;
+
+ if (!ops)
+ {
+ DBG(LOG_ERROR, "The param is NULL\n");
+ return;
+ }
+
+ ugd = ops->priv;
+
+ if (ugd)
+ free(ugd);
+
+ __FUNC_EXIT__;
+}
diff --git a/ug-wifidirect/src/wfd_ug_view.c b/ug-wifidirect/src/wfd_ug_view.c
new file mode 100644
index 0000000..7322477
--- /dev/null
+++ b/ug-wifidirect/src/wfd_ug_view.c
@@ -0,0 +1,874 @@
+/*
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * This file implements view of Wi-Fi direct UI Gadget.
+ *
+ * @file wfd_ug_view.c
+ * @author Gibyoung Kim (lastkgb.kim@samsung.com)
+ * @version 0.1
+ */
+
+
+#include <libintl.h>
+
+#include <assert.h>
+#include <glib.h>
+
+#include <Elementary.h>
+#include <vconf.h>
+#include <ui-gadget-module.h>
+#include <wifi-direct.h>
+
+#include "wfd_ug.h"
+#include "wfd_ug_view.h"
+#include "wfd_client.h"
+
+
+Elm_Gen_Item_Class sep_itc;
+Elm_Gen_Item_Class head_itc;
+Elm_Gen_Item_Class name_itc;
+Elm_Gen_Item_Class title_itc;
+Elm_Gen_Item_Class peer_itc;
+Elm_Gen_Item_Class noitem_itc;
+Elm_Gen_Item_Class help_itc;
+
+
+void _back_btn_cb(void *data, Evas_Object * obj, void *event_info)
+{
+ __FUNC_ENTER__;
+ struct ug_data *ugd = (struct ug_data*) data;
+
+ if (!ugd)
+ {
+ DBG(LOG_ERROR, "The param is NULL\n");
+ return;
+ }
+
+ wfd_ug_view_free_peers(ugd);
+
+ ug_destroy_me(ugd->ug);
+
+ __FUNC_EXIT__;
+ return;
+}
+
+void _scan_btn_cb(void *data, Evas_Object * obj, void *event_info)
+{
+ __FUNC_ENTER__;
+ struct ug_data *ugd = (struct ug_data*) data;
+ int res;
+
+ res = wfd_client_start_discovery(ugd);
+
+ __FUNC_EXIT__;
+ return;
+}
+
+Eina_Bool _is_wifi_on()
+{
+ __FUNC_ENTER__;
+ int wifi_state;
+
+ vconf_get_int(VCONFKEY_WIFI_STATE, &wifi_state);
+
+ if (wifi_state >= VCONFKEY_WIFI_CONNECTED)
+ {
+ return TRUE;
+ }
+ else
+ {
+ return FALSE;
+ }
+ __FUNC_EXIT__;
+}
+
+static void _wfd_onoff_btn_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ __FUNC_ENTER__;
+ struct ug_data *ugd = (struct ug_data*) data;
+
+ ugd->wfd_status = wfd_client_get_link_status();
+ DBG(LOG_VERBOSE, "WFD state is [%d]", ugd->wfd_status);
+
+ if (!ugd->wfd_onoff)
+ {
+ if(ugd->wfd_status < 0)
+ {
+ DBG(LOG_VERBOSE, "bad wfd status\n");
+ wfd_ug_warn_popup(ugd, _("IDS_WFD_POP_ACTIVATE_FAIL"), POPUP_TYPE_TERMINATE);
+
+ ugd->head_text_mode = HEAD_TEXT_TYPE_DIRECT;
+ wfd_ug_view_refresh_glitem(ugd->head);
+ return;
+ }
+
+ ugd->head_text_mode = HEAD_TEXT_TYPE_ACTIVATING;
+ wfd_client_switch_on(ugd);
+ }
+ else
+ {
+ if(ugd->wfd_status < 0)
+ {
+ DBG(LOG_VERBOSE, "bad wfd status\n");
+ wfd_ug_warn_popup(ugd, _("IDS_WFD_POP_DEACTIVATE_FAIL"), POPUP_TYPE_TERMINATE);
+
+ ugd->head_text_mode = HEAD_TEXT_TYPE_DIRECT;
+ wfd_ug_view_refresh_glitem(ugd->head);
+ return;
+ }
+
+ ugd->head_text_mode = HEAD_TEXT_TYPE_DEACTIVATING;
+ wfd_client_switch_off(ugd);
+ }
+ wfd_ug_view_refresh_glitem(ugd->head);
+
+ __FUNC_EXIT__;
+}
+
+static void _gl_header_sel(void *data, Evas_Object *obj, void *event_info)
+{
+ __FUNC_ENTER__;
+ struct ug_data *ugd = (struct ug_data*) data;
+ Elm_Object_Item *item = (Elm_Object_Item *)event_info;
+ int res;
+
+ if(data == NULL)
+ {
+ DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
+ return;
+ }
+
+ if(item != NULL)
+ elm_genlist_item_selected_set(item, EINA_FALSE);
+
+ _wfd_onoff_btn_cb(ugd, NULL, NULL);
+
+ __FUNC_EXIT__;
+}
+
+static char *_gl_header_label_get(void *data, Evas_Object * obj,
+ const char *part)
+{
+ __FUNC_ENTER__;
+ struct ug_data *ugd = (struct ug_data *) data;
+ DBG(LOG_VERBOSE, "%s", part);
+
+ if (data == NULL)
+ {
+ DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
+ return NULL;
+ }
+
+ if (!strcmp(part, "elm.text"))
+ {
+ DBG(LOG_VERBOSE, "Current text mode [%d]\n", ugd->head_text_mode);
+ switch (ugd->head_text_mode)
+ {
+ case HEAD_TEXT_TYPE_DIRECT:
+ return strdup(dgettext("sys_string", "IDS_COM_OPT1_WI_FI_DIRECT"));
+ break;
+ case HEAD_TEXT_TYPE_DEACTIVATING:
+ return strdup(_("IDS_WFD_BODY_DEACTIVATING"));
+ break;
+ case HEAD_TEXT_TYPE_ACTIVATING:
+ return strdup(_("IDS_WFD_BODY_ACTIVATING"));
+ break;
+ case HEAD_TEXT_TYPE_ACTIVATED:
+ return strdup(_("IDS_WFD_BODY_ACTIVATED"));
+ break;
+ case HEAD_TEXT_TYPE_SCANING:
+ return strdup(_("IDS_WFD_BODY_SCANNING"));
+ break;
+ default:
+ break;
+ }
+ }
+
+ __FUNC_EXIT__;
+ return NULL;
+}
+
+static Evas_Object *_gl_header_icon_get(void *data, Evas_Object * obj,
+ const char *part)
+{
+ __FUNC_ENTER__;
+ struct ug_data *ugd = (struct ug_data *) data;
+ Evas_Object *onoff = NULL;
+
+ if (data == NULL)
+ {
+ DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
+ return NULL;
+ }
+
+ if (ugd->head_text_mode == HEAD_TEXT_TYPE_ACTIVATING ||
+ ugd->head_text_mode == HEAD_TEXT_TYPE_DEACTIVATING)
+ return NULL;
+
+ DBG(LOG_VERBOSE, "%s", part);
+ onoff = elm_check_add(obj);
+ elm_object_style_set(onoff, "on&off");
+ elm_check_state_set(onoff, ugd->wfd_onoff);
+ evas_object_smart_callback_add(onoff, "changed", _wfd_onoff_btn_cb, ugd);
+ evas_object_show(onoff);
+
+ __FUNC_EXIT__;
+
+ return onoff;
+}
+
+static char *_gl_name_label_get(void *data, Evas_Object * obj, const char *part)
+{
+ __FUNC_ENTER__;
+ struct ug_data *ugd = (struct ug_data *) data;
+
+ if (data == NULL)
+ {
+ DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
+ return NULL;
+ }
+
+ DBG(LOG_VERBOSE, "%s", part);
+
+ if (!strcmp(part, "elm.text.1"))
+ {
+ return strdup(_("IDS_WFD_BODY_DEVICE_NAME"));
+ }
+ else if (!strcmp(part, "elm.text.2"))
+ {
+ return strdup(ugd->dev_name);
+ }
+
+ __FUNC_EXIT__;
+
+ return NULL;
+}
+
+static char *_gl_title_label_get(void *data, Evas_Object * obj,
+ const char *part)
+{
+ __FUNC_ENTER__;
+ struct ug_data *ugd = (struct ug_data *) data;
+
+ if (data == NULL)
+ {
+ DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
+ return NULL;
+ }
+
+ if (!strcmp(part, "elm.text"))
+ {
+ if (ugd->peer_cnt)
+ return strdup(_("IDS_WFD_BODY_AVAILABLE_DEVICES"));
+ else
+ return strdup(_("IDS_WFD_BODY_WIFI_DIRECT_DEVICES"));
+ }
+
+ __FUNC_EXIT__;
+
+ return NULL;
+}
+
+static Evas_Object *_gl_noitem_icon_get(void *data, Evas_Object * obj,
+ const char *part)
+{
+ __FUNC_ENTER__;
+ Evas_Object *nocontent;
+
+ if (data == NULL)
+ {
+ DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
+ return NULL;
+ }
+
+ nocontent = elm_layout_add(obj);
+ if (nocontent == NULL)
+ {
+ DBG(LOG_ERROR, "Failed to add nocontent");
+ return NULL;
+ }
+ elm_layout_theme_set(nocontent, "layout", "nocontents", "unnamed");
+ elm_object_part_text_set(nocontent, "elm.text",
+ _("IDS_WFD_BODY_NO_DEVICES"));
+ evas_object_size_hint_min_set(nocontent, 400, 200);
+ evas_object_size_hint_max_set(nocontent, 400, 200);
+ evas_object_resize(nocontent, 400, 200);
+
+ __FUNC_EXIT__;
+
+ return nocontent;
+}
+
+static void _gl_noitem_del(void *data, Evas_Object * obj)
+{
+ __FUNC_ENTER__;
+
+ __FUNC_EXIT__;
+ return;
+}
+
+static char *_gl_peer_label_get(void *data, Evas_Object * obj, const char *part)
+{
+ __FUNC_ENTER__;
+ assertm_if(NULL == obj, "NULL!!");
+ assertm_if(NULL == part, "NULL!!");
+
+ device_type_s *peer = (device_type_s *) data;
+
+ if (data == NULL)
+ {
+ DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
+ return NULL;
+ }
+
+ __FUNC_EXIT__;
+ return strdup(peer->ssid);
+}
+
+static Evas_Object *_gl_peer_icon_get(void *data, Evas_Object * obj,
+ const char *part)
+{
+ __FUNC_ENTER__;
+ assertm_if(NULL == obj, "NULL!!");
+ assertm_if(NULL == part, "NULL!!");
+
+ device_type_s *peer = (device_type_s *) data;
+ Evas_Object *icon = NULL;
+
+ if (data == NULL)
+ {
+ DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
+ return NULL;
+ }
+
+ if (!strcmp(part, "elm.icon.2"))
+ {
+ DBG(LOG_VERBOSE, "elm.icon.2 - connection status [%d]\n",
+ peer->conn_status);
+ if (peer->conn_status == PEER_CONN_STATUS_CONNECTING)
+ {
+ icon = elm_progressbar_add(obj);
+ elm_object_style_set(icon, "list_process");
+ elm_progressbar_pulse(icon, EINA_TRUE);
+ }
+ else if (peer->conn_status == PEER_CONN_STATUS_CONNECTED)
+ {
+ icon = elm_icon_add(obj);
+ elm_icon_file_set(icon, WFD_ICON_CONNECTED, NULL);
+ }
+
+ evas_object_size_hint_aspect_set(icon, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
+ elm_icon_resizable_set(icon, 1, 1);
+ evas_object_show(icon);
+ }
+ else if (!strcmp(part, "elm.icon.1"))
+ {
+ DBG(LOG_VERBOSE, "elm.icon.1 - category [%d]\n", peer->category);
+ char *img_path = NULL;
+ switch (peer->category)
+ {
+ case WFD_DEVICE_TYPE_COMPUTER:
+ img_path = WFD_ICON_DEVICE_PC;
+ break;
+ case WFD_DEVICE_TYPE_INPUT_DEVICE:
+ img_path = WFD_ICON_DEVICE_KEYBOARD;
+ break;
+ case WFD_DEVICE_TYPE_PRINTER:
+ img_path = WFD_ICON_DEVICE_PRINTER;
+ break;
+ case WFD_DEVICE_TYPE_CAMERA:
+ img_path = WFD_ICON_DEVICE_UNKNOWN;
+ break;
+ case WFD_DEVICE_TYPE_STORAGE:
+ case WFD_DEVICE_TYPE_NW_INFRA:
+ case WFD_DEVICE_TYPE_DISPLAYS:
+ case WFD_DEVICE_TYPE_MM_DEVICES:
+ case WFD_DEVICE_TYPE_GAME_DEVICES:
+ case WFD_DEVICE_TYPE_OTHER:
+ img_path = WFD_ICON_DEVICE_UNKNOWN;
+ break;
+ case WFD_DEVICE_TYPE_TELEPHONE:
+ img_path = WFD_ICON_DEVICE_PHONE;
+ break;
+ case WFD_DEVICE_TYPE_AUDIO:
+ img_path = WFD_ICON_DEVICE_HEADSET;
+ break;
+ default:
+ break;
+ }
+
+ if (img_path != NULL)
+ {
+ icon = elm_icon_add(obj);
+ elm_icon_file_set(icon, img_path, NULL);
+ evas_object_size_hint_aspect_set(icon, EVAS_ASPECT_CONTROL_VERTICAL,
+ 1, 1);
+ elm_icon_resizable_set(icon, 1, 1);
+ evas_object_show(icon);
+ }
+ }
+
+ __FUNC_EXIT__;
+ return icon;
+}
+
+static void _gl_peer_del(void *data, Evas_Object * obj)
+{
+ __FUNC_ENTER__;
+ assertm_if(NULL == obj, "NULL!!");
+ assertm_if(NULL == data, "NULL!!");
+
+ __FUNC_EXIT__;
+ return;
+}
+
+static void _gl_peer_sel(void *data, Evas_Object * obj, void *event_info)
+{
+ __FUNC_ENTER__;
+ assertm_if(NULL == obj, "NULL!!");
+ assertm_if(NULL == data, "NULL!!");
+ device_type_s *peer = (device_type_s *) data;
+ Elm_Object_Item *item = (Elm_Object_Item *) event_info;
+ int res;
+
+ if (data == NULL)
+ {
+ DBG(LOG_ERROR, "Incorrect parameter(NULL)\n");
+ return;
+ }
+
+ if (item != NULL)
+ elm_genlist_item_selected_set(item, EINA_FALSE);
+
+ if (peer->conn_status == PEER_CONN_STATUS_DISCONNECTED)
+ {
+ DBG(LOG_VERBOSE, "Connect with peer [%s]\n", peer->mac_addr);
+ res = wfd_client_connect((const char *) peer->mac_addr);
+ if (res != 0)
+ {
+ DBG(LOG_ERROR, "Failed to send connection request. [%d]\n", res);
+ return;
+ }
+ peer->conn_status = PEER_CONN_STATUS_CONNECTING;
+ }
+ else
+ {
+ res = wfd_client_disconnect((const char *) peer->mac_addr);
+ if (res != 0)
+ {
+ DBG(LOG_ERROR, "Failed to send disconnection request. [%d]\n", res);
+ return;
+ }
+ peer->conn_status = PEER_CONN_STATUS_DISCONNECTED;
+ }
+
+ wfd_ug_view_refresh_glitem(peer->gl_item);
+
+ __FUNC_EXIT__;
+ return;
+}
+
+static char *_gl_help_label_get(void *data, Evas_Object * obj, const char *part)
+{
+ __FUNC_ENTER__;
+ DBG(LOG_VERBOSE, "%s", part);
+ __FUNC_ENTER__;
+ return strdup("Help");
+}
+
+static Evas_Object *_create_basic_genlist(void *data)
+{
+ __FUNC_ENTER__;
+
+ struct ug_data *ugd = (struct ug_data *) data;
+ Evas_Object *genlist;
+
+ genlist = elm_genlist_add(ugd->naviframe);
+
+ sep_itc.item_style = "grouptitle.dialogue.seperator";
+ sep_itc.func.text_get = NULL;
+ sep_itc.func.content_get = NULL;
+ sep_itc.func.state_get = NULL;
+ sep_itc.func.del = NULL;
+
+ head_itc.item_style = "dialogue/1text.1icon";
+ head_itc.func.text_get = _gl_header_label_get;
+ head_itc.func.content_get = _gl_header_icon_get;
+ head_itc.func.state_get = NULL;
+
+ name_itc.item_style = "dialogue/2text.3";
+ name_itc.func.text_get = _gl_name_label_get;
+ name_itc.func.content_get = NULL;
+ name_itc.func.state_get = NULL;
+ name_itc.func.del = NULL;
+
+ Elm_Object_Item *item;
+ elm_genlist_item_append(genlist, &sep_itc, NULL, NULL,
+ ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ ugd->head =
+ elm_genlist_item_append(genlist, &head_itc, ugd, NULL,
+ ELM_GENLIST_ITEM_NONE, _gl_header_sel, (void*) ugd);
+ item =
+ elm_genlist_item_append(genlist, &name_itc, ugd, NULL,
+ ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
+
+ __FUNC_EXIT__;
+
+ return genlist;
+}
+
+static int _create_device_genlist(void *data)
+{
+ __FUNC_ENTER__;
+ struct ug_data *ugd = (struct ug_data *) data;
+
+ title_itc.item_style = "dialogue/title";
+ title_itc.func.text_get = _gl_title_label_get;
+ title_itc.func.content_get = NULL;
+ title_itc.func.state_get = NULL;
+ title_itc.func.del = NULL;
+
+ peer_itc.item_style = "dialogue/1text.2icon.2";
+ peer_itc.func.text_get = _gl_peer_label_get;
+ peer_itc.func.content_get = _gl_peer_icon_get;
+ peer_itc.func.state_get = NULL;
+ peer_itc.func.del = _gl_peer_del;
+
+ noitem_itc.item_style = "dialogue/bg/1icon";
+ noitem_itc.func.text_get = NULL;
+ noitem_itc.func.content_get = _gl_noitem_icon_get;
+ noitem_itc.func.state_get = NULL;
+ noitem_itc.func.del = _gl_noitem_del;
+
+ sep_itc.item_style = "grouptitle.dialogue.seperator";
+ sep_itc.func.text_get = NULL;
+ sep_itc.func.content_get = NULL;
+ sep_itc.func.state_get = NULL;
+ sep_itc.func.del = NULL;
+
+ help_itc.item_style = "dialogue/1text";
+ help_itc.func.text_get = _gl_help_label_get;
+ help_itc.func.content_get = NULL;
+ help_itc.func.state_get = NULL;
+ help_itc.func.del = NULL;
+
+ Elm_Object_Item *item;
+ item =
+ elm_genlist_item_append(ugd->genlist, &title_itc, (void *) ugd, NULL,
+ ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
+ ugd->noitem =
+ elm_genlist_item_append(ugd->genlist, &noitem_itc, (void *) ugd, NULL,
+ ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ elm_genlist_item_select_mode_set(ugd->noitem,
+ ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
+
+ __FUNC_EXIT__;
+ return 0;
+}
+
+void create_wfd_ug_view(void *data)
+{
+ __FUNC_ENTER__;
+
+ struct ug_data *ugd = (struct ug_data *) data;
+ Evas_Object *back_btn = NULL;
+ Elm_Object_Item *navi_item = NULL;
+ Evas_Object *control_bar = NULL;
+
+ if (ugd == NULL)
+ {
+ DBG(LOG_ERROR, "Incorrect parameter(NULL)");
+ return;
+ }
+
+ ugd->naviframe = elm_naviframe_add(ugd->base);
+ elm_object_part_content_set(ugd->base, "elm.swallow.content",
+ ugd->naviframe);
+ evas_object_show(ugd->naviframe);
+
+ back_btn = elm_button_add(ugd->naviframe);
+ elm_object_style_set(back_btn, "naviframe/back_btn/default");
+ evas_object_smart_callback_add(back_btn, "clicked", _back_btn_cb,
+ (void *) ugd);
+ elm_object_focus_allow_set(back_btn, EINA_FALSE);
+
+ ugd->genlist = _create_basic_genlist(ugd);
+ if (ugd->genlist == NULL)
+ {
+ DBG(LOG_ERROR, "Failed to create basic genlist");
+ return;
+ }
+ evas_object_show(ugd->genlist);
+ _create_device_genlist(ugd);
+
+ back_btn = elm_button_add(ugd->naviframe);
+ elm_object_style_set(back_btn, "naviframe/back_btn/default");
+ evas_object_smart_callback_add(back_btn, "clicked", _back_btn_cb,
+ (void *) ugd);
+ elm_object_focus_allow_set(back_btn, EINA_FALSE);
+
+ navi_item =
+ elm_naviframe_item_push(ugd->naviframe, _("IDS_WFD_HEADER_WIFI_DIRECT"),
+ back_btn, NULL, ugd->genlist, NULL);
+
+ control_bar = elm_toolbar_add(ugd->naviframe);
+ elm_toolbar_shrink_mode_set(control_bar, ELM_TOOLBAR_SHRINK_EXPAND);
+ evas_object_show(control_bar);
+
+ ugd->scan_btn =
+ elm_toolbar_item_append(control_bar, NULL, _("IDS_WFD_BUTTON_SCAN"),
+ _scan_btn_cb, (void *) ugd);
+ elm_object_item_disabled_set(ugd->scan_btn, !ugd->wfd_onoff);
+
+ elm_object_item_part_content_set(navi_item, "controlbar", control_bar);
+
+ __FUNC_EXIT__;
+}
+
+void destroy_wfd_ug_view(void *data)
+{
+ __FUNC_ENTER__;
+
+ struct ug_data *ugd = (struct ug_data *) data;
+
+ if (ugd->genlist)
+ {
+ evas_object_del(ugd->genlist);
+ ugd->genlist = NULL;
+ }
+
+ if (ugd->naviframe)
+ {
+ evas_object_del(ugd->naviframe);
+ ugd->naviframe = NULL;
+ }
+
+ __FUNC_EXIT__;
+}
+
+void wfd_ug_view_refresh_glitem(void *obj)
+{
+ __FUNC_ENTER__;
+ elm_genlist_item_update(obj);
+ __FUNC_EXIT__;
+}
+
+void wfd_ug_view_refresh_button(void *obj, int enable)
+{
+ __FUNC_ENTER__;
+ DBG(LOG_VERBOSE, "scan button is enabling. [%d]\n", enable);
+ elm_object_item_disabled_set(obj, !enable);
+ __FUNC_EXIT__;
+}
+
+void wfd_ug_view_update_peers(void *data)
+{
+ __FUNC_ENTER__;
+ struct ug_data *ugd = (struct ug_data *) data;
+ int i;
+
+ DBG(LOG_VERBOSE, "peer count [%d], peer instance [%x]\n", ugd->peer_cnt,
+ ugd->peers);
+
+ if (ugd->peer_cnt == 0)
+ {
+ DBG(LOG_ERROR, "There are No peers\n");
+ if (ugd->noitem == NULL)
+ ugd->noitem =
+ elm_genlist_item_append(ugd->genlist, &noitem_itc, (void *) ugd,
+ NULL, ELM_GENLIST_ITEM_NONE, NULL,
+ NULL);
+ return;
+ }
+ else if (ugd->peer_cnt > 0)
+ {
+ if (ugd->noitem)
+ {
+ elm_object_item_del(ugd->noitem);
+ ugd->noitem = NULL;
+ DBG(LOG_VERBOSE, "Noitem list is removed\n");
+ }
+
+ for (i = 0; i < ugd->peer_cnt; i++)
+ {
+ DBG(LOG_VERBOSE, "%dth peer being added on genlist\n", i);
+ ugd->peers[i].gl_item =
+ elm_genlist_item_append(ugd->genlist, &peer_itc,
+ (void *) &(ugd->peers[i]), NULL,
+ ELM_GENLIST_ITEM_NONE, _gl_peer_sel,
+ (void *) &(ugd->peers[i]));
+ }
+ }
+
+ __FUNC_EXIT__;
+}
+
+void wfd_ug_view_free_peers(void *data)
+{
+ __FUNC_ENTER__;
+ struct ug_data *ugd = (struct ug_data *) data;
+ int i;
+
+ for (i = 0; i < ugd->peer_cnt; i++)
+ {
+ DBG(LOG_VERBOSE, "%dth peer is deleted\n", i);
+ elm_object_item_del(ugd->peers[i].gl_item);
+ }
+
+ if (ugd->peer_cnt > 0 && ugd->peers != NULL)
+ {
+ DBG(LOG_VERBOSE, "peers will be destroyed\n");
+ free(ugd->peers);
+ ugd->peers = NULL;
+ ugd->peer_cnt = 0;
+ }
+
+ __FUNC_EXIT__;
+}
+
+static void _wfd_ug_act_popup_wifi_ok_cb(void *data, Evas_Object * obj,
+ void *event_info)
+{
+ __FUNC_ENTER__;
+ struct ug_data *ugd = (struct ug_data *) data;
+
+ ugd->wfd_status = WFD_LINK_STATUS_DEACTIVATED;
+ wfd_wifi_off();
+
+ evas_object_del(ugd->act_popup);
+ ugd->act_popup = NULL;
+ __FUNC_EXIT__;
+}
+
+static void _wfd_ug_act_popup_wifi_cancel_cb(void *data, Evas_Object * obj,
+ void *event_info)
+{
+ __FUNC_ENTER__;
+ struct ug_data *ugd = (struct ug_data *) data;
+
+ ugd->head_text_mode = HEAD_TEXT_TYPE_DIRECT;
+ wfd_ug_view_refresh_glitem(ugd->head);
+
+ evas_object_del(ugd->act_popup);
+ ugd->act_popup = NULL;
+ __FUNC_EXIT__;
+}
+
+void wfd_ug_act_popup(void *data, const char *message, int popup_type)
+{
+ __FUNC_ENTER__;
+ struct ug_data *ugd = (struct ug_data *) data;
+ Evas_Object *popup = NULL;
+ Evas_Object *btn1 = NULL, *btn2 = NULL;
+
+ popup = elm_popup_add(ugd->base);
+ evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_object_text_set(popup, message);
+
+ btn1 = elm_button_add(popup);
+ elm_object_text_set(btn1, S_("IDS_COM_SK_YES"));
+ elm_object_part_content_set(popup, "button1", btn1);
+ evas_object_smart_callback_add(btn1, "clicked",
+ _wfd_ug_act_popup_wifi_ok_cb, (void *) ugd);
+
+ btn2 = elm_button_add(popup);
+ elm_object_text_set(btn2, S_("IDS_COM_SK_NO"));
+ elm_object_part_content_set(popup, "button2", btn2);
+ evas_object_smart_callback_add(btn2, "clicked",
+ _wfd_ug_act_popup_wifi_cancel_cb,
+ (void *) ugd);
+
+ evas_object_show(popup);
+ ugd->act_popup = popup;
+ __FUNC_EXIT__;
+}
+
+void wfg_ug_act_popup_remove(void *data)
+{
+ __FUNC_ENTER__;
+ struct ug_data *ugd = (struct ug_data *) data;
+
+ if (ugd->act_popup)
+ {
+ evas_object_del(ugd->act_popup);
+ ugd->act_popup = NULL;
+ }
+ __FUNC_EXIT__;
+}
+
+static void _wfd_ug_terminate_popup_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ __FUNC_ENTER__;
+ struct ug_data *ugd = (struct ug_data*) data;
+
+ evas_object_del(ugd->warn_popup);
+ ugd->warn_popup = NULL;
+
+ wfd_ug_view_free_peers(ugd);
+
+ ug_destroy_me(ugd->ug);
+ __FUNC_EXIT__;
+}
+
+static void _wfd_ug_warn_popup_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ __FUNC_ENTER__;
+ struct ug_data *ugd = (struct ug_data*) data;
+
+ evas_object_del(ugd->warn_popup);
+ ugd->warn_popup = NULL;
+ __FUNC_EXIT__;
+}
+
+void wfd_ug_warn_popup(void *data, const char *message, int popup_type)
+{
+ __FUNC_ENTER__;
+ struct ug_data *ugd = (struct ug_data *) data;
+ Evas_Object *popup = NULL;
+ Evas_Object *btn = NULL;
+
+ popup = elm_popup_add(ugd->base);
+ evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_object_text_set(popup, message);
+
+ btn = elm_button_add(popup);
+ elm_object_text_set(btn, S_("IDS_COM_SK_OK"));
+ elm_object_part_content_set(popup, "button1", btn);
+ if(popup_type == POPUP_TYPE_TERMINATE)
+ evas_object_smart_callback_add(btn, "clicked", _wfd_ug_terminate_popup_cb, (void*) ugd);
+ else
+ evas_object_smart_callback_add(btn, "clicked", _wfd_ug_warn_popup_cb, (void*) ugd);
+
+ evas_object_show(popup);
+ ugd->warn_popup = popup;
+ __FUNC_EXIT__;
+}
+
+void wfg_ug_warn_popup_remove(void *data)
+{
+ __FUNC_ENTER__;
+ struct ug_data *ugd = (struct ug_data *) data;
+
+ if (ugd->warn_popup)
+ {
+ evas_object_del(ugd->warn_popup);
+ ugd->warn_popup = NULL;
+ }
+ __FUNC_EXIT__;
+}