summaryrefslogtreecommitdiff
path: root/popup-wifidirect
diff options
context:
space:
mode:
Diffstat (limited to 'popup-wifidirect')
-rw-r--r--popup-wifidirect/CMakeLists.txt41
-rw-r--r--popup-wifidirect/include/wfd-app-strings.h67
-rw-r--r--popup-wifidirect/include/wfd-app-util.h72
-rw-r--r--popup-wifidirect/include/wfd-app.h119
-rw-r--r--popup-wifidirect/org.tizen.wifi-direct-popup.desktop.in8
-rw-r--r--popup-wifidirect/po/CMakeLists.txt24
-rw-r--r--popup-wifidirect/po/POTFILES.in2
-rw-r--r--popup-wifidirect/po/en.po30
-rw-r--r--popup-wifidirect/po/en_GB.po30
-rw-r--r--popup-wifidirect/po/en_US.po30
-rw-r--r--popup-wifidirect/po/ja.po30
-rw-r--r--popup-wifidirect/po/ko_KR.po29
-rw-r--r--popup-wifidirect/po/ug-wifi-qdirect.pot324
-rwxr-xr-xpopup-wifidirect/po/update-po.sh60
-rw-r--r--popup-wifidirect/po/zh_CN.po30
-rw-r--r--popup-wifidirect/src/wfd-app-client.c426
-rw-r--r--popup-wifidirect/src/wfd-app-main.c189
-rw-r--r--popup-wifidirect/src/wfd-app-popup-view.c682
-rw-r--r--popup-wifidirect/src/wfd-app-util.c65
19 files changed, 2258 insertions, 0 deletions
diff --git a/popup-wifidirect/CMakeLists.txt b/popup-wifidirect/CMakeLists.txt
new file mode 100644
index 0000000..b2fbb9e
--- /dev/null
+++ b/popup-wifidirect/CMakeLists.txt
@@ -0,0 +1,41 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(wifi-direct-popup C)
+SET(PACKAGE_NAME org.tizen.wifi-direct-popup)
+
+SET(PREFIX /opt/apps/${PACKAGE_NAME})
+SET(BINDIR "${PREFIX}/bin")
+SET(RESDIR "${PREFIX}/res")
+SET(LOCALEDIR "${RESDIR}/locale")
+SET(EDJDIR "${RESDIR}/edje")
+
+SET(SRCS
+ src/wfd-app-main.c
+ src/wfd-app-client.c
+ src/wfd-app-util.c
+ src/wfd-app-popup-view.c
+)
+
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)
+
+
+SET(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} -DVITA_FEATURE")
+SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
+SET(CMAKE_C_FLAGS_RELEASE "-O2")
+
+IF("${ARCH}" STREQUAL "arm")
+ ADD_DEFINITIONS("-DTARGET")
+ MESSAGE("add -DTARGET")
+ENDIF("${ARCH}" STREQUAL "arm")
+
+ADD_DEFINITIONS("-DPREFIX=\"${PREFIX}\"")
+ADD_DEFINITIONS("-DRESDIR=\"${RESDIR}\"")
+
+ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS})
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS})
+
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${BINDIR})
+
+CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${PACKAGE_NAME}.desktop.in ${CMAKE_BINARY_DIR}/${PACKAGE_NAME}.desktop)
+INSTALL(FILES ${CMAKE_BINARY_DIR}/${PACKAGE_NAME}.desktop DESTINATION /opt/share/applications)
+
+ADD_SUBDIRECTORY(po)
diff --git a/popup-wifidirect/include/wfd-app-strings.h b/popup-wifidirect/include/wfd-app-strings.h
new file mode 100644
index 0000000..e58a799
--- /dev/null
+++ b/popup-wifidirect/include/wfd-app-strings.h
@@ -0,0 +1,67 @@
+/*
+ * 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 strings for wifi direct popup application.
+ *
+ * @file wfd-app-strings.h
+ * @author Sungsik Jang (sungsik.jang@samsung.com)
+ * @version 0.1
+ */
+
+#ifndef __WFD_APP_STRING_H__
+#define __WFD_APP_STRING_H__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#define WFD_STR_HEADER _("WiFi Direct")
+#define WFD_STR_HEADER_CONNECTED _("WiFi Direct connected")
+#define WFD_STR_HEADER_DEACTIVATING _("Deactivating WiFi Direct...")
+#define WFD_STR_HEADER_CANCEL_CONNECT _("Canceling connection...")
+#define WFD_STR_HEADER_DEFAULT _("Wi-Fi")
+#define WFD_STR_BUTN_YES _("Yes")
+#define WFD_STR_BUTN_NO _("No")
+#define WFD_STR_BTN_OK _("OK")
+#define WFD_STR_BTN_CLOSE _("Close")
+#define WFD_STR_BTN_CANCEL _("Cancel")
+
+#define WFD_STR_POP_APRV_CONNECT4 "Connect with %s in %d sec?"
+#define WFD_STR_POP_ENTER_PIN "Enter PIN"
+#define WFD_STR_POP_INVALID_PIN "PIN is not valid."
+
+
+#define WFD_STR_POP_PROG_CONNECT _("Connecting...")
+#define WFD_STR_POP_PROG_CONNECT_WITH_PIN "Connecting...<br>"\
+ "PIN:"
+
+#define WFD_STR_POP_PROG_CANCEL _("Canceling...")
+#define WFD_STR_POP_NOTI_CONNECTED _("Connected")
+#define WFD_STR_POP_NOTI_DISCONNECTED _("Disconnected")
+#define WFD_STR_POP_FAIL_CONNECT "An error has occurred during<br>"\
+ "connecting"
+#define WFD_STR_POP_FAIL_TIMEOUT "Connection timeout"
+
+#define WFD_STR_TITLE_MAIN _("WiFi Direct")
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __WFD_APP_STRING_H__ */
diff --git a/popup-wifidirect/include/wfd-app-util.h b/popup-wifidirect/include/wfd-app-util.h
new file mode 100644
index 0000000..40c0084
--- /dev/null
+++ b/popup-wifidirect/include/wfd-app-util.h
@@ -0,0 +1,72 @@
+/*
+ * 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 wifi direct application util functions.
+ *
+ * @file wfd-app-util.h
+ * @author Sungsik Jang (sungsik.jang@samsung.com)
+ * @version 0.1
+ */
+
+
+#ifndef __WFD_APP_UTIL_H__
+#define __WFD_APP_UTIL_H__
+
+
+#define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
+#define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x"
+
+#ifdef VITA_FEATURE
+#include <dlog.h>
+
+#define WIFI_DIRECT_APP_MID "wfd-app"
+
+#define WFD_APP_LOG_LOW LOG_VERBOSE
+#define WFD_APP_LOG_HIGH LOG_INFO
+#define WFD_APP_LOG_ERROR LOG_ERROR
+#define WFD_APP_LOG_WARN LOG_WARN
+#define WFD_APP_LOG_ASSERT LOG_FATAL
+#define WFD_APP_LOG_EXCEPTION LOG_FATAL
+
+char *wfd_app_trim_path(const char *filewithpath);
+int wfd_app_gettid();
+
+#define WFD_APP_LOG(log_level, format, args...) \
+ LOG(log_level, WIFI_DIRECT_APP_MID, "[%s:%04d,%d] " format, wfd_app_trim_path(__FILE__), __LINE__,wfd_app_gettid(),##args)
+#define __WFD_APP_FUNC_ENTER__ LOG(LOG_VERBOSE, WIFI_DIRECT_APP_MID, "[%s:%04d,%d] Enter: %s()\n", wfd_app_trim_path(__FILE__), __LINE__,wfd_app_gettid(),__func__)
+#define __WFD_APP_FUNC_EXIT__ LOG(LOG_VERBOSE, WIFI_DIRECT_APP_MID, "[%s:%04d,%d] Quit: %s()\n", wfd_app_trim_path(__FILE__), __LINE__,wfd_app_gettid(),__func__)
+
+#else /** _DLOG_UTIL */
+
+#define WFD_APP_LOG(log_level, format, args...) printf("[%s:%04d,%d] " format, wfd_app_trim_path(__FILE__), __LINE__,wfd_app_gettid(), ##args)
+#define __WFD_APP_FUNC_ENTER__ printf("[%s:%04d,%d] Entering: %s()\n", wfd_app_trim_path(__FILE__), __LINE__,wfd_app_gettid(),__func__)
+#define __WFD_APP_FUNC_EXIT__ printf("[%s:%04d,%d] Quit: %s()\n", wfd_app_trim_path(__FILE__), __LINE__,wfd_app_gettid(),__func__)
+
+#endif /** _USE_DLOG_UTIL */
+
+
+
+#define assertm_if(expr, fmt, arg...) do { \
+ if(expr) { \
+ WFD_APP_LOG(WFD_APP_LOG_ASSERT, " ##(%s) -> %s() assert!!## "fmt, #expr, __FUNCTION__, ##arg); \
+ exit(1); \
+ } \
+} while (0)
+
+
+
+#endif /* __WFD_APP_UTIL_H__ */
diff --git a/popup-wifidirect/include/wfd-app.h b/popup-wifidirect/include/wfd-app.h
new file mode 100644
index 0000000..1299a05
--- /dev/null
+++ b/popup-wifidirect/include/wfd-app.h
@@ -0,0 +1,119 @@
+/*
+ * 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 wifi direct popup application functions.
+ *
+ * @file wfd-app.h
+ * @author Sungsik Jang (sungsik.jang@samsung.com)
+ * @version 0.1
+ */
+
+
+#ifndef __WFD_SYS_POPAPP_MAIN_H__
+#define __WFD_SYS_POPAPP_MAIN_H__
+
+#include <appcore-efl.h>
+#include <Ecore_X.h>
+#include <Elementary.h>
+#include <appsvc.h>
+#include <aul.h>
+
+#define PACKAGE "wifi-direct-popup"
+#define EDJ_NAME RESDIR"/edje/wifi-direct-popup.edj"
+#define LOCALEDIR "/opt/apps/org.tizen.wifi-direct-popup/res/locale"
+#define WFD_POP_STR_MAX_LEN 128
+
+enum
+{
+ WFD_POP_TIMER_3 = 3,
+ WFD_POP_TIMER_10 = 10,
+ WFD_POP_TIMER_30 = 30,
+ WFD_POP_TIMER_120 = 120,
+};
+
+enum
+{
+ WFD_POP_APRV_CONNECTION_WPS_PUSHBUTTON_REQ,
+ WFD_POP_APRV_CONNECTION_WPS_DISPLAY_REQ,
+ WFD_POP_APRV_CONNECTION_WPS_KEYPAD_REQ,
+
+ WFD_POP_PROG_CONNECT,
+ WFD_POP_PROG_DISCONNECT,
+ WFD_POP_PROG_CONNECT_CANCEL,
+ WFD_POP_PROG_CONNECT_WITH_PIN,
+ WFD_POP_PROG_CONNECT_WITH_KEYPAD,
+ WFD_POP_NOTI_CONNECTED,
+ WFD_POP_NOTI_DISCONNECTED,
+
+ WFD_POP_FAIL_INIT,
+ WFD_POP_FAIL_CONNECT,
+ WFD_POP_INCORRECT_PIN,
+
+};
+
+enum
+{
+ WFD_POP_RESP_OK,
+ WFD_POP_RESP_CANCEL,
+ WFD_POP_RESP_APRV_CONNECT_PBC_YES = 1,
+ WFD_POP_RESP_APRV_CONNECT_DISPLAY_YES,
+ WFD_POP_RESP_APRV_CONNECT_KEYPAD_YES,
+ WFD_POP_RESP_APRV_CONNECT_NO,
+ WFD_POP_RESP_PROG_CONNECT_CANCEL,
+ WFD_POP_RESP_PROG_CONNECT_KEYPAD_OK,
+ WFD_POP_RESP_APRV_ENTER_PIN_YES,
+ WFD_POP_RESP_APRV_ENTER_PIN_NO,
+};
+
+typedef struct
+{
+ int type;
+ char text[WFD_POP_STR_MAX_LEN];
+ char label1[WFD_POP_STR_MAX_LEN];
+ char label2[WFD_POP_STR_MAX_LEN];
+ int timeout;
+ int resp_data1;
+ int resp_data2;
+ int data;
+} wfd_popup_t;
+
+typedef struct
+{
+ char ssid[32];
+ char mac_address[18];
+} wfd_device_info_t;
+
+typedef struct
+{
+ Evas_Object *win;
+ Evas_Object *popup;
+ Evas_Object *pin_entry;
+ wfd_popup_t *popup_data;
+ uint popup_timeout_handle;
+ char pin_number[32];
+ char peer_mac[18];
+ char peer_name[32];
+ wfd_device_info_t *discovered_peers;
+ int discovered_peer_count;
+} wfd_appdata_t;
+
+
+extern wfd_appdata_t *wfd_get_appdata();
+extern void wfd_destroy_popup();
+extern void wfd_prepare_popup(int type, void *userdata);
+
+#endif /* __WFD_SYS_POPAPP_MAIN_H__ */
diff --git a/popup-wifidirect/org.tizen.wifi-direct-popup.desktop.in b/popup-wifidirect/org.tizen.wifi-direct-popup.desktop.in
new file mode 100644
index 0000000..3ccbdd1
--- /dev/null
+++ b/popup-wifidirect/org.tizen.wifi-direct-popup.desktop.in
@@ -0,0 +1,8 @@
+Name=org.tizen.wifi-direct-popup
+Type=Application
+Exec=/opt/apps/org.tizen.wifi-direct-popup/bin/wifi-direct-popup
+Icon=NULL
+Comment=WiFi Direct UI Application
+nodisplay=TRUE
+X-Tizen-TaskManage=False
+X-Tizen-Removable=False
diff --git a/popup-wifidirect/po/CMakeLists.txt b/popup-wifidirect/po/CMakeLists.txt
new file mode 100644
index 0000000..18bb472
--- /dev/null
+++ b/popup-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/apps/org.tizen.wifi-direct-popup/res/locale/${lang}/LC_MESSAGES RENAME ${PROJECT_NAME}.mo)
+ SET(moFiles ${moFiles} ${moFile})
+ENDFOREACH(pofile)
+
+MESSAGE(".mo files: ${moFiles}")
+ADD_CUSTOM_TARGET(pop_po ALL DEPENDS ${moFiles})
diff --git a/popup-wifidirect/po/POTFILES.in b/popup-wifidirect/po/POTFILES.in
new file mode 100644
index 0000000..6e6a4b0
--- /dev/null
+++ b/popup-wifidirect/po/POTFILES.in
@@ -0,0 +1,2 @@
+# List of source files containing translatable strings.
+wifi_direct_strings.h
diff --git a/popup-wifidirect/po/en.po b/popup-wifidirect/po/en.po
new file mode 100644
index 0000000..f36f9ac
--- /dev/null
+++ b/popup-wifidirect/po/en.po
@@ -0,0 +1,30 @@
+msgid "IDS_WFD_HEADER_WIFI_DIRECT"
+msgstr "Wi-Fi Direct"
+
+msgid "IDS_WFD_POP_CONNECT_WITH_PIN_Q"
+msgstr "Connect with %s?<br>PIN:%s"
+
+msgid "IDS_WFD_POP_CONNECT_Q"
+msgstr "Connect with %s?"
+
+msgid "IDS_WFD_POP_ENTER_PIN"
+msgstr "Enter PIN"
+
+msgid "IDS_WFD_POP_PIN_INVALID"
+msgstr "PIN is not valid"
+
+msgid "IDS_WFD_POP_CONNECTING"
+msgstr "Connecting..."
+
+msgid "IDS_WFD_POP_CONNECTING_WITH_PIN"
+msgstr "Connecting...<br>PIN:%s"
+
+msgid "IDS_WFD_POP_CANCELING"
+msgstr "Canceling..."
+
+msgid "IDS_WFD_POP_CONNECTED"
+msgstr "Connected"
+
+msgid "IDS_WFD_POP_ERROR_OCCURRED"
+msgstr "An error has occurred during connecting"
+
diff --git a/popup-wifidirect/po/en_GB.po b/popup-wifidirect/po/en_GB.po
new file mode 100644
index 0000000..f36f9ac
--- /dev/null
+++ b/popup-wifidirect/po/en_GB.po
@@ -0,0 +1,30 @@
+msgid "IDS_WFD_HEADER_WIFI_DIRECT"
+msgstr "Wi-Fi Direct"
+
+msgid "IDS_WFD_POP_CONNECT_WITH_PIN_Q"
+msgstr "Connect with %s?<br>PIN:%s"
+
+msgid "IDS_WFD_POP_CONNECT_Q"
+msgstr "Connect with %s?"
+
+msgid "IDS_WFD_POP_ENTER_PIN"
+msgstr "Enter PIN"
+
+msgid "IDS_WFD_POP_PIN_INVALID"
+msgstr "PIN is not valid"
+
+msgid "IDS_WFD_POP_CONNECTING"
+msgstr "Connecting..."
+
+msgid "IDS_WFD_POP_CONNECTING_WITH_PIN"
+msgstr "Connecting...<br>PIN:%s"
+
+msgid "IDS_WFD_POP_CANCELING"
+msgstr "Canceling..."
+
+msgid "IDS_WFD_POP_CONNECTED"
+msgstr "Connected"
+
+msgid "IDS_WFD_POP_ERROR_OCCURRED"
+msgstr "An error has occurred during connecting"
+
diff --git a/popup-wifidirect/po/en_US.po b/popup-wifidirect/po/en_US.po
new file mode 100644
index 0000000..f36f9ac
--- /dev/null
+++ b/popup-wifidirect/po/en_US.po
@@ -0,0 +1,30 @@
+msgid "IDS_WFD_HEADER_WIFI_DIRECT"
+msgstr "Wi-Fi Direct"
+
+msgid "IDS_WFD_POP_CONNECT_WITH_PIN_Q"
+msgstr "Connect with %s?<br>PIN:%s"
+
+msgid "IDS_WFD_POP_CONNECT_Q"
+msgstr "Connect with %s?"
+
+msgid "IDS_WFD_POP_ENTER_PIN"
+msgstr "Enter PIN"
+
+msgid "IDS_WFD_POP_PIN_INVALID"
+msgstr "PIN is not valid"
+
+msgid "IDS_WFD_POP_CONNECTING"
+msgstr "Connecting..."
+
+msgid "IDS_WFD_POP_CONNECTING_WITH_PIN"
+msgstr "Connecting...<br>PIN:%s"
+
+msgid "IDS_WFD_POP_CANCELING"
+msgstr "Canceling..."
+
+msgid "IDS_WFD_POP_CONNECTED"
+msgstr "Connected"
+
+msgid "IDS_WFD_POP_ERROR_OCCURRED"
+msgstr "An error has occurred during connecting"
+
diff --git a/popup-wifidirect/po/ja.po b/popup-wifidirect/po/ja.po
new file mode 100644
index 0000000..f36f9ac
--- /dev/null
+++ b/popup-wifidirect/po/ja.po
@@ -0,0 +1,30 @@
+msgid "IDS_WFD_HEADER_WIFI_DIRECT"
+msgstr "Wi-Fi Direct"
+
+msgid "IDS_WFD_POP_CONNECT_WITH_PIN_Q"
+msgstr "Connect with %s?<br>PIN:%s"
+
+msgid "IDS_WFD_POP_CONNECT_Q"
+msgstr "Connect with %s?"
+
+msgid "IDS_WFD_POP_ENTER_PIN"
+msgstr "Enter PIN"
+
+msgid "IDS_WFD_POP_PIN_INVALID"
+msgstr "PIN is not valid"
+
+msgid "IDS_WFD_POP_CONNECTING"
+msgstr "Connecting..."
+
+msgid "IDS_WFD_POP_CONNECTING_WITH_PIN"
+msgstr "Connecting...<br>PIN:%s"
+
+msgid "IDS_WFD_POP_CANCELING"
+msgstr "Canceling..."
+
+msgid "IDS_WFD_POP_CONNECTED"
+msgstr "Connected"
+
+msgid "IDS_WFD_POP_ERROR_OCCURRED"
+msgstr "An error has occurred during connecting"
+
diff --git a/popup-wifidirect/po/ko_KR.po b/popup-wifidirect/po/ko_KR.po
new file mode 100644
index 0000000..eef280e
--- /dev/null
+++ b/popup-wifidirect/po/ko_KR.po
@@ -0,0 +1,29 @@
+msgid "IDS_WFD_HEADER_WIFI_DIRECT"
+msgstr "와이파이 다이렉트"
+
+msgid "IDS_WFD_POP_CONNECT_WITH_PIN_Q"
+msgstr "%s와 연결하시겠습니까?<br>PIN:%s"
+
+msgid "IDS_WFD_POP_CONNECT_Q"
+msgstr "%s와 연결하시겠습니까?"
+
+msgid "IDS_WFD_POP_ENTER_PIN"
+msgstr "PIN 입력"
+
+msgid "IDS_WFD_POP_PIN_INVALID"
+msgstr "유효하지 않은 PIN입니다."
+
+msgid "IDS_WFD_POP_CONNECTING"
+msgstr "연결 중..."
+
+msgid "IDS_WFD_POP_CONNECTING_WITH_PIN"
+msgstr "연결 중...<br>PIN:"
+
+msgid "IDS_WFD_POP_CANCELING"
+msgstr "취소 중..."
+
+msgid "IDS_WFD_POP_CONNECTED"
+msgstr "연결되었습니다."
+
+msgid "IDS_WFD_POP_ERROR_OCCURRED"
+msgstr "연결중에 오류가 발생하였습니다."
diff --git a/popup-wifidirect/po/ug-wifi-qdirect.pot b/popup-wifidirect/po/ug-wifi-qdirect.pot
new file mode 100644
index 0000000..4ca8881
--- /dev/null
+++ b/popup-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/popup-wifidirect/po/update-po.sh b/popup-wifidirect/po/update-po.sh
new file mode 100755
index 0000000..06d3c38
--- /dev/null
+++ b/popup-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/popup-wifidirect/po/zh_CN.po b/popup-wifidirect/po/zh_CN.po
new file mode 100644
index 0000000..f36f9ac
--- /dev/null
+++ b/popup-wifidirect/po/zh_CN.po
@@ -0,0 +1,30 @@
+msgid "IDS_WFD_HEADER_WIFI_DIRECT"
+msgstr "Wi-Fi Direct"
+
+msgid "IDS_WFD_POP_CONNECT_WITH_PIN_Q"
+msgstr "Connect with %s?<br>PIN:%s"
+
+msgid "IDS_WFD_POP_CONNECT_Q"
+msgstr "Connect with %s?"
+
+msgid "IDS_WFD_POP_ENTER_PIN"
+msgstr "Enter PIN"
+
+msgid "IDS_WFD_POP_PIN_INVALID"
+msgstr "PIN is not valid"
+
+msgid "IDS_WFD_POP_CONNECTING"
+msgstr "Connecting..."
+
+msgid "IDS_WFD_POP_CONNECTING_WITH_PIN"
+msgstr "Connecting...<br>PIN:%s"
+
+msgid "IDS_WFD_POP_CANCELING"
+msgstr "Canceling..."
+
+msgid "IDS_WFD_POP_CONNECTED"
+msgstr "Connected"
+
+msgid "IDS_WFD_POP_ERROR_OCCURRED"
+msgstr "An error has occurred during connecting"
+
diff --git a/popup-wifidirect/src/wfd-app-client.c b/popup-wifidirect/src/wfd-app-client.c
new file mode 100644
index 0000000..a4c9c98
--- /dev/null
+++ b/popup-wifidirect/src/wfd-app-client.c
@@ -0,0 +1,426 @@
+/*
+ * 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 wifi direct application client functions.
+ *
+ * @file wfd-app-client.c
+ * @author Sungsik Jang (sungsik.jang@samsung.com)
+ * @version 0.1
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include "wifi-direct.h"
+#include "wfd-app.h"
+#include "wfd-app-util.h"
+
+
+void _cb_activation(int error_code, wifi_direct_device_state_e device_state,
+ void *user_data)
+{
+ __WFD_APP_FUNC_ENTER__;
+
+ wfd_appdata_t *ad = (wfd_appdata_t *) user_data;
+
+ switch (device_state)
+ {
+ case WIFI_DIRECT_DEVICE_STATE_ACTIVATED:
+ WFD_APP_LOG(WFD_APP_LOG_LOW,
+ "event ------------------ WIFI_DIRECT_DEVICE_STATE_ACTIVATED\n");
+ break;
+
+ case WIFI_DIRECT_DEVICE_STATE_DEACTIVATED:
+ WFD_APP_LOG(WFD_APP_LOG_LOW,
+ "event ------------------ WIFI_DIRECT_DEVICE_STATE_DEACTIVATED\n");
+ WFD_APP_LOG(WFD_APP_LOG_LOW,
+ "Termination process of wifi-direct popup begins...\n");
+ elm_exit();
+ break;
+
+ default:
+ break;
+ }
+
+ __WFD_APP_FUNC_EXIT__;
+
+}
+
+
+static wfd_device_info_t *_wfd_app_find_peer_by_mac_address(void *data,
+ const char *mac_address)
+{
+ __WFD_APP_FUNC_ENTER__;
+
+ wfd_appdata_t *ad = (wfd_appdata_t *) data;
+
+ int i;
+
+ if (ad == NULL)
+ {
+ WFD_APP_LOG(WFD_APP_LOG_LOW, "Incorrect parameter(NULL)\n");
+ return NULL;
+ }
+
+ WFD_APP_LOG(WFD_APP_LOG_LOW, "find peer by MAC [%s] \n", mac_address);
+
+ for (i = 0; i < ad->discovered_peer_count; i++)
+ {
+ WFD_APP_LOG(WFD_APP_LOG_LOW, "check %dth peer\n", i);
+
+ if (!strncmp(mac_address, (const char *) ad->discovered_peers[i].mac_address, 18))
+ {
+ WFD_APP_LOG(WFD_APP_LOG_LOW, "found peer. [%d]\n", i);
+ __WFD_APP_FUNC_EXIT__;
+ return &ad->discovered_peers[i];
+ }
+ }
+
+ __WFD_APP_FUNC_EXIT__;
+
+ return NULL;
+}
+
+
+bool _wfd_app_discoverd_peer_cb(wifi_direct_discovered_peer_info_s * peer,
+ void *user_data)
+{
+ __WFD_APP_FUNC_ENTER__;
+
+ wfd_appdata_t *ad = (wfd_appdata_t *) user_data;
+
+ if (NULL != peer->ssid)
+ {
+ WFD_APP_LOG(WFD_APP_LOG_LOW, "discovered peer ssid[%s]\n", peer->ssid);
+ strncpy(ad->discovered_peers[ad->discovered_peer_count].ssid, peer->ssid, 32);
+ }
+ else
+ {
+ WFD_APP_LOG(WFD_APP_LOG_LOW, "peer's ssid is NULL\n");
+ }
+
+ if (NULL != peer->mac_address)
+ {
+ WFD_APP_LOG(WFD_APP_LOG_LOW, "discovered peer mac[%s]\n", peer->mac_address);
+ strncpy(ad->discovered_peers[ad->discovered_peer_count].mac_address, peer->mac_address, 18);
+ }
+ else
+ {
+ WFD_APP_LOG(WFD_APP_LOG_LOW, "peer's mac is NULL\n");
+ }
+
+ ad->discovered_peer_count++;
+
+ __WFD_APP_FUNC_EXIT__;
+
+ return TRUE;
+
+}
+
+
+void _cb_discover(int error_code, wifi_direct_discovery_state_e discovery_state,
+ void *user_data)
+{
+ __WFD_APP_FUNC_ENTER__;
+
+ wfd_appdata_t *ad = (wfd_appdata_t *) user_data;
+ int ret;
+
+ switch (discovery_state)
+ {
+ case WIFI_DIRECT_DISCOVERY_STARTED:
+ {
+ WFD_APP_LOG(WFD_APP_LOG_LOW, "event ------------------ WIFI_DIRECT_DISCOVERY_STARTED\n");
+ }
+ break;
+
+ case WIFI_DIRECT_ONLY_LISTEN_STARTED:
+ {
+ WFD_APP_LOG(WFD_APP_LOG_LOW, "event ------------------ WIFI_DIRECT_ONLY_LISTEN_STARTED\n");
+ }
+ break;
+
+ case WIFI_DIRECT_DISCOVERY_FINISHED:
+ {
+ WFD_APP_LOG(WFD_APP_LOG_LOW, "event ------------------ WIFI_DIRECT_DISCOVERY_FINISHED\n");
+ }
+ break;
+
+ case WIFI_DIRECT_DISCOVERY_FOUND:
+ {
+ WFD_APP_LOG(WFD_APP_LOG_LOW, "event ------------------ WIFI_DIRECT_DISCOVERY_FOUND\n");
+
+ if (NULL != ad->discovered_peers)
+ free(ad->discovered_peers);
+
+ ad->discovered_peers = calloc(10, sizeof(wfd_device_info_t));
+ ad->discovered_peer_count = 0;
+
+ ret = wifi_direct_foreach_discovered_peers(_wfd_app_discoverd_peer_cb, (void *) ad);
+ if (ret != WIFI_DIRECT_ERROR_NONE)
+ WFD_APP_LOG(WFD_APP_LOG_LOW, "get discovery result failed: %d\n", ret);
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ __WFD_APP_FUNC_EXIT__;
+
+}
+
+void _cb_connection(int error_code,
+ wifi_direct_connection_state_e connection_state,
+ const char *mac_address, void *user_data)
+{
+ __WFD_APP_FUNC_ENTER__;
+
+ wfd_appdata_t *ad = (wfd_appdata_t *) user_data;
+ int result;
+
+ switch (connection_state)
+ {
+ case WIFI_DIRECT_CONNECTION_RSP:
+ {
+ WFD_APP_LOG(WFD_APP_LOG_LOW,
+ "event ------------------ WIFI_DIRECT_CONNECTION_RSP\n");
+
+ if (error_code == WIFI_DIRECT_ERROR_NONE)
+ {
+ WFD_APP_LOG(WFD_APP_LOG_LOW, "Link Complete!\n");
+ wfd_prepare_popup(WFD_POP_NOTI_CONNECTED, NULL);
+ }
+ else
+ {
+ if (error_code == WIFI_DIRECT_ERROR_CONNECTION_TIME_OUT)
+ WFD_APP_LOG(WFD_APP_LOG_LOW,
+ "Error Code - WIFI_DIRECT_ERROR_CONNECTION_TIME_OUT\n");
+ else if (error_code == WIFI_DIRECT_ERROR_AUTH_FAILED)
+ WFD_APP_LOG(WFD_APP_LOG_LOW,
+ "Error Code - WIFI_DIRECT_ERROR_AUTH_FAILED\n");
+ else if (error_code == WIFI_DIRECT_ERROR_CONNECTION_FAILED)
+ WFD_APP_LOG(WFD_APP_LOG_LOW,
+ "Error Code - WIFI_DIRECT_ERROR_CONNECTION_FAILED\n");
+
+ wfd_prepare_popup(WFD_POP_FAIL_CONNECT, NULL);
+
+ result = wifi_direct_start_discovery(FALSE, 0);
+ WFD_APP_LOG(WFD_APP_LOG_LOW,
+ "wifi_direct_start_discovery() result=[%d]\n",
+ result);
+ }
+ }
+ break;
+
+ case WIFI_DIRECT_CONNECTION_WPS_REQ:
+ {
+ wifi_direct_config_data_s *config = NULL;
+
+ memcpy(ad->peer_mac, mac_address, sizeof(ad->peer_mac));
+
+ WFD_APP_LOG(WFD_APP_LOG_LOW,
+ "event ------------------ WIFI_DIRECT_CONNECTION_WPS_REQ\n");
+ result = wifi_direct_get_config_data(&config);
+ WFD_APP_LOG(WFD_APP_LOG_LOW,
+ "wifi_direct_client_get_config_data() result=[%d]\n",
+ result);
+
+ if (config->wps_config == WIFI_DIRECT_WPS_PUSHBUTTON)
+ {
+ WFD_APP_LOG(WFD_APP_LOG_LOW,
+ "wps_config is WFD_WPS_PUSHBUTTON. Ignore it..\n");
+ }
+ else if (config->wps_config == WIFI_DIRECT_WPS_KEYPAD)
+ {
+ WFD_APP_LOG(WFD_APP_LOG_LOW, "wps_config is WFD_WPS_KEYPAD\n");
+
+ result = wifi_direct_generate_wps_pin();
+ WFD_APP_LOG(WFD_APP_LOG_LOW,
+ "wifi_direct_client_generate_wps_pin() result=[%d]\n",
+ result);
+
+ char *pin_number = NULL;
+ result = wifi_direct_get_wps_pin(&pin_number);
+ WFD_APP_LOG(WFD_APP_LOG_LOW,
+ "wifi_direct_client_get_wps_pin() result=[%d]. pin=[%s]\n",
+ result, ad->pin_number);
+
+ strncpy(ad->pin_number, pin_number, 32);
+
+ result = wifi_direct_accept_connection(ad->peer_mac);
+ WFD_APP_LOG(WFD_APP_LOG_LOW,
+ "wifi_direct_accept_connection[%s] result=[%d].\n",
+ ad->peer_mac, result);
+
+ result = wifi_direct_activate_pushbutton();
+ wfd_prepare_popup(WFD_POP_PROG_CONNECT_WITH_PIN, NULL);
+
+ if (pin_number != NULL)
+ free(pin_number);
+ }
+ else if (config->wps_config == WIFI_DIRECT_WPS_DISPLAY)
+ {
+ WFD_APP_LOG(WFD_APP_LOG_LOW, "wps_config is WFD_WPS_DISPLAY\n");
+ wfd_prepare_popup(WFD_POP_PROG_CONNECT_WITH_KEYPAD,
+ (void *) NULL);
+ }
+ else
+ {
+ WFD_APP_LOG(WFD_APP_LOG_LOW, "wps_config is unkown!\n");
+
+ }
+ if (config != NULL)
+ free(config);
+ }
+ break;
+
+ case WIFI_DIRECT_CONNECTION_REQ:
+ {
+ WFD_APP_LOG(WFD_APP_LOG_LOW, "event ------------------ WIFI_DIRECT_CONNECTION_REQ\n");
+
+ wifi_direct_config_data_s *config = NULL;
+ wfd_device_info_t *peer_info = NULL;
+
+ if (NULL == mac_address)
+ {
+ WFD_APP_LOG(WFD_APP_LOG_LOW, "ERROR : incomming_peer_mac is NULL !!\n");
+ return;
+ }
+
+ WFD_APP_LOG(WFD_APP_LOG_LOW, "Connection Request from MAC[%s]\n", mac_address);
+ strncpy(ad->peer_mac, mac_address, strlen(mac_address));
+
+ peer_info = _wfd_app_find_peer_by_mac_address(ad, mac_address);
+
+ if (NULL != peer_info->ssid)
+ {
+ WFD_APP_LOG(WFD_APP_LOG_LOW, "Connection Request from SSID[%s]\n", peer_info->ssid);
+ strncpy(ad->peer_name, peer_info->ssid, strlen(peer_info->ssid));
+ }
+ else
+ {
+ WFD_APP_LOG(WFD_APP_LOG_LOW, "incomming_peer SSID is NULL !!\n");
+ }
+
+ if (ad->peer_name == NULL || strlen(ad->peer_name) == 0)
+ strncpy(ad->peer_name, ad->peer_mac, strlen(ad->peer_mac));
+
+ result = wifi_direct_get_config_data(&config);
+ WFD_APP_LOG(WFD_APP_LOG_LOW, "wifi_direct_client_get_config_data() result=[%d]\n", result);
+
+ if (config->wps_config == WIFI_DIRECT_WPS_PUSHBUTTON)
+ {
+ char pushbutton;
+ WFD_APP_LOG(WFD_APP_LOG_LOW, "wps_config is WFD_WPS_PUSHBUTTON\n");
+
+ wfd_prepare_popup(WFD_POP_APRV_CONNECTION_WPS_PUSHBUTTON_REQ, NULL);
+ }
+ else if (config->wps_config == WIFI_DIRECT_WPS_DISPLAY)
+ {
+ WFD_APP_LOG(WFD_APP_LOG_LOW, "wps_config is WFD_WPS_DISPLAY\n");
+
+ result = wifi_direct_generate_wps_pin();
+ WFD_APP_LOG(WFD_APP_LOG_LOW, "wifi_direct_client_generate_wps_pin() result=[%d]\n", result);
+
+ char *pin_number = NULL;
+ result = wifi_direct_get_wps_pin(&pin_number);
+ WFD_APP_LOG(WFD_APP_LOG_LOW, "wifi_direct_get_wps_pin() result=[%d]\n", result);
+
+ strncpy(ad->pin_number, pin_number, 32);
+
+ wfd_prepare_popup(WFD_POP_APRV_CONNECTION_WPS_DISPLAY_REQ, NULL);
+
+ if (pin_number != NULL)
+ free(pin_number);
+ }
+ else if (config->wps_config == WIFI_DIRECT_WPS_KEYPAD)
+ {
+ WFD_APP_LOG(WFD_APP_LOG_LOW, "wps_config is WFD_WPS_KEYPAD\n");
+ wfd_prepare_popup(WFD_POP_APRV_CONNECTION_WPS_KEYPAD_REQ, (void *) NULL);
+ }
+ else
+ {
+ WFD_APP_LOG(WFD_APP_LOG_LOW, "wps_config is unkown!\n");
+ }
+
+ if (config != NULL)
+ free(config);
+ }
+ break;
+
+ case WIFI_DIRECT_DISCONNECTION_IND:
+ {
+ WFD_APP_LOG(WFD_APP_LOG_LOW,
+ "event ------------------ WIFI_DIRECT_DISCONNECTION_IND\n");
+ }
+ break;
+
+ case WIFI_DIRECT_DISCONNECTION_RSP:
+ {
+ wfd_destroy_popup();
+
+ result = wifi_direct_start_discovery(FALSE, 0);
+ WFD_APP_LOG(WFD_APP_LOG_LOW,
+ "wifi_direct_start_discovery() result=[%d]\n", result);
+ }
+ break;
+
+ default:
+ break;
+
+ }
+
+ __WFD_APP_FUNC_EXIT__;
+}
+
+
+int init_wfd_popup_client(wfd_appdata_t * ad)
+{
+ __WFD_APP_FUNC_ENTER__;
+ int ret;
+
+ ret = wifi_direct_initialize();
+
+ ret = wifi_direct_set_device_state_changed_cb(_cb_activation, (void *) ad);
+ ret = wifi_direct_set_discovery_state_changed_cb(_cb_discover, (void *) ad);
+ ret =
+ wifi_direct_set_connection_state_changed_cb(_cb_connection,
+ (void *) ad);
+
+ __WFD_APP_FUNC_EXIT__;
+
+ if (ret)
+ return TRUE;
+ else
+ return FALSE;
+}
+
+int deinit_wfd_popup_client(void)
+{
+ __WFD_APP_FUNC_ENTER__;
+
+ int ret;
+
+ ret = wifi_direct_deinitialize();
+
+ __WFD_APP_FUNC_EXIT__;
+
+ if (ret)
+ return TRUE;
+ else
+ return FALSE;
+}
diff --git a/popup-wifidirect/src/wfd-app-main.c b/popup-wifidirect/src/wfd-app-main.c
new file mode 100644
index 0000000..33ecc2a
--- /dev/null
+++ b/popup-wifidirect/src/wfd-app-main.c
@@ -0,0 +1,189 @@
+/*
+ * 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 wifi direct application main functions.
+ *
+ * @file wfd-app-main.c
+ * @author Sungsik Jang (sungsik.jang@samsung.com)
+ * @version 0.1
+ */
+
+#include <libintl.h>
+
+#include "wfd-app.h"
+#include "wfd-app-util.h"
+
+wfd_appdata_t *g_wfd_ad;
+
+
+wfd_appdata_t *wfd_get_appdata()
+{
+ return g_wfd_ad;
+}
+
+static void _win_del(void *data, Evas_Object * obj, void *event)
+{
+ elm_exit();
+}
+
+static Evas_Object *_create_win(Evas_Object * parent, const char *name)
+{
+ Evas_Object *eo;
+ int w, h;
+
+ eo = elm_win_add(parent, name, ELM_WIN_BASIC);
+ if (eo)
+ {
+ elm_win_title_set(eo, name);
+ elm_win_borderless_set(eo, EINA_TRUE);
+ elm_win_alpha_set(eo, EINA_TRUE);
+ evas_object_smart_callback_add(eo, "delete,request", _win_del, NULL);
+ ecore_x_window_size_get(ecore_x_window_root_first_get(), &w, &h);
+ evas_object_resize(eo, w, h);
+ evas_object_raise(eo);
+ }
+
+ return eo;
+}
+
+
+static int _app_create(void *data)
+{
+ __WFD_APP_FUNC_ENTER__;
+
+ wfd_appdata_t *ad = wfd_get_appdata();
+
+ if (data == NULL)
+ {
+ WFD_APP_LOG(WFD_APP_LOG_LOW, "Incorrect parameter\n");
+ return -1;
+ }
+
+ bindtextdomain(PACKAGE, LOCALEDIR);
+
+ ad->popup_data = (wfd_popup_t *) malloc(sizeof(wfd_popup_t));
+ if (!ad->popup_data)
+ {
+ WFD_APP_LOG(WFD_APP_LOG_ERROR, "malloc failed\n");
+ return -1;
+ }
+ memset(ad->popup_data, 0x0, sizeof(wfd_popup_t));
+
+ ad->win = _create_win(NULL, PACKAGE);
+ elm_win_indicator_mode_set(ad->win, ELM_WIN_INDICATOR_SHOW);
+
+ int r;
+
+ if (!ecore_x_display_get())
+ return -1;
+
+ r = appcore_set_i18n(PACKAGE, NULL);
+ if (r != 0)
+ {
+ WFD_APP_LOG(WFD_APP_LOG_LOW, "appcore_set_i18n error\n");
+ return -1;
+ }
+
+ if (init_wfd_popup_client(ad) == FALSE)
+ {
+ WFD_APP_LOG(WFD_APP_LOG_ERROR, "init_wfd_popup_client error\n");
+ wfd_prepare_popup(WFD_POP_FAIL_INIT, NULL);
+ }
+
+ __WFD_APP_FUNC_EXIT__;
+
+ return 0;
+}
+
+static int _app_terminate(void *data)
+{
+ __WFD_APP_FUNC_ENTER__;
+
+ if (data == NULL)
+ {
+ WFD_APP_LOG(WFD_APP_LOG_ERROR, "Incorrect parameter\n");
+ return -1;
+ }
+
+ wfd_appdata_t *ad = (wfd_appdata_t *) data;
+
+ if (deinit_wfd_popup_client() == FALSE)
+ {
+ WFD_APP_LOG(WFD_APP_LOG_ERROR, "deinit_wfd_popup_client error\n");
+ }
+ else
+ {
+ if (ad->popup)
+ {
+ evas_object_del(ad->popup);
+ ad->popup = NULL;
+ }
+ if (ad->win)
+ {
+ evas_object_del(ad->win);
+ ad->win = NULL;
+ }
+ if (ad->discovered_peers)
+ {
+ free(ad->discovered_peers);
+ ad->discovered_peers = NULL;
+ }
+ }
+
+ __WFD_APP_FUNC_EXIT__;
+
+ return 0;
+}
+
+static int _app_pause(void *data)
+{
+ __WFD_APP_FUNC_ENTER__;
+ __WFD_APP_FUNC_EXIT__;
+ return 0;
+}
+
+static int _app_resume(void *data)
+{
+ __WFD_APP_FUNC_ENTER__;
+ __WFD_APP_FUNC_EXIT__;
+ return 0;
+}
+
+static int _app_reset(bundle * b, void *data)
+{
+ __WFD_APP_FUNC_ENTER__;
+ __WFD_APP_FUNC_EXIT__;
+ return 0;
+}
+
+int main(int argc, char *argv[])
+{
+ wfd_appdata_t ad;
+ struct appcore_ops ops = {
+ .create = _app_create,
+ .terminate = _app_terminate,
+ .pause = _app_pause,
+ .resume = _app_resume,
+ .reset = _app_reset,
+ };
+
+ memset(&ad, 0x0, sizeof(wfd_appdata_t));
+ ops.data = &ad;
+ g_wfd_ad = &ad;
+
+ return appcore_efl_main(PACKAGE, &argc, &argv, &ops);
+}
diff --git a/popup-wifidirect/src/wfd-app-popup-view.c b/popup-wifidirect/src/wfd-app-popup-view.c
new file mode 100644
index 0000000..a0cc286
--- /dev/null
+++ b/popup-wifidirect/src/wfd-app-popup-view.c
@@ -0,0 +1,682 @@
+/*
+ * 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 wifi direct system popup view functions.
+ *
+ * @file wfd-app-popup-view.c
+ * @author Sungsik Jang (sungsik.jang@samsung.com)
+ * @version 0.1
+ */
+
+#include <libintl.h>
+#include <glib.h>
+
+#include "wifi-direct.h"
+#include "wfd-app.h"
+#include "wfd-app-strings.h"
+#include "wfd-app-util.h"
+
+extern wfd_appdata_t *g_wfd_ad;
+extern wfd_popup_t *g_wfd_pop;
+extern unsigned char g_wfd_peer_mac[6];
+extern unsigned char g_wfd_peer_name[32];
+
+static void __popup_resp_cb(void *data, Evas_Object * obj, void *event_info)
+{
+ __WFD_APP_FUNC_ENTER__;
+
+ wfd_appdata_t *ad = wfd_get_appdata();
+ int result = -1;
+ int resp = (int) data;
+ Evas_Object *btn = obj;
+
+ WFD_APP_LOG(WFD_APP_LOG_HIGH, "popup resp : %d\n", resp);
+
+ switch (resp)
+ {
+ case WFD_POP_RESP_APRV_CONNECT_PBC_YES:
+ {
+ WFD_APP_LOG(WFD_APP_LOG_HIGH,
+ "WFD_POP_RESP_APRV_CONNECT_PBC_YES\n");
+
+ result = wifi_direct_accept_connection(ad->peer_mac);
+ WFD_APP_LOG(WFD_APP_LOG_LOW,
+ "wifi_direct_accept_connection() result=[%d]\n",
+ result);
+ if (result == WIFI_DIRECT_ERROR_NONE)
+ {
+ wfd_prepare_popup(WFD_POP_PROG_CONNECT, NULL);
+ }
+ else
+ {
+ WFD_APP_LOG(WFD_APP_LOG_ERROR,
+ "wifi_direct_accept_connection() FAILED!!\n");
+ evas_object_hide(ad->win);
+ }
+ }
+ break;
+
+ case WFD_POP_RESP_APRV_CONNECT_DISPLAY_YES:
+ {
+ WFD_APP_LOG(WFD_APP_LOG_HIGH,
+ "WFD_POP_RESP_APRV_CONNECT_DISPLAY_YES\n");
+
+ result = wifi_direct_accept_connection(ad->peer_mac);
+ WFD_APP_LOG(WFD_APP_LOG_LOW,
+ "wifi_direct_accept_connection() result=[%d]\n",
+ result);
+ if (result == WIFI_DIRECT_ERROR_NONE)
+ {
+ wfd_prepare_popup(WFD_POP_PROG_CONNECT_WITH_PIN,
+ ad->pin_number);
+ }
+ else
+ {
+ WFD_APP_LOG(WFD_APP_LOG_ERROR,
+ "wifi_direct_client_send_connect_request() FAILED!!\n");
+ evas_object_hide(ad->win);
+ }
+ }
+ break;
+
+ case WFD_POP_RESP_PROG_CONNECT_KEYPAD_OK:
+ case WFD_POP_RESP_APRV_CONNECT_KEYPAD_YES:
+ {
+ WFD_APP_LOG(WFD_APP_LOG_HIGH,
+ "WFD_POP_RESP_APRV_CONNECT_KEYPAD_YES\n");
+
+ int len = strlen(ad->pin_number);
+ WFD_APP_LOG(WFD_APP_LOG_LOW, "button ok: pin [%s]", ad->pin_number);
+
+ if (len > 7 && len < 64)
+ {
+ int result = 0;
+ WFD_APP_LOG(WFD_APP_LOG_LOW, "pin=[%s]\n", ad->pin_number);
+
+ result = wifi_direct_set_wps_pin(ad->pin_number);
+
+ if (result != WIFI_DIRECT_ERROR_NONE)
+ {
+ wfd_prepare_popup(WFD_POP_FAIL_CONNECT, NULL);
+ return;
+ }
+
+ result = wifi_direct_activate_pushbutton();
+ result = wifi_direct_accept_connection(ad->peer_mac);
+ WFD_APP_LOG(WFD_APP_LOG_LOW,
+ "wifi_direct_accept_connection(%s) result=[%d]\n",
+ ad->peer_mac, result);
+ if (result == WIFI_DIRECT_ERROR_NONE)
+ {
+ wfd_prepare_popup(WFD_POP_PROG_CONNECT_WITH_PIN,
+ ad->pin_number);
+ }
+ else
+ {
+ WFD_APP_LOG(WFD_APP_LOG_ERROR,
+ "wifi_direct_accept_connection() FAILED!!\n");
+ evas_object_hide(ad->win);
+ }
+ }
+ else
+ {
+ WFD_APP_LOG(WFD_APP_LOG_ERROR, "Error, Incorrect PIN!!\n");
+ wfd_prepare_popup(WFD_POP_INCORRECT_PIN, NULL);
+ return;
+ }
+ }
+ break;
+
+ case WFD_POP_RESP_APRV_CONNECT_NO:
+ {
+ WFD_APP_LOG(WFD_APP_LOG_HIGH,
+ "WFD_POP_RESP_APRV_CONNECT_NO: destroy_popup...\n");
+
+ wfd_destroy_popup();
+ }
+ break;
+
+ case WFD_POP_RESP_PROG_CONNECT_CANCEL:
+ {
+ WFD_APP_LOG(WFD_APP_LOG_HIGH, "WFD_POP_RESP_PROG_CONNECT_CANCEL\n");
+ result = wifi_direct_disconnect(ad->peer_mac);
+ WFD_APP_LOG(WFD_APP_LOG_LOW,
+ "wifi_direct_disconnect[%s] result=[%d]\n",
+ ad->peer_mac, result);
+
+ if (result == WIFI_DIRECT_ERROR_NONE)
+ {
+ wfd_prepare_popup(WFD_POP_PROG_CONNECT_CANCEL, NULL);
+ }
+ else
+ {
+ WFD_APP_LOG(WFD_APP_LOG_ERROR,
+ "wifi_direct_disconnect() FAILED!!\n");
+ wfd_prepare_popup(WFD_POP_FAIL_CONNECT, NULL);
+ }
+ }
+ break;
+
+ default:
+ {
+ WFD_APP_LOG(WFD_APP_LOG_ERROR, "Unknown respone\n");
+ evas_object_hide(ad->win);
+ }
+ break;
+ }
+
+ __WFD_APP_FUNC_EXIT__;
+}
+
+static Evas_Object *__create_progress_layout(Evas_Object * parent,
+ const char *text)
+{
+ __WFD_APP_FUNC_ENTER__;
+
+ if (parent == NULL || text == NULL)
+ {
+ WFD_APP_LOG(WFD_APP_LOG_ERROR, "param is NULL\n");
+ return NULL;
+ }
+
+ Evas_Object *progressbar = NULL, *layout = NULL;
+ Evas_Object *label = NULL;
+ int w = 0, h = 0;
+
+ layout = elm_layout_add(parent);
+ if (layout == NULL)
+ {
+ WFD_APP_LOG(WFD_APP_LOG_ERROR, "layout is NULL\n");
+ return NULL;
+ }
+
+ elm_layout_file_set(layout, EDJ_NAME, "progress_popup");
+ evas_object_size_hint_weight_set(layout,
+ EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+
+ progressbar = elm_progressbar_add(layout);
+ if (progressbar == NULL)
+ {
+ WFD_APP_LOG(WFD_APP_LOG_ERROR, "progressbar is NULL\n");
+ evas_object_del(layout);
+ return NULL;
+ }
+ elm_object_style_set(progressbar, "list_process");
+ evas_object_size_hint_align_set(progressbar, EVAS_HINT_FILL, 0.5);
+ evas_object_size_hint_weight_set(progressbar,
+ EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_object_part_content_set(layout, "popup_pb", progressbar);
+ elm_progressbar_pulse(progressbar, EINA_TRUE);
+
+ label = elm_label_add(layout);
+ if (label == NULL)
+ {
+ WFD_APP_LOG(WFD_APP_LOG_ERROR, "label is NULL\n");
+ evas_object_del(layout);
+ evas_object_del(progressbar);
+ return NULL;
+ }
+ elm_object_style_set(label, "popup_description/default");
+ elm_object_part_content_set(layout, "popup_progress_text", label);
+ edje_object_part_geometry_get(layout, "popup_progress_text", NULL, NULL, &w,
+ &h);
+ elm_label_line_wrap_set(label, ELM_WRAP_WORD);
+ elm_label_wrap_width_set(label, w);
+ elm_object_text_set(label, text);
+
+ evas_object_show(layout);
+
+ __WFD_APP_FUNC_EXIT__;
+
+ return layout;
+}
+
+
+void wfd_destroy_popup()
+{
+ __WFD_APP_FUNC_ENTER__;
+
+ wfd_appdata_t *ad = wfd_get_appdata();
+
+ if (ad == NULL)
+ {
+ WFD_APP_LOG(WFD_APP_LOG_ERROR, "ad is NULL\n");
+ return;
+ }
+
+ if (ad->popup)
+ {
+ //evas_object_smart_callback_del(ad->popup, "response", __popup_resp_cb);
+ evas_object_del(ad->popup);
+ ad->popup = NULL;
+ }
+
+ if (ad->popup_timeout_handle > 0)
+ {
+ g_source_remove(ad->popup_timeout_handle);
+ ad->popup_timeout_handle = 0;
+ }
+
+ evas_object_hide(ad->win);
+
+ __WFD_APP_FUNC_EXIT__;
+ return;
+}
+
+static Evas_Object *wfd_draw_pop_type_a(Evas_Object * win, wfd_popup_t * pop)
+{
+ __WFD_APP_FUNC_ENTER__;
+
+ Evas_Object *popup;
+
+ popup = elm_popup_add(win);
+ evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_object_text_set(popup, pop->text);
+ elm_popup_timeout_set(popup, pop->timeout);
+ evas_object_show(popup);
+ evas_object_show(win);
+
+ __WFD_APP_FUNC_EXIT__;
+ return popup;
+}
+
+static Evas_Object *wfd_draw_pop_type_b(Evas_Object * win, wfd_popup_t * pop)
+{
+ __WFD_APP_FUNC_ENTER__;
+
+ Evas_Object *popup = NULL;
+ Evas_Object *btn = NULL;
+
+ popup = elm_popup_add(win);
+ evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_object_text_set(popup, pop->text);
+
+ btn = elm_button_add(popup);
+ elm_object_text_set(btn, pop->label1);
+ elm_object_part_content_set(popup, "button1", btn);
+ evas_object_smart_callback_add(btn, "clicked", __popup_resp_cb,
+ (void *) pop->resp_data1);
+
+ evas_object_show(popup);
+ evas_object_show(win);
+
+ __WFD_APP_FUNC_EXIT__;
+ return popup;
+}
+
+static Evas_Object *wfd_draw_pop_type_c(Evas_Object * win, wfd_popup_t * pop)
+{
+ __WFD_APP_FUNC_ENTER__;
+
+ Evas_Object *popup = NULL;
+ Evas_Object *btn1 = NULL, *btn2 = NULL;
+
+ popup = elm_popup_add(win);
+ evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_object_text_set(popup, pop->text);
+
+ btn1 = elm_button_add(popup);
+ elm_object_text_set(btn1, pop->label1);
+ elm_object_part_content_set(popup, "button1", btn1);
+ evas_object_smart_callback_add(btn1, "clicked", __popup_resp_cb,
+ (void *) pop->resp_data1);
+
+ btn2 = elm_button_add(popup);
+ elm_object_text_set(btn2, pop->label2);
+ elm_object_part_content_set(popup, "button2", btn2);
+ evas_object_smart_callback_add(btn2, "clicked", __popup_resp_cb,
+ (void *) pop->resp_data2);
+
+ evas_object_show(popup);
+ evas_object_show(win);
+
+ __WFD_APP_FUNC_EXIT__;
+ return popup;
+}
+
+static Evas_Object *wfd_draw_pop_type_d(Evas_Object * win, wfd_popup_t * pop)
+{
+ __WFD_APP_FUNC_ENTER__;
+
+ Evas_Object *popup;
+ Evas_Object *layout;
+
+ popup = elm_popup_add(win);
+ evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_object_style_set(popup, "customstyle");
+ layout = __create_progress_layout(popup, pop->text);
+ elm_popup_timeout_set(popup, pop->timeout);
+ elm_object_content_set(popup, layout);
+ evas_object_show(popup);
+ evas_object_show(win);
+
+ __WFD_APP_FUNC_EXIT__;
+ return popup;
+}
+
+static void __popup_block_clicked_cb(void *data, Evas_Object * obj,
+ void *event_info)
+{
+ wfd_appdata_t *ad = wfd_get_appdata();
+ wfd_popup_t *pop = NULL;
+
+ if (ad != NULL)
+ pop = ad->popup;
+
+ if (ad->win != NULL)
+ evas_object_hide(ad->win);
+
+ if (ad->popup_timeout_handle > 0)
+ {
+ g_source_remove(ad->popup_timeout_handle);
+ ad->popup_timeout_handle = 0;
+ }
+}
+
+gboolean __popup_remove_timeout_cb(gpointer user_data)
+{
+ wfd_appdata_t *ad = wfd_get_appdata();
+ wfd_popup_t *pop = NULL;
+
+ if (ad != NULL)
+ pop = ad->popup;
+ else
+ return false;
+
+ if (pop != user_data)
+ return false;
+
+ if (ad->win != NULL)
+ evas_object_hide(ad->win);
+
+ ad->popup_timeout_handle = 0;
+ return false;
+}
+
+static Evas_Object *wfd_draw_pop_type_e(Evas_Object * win, wfd_popup_t * pop)
+{
+ __WFD_APP_FUNC_ENTER__;
+
+ wfd_appdata_t *ad = wfd_get_appdata();
+ Evas_Object *popup;
+
+ if (ad == NULL)
+ return NULL;
+
+ popup = elm_popup_add(win);
+ evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_object_text_set(popup, pop->text);
+ evas_object_smart_callback_add(popup, "block,clicked",
+ __popup_block_clicked_cb, NULL);
+ ad->popup_timeout_handle =
+ g_timeout_add(3000, __popup_remove_timeout_cb, popup);
+ evas_object_show(popup);
+ evas_object_show(win);
+
+ __WFD_APP_FUNC_EXIT__;
+ return popup;
+}
+
+
+static void _smart_ime_cb(void *data, Evas_Object * obj, void *event_info)
+{
+ __WFD_APP_FUNC_ENTER__;
+ wfd_appdata_t *ad = wfd_get_appdata();
+
+ Ecore_IMF_Context *imf_context = NULL;
+ imf_context = (Ecore_IMF_Context *) ad->pin_entry;
+
+ if (NULL == imf_context)
+ {
+ WFD_APP_LOG(WFD_APP_LOG_ERROR, "Error!!! Ecore_IMF_Context is NULL!!");
+ return;
+ }
+
+ const char *txt =
+ elm_entry_markup_to_utf8(elm_entry_entry_get
+ ((const Evas_Object *) imf_context));
+
+ if (NULL != txt)
+ {
+ WFD_APP_LOG(WFD_APP_LOG_LOW, "* text [%s], len=[%d]", txt, strlen(txt));
+ strncpy(ad->pin_number, txt, sizeof(ad->pin_number));
+ }
+ else
+ {
+ WFD_APP_LOG(WFD_APP_LOG_LOW, "Err!");
+ }
+
+ __WFD_APP_FUNC_EXIT__;
+}
+
+Evas_Object *wfd_draw_pop_type_keypad(Evas_Object * win, wfd_popup_t * pop)
+{
+ __WFD_APP_FUNC_ENTER__;
+ wfd_appdata_t *ad = wfd_get_appdata();
+
+ Evas_Object *conformant = NULL;
+ Evas_Object *layout = NULL;
+ Evas_Object *pinpopup = NULL;
+ Evas_Object *btn1 = NULL, *btn2 = NULL;
+
+ conformant = elm_conformant_add(win);
+ assertm_if(NULL == conformant, "conformant is NULL!!");
+ elm_win_conformant_set(win, EINA_TRUE);
+ elm_win_resize_object_add(win, conformant);
+ evas_object_size_hint_weight_set(conformant, EVAS_HINT_EXPAND,
+ EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(conformant, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(conformant);
+
+ pinpopup = NULL;
+ layout = elm_layout_add(conformant);
+ elm_object_content_set(conformant, layout);
+ pinpopup = elm_popup_add(layout);
+ assertm_if(NULL == pinpopup, "pinpopup is NULL!!");
+ elm_object_part_text_set(pinpopup, "title,text", pop->text);
+
+ Evas_Object *box = elm_box_add(pinpopup);
+ evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(box);
+
+ Evas_Object *editfield = elm_layout_add(box);
+ elm_layout_theme_set(editfield, "layout", "editfield", "default");
+ Evas_Object *editfield_entry = elm_layout_add(box);
+ elm_object_part_content_set(editfield, "elm.swallow.content",
+ editfield_entry);
+ elm_object_part_text_set(editfield, "elm.text", _("Enter PIN"));
+ elm_entry_single_line_set(editfield_entry, EINA_TRUE);
+ elm_entry_scrollable_set(editfield_entry, EINA_TRUE);
+ elm_object_signal_emit(editfield_entry, "elm,state,eraser,show", "elm");
+ evas_object_size_hint_weight_set(editfield, EVAS_HINT_EXPAND,
+ EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(editfield, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ ad->pin_entry = editfield_entry;
+ evas_object_smart_callback_add(ad->pin_entry, "changed", _smart_ime_cb,
+ NULL);
+ evas_object_show(editfield);
+ elm_box_pack_end(box, editfield);
+
+ elm_object_content_set(pinpopup, box);
+
+ btn1 = elm_button_add(pinpopup);
+ elm_object_text_set(pinpopup, pop->label1);
+ elm_object_part_content_set(pinpopup, "button1", btn1);
+ evas_object_smart_callback_add(btn1, "clicked", __popup_resp_cb,
+ (void *) pop->resp_data1);
+
+ btn2 = elm_button_add(pinpopup);
+ elm_object_text_set(btn2, pop->label2);
+ elm_object_part_content_set(pinpopup, "button2", btn2);
+ evas_object_smart_callback_add(btn1, "clicked", __popup_resp_cb,
+ (void *) pop->resp_data2);
+
+ evas_object_show(pinpopup);
+ evas_object_show(win);
+ elm_object_focus_set(ad->pin_entry, EINA_TRUE);
+
+ __WFD_APP_FUNC_EXIT__;
+
+ return pinpopup;
+}
+
+void wfd_prepare_popup(int type, void *userdata)
+{
+ __WFD_APP_FUNC_ENTER__;
+ wfd_appdata_t *ad = wfd_get_appdata();
+ wfd_popup_t *pop = ad->popup_data;
+
+ wfd_destroy_popup();
+
+ memset(pop, 0, sizeof(wfd_popup_t));
+
+ pop->type = type;
+
+ switch (pop->type)
+ {
+
+ case WFD_POP_APRV_CONNECTION_WPS_PUSHBUTTON_REQ:
+ {
+ snprintf(pop->text, sizeof(pop->text), _("IDS_WFD_POP_CONNECT_Q"),
+ ad->peer_name);
+ snprintf(pop->label1, sizeof(pop->label1), "%s",
+ dgettext("sys_string", "IDS_COM_SK_YES"));
+ snprintf(pop->label2, sizeof(pop->label2), "%s",
+ dgettext("sys_string", "IDS_COM_SK_NO"));
+ pop->resp_data1 = WFD_POP_RESP_APRV_CONNECT_PBC_YES;
+ pop->resp_data2 = WFD_POP_RESP_APRV_CONNECT_NO;
+
+ ad->popup = wfd_draw_pop_type_c(ad->win, pop);
+ }
+ break;
+
+ case WFD_POP_APRV_CONNECTION_WPS_DISPLAY_REQ:
+ {
+ char *pin = (char *) userdata;
+ snprintf(pop->text, sizeof(pop->text),
+ _("IDS_WFD_POP_CONNECT_WITH_PIN_Q"), ad->peer_name,
+ ad->pin_number);
+ snprintf(pop->label1, sizeof(pop->label1), "%s",
+ dgettext("sys_string", "IDS_COM_SK_YES"));
+ snprintf(pop->label2, sizeof(pop->label2), "%s",
+ dgettext("sys_string", "IDS_COM_SK_NO"));
+
+ pop->resp_data1 = WFD_POP_RESP_APRV_CONNECT_DISPLAY_YES;
+ pop->resp_data2 = WFD_POP_RESP_APRV_CONNECT_NO;
+
+ ad->popup = wfd_draw_pop_type_c(ad->win, pop);
+ }
+ break;
+
+ case WFD_POP_APRV_CONNECTION_WPS_KEYPAD_REQ:
+ {
+ char *pin = (char *) userdata;
+ snprintf(pop->text, sizeof(pop->text), _("IDS_WFD_POP_CONNECT_Q"),
+ ad->peer_name);
+ snprintf(pop->label1, sizeof(pop->label1), "%s",
+ dgettext("sys_string", "IDS_COM_SK_YES"));
+ snprintf(pop->label2, sizeof(pop->label2), "%s",
+ dgettext("sys_string", "IDS_COM_SK_NO"));
+ pop->resp_data1 = WFD_POP_RESP_APRV_CONNECT_KEYPAD_YES;
+ pop->resp_data2 = WFD_POP_RESP_APRV_CONNECT_NO;
+
+ ad->popup = wfd_draw_pop_type_keypad(ad->win, pop);
+ }
+ break;
+
+ case WFD_POP_PROG_CONNECT:
+ {
+ snprintf(pop->text, sizeof(pop->text), "%s",
+ _("IDS_WFD_POP_CONNECTING"));
+ snprintf(pop->label1, sizeof(pop->label1), "%s",
+ dgettext("sys_string", "IDS_COM_POP_CANCEL"));
+ pop->timeout = WFD_POP_TIMER_120;
+ pop->resp_data1 = WFD_POP_RESP_PROG_CONNECT_CANCEL;
+
+ ad->popup = wfd_draw_pop_type_b(ad->win, pop);
+ }
+ break;
+
+ case WFD_POP_PROG_CONNECT_WITH_KEYPAD:
+ {
+ snprintf(pop->text, sizeof(pop->text), "%s",
+ _("IDS_WFD_POP_ENTER_PIN"));
+ snprintf(pop->label1, sizeof(pop->label1), "%s",
+ dgettext("sys_string", "IDS_COM_SK_OK"));
+ snprintf(pop->label2, sizeof(pop->label2), "%s",
+ dgettext("sys_string", "IDS_COM_POP_CANCEL"));
+ pop->timeout = WFD_POP_TIMER_120;
+ pop->resp_data1 = WFD_POP_RESP_PROG_CONNECT_KEYPAD_OK;
+ pop->resp_data2 = WFD_POP_RESP_PROG_CONNECT_CANCEL;
+
+ ad->popup = wfd_draw_pop_type_keypad(ad->win, pop);
+ }
+ break;
+
+ case WFD_POP_PROG_CONNECT_WITH_PIN:
+ snprintf(pop->text, sizeof(pop->text), "%s %s",
+ _("IDS_WFD_POP_CONNECTING_WITH_PIN"), ad->pin_number);
+ snprintf(pop->label1, sizeof(pop->label1), "%s",
+ dgettext("sys_string", "IDS_COM_POP_CANCEL"));
+ pop->timeout = WFD_POP_TIMER_120;
+ pop->resp_data1 = WFD_POP_RESP_PROG_CONNECT_CANCEL;
+
+ ad->popup = wfd_draw_pop_type_c(ad->win, pop);
+ break;
+
+ case WFD_POP_PROG_CONNECT_CANCEL:
+ {
+ snprintf(pop->text, sizeof(pop->text), "%s",
+ dgettext("sys_string", "IDS_COM_POP_CANCEL"));
+ pop->timeout = WFD_POP_TIMER_120;
+ ad->popup = wfd_draw_pop_type_a(ad->win, pop);
+ }
+ break;
+
+ case WFD_POP_INCORRECT_PIN:
+ snprintf(pop->text, sizeof(pop->text), "%s",
+ _("IDS_WFD_POP_PIN_INVALID"));
+ snprintf(pop->label1, sizeof(pop->label1), "%s",
+ dgettext("sys_string", "IDS_COM_SK_OK"));
+ pop->timeout = WFD_POP_TIMER_3;
+ pop->resp_data1 = WFD_POP_RESP_OK;
+ break;
+
+ case WFD_POP_NOTI_CONNECTED:
+ snprintf(pop->text, sizeof(pop->text), "%s",
+ _("IDS_WFD_POP_CONNECTED"));
+ pop->timeout = WFD_POP_TIMER_3;
+
+ ad->popup = wfd_draw_pop_type_e(ad->win, pop);
+ break;
+
+ case WFD_POP_FAIL_CONNECT:
+ snprintf(pop->text, sizeof(pop->text), "%s",
+ _("IDS_WFD_POP_ERROR_OCCURRED"));
+ pop->timeout = WFD_POP_TIMER_3;
+
+ ad->popup = wfd_draw_pop_type_e(ad->win, pop);
+ break;
+
+ default:
+ break;
+ }
+
+ __WFD_APP_FUNC_EXIT__;
+ return;
+}
diff --git a/popup-wifidirect/src/wfd-app-util.c b/popup-wifidirect/src/wfd-app-util.c
new file mode 100644
index 0000000..592eabf
--- /dev/null
+++ b/popup-wifidirect/src/wfd-app-util.c
@@ -0,0 +1,65 @@
+/*
+ * 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 wifi direct application utils functions.
+ *
+ * @file wfd-app-util.c
+ * @author Sungsik Jang (sungsik.jang@samsung.com)
+ * @version 0.1
+ */
+
+
+#include <stdio.h>
+#include <string.h>
+#include "wfd-app-util.h"
+
+
+char *wfd_app_trim_path(const char *filewithpath)
+{
+ static char *filename[100];
+ char *strptr = NULL;
+ int start = 0;
+ const char *space = " ";
+ int len = strlen(filewithpath);
+
+ if (len > 20)
+ {
+ strptr = (char *) filewithpath + (len - 20);
+ start = 0;
+ }
+ else if (len < 20)
+ {
+ strptr = (char *) filewithpath;
+ start = 20 - len;
+ }
+ strncpy((char *) filename, space, strlen(space));
+ strncpy((char *) filename + start, strptr, 50);
+
+ return (char *) filename;
+}
+
+
+int wfd_app_gettid()
+{
+#ifdef __NR_gettid
+ return syscall(__NR_gettid);
+#else
+ fprintf(stderr,
+ "__NR_gettid is not defined, please include linux/unistd.h ");
+ return -1;
+#endif
+}