Tizen release 1.0
authorKim Kibum <kb0929.kim@samsung.com>
Mon, 9 Apr 2012 03:12:12 +0000 (12:12 +0900)
committerKim Kibum <kb0929.kim@samsung.com>
Mon, 9 Apr 2012 03:12:12 +0000 (12:12 +0900)
17 files changed:
CMakeLists.txt [new file with mode: 0644]
NOTICE [new file with mode: 0644]
data/bt-syspopup.ini [new file with mode: 0644]
data/images/01_header_icon_cancel.png [new file with mode: 0644]
data/images/01_header_icon_done.png [new file with mode: 0644]
data/org.tizen.bt-syspopup.desktop.in [new file with mode: 0644]
data/tizen.org.bt-syspopup.png [new file with mode: 0644]
debian/changelog [new file with mode: 0644]
debian/compat [new file with mode: 0644]
debian/control [new file with mode: 0644]
debian/dirs [new file with mode: 0644]
debian/docs [new file with mode: 0644]
debian/org.tizen.bt-syspopup.install.in [new file with mode: 0644]
debian/rules [new file with mode: 0755]
packaging/org.tizen.bt-syspopup.spec [new file with mode: 0644]
src/bt-syspopup.c [new file with mode: 0644]
src/bt-syspopup.h [new file with mode: 0644]

diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644 (file)
index 0000000..2e2cc33
--- /dev/null
@@ -0,0 +1,76 @@
+
+
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(bt-syspopup C)
+
+SET(SRCS ${CMAKE_SOURCE_DIR}/src/bt-syspopup.c)
+
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+
+IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
+       SET(CMAKE_BUILD_TYPE "Release")
+ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "")
+MESSAGE("Build type: ${CMAKE_BUILD_TYPE}")
+
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR})
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(pkgs REQUIRED
+       appcore-efl
+       bundle
+       devman
+       devman_haptic
+       dlog
+       dbus-glib-1
+       ecore
+       ecore-input
+       ecore-imf
+       edbus
+       edje
+       elementary
+       evas
+       gobject-2.0
+       pmapi
+       syspopup
+       utilX)
+
+FOREACH(flag ${pkgs_CFLAGS})
+       SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag} -Wall -g")
+ENDFOREACH(flag)
+#SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -finstrument-functions")
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
+SET(CMAKE_C_FLAGS_DEBUG "-O0 -g ")
+SET(CMAKE_C_FLAGS_RELEASE "-O2")
+#This is flag for Gprof
+#SET(CMAKE_C_FLAGS_RELEASE "-pg")
+
+FIND_PROGRAM(UNAME NAMES uname)
+EXEC_PROGRAM("${UNAME}" ARGS "-m" OUTPUT_VARIABLE "ARCH")
+IF("${ARCH}" STREQUAL "arm")
+       ADD_DEFINITIONS("-DTARGET")
+       MESSAGE("add -DTARGET")
+ENDIF("${ARCH}" STREQUAL "arm")
+
+ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
+ADD_DEFINITIONS("-DSLP_DEBUG")
+
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed")
+
+ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS})
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS})
+
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin)
+
+# install desktop file & icon
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+CONFIGURE_FILE(data/org.tizen.bt-syspopup.desktop.in data/org.tizen.bt-syspopup.desktop)
+INSTALL(FILES ${CMAKE_BINARY_DIR}/data/org.tizen.bt-syspopup.desktop DESTINATION /opt/share/applications/)
+
+INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/data/images/ DESTINATION
+${PREFIX}/share/icon FILES_MATCHING PATTERN "*.png")
+
+
+# install ini file
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}.ini DESTINATION share/process-info)
+
diff --git a/NOTICE b/NOTICE
new file mode 100644 (file)
index 0000000..ded3804
--- /dev/null
+++ b/NOTICE
@@ -0,0 +1 @@
+Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
\ No newline at end of file
diff --git a/data/bt-syspopup.ini b/data/bt-syspopup.ini
new file mode 100644 (file)
index 0000000..5abbace
--- /dev/null
@@ -0,0 +1,2 @@
+[ProcessSetting]
+BG_SCHEDULE=true
diff --git a/data/images/01_header_icon_cancel.png b/data/images/01_header_icon_cancel.png
new file mode 100644 (file)
index 0000000..4ccaf4a
Binary files /dev/null and b/data/images/01_header_icon_cancel.png differ
diff --git a/data/images/01_header_icon_done.png b/data/images/01_header_icon_done.png
new file mode 100644 (file)
index 0000000..7c494fd
Binary files /dev/null and b/data/images/01_header_icon_done.png differ
diff --git a/data/org.tizen.bt-syspopup.desktop.in b/data/org.tizen.bt-syspopup.desktop.in
new file mode 100644 (file)
index 0000000..3e34c40
--- /dev/null
@@ -0,0 +1,9 @@
+Name=Bluetooth System Popup
+Type=Application
+Exec=/usr/bin/bt-syspopup
+Nodisplay=True
+Icon=org.tizen.bt-syspopup.png
+Network=False
+Comment=Bluetooth System Popup (Pairing / Connection Confirmation)
+X-TIZEN-TaskManage=false
+X-TIZEN-Removable=false
diff --git a/data/tizen.org.bt-syspopup.png b/data/tizen.org.bt-syspopup.png
new file mode 100644 (file)
index 0000000..626b572
Binary files /dev/null and b/data/tizen.org.bt-syspopup.png differ
diff --git a/debian/changelog b/debian/changelog
new file mode 100644 (file)
index 0000000..49c927d
--- /dev/null
@@ -0,0 +1,37 @@
+bt-syspopup (0.2.37-2) unstable; urgency=low
+
+  * Modify the desktop file
+  * Git: slp/pkgs/b/bt-syspopup
+  * Tag: bt-syspopup_0.2.37-2
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com>  Thu, 22 Mar 2012 13:19:38 +0900
+
+bt-syspopup (0.2.37-1) unstable; urgency=low
+
+  * Release Tizen 1.0
+  * Git: slp/pkgs/b/bt-syspopup
+  * Tag: bt-syspopup_0.2.37-1
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com>  Tue, 20 Mar 2012 16:31:30 +0900
+
+bt-syspopup (0.2.30-2) unstable; urgency=low
+
+  * Set License As Samsung Proprietary License
+  * Git: slp/pkgs/b/bt-syspopup
+  * Tag: bt-syspopup_0.2.30-2
+
+ -- Chanyeol Park <chanyeol.park@samsung.com>  Mon, 27 Feb 2012 17:05:04 +0900
+
+bt-syspopup (0.2.30-1) unstable; urgency=low
+
+  * Add the codes
+  * Git: slp/pkgs/b/bt-syspopup
+  * Tag: bt-syspopup_0.2.30-1
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com>  Wed, 01 Feb 2012 09:40:35 +0900
+
+bt-syspopup (0.1.0) unstable; urgency=low
+
+  * Initial Release.
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com>  Tue, 28 Dec 2010 16:31:28 +0900
diff --git a/debian/compat b/debian/compat
new file mode 100644 (file)
index 0000000..7ed6ff8
--- /dev/null
@@ -0,0 +1 @@
+5
diff --git a/debian/control b/debian/control
new file mode 100644 (file)
index 0000000..b5b971c
--- /dev/null
@@ -0,0 +1,19 @@
+Source: bt-syspopup
+Section: main
+Priority: extra
+Maintainer: Hocheol Seo <hocheol.seo@samsung.com>, DoHyun Pyun <dh79.pyun@samsung.com>, InJun Yang <injun.yang@samsung.com>, Chanyeol Park <chanyeol.park@samsung.com>
+Uploaders: Sunil Behera <sunil.behera@samsung.com>, Syam Sidhardhan <s.syam@samsung.com>
+Build-Depends: debhelper (>= 5),libevas-dev,libecore-dev,libethumb-dev,libelm-dev,libefreet-dev, libslp-sensor-dev,libappcore-efl-dev,libdevman-dev, libslp-utilx-dev, syspopup-dev, dlog-dev, libslp-pm-dev, libdbus-glib-1-dev, libglib2.0-dev
+Standards-Version: 0.1.0 
+
+Package: org.tizen.bt-syspopup
+Section: main
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, libslp-utilx-0, libdlog-0
+Description: bluetooth system-popup application (bluetooth system popup)
+
+Package: org.tizen.bt-syspopup-dbg
+Section: debug
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: bluetooth system-popup application (unstripped)
diff --git a/debian/dirs b/debian/dirs
new file mode 100644 (file)
index 0000000..ca882bb
--- /dev/null
@@ -0,0 +1,2 @@
+usr/bin
+usr/sbin
diff --git a/debian/docs b/debian/docs
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/debian/org.tizen.bt-syspopup.install.in b/debian/org.tizen.bt-syspopup.install.in
new file mode 100644 (file)
index 0000000..67008f2
--- /dev/null
@@ -0,0 +1,4 @@
+@PREFIX@/bin/bt-syspopup
+/opt/share/applications/org.tizen.bt-syspopup.desktop
+@PREFIX@/share/process-info/bt-syspopup.ini
+@PREFIX@/share/icon/*
diff --git a/debian/rules b/debian/rules
new file mode 100755 (executable)
index 0000000..a66465e
--- /dev/null
@@ -0,0 +1,140 @@
+#!/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
+CXXFLAGS ?=  -Wall -g
+LDFLAGS ?= 
+PREFIX ?= /usr
+DATADIR ?= /opt
+
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+       CFLAGS += -O0
+       CXXFLAGS += -O0
+else
+       CFLAGS += -O2
+       CXXFLAGS += -O2
+endif
+
+LDFLAGS += -Wl,--rpath=$(PREFIX)/lib -Wl,--as-needed
+
+#CMAKE_TMP_DIR = $(CURDIR)/cmake_tmp
+
+
+configure: configure-stamp
+configure-stamp:
+       dh_testdir
+       # Add here commands to configure the package.
+#      mkdir -p $(CMAKE_TMP_DIR);
+       CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" cmake . -DCMAKE_INSTALL_PREFIX=$(PREFIX)
+
+       touch configure-stamp
+
+build: build-stamp
+
+build-stamp: configure-stamp 
+       dh_testdir
+
+       # Add here commands to compile the package.
+       $(MAKE)
+       #docbook-to-man debian/wavplayer.sgml > wavplayer.1
+
+       for f in `find $(CURDIR)/debian/ -name "*.in"`; do \
+               cat $$f > $${f%.in}; \
+               sed -i -e "s#@PREFIX@#$(PREFIX)#g" $${f%.in}; \
+               sed -i -e "s#@DATADIR@#$(DATADIR)#g" $${f%.in}; \
+       done
+
+
+       touch $@
+
+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 $(CMAKE_TMP_DIR)
+
+       for f in `find $(CURDIR)/ -name "CMakeCache.txt"`; do \
+               rm -f $${f}; \
+       done
+
+       for f in `find $(CURDIR)/ -name "CMakeFiles"`; do \
+               rm -rf $${f}; \
+       done
+
+       for f in `find $(CURDIR)/ -name "cmake_install.cmake"`; do \
+               rm -f $${f}; \
+       done
+
+       for f in `find $(CURDIR)/ -name "Makefile"`; do \
+               rm -f $${f}; \
+       done
+
+       for f in `find $(CURDIR)/ -name "install_manifest.txt"`; do \
+               rm -f $${f}; \
+       done
+       
+       for f in `find $(CURDIR)/debian/ -name "*.in"`; do \
+               rm -f $${f%.in}; \
+       done
+       rm -f data/*.desktop
+
+       dh_clean 
+
+install: build
+       dh_testdir
+       dh_testroot
+       dh_clean -k 
+       dh_installdirs
+
+       # Add here commands to install the package into debian/wavplayer.
+       $(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_installmenu
+#      dh_installdebconf       
+#      dh_installlogrotate
+#      dh_installemacsen
+#      dh_installpam
+#      dh_installmime
+#      dh_python
+#      dh_installinit
+#      dh_installcron
+#      dh_installinfo
+       dh_installman
+       dh_link
+       dh_strip --dbg-package=org.tizen.bt-syspopup-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/org.tizen.bt-syspopup.spec b/packaging/org.tizen.bt-syspopup.spec
new file mode 100644 (file)
index 0000000..c06446a
--- /dev/null
@@ -0,0 +1,50 @@
+Name:       org.tizen.bt-syspopup
+Summary:    bluetooth system-popup application (bluetooth system popup)
+Version:    0.2.37
+Release:    2
+Group:      TO_BE_FILLED
+License:    Apache-2.0
+Source0:    %{name}-%{version}.tar.gz
+BuildRequires:  pkgconfig(evas)
+BuildRequires:  pkgconfig(ecore-input)
+BuildRequires:  pkgconfig(ethumb)
+BuildRequires:  pkgconfig(elementary)
+BuildRequires:  pkgconfig(efreet)
+BuildRequires:  pkgconfig(sensor)
+BuildRequires:  pkgconfig(appcore-efl)
+BuildRequires:  pkgconfig(devman_haptic)
+BuildRequires:  pkgconfig(utilX)
+BuildRequires:  pkgconfig(syspopup)
+BuildRequires:  pkgconfig(dlog)
+BuildRequires:  pkgconfig(pmapi)
+BuildRequires:  pkgconfig(dbus-glib-1)
+BuildRequires:  pkgconfig(glib-2.0)
+
+BuildRequires:  cmake
+BuildRequires:  gettext-devel
+
+%description
+bluetooth system-popup application (bluetooth system popup).
+
+%prep
+%setup -q
+
+
+%build
+
+cmake . -DCMAKE_INSTALL_PREFIX=/usr
+make %{?jobs:-j%jobs}
+
+%install
+rm -rf %{buildroot}
+%make_install
+
+
+%files
+%defattr(-,root,root,-)
+/opt/share/applications/org.tizen.bt-syspopup.desktop
+/usr/bin/bt-syspopup
+/usr/share/icon/01_header_icon_cancel.png
+/usr/share/icon/01_header_icon_done.png
+/usr/share/process-info/bt-syspopup.ini
+
diff --git a/src/bt-syspopup.c b/src/bt-syspopup.c
new file mode 100644 (file)
index 0000000..a3cf075
--- /dev/null
@@ -0,0 +1,1186 @@
+/*
+
+Copyright (c) 2000-2012 Samsung Electronics Co., Ltd All Rights Reserved
+
+This file is part of Bluetooth
+Written by Hocheol Seo <hocheol.seo@samsung.com>
+           DoHyun Pyun <dh79.pyun@samsung.com>
+
+PROPRIETARY/CONFIDENTIAL
+
+This software is the confidential and proprietary information of
+SAMSUNG ELECTRONICS ("Confidential Information"). You shall not
+disclose such Confidential Information and shall use it only in
+accordance with the terms of the license agreement you entered
+into with SAMSUNG ELECTRONICS.
+
+SAMSUNG make no representations or warranties about the suitability
+of the software, either express or implied, including but not limited
+to the implied warranties of merchantability, fitness for a particular
+purpose, or non-infringement. SAMSUNG shall not be liable for any
+damages suffered by licensee as a result of using, modifying or
+distributing this software or its derivatives.
+
+*/
+
+#include <stdio.h>
+#include <pmapi.h>
+#include <appcore-efl.h>
+#include <Ecore_X.h>
+#include <utilX.h>
+#include <vconf.h>
+#include <vconf-keys.h>
+#include <syspopup.h>
+#include <E_DBus.h>
+
+#include "bt-syspopup.h"
+
+static void __bluetooth_delete_input_view(struct bt_popup_appdata *ad);
+static void __bluetooth_win_del(void *data);
+
+static int __bluetooth_term(bundle *b, void *data)
+{
+       bt_log_print(BT_POPUP, "\nSystem-popup: terminate");
+       return 0;
+}
+
+static int __bluetooth_timeout(bundle *b, void *data)
+{
+       bt_log_print(BT_POPUP, "\nSystem-popup: timeout");
+       return 0;
+}
+
+syspopup_handler handler = {
+       .def_term_fn = __bluetooth_term,
+       .def_timeout_fn = __bluetooth_timeout
+};
+
+/* Cleanup objects to avoid mem-leak */
+static void __bluetooth_cleanup(struct bt_popup_appdata *ad)
+{
+       if (ad == NULL)
+               return;
+
+       if (ad->popup)
+               evas_object_del(ad->popup);
+
+       if (ad->layout_main)
+               evas_object_del(ad->layout_main);
+
+       if (ad->win_main)
+               evas_object_del(ad->win_main);
+
+       ad->popup = NULL;
+       ad->layout_main = NULL;
+       ad->win_main = NULL;
+}
+
+static void __bluetooth_remove_all_event(struct bt_popup_appdata *ad)
+{
+       switch (ad->event_type) {
+       case BT_EVENT_PIN_REQUEST:
+       case BT_EVENT_KEYBOARD_PASSKEY_REQUEST:
+
+               dbus_g_proxy_call_no_reply(ad->agent_proxy,
+                                          "ReplyPinCode",
+                                          G_TYPE_UINT, BT_AGENT_CANCEL,
+                                          G_TYPE_STRING, "", G_TYPE_INVALID,
+                                          G_TYPE_INVALID);
+
+               break;
+
+       case BT_EVENT_PASSKEY_CONFIRM_REQUEST:
+
+               dbus_g_proxy_call_no_reply(ad->agent_proxy,
+                                          "ReplyConfirmation",
+                                          G_TYPE_UINT, BT_AGENT_CANCEL,
+                                          G_TYPE_INVALID, G_TYPE_INVALID);
+
+               break;
+
+       case BT_EVENT_PASSKEY_REQUEST:
+
+               dbus_g_proxy_call_no_reply(ad->agent_proxy,
+                                          "ReplyPassKey",
+                                          G_TYPE_UINT, BT_AGENT_CANCEL,
+                                          G_TYPE_STRING, "", G_TYPE_INVALID,
+                                          G_TYPE_INVALID);
+
+               break;
+
+       case BT_EVENT_PASSKEY_DISPLAY_REQUEST:
+               /* Nothing to do */
+               break;
+
+       case BT_EVENT_AUTHORIZE_REQUEST:
+
+               dbus_g_proxy_call_no_reply(ad->agent_proxy,
+                                          "ReplyAuthorize",
+                                          G_TYPE_UINT, BT_AGENT_CANCEL,
+                                          G_TYPE_INVALID, G_TYPE_INVALID);
+
+               break;
+
+       case BT_EVENT_APP_CONFIRM_REQUEST:
+               {
+                       DBusMessage *msg = NULL;
+                       int response = 2;
+
+                       msg = dbus_message_new_signal(
+                                       BT_SYS_POPUP_IPC_RESPONSE_OBJECT,
+                                       BT_SYS_POPUP_INTERFACE,
+                                       BT_SYS_POPUP_METHOD_RESPONSE);
+
+                       /* For timeout rejection is sent to  be handled in
+                          application */
+                       response = 1;
+
+                       dbus_message_append_args(msg,
+                                DBUS_TYPE_INT32, &response,
+                                DBUS_TYPE_INVALID);
+
+                       e_dbus_message_send(ad->EDBusHandle,
+                               msg, NULL, -1, NULL);
+
+                       dbus_message_unref(msg);
+               }
+               break;
+
+       case BT_EVENT_PUSH_AUTHORIZE_REQUEST:
+
+               dbus_g_proxy_call_no_reply(ad->obex_proxy,
+                                          "ReplyAuthorize",
+                                          G_TYPE_UINT, BT_AGENT_CANCEL,
+                                          G_TYPE_INVALID, G_TYPE_INVALID);
+
+               break;
+
+       case BT_EVENT_CONFIRM_OVERWRITE_REQUEST:
+
+               dbus_g_proxy_call_no_reply(ad->obex_proxy,
+                                          "ReplyOverwrite",
+                                          G_TYPE_UINT, BT_AGENT_CANCEL,
+                                          G_TYPE_INVALID, G_TYPE_INVALID);
+
+               break;
+
+       default:
+               break;
+       }
+
+       __bluetooth_win_del(ad);
+}
+
+static int __bluetooth_keydown_cb(void *data, int type, void *event_info)
+{
+       struct bt_popup_appdata *ad = (struct bt_popup_appdata *)data;
+       Ecore_Event_Key *ev = event_info;
+
+       if (!strcmp(ev->keyname, KEY_END) || !strcmp(ev->keyname, KEY_SELECT)) {
+               bt_log_print(BT_POPUP, "Key [%s]", ev->keyname);
+               /* remove_all_event(); */
+
+               if (!strcmp(ev->keyname, KEY_END)) {
+                       __bluetooth_remove_all_event(ad);
+               }
+       }
+
+       return 0;
+}
+
+static int __bluetooth_request_timeout_cb(void *data)
+{
+       struct bt_popup_appdata *ad;
+
+       if (data == NULL)
+               return 0;
+
+       ad = (struct bt_popup_appdata *)data;
+
+       bt_log_print(BT_POPUP, "Request time out, Canceling reqeust");
+
+       /* Destory UI and timer */
+       if (ad->timer) {
+               ecore_timer_del(ad->timer);
+               ad->timer = NULL;
+       }
+
+       __bluetooth_remove_all_event(ad);
+       return 0;
+}
+
+static void __bluetooth_input_request_cb(void *data,
+                                      Evas_Object *obj, void *event_info)
+{
+       struct bt_popup_appdata *ad = (struct bt_popup_appdata *)data;
+       const char *event = elm_object_text_get(obj);
+       int response = 0;
+
+       char *input_text = NULL;
+       char *convert_input_text = NULL;
+
+       if (ad == NULL)
+               return;
+
+
+       if (ad->entry == NULL) {
+               /* BT_EVENT_KEYBOARD_PASSKEY_REQUEST */
+               convert_input_text = strdup(ad->passkey);
+
+               if (!strcmp(event, BT_STR_YES))
+                       response = 1;
+               else
+                       response = 0;
+       } else {
+               /* BT_EVENT_PIN_REQUEST / BT_EVENT_PASSKEY_REQUEST */
+
+                       input_text = (char *)elm_entry_entry_get(ad->entry);
+
+               if (input_text) {
+                       convert_input_text =
+                           elm_entry_markup_to_utf8(input_text);
+               }
+
+               if (!strcmp(event, BT_STR_DONE))
+                       response = 1;
+               else
+                       response = 0;
+       }
+
+       if (convert_input_text == NULL)
+               return;
+
+       bt_log_print(BT_POPUP, "PIN/Passkey[%s] event[%d] response[%d]",
+                    convert_input_text, ad->event_type, response);
+
+       if (response == 1) {
+               bt_log_print(BT_POPUP, "Done case");
+               if (ad->event_type == BT_EVENT_PIN_REQUEST ||
+                   ad->event_type == BT_EVENT_KEYBOARD_PASSKEY_REQUEST) {
+                       dbus_g_proxy_call_no_reply(ad->agent_proxy,
+                                                  "ReplyPinCode",
+                                                  G_TYPE_UINT, BT_AGENT_ACCEPT,
+                                                  G_TYPE_STRING,
+                                                  convert_input_text,
+                                                  G_TYPE_INVALID,
+                                                  G_TYPE_INVALID);
+               } else {
+                       dbus_g_proxy_call_no_reply(ad->agent_proxy,
+                                                  "ReplyPassKey",
+                                                  G_TYPE_UINT, BT_AGENT_ACCEPT,
+                                                  G_TYPE_STRING,
+                                                  convert_input_text,
+                                                  G_TYPE_INVALID,
+                                                  G_TYPE_INVALID);
+               }
+       } else {
+               bt_log_print(BT_POPUP, "Cancel case");
+               if (ad->event_type == BT_EVENT_PIN_REQUEST ||
+                   ad->event_type == BT_EVENT_KEYBOARD_PASSKEY_REQUEST) {
+                       dbus_g_proxy_call_no_reply(ad->agent_proxy,
+                                                  "ReplyPinCode",
+                                                  G_TYPE_UINT, BT_AGENT_CANCEL,
+                                                  G_TYPE_STRING, "",
+                                                  G_TYPE_INVALID,
+                                                  G_TYPE_INVALID);
+               } else {
+                       dbus_g_proxy_call_no_reply(ad->agent_proxy,
+                                                  "ReplyPassKey",
+                                                  G_TYPE_UINT, BT_AGENT_CANCEL,
+                                                  G_TYPE_STRING, "",
+                                                  G_TYPE_INVALID,
+                                                  G_TYPE_INVALID);
+               }
+       }
+
+       __bluetooth_delete_input_view(ad);
+
+       free(convert_input_text);
+
+       __bluetooth_win_del(ad);
+}
+
+static void __bluetooth_passkey_confirm_cb(void *data,
+                                        Evas_Object *obj, void *event_info)
+{
+       if (obj == NULL || data == NULL)
+               return;
+
+       struct bt_popup_appdata *ad = (struct bt_popup_appdata *)data;
+       const char *event = elm_object_text_get(obj);
+
+       if (ad == NULL)
+               return;
+
+       if (!strcmp(event, BT_STR_YES)) {
+               dbus_g_proxy_call_no_reply(ad->agent_proxy, "ReplyConfirmation",
+                                          G_TYPE_UINT, BT_AGENT_ACCEPT,
+                                          G_TYPE_INVALID, G_TYPE_INVALID);
+       } else {
+               dbus_g_proxy_call_no_reply(ad->agent_proxy, "ReplyConfirmation",
+                                          G_TYPE_UINT, BT_AGENT_CANCEL,
+                                          G_TYPE_INVALID, G_TYPE_INVALID);
+       }
+
+       evas_object_del(obj);
+
+       __bluetooth_win_del(ad);
+}
+
+static int __bluetooth_init_app_signal(struct bt_popup_appdata *ad)
+{
+       if (NULL == ad)
+               return FALSE;
+
+       e_dbus_init();
+       ad->EDBusHandle = e_dbus_bus_get(DBUS_BUS_SYSTEM);
+       if (!ad->EDBusHandle) {
+               bt_log_print(BT_POPUP, "e_dbus_bus_get failed  \n ");
+               return FALSE;
+       } else {
+               bt_log_print(BT_POPUP, "e_dbus_bus_get success \n ");
+               e_dbus_request_name(ad->EDBusHandle,
+                                   BT_SYS_POPUP_IPC_NAME, 0, NULL, NULL);
+       }
+       return TRUE;
+}
+
+static void __bluetooth_app_confirm_cb(void *data,
+                                    Evas_Object *obj, void *event_info)
+{
+       bt_log_print(BT_POPUP, "__bluetooth_app_confirm_cb ");
+       if (obj == NULL || data == NULL)
+               return;
+
+       struct bt_popup_appdata *ad = (struct bt_popup_appdata *)data;
+       const char *event = elm_object_text_get(obj);
+
+       DBusMessage *msg = NULL;
+       int response = 0;
+
+       msg = dbus_message_new_signal(BT_SYS_POPUP_IPC_RESPONSE_OBJECT,
+                                     BT_SYS_POPUP_INTERFACE,
+                                     BT_SYS_POPUP_METHOD_RESPONSE);
+
+       if (!strcmp(event, BT_STR_YES) || !strcmp(event, BT_STR_OK))
+               response = 0;
+       else
+               response = 1;
+
+       dbus_message_append_args(msg,
+                                DBUS_TYPE_INT32, &response, DBUS_TYPE_INVALID);
+
+       e_dbus_message_send(ad->EDBusHandle, msg, NULL, -1, NULL);
+       dbus_message_unref(msg);
+
+       evas_object_del(obj);
+
+       __bluetooth_win_del(ad);
+}
+
+static void __bluetooth_authorization_request_cb(void *data,
+                                              Evas_Object *obj,
+                                              void *event_info)
+{
+       struct bt_popup_appdata *ad = (struct bt_popup_appdata *)data;
+       if (obj == NULL || ad == NULL)
+               return;
+
+       const char *event = elm_object_text_get(obj);
+
+       if (!strcmp(event, BT_STR_YES)) {
+               dbus_g_proxy_call_no_reply(ad->agent_proxy, "ReplyAuthorize",
+                                          G_TYPE_UINT, BT_AGENT_ACCEPT,
+                                          G_TYPE_INVALID, G_TYPE_INVALID);
+       } else {
+               dbus_g_proxy_call_no_reply(ad->agent_proxy, "ReplyAuthorize",
+                                          G_TYPE_UINT, BT_AGENT_CANCEL,
+                                          G_TYPE_INVALID, G_TYPE_INVALID);
+       }
+
+       __bluetooth_win_del(ad);
+}
+
+static void __bluetooth_push_authorization_request_cb(void *data,
+                                                   Evas_Object *obj,
+                                                   void *event_info)
+{
+       struct bt_popup_appdata *ad = (struct bt_popup_appdata *)data;
+       if (obj == NULL || ad == NULL)
+               return;
+
+       const char *event = elm_object_text_get(obj);
+
+       if (!strcmp(event, BT_STR_YES))
+               dbus_g_proxy_call_no_reply(ad->obex_proxy, "ReplyAuthorize",
+                                          G_TYPE_UINT, BT_AGENT_ACCEPT,
+                                          G_TYPE_INVALID, G_TYPE_INVALID);
+       else
+               dbus_g_proxy_call_no_reply(ad->obex_proxy, "ReplyAuthorize",
+                                          G_TYPE_UINT, BT_AGENT_CANCEL,
+                                          G_TYPE_INVALID, G_TYPE_INVALID);
+
+       __bluetooth_win_del(ad);
+}
+
+static void __bluetooth_confirm_overwrite_request_cb(void *data,
+                                                  Evas_Object *obj,
+                                                  void *event_info)
+{
+       struct bt_popup_appdata *ad = (struct bt_popup_appdata *)data;
+       if (obj == NULL || ad == NULL)
+               return;
+
+       const char *event = elm_object_text_get(obj);
+
+       if (!strcmp(event, BT_STR_YES))
+               dbus_g_proxy_call_no_reply(ad->obex_proxy, "ReplyOverwrite",
+                                          G_TYPE_UINT, BT_AGENT_ACCEPT,
+                                          G_TYPE_INVALID, G_TYPE_INVALID);
+       else
+               dbus_g_proxy_call_no_reply(ad->obex_proxy, "ReplyOverwrite",
+                                          G_TYPE_UINT, BT_AGENT_CANCEL,
+                                          G_TYPE_INVALID, G_TYPE_INVALID);
+
+       __bluetooth_win_del(ad);
+}
+
+static Evas_Object *__bluetooth_create_bg(Evas_Object *parent, char *style)
+{
+       Evas_Object *bg = NULL;
+
+       bg = elm_bg_add(parent);
+
+       evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+
+       if (style)
+               elm_object_style_set(bg, style);
+
+       elm_win_resize_object_add(parent, bg);
+
+       evas_object_show(bg);
+
+       return bg;
+}
+
+static Evas_Object *__bluetooth_create_layout(Evas_Object *parent)
+{
+       Evas_Object *layout = NULL;
+
+       layout = elm_layout_add(parent);
+
+       elm_layout_theme_set(layout, "layout", "application", "default");
+       evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND,
+                                        EVAS_HINT_EXPAND);
+
+       elm_win_resize_object_add(parent, layout);
+
+       evas_object_show(layout);
+
+       return layout;
+}
+
+static Evas_Object *__bluetooth_add_navigationbar(Evas_Object *parent)
+{
+       Evas_Object *naviframe = NULL;
+
+       naviframe = elm_naviframe_add(parent);
+       elm_object_part_content_set(parent, "elm.swallow.content", naviframe);
+       evas_object_show(naviframe);
+
+       return naviframe;
+}
+
+static void __bluetooth_ime_hide(void)
+{
+       Ecore_IMF_Context *imf_context = NULL;
+       imf_context = ecore_imf_context_add(ecore_imf_context_default_id_get());
+       if (imf_context)
+               ecore_imf_context_input_panel_hide(imf_context);
+}
+
+static void __bluetooth_entry_change_cb(void *data, Evas_Object *obj,
+                                     void *event_info)
+{
+       struct bt_popup_appdata *ad = (struct bt_popup_appdata *)data;
+       char *input_text = NULL;
+       char *convert_input_text = NULL;
+       char *output_text = NULL;
+       int text_length = 0;
+
+       input_text = (char *)elm_entry_entry_get(obj);
+
+       if (input_text) {
+               convert_input_text = elm_entry_markup_to_utf8(input_text);
+               if (convert_input_text) {
+                       text_length = strlen(convert_input_text);
+
+                       if (text_length == 0)
+                               elm_object_disabled_set(ad->edit_field_save_btn,
+                                                       EINA_TRUE);
+                       else
+                               elm_object_disabled_set(ad->edit_field_save_btn,
+                                                       EINA_FALSE);
+
+                       if (ad->event_type == BT_EVENT_PASSKEY_REQUEST) {
+                               if (text_length > BT_PK_MLEN) {
+                                       text_length = BT_PK_MLEN;
+                                       convert_input_text[BT_PK_MLEN] = '\0';
+                                       output_text =
+                                           elm_entry_utf8_to_markup
+                                           (convert_input_text);
+
+                                       elm_entry_entry_set(obj, output_text);
+                                       elm_entry_cursor_end_set(obj);
+                                       free(output_text);
+                               }
+                       } else {
+                               if (text_length > BT_PIN_MLEN) {
+                                       text_length = BT_PIN_MLEN;
+                                       convert_input_text[BT_PIN_MLEN] = '\0';
+                                       output_text =
+                                           elm_entry_utf8_to_markup
+                                               (convert_input_text);
+
+                                       elm_entry_entry_set(obj, output_text);
+                                       elm_entry_cursor_end_set(obj);
+                                       free(output_text);
+                               }
+                       }
+                       free(convert_input_text);
+               }
+       }
+}
+
+static Evas_Object *__bluetooth_gl_icon_get(void *data,
+                                         Evas_Object *obj, const char *part)
+{
+       Evas_Object *entry = NULL;
+       Evas_Object *layout = NULL;
+       struct bt_popup_appdata *ad = NULL;
+
+       bt_log_print(BT_POPUP, "__bluetooth_gl_icon_get");
+
+       ad = (struct bt_popup_appdata *)data;
+
+       if (data == NULL) {
+               bt_log_print(BT_POPUP, "data is NULL");
+               return NULL;
+       }
+
+       if (!strcmp(part, "elm.icon")) {
+
+               layout = elm_layout_add(obj);
+               elm_layout_theme_set(layout, "layout", "editfield", "default");
+
+               entry = elm_entry_add(obj);
+               ad->entry = entry;
+
+               elm_entry_single_line_set(entry, EINA_TRUE);
+               elm_entry_scrollable_set(entry, EINA_TRUE);
+               elm_entry_password_set(entry, EINA_TRUE);
+
+               elm_entry_input_panel_layout_set(entry,
+                        ELM_INPUT_PANEL_LAYOUT_PHONENUMBER);
+
+               elm_entry_input_panel_enabled_set(entry, EINA_TRUE);
+
+               elm_object_part_content_set(layout, "elm.swallow.content", entry);
+
+               evas_object_show(entry);
+               elm_object_focus_set(entry, EINA_TRUE);
+
+               evas_object_smart_callback_add(entry, "changed",
+                       __bluetooth_entry_change_cb, ad);
+
+               return layout;
+       }
+
+       return NULL;
+}
+
+static void __bluetooth_draw_popup(struct bt_popup_appdata *ad,
+                       const char *title, char *btn1_text,
+                       char *btn2_text, void (*func) (void *data,
+                       Evas_Object *obj, void *event_info))
+{
+       char temp_str[BT_TITLE_STR_MAX_LEN+BT_TEXT_EXTRA_LEN] = { 0 };
+       Ecore_X_Window xwin;
+       Evas_Object *btn1;
+       Evas_Object *btn2;
+
+       bt_log_print(BT_POPUP, "__bluetooth_draw_popup");
+
+       ad->popup = elm_popup_add(ad->win_main);
+       evas_object_size_hint_weight_set(ad->popup, EVAS_HINT_EXPAND,
+                                        EVAS_HINT_EXPAND);
+
+       if (title != NULL) {
+               snprintf(temp_str, BT_TITLE_STR_MAX_LEN+BT_TEXT_EXTRA_LEN,
+                       "<align=center>%s</font>", title);
+               elm_object_text_set(ad->popup, temp_str);
+       }
+
+       if ((btn1_text != NULL) && (btn2_text != NULL)) {
+               btn1 = elm_button_add(ad->popup);
+               elm_object_text_set(btn1, btn1_text);
+               elm_object_part_content_set(ad->popup, "button1", btn1);
+               evas_object_smart_callback_add(btn1, "clicked", func, ad);
+
+               btn2 = elm_button_add(ad->popup);
+               elm_object_text_set(btn2, btn2_text);
+               elm_object_part_content_set(ad->popup, "button2", btn2);
+               evas_object_smart_callback_add(btn2, "clicked", func, ad);
+       } else if (btn1_text != NULL) {
+               btn1 = elm_button_add(ad->popup);
+               elm_object_text_set(btn1, btn1_text);
+               elm_object_part_content_set(ad->popup, "button1", btn1);
+               evas_object_smart_callback_add(btn1, "clicked", func, ad);
+       }
+
+       xwin = elm_win_xwindow_get(ad->popup);
+       ecore_x_netwm_window_type_set(xwin, ECORE_X_WINDOW_TYPE_NOTIFICATION);
+       utilx_set_system_notification_level(ecore_x_display_get(), xwin,
+                               UTILX_NOTIFICATION_LEVEL_NORMAL);
+
+       evas_object_show(ad->popup);
+       evas_object_show(ad->win_main);
+
+       bt_log_print(BT_POPUP, "__bluetooth_draw_popup END");
+}
+
+static void __bluetooth_draw_input_view(struct bt_popup_appdata *ad,
+                       const char *title,
+                       void (*func)
+                       (void *data, Evas_Object *obj, void *event_info))
+{
+       Evas_Object *bg = NULL;
+       Evas_Object *genlist = NULL;
+       Evas_Object *l_button = NULL;
+       Evas_Object *r_button = NULL;
+       Elm_Object_Item *git = NULL;
+       Elm_Object_Item *navi_it;
+       Ecore_X_Window xwin;
+
+       evas_object_show(ad->win_main);
+
+       bg = __bluetooth_create_bg(ad->win_main, "group_list");
+
+       ad->layout_main = __bluetooth_create_layout(ad->win_main);
+
+       /* Show Indicator */
+       elm_win_indicator_mode_set(ad->win_main, ELM_WIN_INDICATOR_SHOW);
+
+       ad->navi_fr = __bluetooth_add_navigationbar(ad->layout_main);
+
+       /* Create genlist */
+       genlist = elm_genlist_add(ad->navi_fr);
+       evas_object_show(genlist);
+
+       /* Set item class for dialogue seperator */
+       ad->sp_itc.item_style = "dialogue/separator/11/with_line";
+       ad->sp_itc.func.text_get = NULL;
+       ad->sp_itc.func.content_get = NULL;
+       ad->sp_itc.func.state_get = NULL;
+       ad->sp_itc.func.del = NULL;
+
+       ad->itc.item_style = "dialogue/1icon";
+       ad->itc.func.text_get = NULL;
+       ad->itc.func.content_get = __bluetooth_gl_icon_get;
+       ad->itc.func.state_get = NULL;
+       ad->itc.func.del = NULL;
+
+       /* Seperator */
+       git = elm_genlist_item_append(genlist, &ad->sp_itc, NULL, NULL,
+                                   ELM_GENLIST_ITEM_NONE, NULL, NULL);
+
+       elm_genlist_item_select_mode_set(git, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
+
+       /*editfield for dialogue item (dialogue item) */
+       elm_genlist_item_append(genlist, &ad->itc, ad, NULL,
+                               ELM_GENLIST_ITEM_NONE, NULL, ad);
+
+       navi_it = elm_naviframe_item_push(ad->navi_fr, BT_STR_ENTER_PIN,
+                      NULL, NULL, genlist, NULL);
+
+       l_button = elm_button_add(ad->navi_fr);
+       elm_object_style_set(l_button, "naviframe/title/default");
+       elm_object_text_set(l_button, BT_STR_CANCEL);
+       evas_object_show(l_button);
+       evas_object_smart_callback_add(l_button, "clicked", func, ad);
+       elm_object_item_part_content_set(navi_it, "title_left_btn", l_button);
+
+       r_button = elm_button_add(ad->navi_fr);
+       elm_object_style_set(r_button, "naviframe/title/default");
+       elm_object_text_set(r_button, BT_STR_DONE);
+       evas_object_show(r_button);
+       evas_object_smart_callback_add(r_button, "clicked", func, ad);
+       elm_object_disabled_set(r_button, EINA_TRUE);
+
+       elm_object_item_part_content_set(navi_it, "title_right_btn", r_button);
+
+       ad->edit_field_save_btn = r_button;
+
+       xwin = elm_win_xwindow_get(ad->layout_main);
+       ecore_x_netwm_window_type_set(xwin, ECORE_X_WINDOW_TYPE_NOTIFICATION);
+       utilx_set_system_notification_level(ecore_x_display_get(), xwin,
+                               UTILX_NOTIFICATION_LEVEL_NORMAL);
+}
+
+static void __bluetooth_delete_input_view(struct bt_popup_appdata *ad)
+{
+       __bluetooth_ime_hide();
+
+       if (ad->navi_fr)
+               elm_naviframe_item_pop(ad->navi_fr);
+
+       if (ad->layout_main)
+               evas_object_del(ad->layout_main);
+
+       ad->navi_fr = NULL;
+       ad->layout_main = NULL;
+}
+
+/* AUL bundle handler */
+static int __bluetooth_launch_handler(struct bt_popup_appdata *ad,
+                            void *reset_data, const char *event_type)
+{
+       bundle *kb = (bundle *) reset_data;
+       char view_title[BT_TITLE_STR_MAX_LEN] = { 0 };
+       char text[BT_GLOBALIZATION_STR_LENGTH] = { 0 };
+       int timeout = 0;
+       const char *device_name = NULL;
+       const char *passkey = NULL;
+       const char *file = NULL;
+       char *conv_str = NULL;
+
+       bt_log_print(BT_POPUP, "__bluetooth_launch_handler");
+
+       if (!reset_data || !event_type)
+               return -1;
+
+       if (!strcasecmp(event_type, "pin-request")) {
+               ad->event_type = BT_EVENT_PIN_REQUEST;
+               timeout = BT_AUTHENTICATION_TIMEOUT;
+
+               device_name = bundle_get_val(kb, "device-name");
+
+               if (device_name)
+                       conv_str = elm_entry_utf8_to_markup(device_name);
+
+               snprintf(view_title, BT_TITLE_STR_MAX_LEN,
+                        "%s (%s)", BT_STR_ENTER_PIN, conv_str);
+
+               if (conv_str)
+                       free(conv_str);
+
+               /* Request user inputted PIN for basic pairing */
+               __bluetooth_draw_input_view(ad, view_title,
+                                         __bluetooth_input_request_cb);
+       } else if (!strcasecmp(event_type, "passkey-confirm-request")) {
+               ad->event_type = BT_EVENT_PASSKEY_CONFIRM_REQUEST;
+               timeout = BT_AUTHENTICATION_TIMEOUT;
+
+               device_name = bundle_get_val(kb, "device-name");
+               passkey = bundle_get_val(kb, "passkey");
+
+               if (device_name && passkey) {
+                       conv_str = elm_entry_utf8_to_markup(device_name);
+
+                       snprintf(text, BT_GLOBALIZATION_STR_LENGTH,
+                            BT_STR_PASSKEY_MATCH_Q, conv_str);
+
+                       snprintf(view_title, BT_TITLE_STR_MAX_LEN,
+                            "%s<br>%s", text, passkey);
+
+                       bt_log_print(BT_POPUP, "title: %s", view_title);
+
+                       if (conv_str)
+                               free(conv_str);
+
+                       __bluetooth_draw_popup(ad, view_title,
+                                       BT_STR_YES, BT_STR_NO,
+                                       __bluetooth_passkey_confirm_cb);
+               } else {
+                       timeout = BT_ERROR_TIMEOUT;
+               }
+       } else if (!strcasecmp(event_type, "passkey-request")) {
+               const char *device_name = NULL;
+
+               ad->event_type = BT_EVENT_PASSKEY_REQUEST;
+               timeout = BT_AUTHENTICATION_TIMEOUT;
+
+               device_name = bundle_get_val(kb, "device-name");
+
+               if (device_name)
+                       conv_str = elm_entry_utf8_to_markup(device_name);
+
+               snprintf(view_title, BT_TITLE_STR_MAX_LEN,
+                        "%s (%s)", BT_STR_ENTER_PIN, conv_str);
+
+               if (conv_str)
+                       free(conv_str);
+
+               /* Request user inputted Passkey for basic pairing */
+               __bluetooth_draw_input_view(ad, view_title,
+                                         __bluetooth_input_request_cb);
+
+       } else if (!strcasecmp(event_type, "passkey-display-request")) {
+               /* Nothing to do */
+       } else if (!strcasecmp(event_type, "authorize-request")) {
+               ad->event_type = BT_EVENT_AUTHORIZE_REQUEST;
+               timeout = BT_AUTHORIZATION_TIMEOUT;
+
+               device_name = bundle_get_val(kb, "device-name");
+
+               if (device_name)
+                       conv_str = elm_entry_utf8_to_markup(device_name);
+
+               snprintf(view_title, BT_TITLE_STR_MAX_LEN,
+                        BT_STR_ALLOW_PS_TO_CONNECT_Q, conv_str);
+
+               if (conv_str)
+                       free(conv_str);
+
+               __bluetooth_draw_popup(ad, view_title, BT_STR_YES, BT_STR_NO,
+                                    __bluetooth_authorization_request_cb);
+       } else if (!strcasecmp(event_type, "app-confirm-request")) {
+               bt_log_print(BT_POPUP, "app-confirm-request");
+               ad->event_type = BT_EVENT_APP_CONFIRM_REQUEST;
+               timeout = BT_AUTHORIZATION_TIMEOUT;
+
+               const char *title = NULL;
+               const char *type = NULL;
+
+               title = bundle_get_val(kb, "title");
+               type = bundle_get_val(kb, "type");
+
+               if (!title)
+                       return -1;
+
+               if (strcasecmp(type, "twobtn") == 0) {
+                       __bluetooth_draw_popup(ad, title, BT_STR_YES, BT_STR_NO,
+                                            __bluetooth_app_confirm_cb);
+               } else if (strcasecmp(type, "onebtn") == 0) {
+                       timeout = BT_NOTIFICATION_TIMEOUT;
+                       __bluetooth_draw_popup(ad, title, BT_STR_YES, NULL,
+                                            __bluetooth_app_confirm_cb);
+               } else if (strcasecmp(type, "none") == 0) {
+                       timeout = BT_NOTIFICATION_TIMEOUT;
+                       __bluetooth_draw_popup(ad, title, NULL, NULL,
+                                            __bluetooth_app_confirm_cb);
+               }
+       } else if (!strcasecmp(event_type, "push-authorize-request")) {
+               ad->event_type = BT_EVENT_PUSH_AUTHORIZE_REQUEST;
+               timeout = BT_AUTHORIZATION_TIMEOUT;
+
+               device_name = bundle_get_val(kb, "device-name");
+               file = bundle_get_val(kb, "file");
+
+               if (device_name)
+                       conv_str = elm_entry_utf8_to_markup(device_name);
+
+               snprintf(view_title, BT_TITLE_STR_MAX_LEN,
+                        BT_STR_RECEIVE_PS_FROM_PS_Q, file, conv_str);
+
+               if (conv_str)
+                       free(conv_str);
+
+               __bluetooth_draw_popup(ad, view_title, BT_STR_YES, BT_STR_NO,
+                               __bluetooth_push_authorization_request_cb);
+       } else if (!strcasecmp(event_type, "confirm-overwrite-request")) {
+               ad->event_type = BT_EVENT_CONFIRM_OVERWRITE_REQUEST;
+               timeout = BT_AUTHORIZATION_TIMEOUT;
+
+               file = bundle_get_val(kb, "file");
+
+               snprintf(view_title, BT_TITLE_STR_MAX_LEN,
+                        BT_STR_OVERWRITE_FILE_Q, file);
+
+               __bluetooth_draw_popup(ad, view_title, BT_STR_YES, BT_STR_NO,
+                               __bluetooth_confirm_overwrite_request_cb);
+       } else if (!strcasecmp(event_type, "keyboard-passkey-request")) {
+               ad->event_type = BT_EVENT_KEYBOARD_PASSKEY_REQUEST;
+               timeout = BT_AUTHENTICATION_TIMEOUT;
+
+               device_name = bundle_get_val(kb, "device-name");
+               passkey = bundle_get_val(kb, "passkey");
+
+               if (device_name && passkey) {
+                       snprintf(ad->passkey, sizeof(ad->passkey), "%s", passkey);
+
+                       conv_str = elm_entry_utf8_to_markup(device_name);
+
+                       snprintf(text, BT_GLOBALIZATION_STR_LENGTH,
+                            BT_STR_PASSKEY_MATCH_Q, conv_str);
+
+                       snprintf(view_title, BT_TITLE_STR_MAX_LEN,
+                            "%s<br>%s", text, passkey);
+
+                       bt_log_print(BT_POPUP, "title: %s", view_title);
+
+                       if (conv_str)
+                               free(conv_str);
+
+                       __bluetooth_draw_popup(ad, view_title,
+                                               BT_STR_YES, BT_STR_NO,
+                                               __bluetooth_input_request_cb);
+               } else {
+                       timeout = BT_ERROR_TIMEOUT;
+               }
+       } else if (!strcasecmp(event_type, "bt-information")) {
+               bt_log_print(BT_POPUP, "bt-information");
+               ad->event_type = BT_EVENT_INFORMATION;
+               timeout = BT_NOTIFICATION_TIMEOUT;
+
+               const char *title = NULL;
+               const char *type = NULL;
+
+               title = bundle_get_val(kb, "title");
+               type = bundle_get_val(kb, "type");
+
+               if (title != NULL) {
+                       if (strlen(title) > 255)
+                               return -1;
+               } else
+                       return -1;
+
+               if (strcasecmp(type, "onebtn") == 0) {
+                       __bluetooth_draw_popup(ad, title, BT_STR_OK, NULL,
+                                            __bluetooth_app_confirm_cb);
+               } else if (strcasecmp(type, "none") == 0) {
+                       __bluetooth_draw_popup(ad, title, NULL, NULL,
+                                            __bluetooth_app_confirm_cb);
+               }
+       } else if (!strcasecmp(event_type, "bt-security")) {
+               const char *type = NULL;
+
+               bt_log_print(BT_POPUP, "bt-security");
+               ad->event_type = BT_EVENT_INFORMATION;
+               timeout = BT_NOTIFICATION_TIMEOUT;
+
+               type = bundle_get_val(kb, "type");
+
+               if (!strcasecmp(type, "disabled")) {
+                       snprintf(view_title, BT_TITLE_STR_MAX_LEN,
+                                BT_STR_DISABLED_RESTRICTS);
+               } else if (!strcasecmp(type, "handsfree")) {
+                       snprintf(view_title, BT_TITLE_STR_MAX_LEN,
+                                BT_STR_HANDS_FREE_RESTRICTS);
+               }
+
+               __bluetooth_draw_popup(ad, view_title, BT_STR_OK, NULL,
+                                       __bluetooth_app_confirm_cb);
+       } else {
+
+               return -1;
+       }
+
+       if (ad->event_type != BT_EVENT_FILE_RECIEVED)
+               ad->timer = ecore_timer_add(timeout, (Ecore_Task_Cb)
+                                       __bluetooth_request_timeout_cb,
+                                       ad);
+
+       return 0;
+}
+
+static void __bluetooth_win_del(void *data)
+{
+       struct bt_popup_appdata *ad = (struct bt_popup_appdata *)data;
+
+       __bluetooth_cleanup(ad);
+
+       elm_exit();
+}
+
+static Evas_Object *__bluetooth_create_win(const char *name)
+{
+       Evas_Object *eo;
+       int w;
+       int h;
+
+       eo = elm_win_add(NULL, name, ELM_WIN_DIALOG_BASIC);
+       if (eo) {
+               elm_win_title_set(eo, name);
+               elm_win_borderless_set(eo, EINA_TRUE);
+               ecore_x_window_size_get(ecore_x_window_root_first_get(),
+                                       &w, &h);
+               evas_object_resize(eo, w, h);
+       }
+
+       return eo;
+}
+
+static void __bluetooth_session_init(struct bt_popup_appdata *ad)
+{
+       DBusGConnection *conn = NULL;
+       GError *err = NULL;
+
+       g_type_init();
+
+       conn = dbus_g_bus_get(DBUS_BUS_SYSTEM, &err);
+
+       if (!conn) {
+               bt_log_print(BT_POPUP,
+                            "ERROR: Can't get on system bus [%s]",
+                            err->message);
+               g_error_free(err);
+               return;
+       }
+
+       ad->agent_proxy = dbus_g_proxy_new_for_name(conn,
+                                                   "org.bluez.frwk_agent",
+                                                   "/org/bluez/agent/frwk_agent",
+                                                   "org.bluez.Agent");
+       if (!ad->agent_proxy) {
+               bt_log_print(BT_POPUP, "Could not create a agent dbus proxy");
+       }
+       ad->obex_proxy = dbus_g_proxy_new_for_name(conn,
+                                                  "org.bluez.frwk_agent",
+                                                  "/org/obex/ops_agent",
+                                                  "org.openobex.Agent");
+       if (!ad->agent_proxy) {
+               bt_log_print(BT_POPUP, "Could not create a agent dbus proxy");
+       }
+
+       if (!__bluetooth_init_app_signal(ad))
+               bt_log_print(BT_POPUP, "__bt_syspopup_init_app_signal failed");
+}
+
+static int __bluetooth_create(void *data)
+{
+       struct bt_popup_appdata *ad = data;
+       Evas_Object *win = NULL;
+
+       bt_log_print(BT_POPUP, "__bluetooth_create() start.\n");
+
+       /* create window */
+       win = __bluetooth_create_win(PACKAGE);
+       if (win == NULL)
+               return -1;
+       ad->win_main = win;
+
+       /* init internationalization */
+       if (appcore_set_i18n(BT_COMMON_PKG, BT_COMMON_RES) < 0)
+               return -1;
+
+       ecore_imf_init();
+       ad->event_handle = ecore_event_handler_add(ECORE_EVENT_KEY_DOWN,
+                                                  (Ecore_Event_Handler_Cb)
+                                                  __bluetooth_keydown_cb,
+                                                  ad);
+
+       __bluetooth_session_init(ad);
+
+       return 0;
+}
+
+static int __bluetooth_terminate(void *data)
+{
+       struct bt_popup_appdata *ad = data;
+
+       if (ad->event_handle)
+               ecore_event_handler_del(ad->event_handle);
+
+       if (ad->popup)
+               evas_object_del(ad->popup);
+
+       if (ad->layout_main)
+               evas_object_del(ad->layout_main);
+
+       if (ad->win_main)
+               evas_object_del(ad->win_main);
+
+       ad->popup = NULL;
+       ad->layout_main = NULL;
+       ad->win_main = NULL;
+
+       return 0;
+}
+
+static int __bluetooth_pause(void *data)
+{
+
+       return 0;
+}
+
+static int __bluetooth_resume(void *data)
+{
+
+       return 0;
+}
+
+static int __bluetooth_reset(bundle *b, void *data)
+{
+       struct bt_popup_appdata *ad = data;
+       const char *event_type = NULL;
+       int ret = 0;
+
+       bt_log_print(BT_POPUP, "__bluetooth_reset()\n");
+
+       if (ad == NULL) {
+               bt_log_print(BT_POPUP, "App data is NULL\n");
+               return -1;
+       }
+
+       /* Start Main UI */
+       event_type = bundle_get_val(b, "event-type");
+
+       if (event_type != NULL) {
+               if (syspopup_has_popup(b)) {
+                       if (!strcasecmp(event_type, "terminate")) {
+                               __bluetooth_win_del(ad);
+                               return 0;
+                       } else {
+                               /* Destroy the existing popup*/
+                               __bluetooth_cleanup(ad);
+                               /* create window */
+                               ad->win_main = __bluetooth_create_win(PACKAGE);
+                               if (ad->win_main == NULL)
+                                       return -1;
+                       }
+               }
+               if (strcasecmp(event_type, "pin-request") != 0 &&
+                     strcasecmp(event_type, "passkey-request") != 0)
+                       elm_win_alpha_set(ad->win_main, EINA_TRUE);
+
+               ret = syspopup_create(b, &handler, ad->win_main, ad);
+               if (ret == -1) {
+                       bt_log_print(BT_POPUP, "syspopup_create err");
+               }
+               else {
+                       ret = __bluetooth_launch_handler(ad,
+                                                      b, event_type);
+
+                       if (ret != 0)
+                               return -1;
+
+                       /* Change LCD brightness */
+                       ret = pm_change_state(LCD_NORMAL);
+                       if (ret != 0)
+                               return -1;
+               }
+       } else {
+               bt_log_print(BT_POPUP, "event type is NULL \n");
+       }
+
+       return 0;
+}
+
+int main(int argc, char *argv[])
+{
+       struct bt_popup_appdata ad;
+       struct appcore_ops ops = {
+               .create = __bluetooth_create,
+               .terminate = __bluetooth_terminate,
+               .pause = __bluetooth_pause,
+               .resume = __bluetooth_resume,
+               .reset = __bluetooth_reset,
+       };
+
+       memset(&ad, 0x0, sizeof(struct bt_popup_appdata));
+       ops.data = &ad;
+
+       return appcore_efl_main(PACKAGE, &argc, &argv, &ops);
+}
+
diff --git a/src/bt-syspopup.h b/src/bt-syspopup.h
new file mode 100644 (file)
index 0000000..aff4914
--- /dev/null
@@ -0,0 +1,165 @@
+/*
+
+Copyright (c) 2000-2012 Samsung Electronics Co., Ltd All Rights Reserved
+
+This file is part of Bluetooth
+Written by Hocheol Seo <hocheol.seo@samsung.com>
+           DoHyun Pyun <dh79.pyun@samsung.com>
+
+PROPRIETARY/CONFIDENTIAL
+
+This software is the confidential and proprietary information of
+SAMSUNG ELECTRONICS ("Confidential Information"). You shall not
+disclose such Confidential Information and shall use it only in
+accordance with the terms of the license agreement you entered
+into with SAMSUNG ELECTRONICS.
+
+SAMSUNG make no representations or warranties about the suitability
+of the software, either express or implied, including but not limited
+to the implied warranties of merchantability, fitness for a particular
+purpose, or non-infringement. SAMSUNG shall not be liable for any
+damages suffered by licensee as a result of using, modifying or
+distributing this software or its derivatives.
+
+*/
+
+#ifndef __DEF_BT_SYSPOPUP_H_
+#define __DEF_BT_SYSPOPUP_H_
+
+#include <Elementary.h>
+#include <dlog.h>
+#include <glib.h>
+#include <dbus/dbus-glib.h>
+
+#ifndef PREFIX
+#define PREFIX "/usr"
+#endif
+
+#define TEMP_DIR       "/tmp"
+#define PACKAGE                "bt-syspopup"
+#define APPNAME                "bt-syspopup"
+#define LOCALEDIR      PREFIX"/share/locale"
+#define ICON_DIR       PREFIX"/share/icon"
+
+#define BT_COMMON_PKG          "ug-setting-bluetooth-efl"
+#define BT_COMMON_RES          "/opt/ug/res/locale"
+
+#define _EDJ(obj) elm_layout_edje_get(obj)
+
+#define BT_POPUP_ICON_CANCEL ICON_DIR"/01_header_icon_cancel.png"
+#define BT_POPUP_ICON_DONE ICON_DIR"/01_header_icon_done.png"
+
+#define BT_AUTHENTICATION_TIMEOUT              35
+#define BT_AUTHORIZATION_TIMEOUT               15
+#define BT_NOTIFICATION_TIMEOUT                2
+#define BT_ERROR_TIMEOUT                       1
+
+#define BT_PIN_MLEN 16         /* Pin key max length */
+#define BT_PK_MLEN 6           /* Passkey max length */
+#define BT_CONTROLBAR_MAX_LENGTH 3
+
+#define BT_GLOBALIZATION_STR_LENGTH 256
+#define BT_DEVICE_NAME_LENGTH_MAX 256
+#define BT_FILE_NAME_LENGTH_MAX 256
+#define BT_TEXT_EXTRA_LEN 20
+
+#define BT_TITLE_STR_MAX_LEN \
+       (BT_GLOBALIZATION_STR_LENGTH+BT_DEVICE_NAME_LENGTH_MAX+BT_FILE_NAME_LENGTH_MAX)
+
+#define BT_MESSAGE_STRING_SIZE 256*2+1
+
+#define BT_POPUP       "BT_POPUP"
+
+#define bt_log_print(tag, format, args...) LOG(LOG_DEBUG, \
+       tag, "%s:%d "format, __func__, __LINE__, ##args)
+
+#define BT_SYS_POPUP_IPC_NAME "org.projectx"
+#define BT_SYS_POPUP_IPC_RESPONSE_OBJECT "/org/projectx/bt_syspopup_res"
+#define BT_SYS_POPUP_INTERFACE "User.Bluetooth.syspopup"
+#define BT_SYS_POPUP_METHOD_RESPONSE "Response"
+
+/* String defines to support multi-languages */
+#define BT_STR_ENTER_PIN       \
+       dgettext(BT_COMMON_PKG, "IDS_BT_HEADER_ENTERPIN")
+#define BT_STR_ALLOW_PS_TO_CONNECT_Q   \
+       dgettext(BT_COMMON_PKG, "IDS_BT_POP_ALLOW_PS_TO_CONNECT_Q")
+
+#define BT_STR_RECEIVE_PS_FROM_PS_Q \
+       dgettext(BT_COMMON_PKG, "IDS_BT_POP_RECEIVE_PS_FROM_PS_Q")
+
+#define BT_STR_PASSKEY_MATCH_Q \
+       dgettext(BT_COMMON_PKG, "IDS_BT_POP_MATCH_PASSKEYS_ON_PS_Q")
+
+#define BT_STR_OVERWRITE_FILE_Q \
+       dgettext(BT_COMMON_PKG, "IDS_BT_POP_PS_ALREADY_EXISTS_OVERWRITE_Q")
+
+/* We will add these strings in BT_COMMON_PKG to translate */
+#define BT_STR_DISABLED_RESTRICTS \
+       "Security policy restricts use of Bluletooth connection"
+
+#define BT_STR_HANDS_FREE_RESTRICTS \
+       "Security policy restricts use of Bluletooth connection to hands-free features only"
+
+#define BT_STR_OK dgettext("sys_string", "IDS_COM_SK_OK")
+#define BT_STR_YES dgettext("sys_string", "IDS_COM_SK_YES")
+#define BT_STR_NO dgettext("sys_string", "IDS_COM_SK_NO")
+#define BT_STR_DONE dgettext("sys_string", "IDS_COM_SK_DONE")
+#define BT_STR_CANCEL dgettext("sys_string", "IDS_COM_SK_CANCEL")
+
+
+typedef enum {
+       BT_CHANGED_MODE_ENABLE,
+       BT_CHANGED_MODE_DISABLE,
+} bt_changed_mode_type_t;
+
+typedef enum {
+       BT_EVENT_PIN_REQUEST = 0x0001,
+       BT_EVENT_PASSKEY_CONFIRM_REQUEST = 0x0002,
+       BT_EVENT_PASSKEY_REQUEST = 0x0004,
+       BT_EVENT_PASSKEY_DISPLAY_REQUEST = 0x0008,
+       BT_EVENT_AUTHORIZE_REQUEST = 0x0010,
+       BT_EVENT_APP_CONFIRM_REQUEST = 0x0020,
+       BT_EVENT_PUSH_AUTHORIZE_REQUEST = 0x0040,
+       BT_EVENT_CONFIRM_OVERWRITE_REQUEST = 0x0080,
+       BT_EVENT_FILE_RECIEVED = 0x0100,
+       BT_EVENT_KEYBOARD_PASSKEY_REQUEST = 0x0200,
+       BT_EVENT_INFORMATION = 0x0400,
+       BT_EVENT_TERMINATE = 0x0800,
+} bt_popup_event_type_t;
+
+typedef enum {
+       BT_AGENT_ACCEPT,
+       BT_AGENT_REJECT,
+       BT_AGENT_CANCEL,
+       BT_CORE_AGENT_TIMEOUT,
+} bt_agent_accept_type_t;
+
+struct bt_popup_appdata {
+       Evas *evas;
+       Evas_Object *win_main;
+       Evas_Object *layout_main;
+       Evas_Object *popup;
+
+       /* Passkey layout objects */
+       Evas_Object *navi_fr;
+       Evas_Object *entry;
+       Evas_Object *edit_field_save_btn;
+       Evas_Object *ticker_noti;
+
+       Ecore_Timer *timer;
+       Ecore_Event_Handler *event_handle;
+
+       DBusGProxy *agent_proxy;
+       DBusGProxy *obex_proxy;
+       E_DBus_Connection *EDBusHandle;
+
+       Elm_Genlist_Item_Class sp_itc;
+       Elm_Genlist_Item_Class itc;
+
+       char passkey[BT_PK_MLEN + 1];
+
+       int changed_mode;
+       bt_popup_event_type_t event_type;
+};
+
+#endif                         /* __DEF_BT_SYSPOPUP_H_ */