summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKim Kibum <kb0929.kim@samsung.com>2012-06-08 14:54:20 +0900
committerKim Kibum <kb0929.kim@samsung.com>2012-06-08 14:54:20 +0900
commitd78b6a702fb987794bfb8e272e58e423ae584300 (patch)
tree499ded173b92d92d374878c04d9c4b0c789c6d9c
parentfd9be1d338e467f59738b0e7b5a728928023973e (diff)
downloadug-wifi-direct-d78b6a702fb987794bfb8e272e58e423ae584300.tar.gz
ug-wifi-direct-d78b6a702fb987794bfb8e272e58e423ae584300.tar.bz2
ug-wifi-direct-d78b6a702fb987794bfb8e272e58e423ae584300.zip
apply FSL(Flora Software License)
-rw-r--r--AUTHORS3
-rw-r--r--CMakeLists.txt16
-rw-r--r--LICENSE77
-rw-r--r--NOTICE0
-rw-r--r--README1
-rw-r--r--debian/changelog9
-rw-r--r--debian/compat1
-rw-r--r--debian/control39
-rw-r--r--debian/copyright0
-rw-r--r--debian/dirs2
-rw-r--r--debian/libug-setting-wifidirect-efl.install.in4
-rw-r--r--debian/libug-setting-wifidirect-efl.postinst12
-rw-r--r--debian/org.tizen.wifi-direct-popup.install.in3
-rwxr-xr-xdebian/rules141
-rwxr-xr-xpackaging/ug-wifi-direct.spec88
-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
-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
63 files changed, 6132 insertions, 0 deletions
diff --git a/AUTHORS b/AUTHORS
new file mode 100644
index 0000000..d688359
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1,3 @@
+Dongwook Lee <dwmax.lee@samsung.com>
+Sungsik Jang <sungsik.jang@samsung.com>
+Gibyoung Kim <lastkgb.kim@samsung.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..0110117
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,16 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(pkgs REQUIRED appcore-efl appsvc ui-gadget x11 dlog
+ elementary ecore-x
+ network pmapi
+ wifi-direct
+ )
+
+FOREACH(flag ${pkgs_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+ADD_SUBDIRECTORY(popup-wifidirect)
+ADD_SUBDIRECTORY(ug-wifidirect)
+
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..bbc9fc3
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,77 @@
+Flora License
+
+Version 1.0, May, 2012
+
+http://www.tizenopensource.org/license
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
+
+"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
+
+"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
+
+"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
+
+"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
+
+"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
+
+"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
+
+"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
+
+"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
+
+"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
+
+"Tizen Certified Platform" shall mean a software platform that complies with the standards set forth in the Compatibility Definition Document and passes the Compatibility Test Suite as defined from time to time by the Tizen Technical Steering Group and certified by the Tizen Association or its designated agent.
+
+2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work solely as incorporated into a Tizen Certified Platform, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work solely as incorporated into a Tizen Certified Platform to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof pursuant to the copyright license above, in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
+
+ 1. You must give any other recipients of the Work or Derivative Works a copy of this License; and
+
+ 2. You must cause any modified files to carry prominent notices stating that You changed the files; and
+
+ 3. You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
+
+ 4. If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Flora License to your work
+
+To apply the Flora License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ 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.
+
+
diff --git a/NOTICE b/NOTICE
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/NOTICE
diff --git a/README b/README
new file mode 100644
index 0000000..a49435a
--- /dev/null
+++ b/README
@@ -0,0 +1 @@
+Wi-Fi Direct Setting UG
diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 0000000..2492f00
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,9 @@
+ug-setting-wifidirect-efl (0.4.2) unstable; urgency=low
+
+ * Connection error popup of WFD UG is removed
+ * Connection time limit string is removed
+ * Popup window type is changed as ELM_WIN_BASIC
+ * Git: slp/pkgs/u/ug-wifi-direct
+ * Tag: ug-setting-wifidirect-efl_0.4.2
+
+ -- Gibyoung Kim <lastkgb.kim@samsung.com> Thu, 19 Apr 2012 20:50:38 +0900
diff --git a/debian/compat b/debian/compat
new file mode 100644
index 0000000..7ed6ff8
--- /dev/null
+++ b/debian/compat
@@ -0,0 +1 @@
+5
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000..91b2bc8
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,39 @@
+Source: ug-setting-wifidirect-efl
+Section: net
+Priority: extra
+Maintainer: Dongwook Lee <dwmax.lee@samsung.com>, Gibyoung Kim <lastkgb.kim@samsung.com>
+Uploaders: Dongwook Lee <dwmax.lee@samsung.com>, Gibyoung Kim <lastkgb.kim@samsung.com>
+Build-Depends: debhelper (>= 5),
+ libappcore-efl-dev,
+ libappsvc-dev,
+ libelm-dev,
+ libslp-utilx-dev,
+ libui-gadget-dev,
+ libwifi-direct-dev,
+ libnetwork-dev,
+ libslp-pm-dev
+Standards-Version: 3.7.2
+
+Package: libug-setting-wifidirect-efl
+Section: net
+Architecture: any
+Depends: ${misc:Depends}, libappcore-efl-0, libslp-utilx-0, libui-gadget-0, libvconf-0, libwifi-direct, libnetwork-0
+Description: Wi-Fi Direct Setting application
+
+Package: libug-setting-wifidirect-efl-dbg
+Section: net-debug
+Architecture: any
+Depends: ${misc:Depends}, libug-setting-wifidirect-efl (= ${Source-Version})
+Description: Wi-Fi Direct Setting application -debug pkg (unstripped)
+
+Package: org.tizen.wifi-direct-popup
+Section: net
+Architecture: any
+Depends: libwifi-direct, ${misc:Depends}
+Description: WiFi Direct popup application pkg
+
+Package: org.tizen.wifi-direct-popup-dbg
+Section: net-debug
+Architecture: any
+Depends: org.tizen.wifi-direct-popup
+Description: WiFi Direct popup application Debug pkg
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/debian/copyright
diff --git a/debian/dirs b/debian/dirs
new file mode 100644
index 0000000..ca882bb
--- /dev/null
+++ b/debian/dirs
@@ -0,0 +1,2 @@
+usr/bin
+usr/sbin
diff --git a/debian/libug-setting-wifidirect-efl.install.in b/debian/libug-setting-wifidirect-efl.install.in
new file mode 100644
index 0000000..3e3982d
--- /dev/null
+++ b/debian/libug-setting-wifidirect-efl.install.in
@@ -0,0 +1,4 @@
+/opt/ug/lib/*
+/opt/ug/res/edje/*
+/opt/ug/res/images/*
+/opt/ug/res/locale/*
diff --git a/debian/libug-setting-wifidirect-efl.postinst b/debian/libug-setting-wifidirect-efl.postinst
new file mode 100644
index 0000000..ed6e4cf
--- /dev/null
+++ b/debian/libug-setting-wifidirect-efl.postinst
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+# Automatically added by dh_makeshlibs
+if [ ${USER} == "root" ]
+then
+ /usr/bin/vconftool set -t int db/wifi_direct/onoff 0 -u apps
+ /usr/bin/vconftool set -t int db/wifi_direct/connection_status 0 -u apps
+ /usr/bin/vconftool set -t string db/wifi_direct/id "" -u apps
+ /usr/bin/vconftool set -t string db/wifi_direct/password "" -u apps
+fi
+
+# End automatically added section
diff --git a/debian/org.tizen.wifi-direct-popup.install.in b/debian/org.tizen.wifi-direct-popup.install.in
new file mode 100644
index 0000000..f7097cd
--- /dev/null
+++ b/debian/org.tizen.wifi-direct-popup.install.in
@@ -0,0 +1,3 @@
+/opt/apps/org.tizen.wifi-direct-popup/bin/*
+/opt/apps/org.tizen.wifi-direct-popup/res/*
+/opt/share/applications/*
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..8153a00
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,141 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+# Sample debian/rules that uses debhelper.
+# This file was originally written by Joey Hess and Craig Small.
+# As a special exception, when this file is copied by dh-make into a
+# dh-make output file, you may use that output file without restriction.
+# This special exception was added by Craig Small in version 0.37 of dh-make.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+CFLAGS ?= -Wall -g
+LDFLAGS ?= -pie
+PREFIX ?= /opt/ug
+DATADIR ?= /opt
+
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+ CFLAGS += -O0
+else
+ CFLAGS += -O2
+endif
+
+LDFLAGS += -Wl,--rpath=/usr/lib -Wl,--hash-style=both -Wl,--as-needed
+
+
+configure: configure-stamp
+configure-stamp:
+ dh_testdir
+ # Add here commands to configure the package.
+ CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" cmake .
+ touch configure-stamp
+
+build: build-stamp
+build-stamp: configure-stamp
+ dh_testdir
+
+ # Add here commands to compile the package.
+ $(MAKE)
+
+ for f in `find $(CURDIR)/debian/ -name "*.in"`; do \
+ cat $$f > $${f%.in}; \
+ sed -i -e "s#@PREFIX@#$(PREFIX)#g" $${f%.in}; \
+ done
+
+clean:
+ dh_testdir
+ dh_testroot
+ rm -f build-stamp configure-stamp
+
+ # Add here commands to clean up after the build process.
+ -$(MAKE) clean
+
+ rm -rf CMakeCache.txt
+ rm -rf cmake_install.cmake
+ rm -rf Makefile
+ rm -rf install_manifest.txt
+ rm -rf CMakeFiles
+
+ rm -rf popup-wifidirect/CMakeCache.txt
+ rm -rf popup-wifidirect/CMakeFiles
+ rm -rf popup-wifidirect/cmake_install.cmake
+ rm -rf popup-wifidirect/Makefile
+ rm -rf popup-wifidirect/install_manifest.txt
+ rm -rf popup-wifidirect/*.so
+
+ rm -rf ug-wifidirect/CMakeCache.txt
+ rm -rf ug-wifidirect/CMakeFiles
+ rm -rf ug-wifidirect/cmake_install.cmake
+ rm -rf ug-wifidirect/Makefile
+ rm -rf ug-wifidirect/install_manifest.txt
+ rm -rf ug-wifidirect/*.so
+
+ rm -rf popup-wifidirect/po/CMakeCache.txt
+ rm -rf popup-wifidirect/po/CMakeFiles
+ rm -rf popup-wifidirect/po/cmake_install.cmake
+ rm -rf popup-wifidirect/po/Makefile
+ rm -rf popup-wifidirect/po/install_manifest.txt
+ rm -fr popup-wifidirect/po/*.mo
+
+ rm -rf ug-wifidirect/po/CMakeCache.txt
+ rm -rf ug-wifidirect/po/CMakeFiles
+ rm -rf ug-wifidirect/po/cmake_install.cmake
+ rm -rf ug-wifidirect/po/Makefile
+ rm -rf ug-wifidirect/po/install_manifest.txt
+ rm -fr ug-wifidirect/po/*.mo
+
+ rm -rf *.so
+ rm -rf *.desktop
+ rm -rf *.edj
+ rm -rf *.pc
+
+ rm -rf debian/*.install
+ rm -fr debian/temp
+
+ dh_clean
+
+dev_clean:
+ dh_testdir
+ dh_testroot
+ rm -f build-stamp configure-stamp
+
+ dh_clean
+
+install: build
+ dh_testdir
+ dh_testroot
+ dh_clean -k
+ dh_installdirs
+
+ # Add here commands to install the package into debian/tmp.
+ $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
+
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+ dh_testdir
+ dh_testroot
+ dh_installchangelogs
+ dh_installdocs
+ dh_installexamples
+ dh_install --sourcedir=debian/tmp
+ dh_installman
+ dh_link
+# dh_strip
+ dh_strip --dbg-package=libug-setting-wifidirect-efl-dbg
+ dh_compress
+ dh_fixperms
+# dh_perl
+ dh_makeshlibs
+ dh_installdeb
+# dh_shlibdeps
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install configure
diff --git a/packaging/ug-wifi-direct.spec b/packaging/ug-wifi-direct.spec
new file mode 100755
index 0000000..91f2085
--- /dev/null
+++ b/packaging/ug-wifi-direct.spec
@@ -0,0 +1,88 @@
+%define PREFIX /opt/ug
+
+Name: libug-setting-wifidirect-efl
+Summary: Wi-Fi Direct setting UI gadget
+Version: 0.4.2
+Release: 1
+Group: TO_BE_FILLED
+License: Flora Software License
+Source0: %{name}-%{version}.tar.gz
+Requires(post): /sbin/ldconfig
+Requires(post): /usr/bin/sqlite3
+Requires(postun): /sbin/ldconfig
+BuildRequires: cmake
+BuildRequires: edje-tools
+BuildRequires: gettext-tools
+BuildRequires: pkgconfig(dbus-glib-1)
+BuildRequires: pkgconfig(dlog)
+BuildRequires: pkgconfig(vconf)
+BuildRequires: pkgconfig(appcore-efl)
+BuildRequires: pkgconfig(ui-gadget)
+BuildRequires: pkgconfig(wifi-direct)
+BuildRequires: pkgconfig(network)
+BuildRequires: pkgconfig(utilX)
+BuildRequires: pkgconfig(elementary)
+BuildRequires: pkgconfig(edje)
+BuildRequires: pkgconfig(evas)
+BuildRequires: pkgconfig(ecore)
+BuildRequires: pkgconfig(ethumb)
+BuildRequires: pkgconfig(glib-2.0)
+BuildRequires: pkgconfig(efreet)
+BuildRequires: pkgconfig(dbus-1)
+BuildRequires: pkgconfig(dbus-glib-1)
+BuildRequires: pkgconfig(edbus)
+BuildRequires: pkgconfig(aul)
+BuildRequires: pkgconfig(devman)
+BuildRequires: pkgconfig(appsvc)
+BuildRequires: pkgconfig(pmapi)
+BuildRequires: pkgconfig(capi-appfw-application)
+BuildRequires: pkgconfig(capi-system-runtime-info)
+BuildRequires: pkgconfig(capi-system-device)
+
+BuildRequires: cmake
+BuildRequires: gettext-devel
+
+%define debug_package %{nil}
+
+%description
+wifi direct client library (Shared Library)
+
+
+%package -n org.tizen.wifi-direct-popup
+Summary: Wifi-Wirect system popup
+Requires: %{name} = %{version}-%{release}
+
+%description -n org.tizen.wifi-direct-popup
+Wi-Fi Direct system popup.
+
+
+%prep
+%setup -q
+
+%build
+cmake . -DCMAKE_INSTALL_PREFIX=$PREFIX
+make %{?jobs:-j%jobs}
+
+%install
+rm -rf %{buildroot}
+
+%make_install
+
+%post
+vconftool set -t int db/wifi_direct/onoff 0 -u apps -i
+
+%postun
+
+
+%files
+%defattr(-,root,root,-)
+/opt/ug/lib/*
+/opt/ug/res/images/*
+/opt/ug/res/edje/*
+/opt/ug/res/locale/*/*/*
+
+%files -n org.tizen.wifi-direct-popup
+%defattr(-,root,root,-)
+/opt/apps/org.tizen.wifi-direct-popup/bin/*
+/opt/apps/org.tizen.wifi-direct-popup/res/locale/*/*/*
+/opt/share/applications/*
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
+}
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__;
+}