CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(bt-syspopup C)
-SET(SRCS ${CMAKE_SOURCE_DIR}/src/bt-syspopup.c)
+IF("$ENV{CFLAGS}" MATCHES "-DTIZEN_WEARABLE")
+SET(SRCS ${CMAKE_SOURCE_DIR}/src/bt-syspopup-w.c)
+ENDIF()
+IF("$ENV{CFLAGS}" MATCHES "-DTIZEN_MOBILE")
+SET(SRCS ${CMAKE_SOURCE_DIR}/src/bt-syspopup-m.c)
+ENDIF()
SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+IF("$ENV{CFLAGS}" MATCHES "-DTIZEN_WEARABLE")
+SET(TABLEDIR "/usr/apps/org.tizen.bt-syspopup/shared/res/tables")
+ENDIF()
+
IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
SET(CMAKE_BUILD_TYPE "Release")
ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "")
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR})
INCLUDE(FindPkgConfig)
+IF("$ENV{CFLAGS}" MATCHES "-DTIZEN_WEARABLE")
pkg_check_modules(pkgs REQUIRED
- appcore-efl
+ capi-appfw-application
bundle
- devman
- devman_haptic
+ deviced
dlog
dbus-glib-1
ecore
ecore-input
ecore-imf
+ edje
+ elementary
+ evas
+ gobject-2.0
+ syspopup
+ syspopup-caller
+ capi-network-bluetooth
+ feedback
+ aul
+ efl-assist
edbus
+ vconf)
+ELSEIF("$ENV{CFLAGS}" MATCHES "-DTIZEN_MOBILE")
+pkg_check_modules(pkgs REQUIRED
+ capi-appfw-application
+ bundle
+ deviced
+ capi-system-device
+ capi-media-player
+ dlog
+ dbus-glib-1
+ ecore
+ ecore-input
+ ecore-imf
edje
elementary
evas
+ efl-assist
gobject-2.0
- pmapi
syspopup
- bluetooth-api
+ capi-network-bluetooth
feedback
- aul)
+ notification
+ aul
+ edbus
+ vconf)
+ENDIF()
FOREACH(flag ${pkgs_CFLAGS})
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag} -Wall -g")
ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS})
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS})
+IF("$ENV{CFLAGS}" MATCHES "-DTIZEN_WEARABLE")
+ADD_CUSTOM_TARGET(custom_popup.edj
+COMMAND edje_cc -id ${CMAKE_CURRENT_SOURCE_DIR}/data/images
+${CMAKE_CURRENT_SOURCE_DIR}/data/custom_popup_w.edc
+${CMAKE_CURRENT_SOURCE_DIR}/data/custom_popup.edj DEPENDS
+${CMAKE_CURRENT_SOURCE_DIR}/data/custom_popup_w.edc
+)
+ENDIF()
+IF("$ENV{CFLAGS}" MATCHES "-DTIZEN_MOBILE")
ADD_CUSTOM_TARGET(custom_popup.edj
COMMAND edje_cc -id ${CMAKE_CURRENT_SOURCE_DIR}/data
-${CMAKE_CURRENT_SOURCE_DIR}/data/custom_popup.edc
+${CMAKE_CURRENT_SOURCE_DIR}/data/custom_popup_m.edc
${CMAKE_CURRENT_SOURCE_DIR}/data/custom_popup.edj DEPENDS
-${CMAKE_CURRENT_SOURCE_DIR}/data/custom_popup.edc
+${CMAKE_CURRENT_SOURCE_DIR}/data/custom_popup_m.edc
)
+ENDIF()
ADD_DEPENDENCIES(${PROJECT_NAME} custom_popup.edj)
INSTALL(FILES ${CMAKE_BINARY_DIR}/data/org.tizen.bt-syspopup.xml DESTINATION /usr/share/packages/)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/data/org.tizen.bt-syspopup.png DESTINATION ${TZ_SYS_SHARE}/icons/default/small)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/data/custom_popup.edj DESTINATION ${TZ_SYS_RW_APP}/org.tizen.bt-syspopup/res/edje)
+IF("$ENV{CFLAGS}" MATCHES "-DTIZEN_WEARABLE")
+INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/tables/ DESTINATION ${TABLEDIR} FILES_MATCHING PATTERN "*.xml")
+ENDIF()
--- /dev/null
+Flora License
+
+Version 1.1, April, 2013
+
+http://floralicense.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 Tizen Compliance Specification
+and passes the Tizen Compliance Tests 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
+ and your own copyright statement or terms and conditions do not conflict
+ the conditions stated in the License including section 3.
+
+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.1 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://floralicense.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.
+
+++ /dev/null
-#define SIDE_MARGIN 32 0
-
-collections {
- group {
- name: "custom_popup";
- parts{
- part {
- name: "left_padding";
- type: RECT;
- scale: 1;
- description {
- state: "default" 0.0;
- fixed: 1 0;
- visible: 0;
- align: 0.0 0.5;
- min: SIDE_MARGIN;
- rel1 {
- relative: 0.0 0.0;
- }
- rel2 {
- relative: 0.0 1.0;
- }
- }
- }
- part{
- name:"content";
- type: SWALLOW;
- scale : 1;
- description {
- state: "default" 0.0;
- min: 3 0;
- align: 0.5 0.5;
- fixed: 1 0;
- rel1 {
- relative: 1.0 0.0;
- to:"left_padding";
- }
- rel2 {
- relative: 0.0 1.0;
- to:"right_padding";
- }
- }
- }
- part {
- name: "right_padding";
- type: RECT;
- scale: 1;
- description {
- state: "default" 0.0;
- fixed: 1 0;
- visible: 0;
- align: 1.0 0.5;
- min: SIDE_MARGIN;
- rel1 {
- relative: 1.0 0.0;
- }
- rel2 {
- relative: 1.0 1.0;
- }
- }
- }
- }
- }
-
-
-
- group { name: "popup_checkview";
- parts {
- part { name: "pad_t";
- scale : 1;
- mouse_events: 0;
- repeat_events: 1;
- description { state: "default" 0.0;
- align: 0.5 0.0;
- min: 0 0;
- fixed: 0 1;
- rel1 {
- relative: 1.0 0.0;to_x: "pad_l";
- }
- rel2 {
- relative: 0.0 0.0;to_x: "pad_r";
- }
- }
- }
- part { name: "pad_l";
- scale: 1;
- description { state: "default" 0.0;
- min : 0 0;
- fixed: 1 0;
- rel1 {
- relative: 0.0 0.0;
- }
- rel2 {
- relative: 0.0 1.0;
- }
- align: 0.0 0.0;
- }
- }
- part { name: "pad_r";
- scale: 1;
- description { state: "default" 0.0;
- min : 0 0;
- fixed: 1 0;
- rel1 {
- relative: 1.0 0.0;
- }
- rel2 {
- relative: 1.0 1.0;
- }
- align: 1.0 0.0;
- }
- }
- part { name:"elm.swallow.content";
- type: SWALLOW;
- ignore_flags: ON_HOLD;
- scale : 1;
- description { state: "default" 0.0;
- min: 648 0;
- align: 0.5 0.5;
- fixed: 1 0;
- rel1 {
- relative: 0.5 1.0;
- to: "pad_t";
- }
- rel2 {
- relative: 0.5 0.0;
- to: "pad_b";
- }
- }
- }
- part { name: "pad_b";
- scale : 1;
- mouse_events: 0;
- description { state: "default" 0.0;
- align: 0.5 1.0;
- min: 0 84;
- fixed: 0 1;
- rel1 {
- relative: 1.0 1.0;to_x: "pad_l";
- }
- rel2 {
- relative: 0.0 1.0;to_x: "pad_r";
- }
- }
- }
- part { name: "elm.swallow.end";
- type: SWALLOW;
- ignore_flags: ON_HOLD;
- scale : 1;
- mouse_events: 1;
- repeat_events: 1;
- description { state: "default" 0.0;
- align: 0.0 1.0;
- min: 648 64;
- max: 648 64;
- fixed: 1 1;
- rel1 {
- relative: 0.0 0.0;
- to: "pad_b";
- }
- rel2 {
- relative: 1.0 1.0;
- to: "pad_b";
- }
- }
- }
- part { name: "pad_after_check";
- type : RECT;
- scale : 1;
- mouse_events: 0;
- description { state: "default" 0.0;
- align: 0.0 0.0;
- min: 16 64;
- fixed: 1 1;
- visible: 0;
- rel1 {
- relative: 1.0 0.0;to: "elm.swallow.end";
- }
- rel2 {
- relative: 1.0 1.0;to: "elm.swallow.end";
- }
- }
- }
- part { name: "elm.text";
- type: TEXT;
- scale : 1;
- description { state: "default" 0.0;
- text {
- font: "SLP:style=Medium";
- size: 42;
- min: 0 0;
- align: 0.0 0.5;
- text_class: "slp";
- }
- color: 0 0 0 255;
- align: 0.0 0.5;
- rel1 {
- relative: 1.0 0.0;
- to_x: "pad_after_check";
- to_y: "elm.swallow.end";
- }
- rel2 {
- relative: 1.0 1.0;
- to_y: "elm.swallow.end";
- }
- }
- }
- }
- }
-
- group { name: "popup_checkview_image";
- inherit: "popup_checkview";
- parts{
- part{ name:"elm.swallow.content";
- type: SWALLOW;
- ignore_flags: ON_HOLD;
- scale : 1;
- description { state: "default" 0.0;
- min: 648 0;
- align: 0.5 0.5;
- fixed: 1 0;
- rel1 {
- relative: 0.5 1.0;
- to: "pad_t";
- }
- rel2 {
- relative: 0.5 0.0;
- to: "elm.swallow.icon.bg";
- }
- }
- }
- part { name: "elm.swallow.icon.bg";
- scale: 1;
- description { state: "default" 0.0;
- align: 0.5 1.0;
- fixed: 1 1;
- visible: 0;
- min: 360 164;
- rel1 {
- relative: 0.5 0.0;
- to: "pad_b";
- }
- rel2 {
- relative: 0.5 0.0;
- to: "pad_b";
- }
- }
- }
- part { name: "elm.swallow.entry";
- type: SWALLOW;
- scale: 1;
- ignore_flags: ON_HOLD;
- description { state: "default" 0.0;
- align: 0.5 0.5;
- fixed: 0 1;
- min: 648 120;
- rel1 {
- relative: 0.0 0.5;
- to: "elm.swallow.icon.bg";
- }
- rel2 {
- relative: 1.0 0.5;
- to: "elm.swallow.icon.bg";
- }
- }
- }
- }
- }
-}
--- /dev/null
+#define POPUP_HEIGHT_LANDSCAPE 55
+#define POPUP_CONTENT_DEFAULT_PADDING_LEFT_MIN_INC 15
+#define POPUP_EDITFIELD_LAYOUT_MINMAX_HEIGHT_INC 96
+#define POPUP_WITH_3_GL_ITEMS 300
+#define POPUP_WITH_2_GL_ITEMS 235
+
+collections {
+ base_scale : 1.8;
+ group {
+ name: "passwd_popup";
+ parts {
+ part {
+ name:"pad_t";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 0 0;
+ align: 0.5 0.0;
+ fixed: 0 1;
+ rel2.relative: 1.0 0.0;
+ }
+ }
+ part {
+ name:"elm.swallow.layout";
+ type: SWALLOW;
+ scale: 1;
+ mouse_events: 1;
+ repeat_events: 1;
+ description {
+ state: "default" 0.0;
+ min: 0 POPUP_WITH_3_GL_ITEMS;
+ align: 0.5 1.0;
+ fixed: 1 0;
+ rel1 {
+ relative: 1.0 1.0;
+ to_x: "pad_l";
+ to_y: "pad_t";
+ }
+ rel2 {
+ relative: 0.0 0.0;
+ to_x: "pad_r";
+ to_y: "pad_b";
+ }
+ }
+ }
+
+ part {
+ name:"pad_b";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ align: 0.5 1.0;
+ fixed: 0 1;
+ rel1.relative: 0.0 1.0;
+ }
+ }
+
+ part {
+ name: "pad_l";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 0 0;
+ fixed: 1 0;
+ align: 0.0 0.0;
+ rel1 {
+ relative: 0.0 0.0;
+ }
+ rel2 {
+ relative: 0.0 1.0;
+ }
+ }
+ }
+
+ part {
+ name: "pad_r";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 0 0;
+ fixed: 1 0;
+ align: 1.0 0.0;
+ rel1 {
+ relative: 1.0 0.0;
+ }
+ rel2 {
+ relative: 1.0 1.0;
+ }
+ }
+ }
+ }
+ }
+
+ group { name: "entry_style";
+ parts {
+ part {
+ name: "base";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 450 POPUP_EDITFIELD_LAYOUT_MINMAX_HEIGHT_INC;
+ max: 450 POPUP_EDITFIELD_LAYOUT_MINMAX_HEIGHT_INC;
+ fixed: 1 0;
+ }
+ }
+ part { name: "pad_l";
+ type: SPACER;
+ scale: 1;
+ description { state: "default" 0.0;
+ min: POPUP_CONTENT_DEFAULT_PADDING_LEFT_MIN_INC 0;
+ fixed: 1 0;
+ rel1 {
+ relative: 0.0 0.0;
+ to: "base";
+ }
+ rel2 {
+ relative: 0.0 1.0;
+ to: "base";
+ }
+ align: 0.0 0.0;
+ }
+ }
+ part { name: "pad_r";
+ type: SPACER;
+ scale: 1;
+ description { state: "default" 0.0;
+ min: POPUP_CONTENT_DEFAULT_PADDING_LEFT_MIN_INC 0;
+ fixed: 1 0;
+ rel1 {
+ relative: 1.0 0.0;
+ to: "base";
+ }
+ rel2 {
+ relative: 1.0 1.0;
+ to: "base";
+ }
+ align: 1.0 0.0;
+ }
+ }
+ part { name: "entry_part";
+ type: SWALLOW;
+ scale: 1;
+ description { state: "default" 0.0;
+ min: 0 POPUP_EDITFIELD_LAYOUT_MINMAX_HEIGHT_INC;
+ align: 0.0 0.0;
+ rel1{
+ relative: 1.0 0.0 ;
+ to_x: "pad_l";
+ }
+ rel2{
+ relative: 0.0 1.0;
+ to_x: "pad_r";
+ }
+ }
+ }
+ }
+ }
+
+ group {
+ name: "passwd_popup_landscape_ly";
+ inherit: "passwd_popup";
+ parts {
+
+ part {
+ name:"elm.swallow.layout";
+ type: SWALLOW;
+ scale: 1;
+ mouse_events: 1;
+ repeat_events: 1;
+ description {
+ state: "default" 0.0;
+ min: 0 POPUP_HEIGHT_LANDSCAPE;
+ align: 0.5 1.0;
+ fixed: 1 0;
+ rel1 {
+ relative: 1.0 1.0;
+ to_x: "pad_l";
+ to_y: "pad_t";
+ }
+ rel2 {
+ relative: 0.0 0.0;
+ to_x: "pad_r";
+ to_y: "pad_b";
+ }
+ }
+ }
+ }
+ }
+ group {
+ name: "auth_popup";
+ parts {
+ part {
+ name: "pad_t";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ align: 0.5 0.0;
+ min: 0 0;
+ fixed: 0 1;
+ rel1 {
+ relative: 1.0 0.0;
+ to_x: "pad_l";
+ }
+ rel2 {
+ relative: 0.0 0.0;
+ to_x: "pad_r";
+ }
+ }
+ }
+ part {
+ name: "pad_l";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 26 0;
+ max: 26 0;
+ fixed: 1 0;
+ rel1 {
+ relative: 0.0 0.0;
+ }
+ rel2 {
+ relative: 0.0 1.0;
+ }
+ align: 0.0 0.0;
+ }
+ }
+ part {
+ name: "pad_r";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 26 0;
+ max: 26 0;
+ fixed: 1 0;
+ rel1 {
+ relative: 1.0 0.0;
+ }
+ rel2 {
+ relative: 1.0 1.0;
+ }
+ align: 1.0 0.0;
+ }
+ }
+ part {
+ name: "popup_title";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ relative: 1.0 1.0;
+ to_x: "pad_l";
+ to_y: "pad_t";
+ }
+ rel2 {
+ relative: 0.0 0.0;
+ to_x: "pad_r";
+ to_y: "pad_b";
+ }
+ }
+ }
+ part { name: "bottom_pad";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ align: 0.0 1.0;
+ min: 0 32;
+ fixed: 0 1;
+ rel1 {
+ relative: 1.0 1.0;
+ to_x: "pad_l";
+ }
+ rel2 {
+ relative: 0.0 1.0;
+ to_x: "pad_r";
+ }
+ }
+ }
+ part {
+ name: "pad_b";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ align: 0.0 1.0;
+ min: 0 84;
+ fixed: 1 1;
+ rel1 {
+ relative: 0.0 0.0;
+ to: "bottom_pad";
+ }
+ rel2 {
+ relative: 1.0 0.0;
+ to: "bottom_pad";
+ }
+ }
+ }
+ part {
+ name: "end_field";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ align: 0.5 1.0;
+ min: 0 100;
+ fixed: 0 1;
+ rel1 {
+ relative: 0.0 1.0;
+ to: "pad_b";
+ }
+ rel2 {
+ relative: 1.0 1.0;
+ to: "pad_b";
+ }
+ }
+ }
+ part {
+ name: "check";
+ type: SWALLOW;
+ scale: 1;
+ mouse_events: 1;
+ repeat_events: 1;
+ description {
+ state: "default" 0.0;
+ align: 0.0 0.5;
+ min: 36 36;
+ fixed: 1 1;
+ rel1 {
+ relative: 1.0 1.0;
+ to_x: "pad_l";
+ to_y: "pad_b";
+ }
+ rel2 {
+ relative: 0.0 0.0;
+ to_x: "pad_r";
+ to_y: "pad_b";
+ }
+ }
+ }
+ }
+ }
+ group {
+ name: "access_req_popup";
+ parts {
+ part {
+ name:"pad_t";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 0 0;
+ align: 0.5 0.0;
+ fixed: 0 1;
+ rel2.relative: 1.0 0.0;
+ }
+ }
+ part {
+ name:"elm.swallow.layout";
+ type: SWALLOW;
+ scale: 1;
+ mouse_events: 1;
+ repeat_events: 1;
+ description {
+ state: "default" 0.0;
+ min: 0 POPUP_WITH_2_GL_ITEMS;
+ align: 0.5 1.0;
+ fixed: 1 0;
+ rel1 {
+ relative: 1.0 1.0;
+ to_x: "pad_l";
+ to_y: "pad_t";
+ }
+ rel2 {
+ relative: 0.0 0.0;
+ to_x: "pad_r";
+ to_y: "pad_b";
+ }
+ }
+ }
+
+ part {
+ name:"pad_b";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ align: 0.5 1.0;
+ fixed: 0 1;
+ rel1.relative: 0.0 1.0;
+ }
+ }
+
+ part {
+ name: "pad_l";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 0 0;
+ fixed: 1 0;
+ align: 0.0 0.0;
+ rel1 {
+ relative: 0.0 0.0;
+ }
+ rel2 {
+ relative: 0.0 1.0;
+ }
+ }
+ }
+
+ part {
+ name: "pad_r";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 0 0;
+ fixed: 1 0;
+ align: 1.0 0.0;
+ rel1 {
+ relative: 1.0 0.0;
+ }
+ rel2 {
+ relative: 1.0 1.0;
+ }
+ }
+ }
+ }
+ }
+}
--- /dev/null
+#define FONT_BLD "Tizen:style=Bold"
+#define FONT_MED "Tizen:style=Medium"
+#define FONT_ROM "Tizen:style=Roman"
+#define FONT_LIG "Tizen:style=Roman"
+
+#define RESOURCE_IMAGE( FILE_NAME ) \
+ group { \
+ name: FILE_NAME; \
+ images.image: FILE_NAME COMP; \
+ parts { \
+ part { name: "image"; \
+ repeat_events: 1; \
+ description { \
+ state: "default" 0.0; \
+ image.normal: FILE_NAME; \
+ aspect: 0 0; \
+ aspect_preference: BOTH; \
+ } \
+ } \
+ } \
+ }
+
+#define IMAGE_ROTATE_DESCRIPTION(STATE_NAME, ANGLE) \
+ description { \
+ state: STATE_NAME 0.0; \
+ inherit: "show" 0.0; \
+ map { \
+ on: 1; \
+ perspective_on: 1; \
+ smooth: 1; \
+ rotation { \
+ z: ANGLE; \
+ } \
+ } \
+ } \
+
+#define HOR_SIZE 360
+#define VER_SIZE 480
+#define BUTTON_HEIGHT 85
+
+collections {
+#include "groups/passkey_confirm.edc"
+#include "groups/auth_popup.edc"
+#include "groups/passwd_popup.edc"
+#include "groups/passkey_confirm_popup.edc"
+}
+
+
--- /dev/null
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ *
+ */
+
+group {
+ name: "auth_popup";
+ parts {
+ part {
+ name: "pad_t";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ align: 0.5 0.0;
+ min: 0 0;
+ fixed: 0 1;
+ rel1 {
+ relative: 1.0 0.0;to_x: "pad_l";
+ }
+ rel2 {
+ relative: 0.0 0.0;to_x: "pad_r";
+ }
+ }
+ }
+ part {
+ name: "pad_l";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 0 0;
+ max: 0 0;
+ fixed: 1 0;
+ rel1 {
+ relative: 0.0 0.0;
+ }
+ rel2 {
+ relative: 0.0 1.0;
+ }
+ align: 0.0 0.0;
+ }
+ }
+ part {
+ name: "pad_r";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 0 0;
+ max: 0 0;
+ fixed: 1 0;
+ rel1 {
+ relative: 1.0 0.0;
+ }
+ rel2 {
+ relative: 1.0 1.0;
+ }
+ align: 1.0 0.0;
+ }
+ }
+ part {
+ name: "popup_title";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ relative: 1.0 1.0;
+ to_x: "pad_l";
+ to_y: "pad_t";
+ }
+ rel2 {
+ relative: 0.0 0.0;
+ to_x: "pad_r";
+ to_y: "pad_b";
+ }
+ }
+ }
+ part {
+ name: "pad_b";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ align: 0.5 1.0;
+ min: 400 84;
+ fixed: 1 1;
+ rel1 {
+ relative: 0.5 1.0;
+ }
+ rel2 {
+ relative: 0.5 1.0;
+ }
+ }
+ }
+ part {
+ name: "check";
+ type: SWALLOW;
+ scale: 1;
+ mouse_events: 1;
+ repeat_events: 1;
+ description {
+ state: "default" 0.0;
+ align: 0.0 1.0;
+ min: 63 63;
+ max: 63 63;
+ fixed: 1 1;
+ rel1.to: "pad_b";
+ rel2 {
+ relative: 0.0 1.0;
+ to: "pad_b";
+ }
+ }
+ }
+ part {
+ name: "pad_after_check";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ align: 0.0 0.0;
+ min: 16 63;
+ fixed: 1 1;
+ rel1 {
+ relative: 1.0 0.0;to: "check";
+ }
+ rel2 {
+ relative: 1.0 1.0;to: "check";
+ }
+ }
+ }
+ part {
+ name: "check_label";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ relative: 1.0 0.0;
+ to_x: "pad_after_check";
+ to_y: "check";
+ }
+ rel2 {
+ relative: 1.0 1.0;
+ to_x: "pad_b";
+ to_y: "check";
+ }
+ }
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ *
+ */
+
+RESOURCE_IMAGE("b_setup_wizard_watch.png");
+RESOURCE_IMAGE("b_setup_wizard_device.png");
+RESOURCE_IMAGE("b_setup_wizard_pairing_01.png");
+
+#define BG_COLOR "AO011"
+
+#define WATCH_W 54
+#define WATCH_H 70
+#define PHONE_W 62
+#define PHONE_H 112
+#define PROCESS_W 54
+#define PROCESS_H 54
+#define MID_PADDING_W 17
+#define LINE_H 41
+#define BUTTON_H 85
+
+#define PROCESS_PAD_LEFT (HOR_SIZE/2 - PROCESS_W/2)
+#define PROCESS_PAD_TOP (88)
+#define WTCH_PAD_TOP (VER_SIZE - LINE_H * 4 - BUTTON_H - WATCH_H)/2
+#define TEXT_PAD (16)
+
+
+
+group { name: "passkey_confirm";
+ parts {
+ part { name: "bg";
+ type: RECT;
+ scale: 1;
+ description { state: "default" 0.0;
+ min: HOR_SIZE VER_SIZE;
+ color_class: BG_COLOR;
+ }
+ }
+
+ part {
+ name: "scroller";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ relative: 0.0 0.0;
+ to:"bg";
+ }
+ rel2 {
+ relative: 1.0 (VER_SIZE-BUTTON_HEIGHT)/VER_SIZE;
+ to:"bg";
+ }
+ align: 0.0 0.0;
+ }
+ }
+
+ part { name: "btn1";
+ type: SWALLOW;
+ scale: 1;
+ description { state: "default" 0.0;
+ fixed: 1 1;
+ rel1 {
+ relative: 0.0 1.0;
+ }
+ rel2 {
+ to_x: "padding";
+ relative: 0.0 1.0;
+ }
+ min: 0 BUTTON_HEIGHT;
+ align: 0.5 1;
+ }
+ }
+ part { name: "padding";
+ type: SPACER;
+ scale: 1;
+ mouse_events: 0;
+ description { state: "default" 0.0;
+ rel1 {
+ relative: 0.5 1.0;
+ }
+ rel2 {
+ relative: 0.5 1.0;
+ }
+ align: 0.5 1.0;
+ min: 1 0;
+ max: 1 0;
+ fixed: 1 0;
+ }
+ }
+ part { name: "btn2";
+ type: SWALLOW;
+ scale: 1;
+ description { state: "default" 0.0;
+ fixed: 1 1;
+ rel1 {
+ to_x: "padding";
+ relative: 1.0 1.0;
+ }
+ rel2 {
+ relative: 1.0 1.0;
+ }
+ min: 0 BUTTON_HEIGHT;
+ align: 0.5 1;
+ }
+ }
+ }
+}
+
+group { name: "passkey_confirm_scroller";
+ parts{
+ part {
+ name: "background";
+ type: RECT;
+ mouse_events: 1;
+ description {
+ state: "default" 0;
+ color_class: BG_COLOR;
+
+ }
+ }
+ part { name: "pad_l";
+ type: SPACER;
+ scale: 1;
+ description { state: "default" 0.0;
+ min: TEXT_PAD 0;
+ max: TEXT_PAD 0;
+ fixed: 1 0;
+ rel1 {
+ relative: 0.0 0.0;
+ }
+ rel2 {
+ relative: 0.0 1.0;
+ }
+ align: 0.0 0.0;
+ }
+ }
+
+ part { name: "pad_r";
+ type: SPACER;
+ scale: 1;
+ description { state: "default" 0.0;
+ min: TEXT_PAD 0;
+ max: TEXT_PAD 0;
+ fixed: 1 0;
+ rel1 {
+ relative: 1.0 0.0;
+ }
+ rel2 {
+ relative: 1.0 1.0;
+ }
+ align: 1.0 0.0;
+ }
+ }
+
+ part { name: "pad_b";
+ type: SPACER;
+ scale: 1;
+ description { state: "default" 0.0;
+ align: 0.5 1.0;
+ min: 0 TEXT_PAD;
+ fixed: 1 1;
+ rel1 {
+ relative: 0.0 1.0;
+ to_x: "pad_l";
+ }
+ rel2 {
+ relative: 1.0 1.0;
+ to_x: "pad_r";
+ }
+ }
+ }
+
+ part {
+ name: "elm.swallow.img.watch";
+ type: IMAGE;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ align: 1.0 0.0;
+ visible: 1;
+ fixed: 1 1;
+ min: WATCH_W WATCH_H;
+ max: WATCH_W WATCH_H;
+ image.normal: "b_setup_wizard_watch.png";
+ color_class: "AO014";
+ rel1 {
+ relative: 0 0;
+ to:"background";
+ offset:0 WTCH_PAD_TOP;
+ }
+ rel2 {
+ relative: 0 0;
+ to_x:"elm.swallow.img.icon";
+ offset: (-MID_PADDING_W) 0;
+ }
+ }
+ }
+ part {
+ name: "elm.swallow.img.phone";
+ type: IMAGE;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ visible: 1;
+ fixed: 1 1;
+ min: PHONE_W PHONE_H;
+ max: PHONE_W PHONE_H;
+ image.normal: "b_setup_wizard_device.png";
+ color_class: "AO014";
+ rel1 {
+ relative: 1.0 0.0;
+ to:"elm.swallow.img.icon";
+ offset: MID_PADDING_W (-26);
+ }
+ rel2 {
+ relative: 1.0 1.0;
+ to:"elm.swallow.img.icon";
+ offset: (MID_PADDING_W + PHONE_W) (26);
+ }
+ }
+ }
+
+ part {
+ name: "elm.swallow.img.icon";
+ type: IMAGE;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ visible: 1;
+ fixed: 1 1;
+ min: PROCESS_W PROCESS_H;
+ max: PROCESS_W PROCESS_H;
+ image.normal: "b_setup_wizard_pairing_01.png";
+ color_class: "AO013L2";
+
+ rel1 {
+ relative: 0.0 0.0;
+ offset: PROCESS_PAD_LEFT PROCESS_PAD_TOP;
+ to:"background";
+ }
+ rel2 {
+ relative: 0.0 0.0;
+ offset: (PROCESS_PAD_LEFT+PROCESS_W) (PROCESS_PAD_TOP+PROCESS_H);
+ to:"background";
+ }
+ map {
+ on: 1;
+ smooth: 0;
+ rotation {
+ z:0;
+ }
+ }
+ }
+ description {
+ state: "state1" 0.1;
+ inherit: "default" 0.0;
+ map {
+ on: 1;
+ smooth: 0;
+ rotation {
+ z:180;
+ }
+ }
+ }
+ description {
+ state: "state2" 0.2;
+ inherit: "default" 0.0;
+ map {
+ on: 1;
+ smooth: 0;
+ rotation {
+ z:360;
+ }
+ }
+ }
+ }
+ part {
+ name: "elm.text.block";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ color_class: BG_COLOR;
+ align: 0.0 0.0;
+ rel1 {
+ relative: 1.0 1.0;
+ to_x:"pad_l";
+ to_y:"elm.swallow.img.phone";
+ offset: 0 46;
+ }
+ rel2 {
+ relative: 0.0 0.0;
+ to_x:"pad_r";
+ to_y:"pad_b";
+ }
+ }
+ }
+ }
+ programs {
+ program {
+ signal: "load";
+ source: "";
+ in: 0.0 0.0;
+ after: "animation";
+ }
+ program {
+ name: "animation";
+ action: STATE_SET "default" 0.0;
+ target: "elm.swallow.img.icon";
+ transition: LINEAR 0.0;
+ after: "animation1";
+ }
+ program {
+ name: "animation1";
+ action: STATE_SET "state1" 0.1;
+ target: "elm.swallow.img.icon";
+ transition: LINEAR 0.7;
+ after: "animation2";
+ }
+ program {
+ name: "animation2";
+ action: STATE_SET "state2" 0.2;
+ target: "elm.swallow.img.icon";
+ transition: LINEAR 0.7;
+ after: "animation";
+ }
+ }
+}
+
+
--- /dev/null
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ *
+ */
+
+images {
+ image: "b_setup_wizard_bluetooth_pairing.png" COMP;
+}
+
+#define BG_COLOR 0 0 0 255
+
+group { name: "passkey_confirm_popup";
+ parts {
+ part { name: "bg";
+ type: RECT;
+ scale: 1;
+ description { state: "default" 0.0;
+ min: HOR_SIZE VER_SIZE;
+ color: BG_COLOR;
+ }
+ }
+
+ part {
+ name: "scroller";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ relative: 0.0 0.0;
+ to:"bg";
+ }
+ rel2 {
+ relative: 1.0 (VER_SIZE-BUTTON_HEIGHT)/VER_SIZE;
+ to:"bg";
+ }
+ align: 0.0 0.0;
+ }
+ }
+
+ part { name: "btn1";
+ type: SWALLOW;
+ scale: 1;
+ description { state: "default" 0.0;
+ fixed: 1 1;
+ rel1 {
+ relative: 0.0 1.0;
+ }
+ rel2 {
+ to_x: "padding";
+ relative: 0.0 1.0;
+ }
+ min: 0 BUTTON_HEIGHT;
+ align: 0.5 1;
+ }
+ }
+ part { name: "padding";
+ type: SPACER;
+ scale: 1;
+ mouse_events: 0;
+ description { state: "default" 0.0;
+ rel1 {
+ relative: 0.5 1.0;
+ }
+ rel2 {
+ relative: 0.5 1.0;
+ }
+ align: 0.5 1.0;
+ min: 1 0;
+ max: 1 0;
+ fixed: 1 0;
+ }
+ }
+ part { name: "btn2";
+ type: SWALLOW;
+ scale: 1;
+ description { state: "default" 0.0;
+ fixed: 1 1;
+ rel1 {
+ to_x: "padding";
+ relative: 1.0 1.0;
+ }
+ rel2 {
+ relative: 1.0 1.0;
+ }
+ min: 0 BUTTON_HEIGHT;
+ align: 0.5 1;
+ }
+ }
+ }
+}
+
+group { name: "passkey_confirm_popup_scroller";
+ parts {
+ part { name: "bg";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.0 0.0; }
+ rel2 { relative: 1.0 1.0; }
+ color: BG_COLOR;
+ }
+ }
+ part {
+ name: "elm.image";
+ type: IMAGE;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ relative: 0 0;
+ to: "bg";
+ offset: 39 0;
+ }
+ rel2 {
+ relative: 0 0;
+ to: "bg";
+ offset: (39+242) 124;
+ }
+ visible: 1;
+ image {
+ normal: "b_setup_wizard_bluetooth_pairing.png";
+ }
+ align: 0.5 0.0;
+ }
+ description {
+ state: "show" 0.0;
+ inherit: "default" 0.0;
+ visible: 1;
+ }
+ }
+ part {
+ name: "elm.text.block";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ relative: 0.0 0.0;
+ to: "bg";
+ offset: 0 124;
+ }
+ rel2 {
+ relative: 1.0 1.0;
+ offset: -16 0;
+ }
+ }
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ *
+ */
+#define WIN_WIDTH 360
+#define WIN_HEIGHT 480
+
+RESOURCE_IMAGE("b_privacy_lock_button_00.png");
+RESOURCE_IMAGE("b_privacy_lock_button_01.png");
+RESOURCE_IMAGE("b_privacy_lock_button_02.png");
+RESOURCE_IMAGE("b_privacy_lock_button_03.png");
+RESOURCE_IMAGE("b_privacy_lock_button_04.png");
+RESOURCE_IMAGE("b_privacy_lock_button_05.png");
+RESOURCE_IMAGE("b_privacy_lock_button_06.png");
+RESOURCE_IMAGE("b_privacy_lock_button_07.png");
+RESOURCE_IMAGE("b_privacy_lock_button_08.png");
+RESOURCE_IMAGE("b_privacy_lock_button_09.png");
+RESOURCE_IMAGE("b_privacy_lock_clear_btn.png");
+RESOURCE_IMAGE("b_privacy_lock_button_clear.png");
+
+#define KEYPAD_BUTTON_DESC_CC(part_name, sx, sy, dx, dy, ox, oy)\
+ part {\
+ name : part_name",bg";\
+ type : RECT;\
+ mouse_events : 1;\
+ description {\
+ state : "default" 0.0;\
+ min : dx dy;\
+ fixed : 1 1;\
+ rel1 { relative : sx sy; offset: ox oy; }\
+ rel2 { relative : sx sy; }\
+ color_class : "AO012L2";\
+ align : 0.0 0.0;\
+ }\
+ description {\
+ state : "pressed" 0.0;\
+ inherit : "default" 0.0;\
+ color_class : "AO012L2P";\
+ }\
+ }\
+ part {\
+ name : part_name;\
+ type : IMAGE;\
+ mouse_events : 1;\
+ description {\
+ state : "default" 0.0;\
+ rel1.to : part_name",bg"; \
+ rel2.to : part_name",bg"; \
+ min : dx 63;\
+ max : dx 63;\
+ fixed : 1 1;\
+ image { normal : "b_privacy_lock_"part_name".png"; }\
+ color_class : "AO012";\
+ }\
+ description {\
+ state : "disable" 0.0;\
+ visible : 0;\
+ }\
+ }\
+ part {\
+ name : part_name",sw";\
+ type : SWALLOW;\
+ description {\
+ state : "default" 0.0;\
+ fixed : 1 1;\
+ rel1.to : part_name",bg"; \
+ rel2.to : part_name",bg"; \
+ }\
+ description {\
+ state : "hidden" 0.0;\
+ visible : 0;\
+ }\
+ }
+
+#define KEYPAD_TXT_DESC_CC(part_name, sx, sy, dx, dy,ox,oy)\
+ part {\
+ name : part_name",bg";\
+ type : RECT;\
+ mouse_events : 1;\
+ description {\
+ state : "default" 0.0;\
+ min : dx dy;\
+ fixed : 1 1;\
+ rel1 { relative : sx sy; offset: ox oy; }\
+ rel2 { relative : sx sy; }\
+ color_class : "AO012L2";\
+ align : 0.0 0.0;\
+ }\
+ description {\
+ state : "pressed" 0.0;\
+ inherit : "default" 0.0;\
+ color_class : "AO012L2P";\
+ }\
+ }\
+ part {\
+ name : part_name;\
+ type : TEXT;\
+ mouse_events : 1;\
+ description {\
+ state : "default" 0.0;\
+ rel1.to : part_name",bg";\
+ rel2.to : part_name",bg";\
+ color : 255 255 255 255;\
+ text {\
+ font : "Tizen:style=Regular";\
+ text_class : tizen;\
+ size : 32;\
+ }\
+ }\
+ description {\
+ state : "disable" 0.0;\
+ inherit : "default" 0.0;\
+ color : 128 128 128 255;\
+ }\
+ }\
+ part {\
+ name : part_name",sw";\
+ type : SWALLOW;\
+ description {\
+ state : "default" 0.0;\
+ fixed : 1 1;\
+ rel1.to : part_name",bg"; \
+ rel2.to : part_name",bg"; \
+ }\
+ description {\
+ state : "hidden" 0.0;\
+ visible : 0;\
+ }\
+ }
+
+#define KEYPAD_BUTTON_PGM(part_name)\
+ program {\
+ name : "keypad,"part_name",release";\
+ signal : "normal";\
+ source : part_name;\
+ action : STATE_SET "default" 0.0;\
+ target : part_name",bg";\
+ }\
+ program {\
+ name : "keypad,"part_name",press";\
+ signal : "pressed";\
+ source : part_name;\
+ action : STATE_SET "pressed" 0.0;\
+ target : part_name",bg";\
+ }\
+ program {\
+ name : "keypad,"part_name",disable";\
+ signal : "disable";\
+ source : part_name;\
+ action : STATE_SET "disable" 0.0;\
+ target : part_name;\
+ }\
+ program {\
+ name : "keypad,"part_name",enable";\
+ signal : "enable";\
+ source : part_name;\
+ action : STATE_SET "default" 0.0;\
+ target : part_name;\
+ }
+
+#define KEYPAD_TXT_PGM(part_name)\
+ program {\
+ name : "keypad,"part_name",release";\
+ signal : "normal";\
+ source : part_name;\
+ action : STATE_SET "default" 0.0;\
+ target : part_name",bg";\
+ }\
+ program {\
+ name : "keypad,"part_name",press";\
+ signal : "pressed";\
+ source : part_name;\
+ action : STATE_SET "pressed" 0.0;\
+ target : part_name",bg";\
+ }\
+ program {\
+ name : "keypad,"part_name",disable";\
+ signal : "disable";\
+ source : part_name;\
+ action : STATE_SET "disable" 0.0;\
+ target : part_name;\
+ }\
+ program {\
+ name : "keypad,"part_name",enable";\
+ signal : "enable";\
+ source : part_name;\
+ action : STATE_SET "default" 0.0;\
+ target : part_name;\
+ }
+
+#define FOCUS_TARGET(part_name)\
+ target : part_name",sw";
+
+group {
+ name: "passwd_popup";
+ parts {
+ part{
+ name: "base";
+ type: RECT;
+ scale: 1;
+ description{
+ state: "default" 0.0;
+ visible: 1;
+ rel1 { relative: 0.0 0.0; }
+ rel2 { relative: 1.0 1.0; }
+ color_class : "B011";
+ }
+ }
+ part { name: "label";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 6/WIN_WIDTH 0.0; to: "base"; offset: 0 0; }
+ rel2 { relative: (WIN_WIDTH-6)/WIN_WIDTH 0.0; to: "base"; offset: 0 11+66; }
+ }
+ }
+ part{
+ name: "pass.txt.bg";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.0 0.0; to: "base"; offset: 0 74+8; }
+ rel2 { relative: 1.0 0.0; to: "base"; offset: 0 74+8+42; }
+ color_class : "B011";
+ }
+ }
+ part {
+ name: "elm.text.password";
+ type: TEXT;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 { to: "pass.txt.bg"; }
+ rel2 { to: "pass.txt.bg"; }
+ color_class: "AT013";
+ text {
+ text_class: "AT013";
+ align: 0.5 0.5;
+ }
+ }
+ }
+ part{
+ name: "sw.keypad";
+ type: SWALLOW;
+ scale: 1;
+ description{
+ state: "default" 0.0;
+ visible: 1;
+ rel1 { relative: 0.0 0.0; to: "base"; offset: 0 74+8+42; }
+ rel2 { relative: 1.0 0.0; to: "base"; offset: 0 74+8+42+299; }
+ }
+ }
+ }
+}
+
+group {
+ name: "keypad";
+ parts {
+ part {
+ name : "rect.bg";
+ type : RECT;
+ mouse_events : 1;
+ description {
+ fixed: 1 1;
+ state : "default" 0.0;
+ color_class : "AO012L1";
+ }
+ }
+
+ KEYPAD_BUTTON_DESC_CC("button_01", 0.0, 0.0, 117+1, 70, 0,1)
+ KEYPAD_BUTTON_DESC_CC("button_02", (117+4)/WIN_WIDTH, 0.0, 117+1, 70, 1,1)
+ KEYPAD_BUTTON_DESC_CC("button_03", (118+4)*2/WIN_WIDTH, 0.0, 117, 70, 0,1)
+
+ KEYPAD_BUTTON_DESC_CC("button_04", 0.0, (71+4)/299, 117+1, 70, 0,1)
+ KEYPAD_BUTTON_DESC_CC("button_05", (117+4)/WIN_WIDTH, (71+4)/299, 117+1, 70, 1,1)
+ KEYPAD_BUTTON_DESC_CC("button_06", (118+4)*2/WIN_WIDTH, (71+4)/299, 117, 70, 0,1)
+
+ KEYPAD_BUTTON_DESC_CC("button_07", 0.0, (71+4)*2/299, 117+1, 70, 0,1)
+ KEYPAD_BUTTON_DESC_CC("button_08", (117+4)/WIN_WIDTH, (71+4)*2/299, 117+1, 70, 1,1)
+ KEYPAD_BUTTON_DESC_CC("button_09", (118+4)*2/WIN_WIDTH, (71+4)*2/299, 117, 70, 0,1)
+
+ KEYPAD_TXT_DESC_CC("confirm", (118+4)*2/WIN_WIDTH, (71+4)*3/299, 117, 74, 0,2)
+ KEYPAD_BUTTON_DESC_CC("button_00", (117+4)/WIN_WIDTH, (71+4)*3/299, 117+1, 74, 1,2)
+ KEYPAD_BUTTON_DESC_CC("button_clear", 0.0, (71+4)*3/299, 117+1, 74, 0,2)
+
+ }
+
+ programs {
+ KEYPAD_BUTTON_PGM("button_00")
+ KEYPAD_BUTTON_PGM("button_01")
+ KEYPAD_BUTTON_PGM("button_02")
+ KEYPAD_BUTTON_PGM("button_03")
+ KEYPAD_BUTTON_PGM("button_04")
+ KEYPAD_BUTTON_PGM("button_05")
+ KEYPAD_BUTTON_PGM("button_06")
+ KEYPAD_BUTTON_PGM("button_07")
+ KEYPAD_BUTTON_PGM("button_08")
+ KEYPAD_BUTTON_PGM("button_09")
+ KEYPAD_BUTTON_PGM("button_clear")
+ KEYPAD_TXT_PGM("confirm")
+
+ program {
+ name : "set,tts,enable";
+ signal : "set,tts,enable";
+ source : "bg";
+ action : STATE_SET "default" 0.0;
+ FOCUS_TARGET("button_00")
+ FOCUS_TARGET("button_01")
+ FOCUS_TARGET("button_02")
+ FOCUS_TARGET("button_03")
+ FOCUS_TARGET("button_04")
+ FOCUS_TARGET("button_05")
+ FOCUS_TARGET("button_06")
+ FOCUS_TARGET("button_07")
+ FOCUS_TARGET("button_08")
+ FOCUS_TARGET("button_09")
+ FOCUS_TARGET("button_clear")
+ FOCUS_TARGET("confirm")
+ }
+ program {
+ name : "set,tts,disable";
+ signal : "set,tts,disable";
+ source : "bg";
+ action : STATE_SET "hidden" 0.0;
+ FOCUS_TARGET("button_00")
+ FOCUS_TARGET("button_01")
+ FOCUS_TARGET("button_02")
+ FOCUS_TARGET("button_03")
+ FOCUS_TARGET("button_04")
+ FOCUS_TARGET("button_05")
+ FOCUS_TARGET("button_06")
+ FOCUS_TARGET("button_07")
+ FOCUS_TARGET("button_08")
+ FOCUS_TARGET("button_09")
+ FOCUS_TARGET("button_clear")
+ FOCUS_TARGET("confirm")
+ }
+ }
+}
<label>Bluetooth System Popup</label>
<author email="dh79.pyun@samsung.com" href="www.samsung.com">DoHyun Pyun</author>
<description>Bluetooth System Popup</description>
- <ui-application appid="org.tizen.bt-syspopup" exec="/opt/apps/org.tizen.bt-syspopup/bin/bt-syspopup" nodisplay="true" multiple="false" type="capp" taskmanage="false">
+ <ui-application appid="org.tizen.bt-syspopup" exec="/usr/apps/org.tizen.bt-syspopup/bin/bt-syspopup" nodisplay="true" multiple="false" type="capp" taskmanage="false">
<label>Bluetooth System Popup</label>
<icon>org.tizen.bt-syspopup.png</icon>
</ui-application>
+%define _usrdir /usr
+%define _appdir %{_usrdir}/apps
+
%bcond_with wayland
Name: org.tizen.bt-syspopup
Summary: bluetooth system-popup application (bluetooth system popup)
-Version: 0.2.56
+Version: 0.3.1
Release: 0
Group: main
License: Apache License, Version 2.0
Source0: %{name}-%{version}.tar.gz
BuildRequires: pkgconfig(evas)
+%if "%{?profile}" == "mobile"
+BuildRequires: pkgconfig(efl-assist)
+BuildRequires: pkgconfig(notification)
+%endif
+%if "%{?profile}" == "wearable"
+BuildRequires: efl-assist-devel
+BuildRequires: pkgconfig(syspopup-caller)
+%endif
BuildRequires: pkgconfig(ecore-input)
-BuildRequires: pkgconfig(edbus)
BuildRequires: pkgconfig(ethumb)
BuildRequires: pkgconfig(elementary)
BuildRequires: pkgconfig(efreet)
-BuildRequires: pkgconfig(sysman)
BuildRequires: pkgconfig(sensor)
-BuildRequires: pkgconfig(appcore-efl)
-BuildRequires: pkgconfig(devman)
BuildRequires: pkgconfig(syspopup)
BuildRequires: pkgconfig(dlog)
-BuildRequires: pkgconfig(pmapi)
BuildRequires: pkgconfig(dbus-glib-1)
BuildRequires: pkgconfig(glib-2.0)
-BuildRequires: pkgconfig(devman_haptic)
BuildRequires: pkgconfig(aul)
-BuildRequires: pkgconfig(bluetooth-api)
+BuildRequires: pkgconfig(edbus)
BuildRequires: pkgconfig(feedback)
-BuildRequires: sysman-internal-devel
BuildRequires: edje-tools
BuildRequires: pkgconfig(libtzplatform-config)
+BuildRequires: pkgconfig(capi-appfw-application)
+BuildRequires: pkgconfig(capi-system-device)
+BuildRequires: pkgconfig(capi-media-player)
+BuildRequires: pkgconfig(deviced)
+BuildRequires: pkgconfig(capi-network-bluetooth)
+BuildRequires: pkgconfig(vconf)
BuildRequires: cmake
BuildRequires: gettext-devel
%build
+%if "%{?profile}" == "wearable"
+export CFLAGS="$CFLAGS -DTIZEN_ENGINEER_MODE -DTIZEN_WEARABLE"
+export CXXFLAGS="$CXXFLAGS -DTIZEN_ENGINEER_MODE"
+export FFLAGS="$FFLAGS -DTIZEN_ENGINEER_MODE"
+%else
+export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE -DTIZEN_MOBILE"
+export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE"
+export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE"
+%endif
export CFLAGS+=" -fpie -fvisibility=hidden"
export LDFLAGS+=" -Wl,--rpath=/usr/lib -Wl,--as-needed -Wl,--unresolved-symbols=ignore-in-shared-libs -pie"
%{TZ_SYS_RW_APP}/org.tizen.bt-syspopup/bin/bt-syspopup
%{TZ_SYS_RW_APP}/org.tizen.bt-syspopup/res/edje/*.edj
%{TZ_SYS_SHARE}/icons/default/small/org.tizen.bt-syspopup.png
+%if "%{?profile}" == "wearable"
+/usr/apps/org.tizen.bt-syspopup/shared/res/tables/org.tizen.bt-syspopup_ChangeableColorTable.xml
+/usr/apps/org.tizen.bt-syspopup/shared/res/tables/org.tizen.bt-syspopup_FontInfoTable.xml
+%endif
--- /dev/null
+/*
+* bt-syspopup
+*
+* Copyright 2013 Samsung Electronics Co., Ltd
+*
+* Contact: Hocheol Seo <hocheol.seo@samsung.com>
+* GirishAshok Joshi <girish.joshi@samsung.com>
+* DoHyun Pyun <dh79.pyun@samsung.com>
+*
+* Licensed under the Flora License, Version 1.1 (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.
+*
+*/
+
+#include <stdio.h>
+#include <dd-display.h>
+#include <app.h>
+#include <device/display.h>
+#include <vconf.h>
+#include <vconf-keys.h>
+#include <syspopup.h>
+#include <E_DBus.h>
+#include <aul.h>
+#include <bluetooth.h>
+#include <feedback.h>
+#include "bt-syspopup-m.h"
+#include <notification.h>
+#include <bundle_internal.h>
+#include <app_control.h>
+#include <app_control_internal.h>
+#include <efl_assist.h>
+
+static void __bluetooth_delete_input_view(struct bt_popup_appdata *ad);
+static void __bluetooth_win_del(void *data);
+
+static void __bluetooth_input_keyback_cb(void *data,
+ Evas *e, Evas_Object *obj, void *event_info);
+
+static void __bluetooth_input_mouseup_cb(void *data,
+ Evas *e, Evas_Object *obj, void *event_info);
+
+static void __bluetooth_keyback_cb(void *data,
+ Evas *e, Evas_Object *obj, void *event_info);
+
+static void __bluetooth_mouseup_cb(void *data,
+ Evas *e, Evas_Object *obj, void *event_info);
+
+static void __bluetooth_keyback_auth_cb(void *data,
+ Evas *e, Evas_Object *obj, void *event_info);
+
+static void __bluetooth_mouseup_auth_cb(void *data,
+ Evas *e, Evas_Object *obj, void *event_info);
+
+static void __bluetooth_terminate(void *data);
+
+static void __bluetooth_remove_all_event(struct bt_popup_appdata *ad);
+
+static void __bluetooth_set_win_level(Evas_Object *parent);
+
+static void __popup_terminate(void);
+
+static int __bluetooth_term(bundle *b, void *data)
+{
+ struct bt_popup_appdata *ad;
+
+ BT_DBG("System-popup: terminate");
+
+ if (data == NULL)
+ return 0;
+
+ ad = (struct bt_popup_appdata *)data;
+ /* Destory UI and timer */
+ if (ad->timer) {
+ BT_DBG("removing the timer");
+ ecore_timer_del(ad->timer);
+ ad->timer = NULL;
+ }
+ __bluetooth_remove_all_event(ad);
+ __bluetooth_terminate(data);
+ return 0;
+}
+
+static int __bluetooth_timeout(bundle *b, void *data)
+{
+ BT_DBG("System-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)
+{
+ ret_if(ad == NULL);
+
+ if (ad->popup) {
+ evas_object_del(ad->popup);
+ ad->popup = NULL;
+ }
+ if (ad->layout) {
+ evas_object_del(ad->layout);
+ ad->layout = NULL;
+ }
+ if (ad->conform) {
+ evas_object_del(ad->conform);
+ ad->conform = NULL;
+ }
+ if (ad->agent_proxy) {
+ g_object_unref(ad->agent_proxy);
+ ad->agent_proxy = NULL;
+ }
+}
+
+static void __bt_main_win_rot_changed_cb(void *data, Evas_Object *obj,
+ void *event)
+{
+ FN_START;
+
+ ret_if(!data);
+
+ struct bt_popup_appdata *ad = data;
+ int changed_ang = elm_win_rotation_get(obj);
+ BT_INFO("New angle: %d, old angle: %d", changed_ang,
+ ad->rotation);
+ if (changed_ang == ad->rotation) {
+ return;
+ } else {
+ ad->rotation = changed_ang;
+ }
+
+ BT_INFO("Rotation: %d", ad->rotation);
+
+ if (ad->popup) {
+ if (ad->event_type == BT_EVENT_PIN_REQUEST ||
+ ad->event_type == BT_EVENT_PASSKEY_CONFIRM_REQUEST){
+ if (ad->rotation == APP_DEVICE_ORIENTATION_0 ||
+ ad->rotation == APP_DEVICE_ORIENTATION_180)
+ elm_layout_file_set(elm_object_content_get(ad->popup),
+ CUSTOM_POPUP_PATH, "passwd_popup");
+ else
+ elm_layout_file_set(elm_object_content_get(ad->popup),
+ CUSTOM_POPUP_PATH, "passwd_popup_landscape_ly");
+ }
+ }
+ FN_END;
+}
+
+static void __bluetooth_cleanup_win(struct bt_popup_appdata *ad)
+{
+ ret_if(ad == NULL);
+
+ if (ad->win_main) {
+ evas_object_smart_callback_del(ad->win_main, "wm,rotation,changed",
+ __bt_main_win_rot_changed_cb);
+ evas_object_del(ad->win_main);
+ ad->win_main = NULL;
+ }
+}
+
+static void __bluetooth_player_free_job_cb(void *data)
+{
+ FN_START;
+ player_h sound_player = data;
+ player_state_e state = PLAYER_STATE_NONE;
+
+ retm_if(sound_player == NULL, "invalid parameter");
+
+ if (player_get_state(sound_player, &state) == PLAYER_ERROR_NONE) {
+
+ BT_INFO("the state of sound player %d", state);
+
+ if (state == PLAYER_STATE_PLAYING) {
+ player_stop(sound_player);
+ player_unprepare(sound_player);
+ }
+ if (state == PLAYER_STATE_READY) {
+ player_unprepare(sound_player);
+ }
+ }
+ player_destroy(sound_player);
+ FN_END;
+}
+
+static void __bluetooth_player_free(player_h sound_player)
+{
+ FN_START;
+ retm_if(sound_player == NULL, "invalid parameter");
+
+ ecore_job_add(__bluetooth_player_free_job_cb, sound_player);
+ sound_player = NULL;
+ FN_END;
+}
+
+static void
+__bluetooth_player_del_timeout_timer(struct bt_popup_appdata *ad)
+{
+ FN_START;
+ if (ad->playing_timer) {
+ ecore_timer_del(ad->playing_timer);
+ ad->playing_timer = NULL;
+ }
+ FN_END;
+}
+
+static void
+__bluetooth_player_completed_cb(void *user_data)
+{
+ retm_if(user_data == NULL, "invalid parameter");
+ struct bt_popup_appdata *ad = user_data;
+
+ BT_DBG("Media player completed");
+
+ __bluetooth_player_del_timeout_timer(ad);
+ __bluetooth_player_free(ad->player);
+}
+
+static void
+__bluetooth_player_interrupted_cb(player_interrupted_code_e code, void *user_data)
+{
+ retm_if(user_data == NULL, "invalid parameter");
+ struct bt_popup_appdata *ad = user_data;
+
+ BT_ERR("interrupt code [%d]", (int)code);
+
+ __bluetooth_player_del_timeout_timer(ad);
+ __bluetooth_player_free(ad->player);
+}
+
+static void
+__bluetooth_player_error_cb(int error_code, void *user_data)
+{
+ retm_if(user_data == NULL, "invalid parameter");
+ struct bt_popup_appdata *ad = user_data;
+
+ BT_ERR("Error code [%d]", (int)error_code);
+
+ __bluetooth_player_del_timeout_timer(ad);
+ __bluetooth_player_free(ad->player);
+}
+
+static Eina_Bool __bluetooth_player_timeout_cb(void *data)
+{
+ retvm_if(data == NULL, ECORE_CALLBACK_CANCEL, "invalid parameter");
+ struct bt_popup_appdata *ad = data;
+
+ __bluetooth_player_free(ad->player);
+ ad->playing_timer = NULL;
+
+ return ECORE_CALLBACK_CANCEL;
+}
+
+static void __bluetooth_player_start_job_cb(void *data)
+{
+ FN_START;
+ int ret = PLAYER_ERROR_NONE;
+ ret_if(!data);
+ struct bt_popup_appdata *ad = data;
+ ret_if(!ad);
+
+ ret = player_start(ad->player);
+ if (ret != PLAYER_ERROR_NONE) {
+ BT_ERR("player_start [%d]", ret);
+ __bluetooth_player_free(ad->player);
+ return;
+ }
+ ad->playing_timer = ecore_timer_add(15,
+ __bluetooth_player_timeout_cb, ad);
+ FN_END;
+}
+
+static int __bluetooth_notify_event(struct bt_popup_appdata *ad)
+{
+ FN_START;
+ retvm_if(!ad, PLAYER_ERROR_INVALID_PARAMETER, "invalid parameter");
+ int result;
+ char *path = NULL;
+ sound_session_type_e type = 1;
+ player_state_e state = PLAYER_STATE_NONE;
+
+ int ret = PLAYER_ERROR_NONE;
+ int sndRet = SOUND_MANAGER_ERROR_NONE;
+
+ BT_DBG("Notify event");
+
+ __bluetooth_player_del_timeout_timer(ad);
+
+ if (ad->player != NULL)
+ __bluetooth_player_free(ad->player);
+
+ sound_manager_get_session_type(&type);
+ if (type != SOUND_SESSION_TYPE_NOTIFICATION) {
+ sndRet = sound_manager_set_session_type(SOUND_SESSION_TYPE_NOTIFICATION);
+ if(sndRet != SOUND_MANAGER_ERROR_NONE) {
+ BT_ERR("sound_manager_set_session_type fail");
+ return PLAYER_ERROR_INVALID_PARAMETER;
+ }
+ }
+
+ ret = player_create(&ad->player);
+ if (ret != PLAYER_ERROR_NONE) {
+ BT_ERR("creating the player handle failed[%d]", ret);
+ ad->player= NULL;
+ return ret;
+ }
+
+ ret = player_set_sound_type(ad->player, SOUND_TYPE_NOTIFICATION);
+ if (ret != PLAYER_ERROR_NONE) {
+ BT_ERR("player_set_sound_type() ERR: %x!!!!", ret);
+ __bluetooth_player_free(ad->player);
+ return ret;
+ }
+
+ player_get_state(ad->player, &state);
+ if (state > PLAYER_STATE_READY) {
+ __bluetooth_player_free(ad->player);
+ return ret;
+ }
+
+ /* Set the notification sound from vconf*/
+ path = vconf_get_str(VCONF_NOTI_SOUND);
+ if (path)
+ {
+ ret = player_set_uri(ad->player, path);
+ if (ret != 0)
+ BT_ERR("player_set_uri Failed : %d", ret);
+
+ } else {
+ BT_ERR("vconf_get_str failed");
+ __bluetooth_player_free(ad->player);
+ return ret;
+ }
+
+ ret = player_prepare(ad->player);
+ if (ret != PLAYER_ERROR_NONE) {
+ BT_ERR("realizing the player handle failed[%d]", ret);
+ __bluetooth_player_free(ad->player);
+ return ret;
+ }
+
+ player_get_state(ad->player, &state);
+ if (state != PLAYER_STATE_READY) {
+ BT_ERR("state of player is invalid %d", state);
+ __bluetooth_player_free(ad->player);
+ return ret;
+ }
+
+ /* register callback */
+ ret = player_set_completed_cb(ad->player, __bluetooth_player_completed_cb, ad);
+ if (ret != PLAYER_ERROR_NONE) {
+ BT_ERR("player_set_completed_cb() ERR: %x!!!!", ret);
+ __bluetooth_player_free(ad->player);
+ return ret;
+ }
+
+ ret = player_set_interrupted_cb(ad->player, __bluetooth_player_interrupted_cb, ad);
+ if (ret != PLAYER_ERROR_NONE) {
+ __bluetooth_player_free(ad->player);
+ return ret;
+ }
+
+ ret = player_set_error_cb(ad->player, __bluetooth_player_error_cb, ad);
+ if (ret != PLAYER_ERROR_NONE) {
+ __bluetooth_player_free(ad->player);
+ return ret;
+ }
+
+ ecore_job_add(__bluetooth_player_start_job_cb, ad);
+
+ FN_END;
+}
+
+static void __bluetooth_parse_event(struct bt_popup_appdata *ad, const char *event_type)
+{
+ if (!strcasecmp(event_type, "pin-request"))
+ ad->event_type = BT_EVENT_PIN_REQUEST;
+ else if (!strcasecmp(event_type, "passkey-confirm-request"))
+ ad->event_type = BT_EVENT_PASSKEY_CONFIRM_REQUEST;
+ else if (!strcasecmp(event_type, "passkey-request"))
+ ad->event_type = BT_EVENT_PASSKEY_REQUEST;
+ else if (!strcasecmp(event_type, "authorize-request"))
+ ad->event_type = BT_EVENT_AUTHORIZE_REQUEST;
+ else if (!strcasecmp(event_type, "app-confirm-request"))
+ ad->event_type = BT_EVENT_APP_CONFIRM_REQUEST;
+ else if (!strcasecmp(event_type, "push-authorize-request"))
+ ad->event_type = BT_EVENT_PUSH_AUTHORIZE_REQUEST;
+ else if (!strcasecmp(event_type, "confirm-overwrite-request"))
+ ad->event_type = BT_EVENT_CONFIRM_OVERWRITE_REQUEST;
+ else if (!strcasecmp(event_type, "keyboard-passkey-request"))
+ ad->event_type = BT_EVENT_KEYBOARD_PASSKEY_REQUEST;
+ else if (!strcasecmp(event_type, "bt-information"))
+ ad->event_type = BT_EVENT_INFORMATION;
+ else if (!strcasecmp(event_type, "exchange-request"))
+ ad->event_type = BT_EVENT_EXCHANGE_REQUEST;
+ else if (!strcasecmp(event_type, "phonebook-request"))
+ ad->event_type = BT_EVENT_PHONEBOOK_REQUEST;
+ else if (!strcasecmp(event_type, "message-request"))
+ ad->event_type = BT_EVENT_MESSAGE_REQUEST;
+ else if (!strcasecmp(event_type, "pairing-retry-request"))
+ ad->event_type = BT_EVENT_RETRY_PAIR_REQUEST;
+ else if (!strcasecmp(event_type, "music-auto-connect-request"))
+ ad->event_type = BT_EVENT_MUSIC_AUTO_CONNECT_REQUEST;
+ else if (!strcasecmp(event_type, "remote-legacy-pair-failed"))
+ ad->event_type = BT_EVENT_LEGACY_PAIR_FAILED_FROM_REMOTE;
+ else
+ ad->event_type = 0x0000;
+ return;
+}
+
+static void __bluetooth_request_to_cancel(void)
+{
+ bt_device_cancel_bonding();
+}
+
+static void __bluetooth_remove_all_event(struct bt_popup_appdata *ad)
+{
+ BT_INFO("Remove event 0X%X", ad->event_type);
+ switch (ad->event_type) {
+ case BT_EVENT_PIN_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_KEYBOARD_PASSKEY_REQUEST:
+
+ __bluetooth_request_to_cancel();
+
+ 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;
+ int response;
+
+ 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 = BT_AGENT_REJECT;
+
+ 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:
+ case BT_EVENT_PHONEBOOK_REQUEST:
+ case BT_EVENT_MESSAGE_REQUEST:
+ case BT_EVENT_EXCHANGE_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_CONFIRM_OVERWRITE_REQUEST: {
+ DBusMessage *msg;
+ int response = BT_AGENT_REJECT;
+
+ msg = dbus_message_new_signal(BT_SYS_POPUP_IPC_RESPONSE_OBJECT,
+ BT_SYS_POPUP_INTERFACE,
+ BT_SYS_POPUP_METHOD_RESPONSE);
+ if (msg == NULL) {
+ BT_ERR("msg == NULL, Allocation failed");
+ break;
+ }
+
+ 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_RETRY_PAIR_REQUEST: {
+ DBusMessage *msg = NULL;
+ int response = BT_AGENT_REJECT;
+
+ msg = dbus_message_new_signal(BT_SYS_POPUP_IPC_RESPONSE_OBJECT,
+ BT_SYS_POPUP_INTERFACE,
+ BT_SYS_POPUP_METHOD_RESPONSE);
+
+ 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;
+ }
+
+ default:
+ break;
+ }
+
+ __bluetooth_win_del(ad);
+}
+
+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_DBG("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;
+ char *input_text = NULL;
+ char *convert_input_text = NULL;
+
+ if (ad == NULL)
+ return;
+
+ /* 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 (!g_strcmp0(event, BT_STR_PAIR))
+ response = BT_AGENT_ACCEPT;
+ else
+ response = BT_AGENT_CANCEL;
+
+ if (convert_input_text == NULL)
+ return;
+
+ BT_DBG_SECURE("PIN/Passkey[%s] event[%d] response[%d - %s]",
+ convert_input_text, ad->event_type, response,
+ (response == BT_AGENT_ACCEPT) ? "Accept" : "Cancel");
+
+ if (ad->event_type == BT_EVENT_PIN_REQUEST) {
+ dbus_g_proxy_call_no_reply(ad->agent_proxy,
+ "ReplyPinCode", G_TYPE_UINT, response,
+ 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, response,
+ G_TYPE_STRING, convert_input_text,
+ G_TYPE_INVALID, G_TYPE_INVALID);
+ }
+ __bluetooth_delete_input_view(ad);
+
+ free(convert_input_text);
+
+ __bluetooth_win_del(ad);
+}
+
+static void __bluetooth_input_cancel_cb(void *data,
+ Evas_Object *obj, void *event_info)
+{
+ struct bt_popup_appdata *ad = (struct bt_popup_appdata *)data;
+
+ bt_device_cancel_bonding();
+
+ __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 (!g_strcmp0(event, BT_STR_CONFIRM)) {
+ 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_ERR("e_dbus_bus_get failed");
+ return FALSE;
+ } else {
+ BT_DBG("e_dbus_bus_get success");
+ 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_DBG("__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;
+
+ msg = dbus_message_new_signal(BT_SYS_POPUP_IPC_RESPONSE_OBJECT,
+ BT_SYS_POPUP_INTERFACE,
+ BT_SYS_POPUP_METHOD_RESPONSE);
+
+ if (!g_strcmp0(event, BT_STR_OK))
+ response = BT_AGENT_ACCEPT;
+ else
+ response = BT_AGENT_REJECT;
+
+ 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;
+ guint reply_val;
+
+ if (obj == NULL || ad == NULL)
+ return;
+
+ const char *event = elm_object_text_get(obj);
+
+ if (!g_strcmp0(event, BT_STR_OK) || !g_strcmp0(event, BT_STR_ACCEPT)
+ || !g_strcmp0(event, BT_STR_ALLOW)) {
+ reply_val = (ad->make_trusted == TRUE) ?
+ BT_AGENT_ACCEPT_ALWAYS : BT_AGENT_ACCEPT;
+ } else {
+ reply_val = BT_AGENT_CANCEL;
+ }
+
+ dbus_g_proxy_call_no_reply(ad->agent_proxy, "ReplyAuthorize",
+ G_TYPE_UINT, reply_val,
+ G_TYPE_INVALID, G_TYPE_INVALID);
+
+ ad->make_trusted = FALSE;
+
+ __bluetooth_win_del(ad);
+}
+
+static void __bluetooth_information_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;
+
+ __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 (!g_strcmp0(event, BT_STR_OK))
+ 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_ime_hide(void)
+{
+ FN_START;
+ 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);
+ FN_END;
+}
+
+static void __bluetooth_entry_keydown_cb(void *data, Evas *e, Evas_Object *obj,
+ void *event_info)
+{
+ FN_START;
+ Evas_Event_Key_Down *ev;
+ Evas_Object *entry = obj;
+
+ if (data == NULL || event_info == NULL || entry == NULL)
+ return;
+
+ ev = (Evas_Event_Key_Down *)event_info;
+ BT_INFO("ENTER ev->key:%s", ev->key);
+
+ if (g_strcmp0(ev->key, "KP_Enter") == 0 ||
+ g_strcmp0(ev->key, "Return") == 0) {
+
+ Ecore_IMF_Context *imf_context = NULL;
+
+ imf_context =
+ (Ecore_IMF_Context*)elm_entry_imf_context_get(entry);
+ if (imf_context)
+ ecore_imf_context_input_panel_hide(imf_context);
+
+ elm_object_focus_set(entry, EINA_FALSE);
+ }
+ FN_END;
+}
+
+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);
+ elm_entry_input_panel_return_key_disabled_set(obj,
+ EINA_TRUE);
+ } else {
+ elm_object_disabled_set(ad->edit_field_save_btn,
+ EINA_FALSE);
+ elm_entry_input_panel_return_key_disabled_set(obj,
+ EINA_FALSE);
+ }
+
+ free(convert_input_text);
+ }
+ }
+}
+
+static void __bluetooth_auth_check_clicked_cb(void *data, Evas_Object *obj,
+ void *event_info)
+{
+ struct bt_popup_appdata *ad = data;
+ Eina_Bool state = elm_check_state_get(obj);
+
+ BT_INFO("Check %d", state);
+ ad->make_trusted = state;
+}
+
+static void __bluetooth_auth_check_label_clicked_cb(void *data, Evas_Object *obj,
+ void *event_info)
+{
+ FN_START;
+ ret_if (!obj || !data);
+
+ Elm_Object_Item *item = NULL;
+ item = (Elm_Object_Item *)event_info;
+ ret_if (!item);
+
+ struct bt_popup_appdata *ad = data;
+ ret_if (!ad);
+
+ Evas_Object *content = elm_object_item_part_content_get(item, "elm.icon.2");
+ Evas_Object *ck = elm_object_part_content_get(content, "elm.swallow.content");
+
+ elm_genlist_item_selected_set(item, EINA_FALSE);
+
+ Eina_Bool state = elm_check_state_get(ck);
+
+ elm_check_state_set(ck, !state);
+
+ BT_INFO("Check %d", !state);
+ ad->make_trusted = !state;
+
+ FN_END;
+}
+static void __bluetooth_mouseup_auth_cb(void *data,
+ Evas *e, Evas_Object *obj, void *event_info)
+{
+ Evas_Event_Mouse_Up *ev = event_info;
+ struct bt_popup_appdata *ad = data;
+ DBusMessage *msg = NULL;
+ int response = BT_AGENT_REJECT;
+
+ BT_DBG("Mouse event callback function is called + ");
+
+ if (ev->button == 3) {
+ evas_object_event_callback_del(obj, EVAS_CALLBACK_MOUSE_UP,
+ __bluetooth_mouseup_auth_cb);
+ evas_object_event_callback_del(obj, EVAS_CALLBACK_KEY_DOWN,
+ __bluetooth_keyback_auth_cb);
+ msg = dbus_message_new_signal(BT_SYS_POPUP_IPC_RESPONSE_OBJECT,
+ BT_SYS_POPUP_INTERFACE,
+ BT_SYS_POPUP_METHOD_RESPONSE);
+
+ 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);
+ __bluetooth_win_del(ad);
+ }
+ BT_DBG("Mouse event callback -");
+}
+
+static void __bluetooth_keyback_auth_cb(void *data,
+ Evas *e, Evas_Object *obj, void *event_info)
+{
+ Evas_Event_Key_Down *ev = event_info;
+ struct bt_popup_appdata *ad = data;
+ DBusMessage *msg = NULL;
+ int response = BT_AGENT_REJECT;
+
+ BT_DBG("Keyboard event callback function is called + ");
+
+#if 0
+ if (!strcmp(ev->keyname, KEY_BACK)) {
+ evas_object_event_callback_del(obj, EVAS_CALLBACK_MOUSE_UP,
+ __bluetooth_mouseup_auth_cb);
+ evas_object_event_callback_del(obj, EVAS_CALLBACK_KEY_DOWN,
+ __bluetooth_keyback_auth_cb);
+
+ msg = dbus_message_new_signal(BT_SYS_POPUP_IPC_RESPONSE_OBJECT,
+ BT_SYS_POPUP_INTERFACE,
+ BT_SYS_POPUP_METHOD_RESPONSE);
+
+ 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);
+ __bluetooth_win_del(ad);
+ }
+#endif
+ BT_DBG("Keyboard Mouse event callback -");
+}
+
+static void __bluetooth_draw_auth_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 };
+ Evas_Object *btn1 = NULL;
+ Evas_Object *btn2 = NULL;
+ Evas_Object *layout = NULL;
+ Evas_Object *label = NULL;
+ Evas_Object *check = NULL;
+ BT_DBG("+");
+
+ ad->make_trusted = TRUE;
+
+ ad->popup = elm_popup_add(ad->layout);
+ elm_popup_align_set(ad->popup, ELM_NOTIFY_ALIGN_FILL, 1.0);
+ elm_object_style_set(ad->popup, "transparent");
+
+ /*set window level to HIGH*/
+ __bluetooth_set_win_level(ad->popup);
+
+ layout = elm_layout_add(ad->popup);
+ elm_layout_file_set(layout, CUSTOM_POPUP_PATH, "auth_popup");
+ evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND,
+ EVAS_HINT_EXPAND);
+
+ if (title != NULL) {
+
+ elm_object_part_text_set(ad->popup, "title,text",
+ BT_STR_ALLOW_APP_PERMISSION);
+
+ snprintf(temp_str, BT_TITLE_STR_MAX_LEN + BT_TEXT_EXTRA_LEN,
+ "%s", title);
+
+ label = elm_label_add(ad->popup);
+ elm_object_style_set(label, "popup/default");
+ elm_label_line_wrap_set(label, ELM_WRAP_MIXED);
+ elm_object_text_set(label, temp_str);
+ evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(label, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_object_part_content_set(layout, "popup_title", label);
+ evas_object_show(label);
+ }
+
+ /* check */
+ check = elm_check_add(ad->popup);
+ elm_object_style_set(check, "popup");
+ elm_check_state_set(check, EINA_FALSE);
+ elm_object_text_set(check, BT_STR_DONT_ASK_AGAIN);
+ evas_object_size_hint_align_set(check, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(check, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_show(check);
+ evas_object_smart_callback_add(check, "changed",
+ __bluetooth_auth_check_clicked_cb, ad);
+ elm_object_part_content_set(layout, "check", check);
+
+ evas_object_show(layout);
+ elm_object_content_set(ad->popup, layout);
+
+ btn1 = elm_button_add(ad->popup);
+ elm_object_style_set(btn1, "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_style_set(btn2, "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);
+
+ evas_object_event_callback_add(ad->popup, EVAS_CALLBACK_MOUSE_UP,
+ __bluetooth_mouseup_auth_cb, ad);
+ evas_object_event_callback_add(ad->popup, EVAS_CALLBACK_KEY_DOWN,
+ __bluetooth_keyback_auth_cb, ad);
+
+ evas_object_show(ad->popup);
+ evas_object_show(ad->win_main);
+
+ BT_DBG("-");
+}
+
+static void __bluetooth_mouseup_cb(void *data,
+ Evas *e, Evas_Object *obj, void *event_info)
+{
+ Evas_Event_Mouse_Up *ev = event_info;
+ struct bt_popup_appdata *ad = data;
+
+ BT_DBG("Mouse event callback function is called + ");
+
+ if (ev->button == 3) {
+ evas_object_event_callback_del(obj, EVAS_CALLBACK_MOUSE_UP,
+ __bluetooth_mouseup_cb);
+ evas_object_event_callback_del(obj, EVAS_CALLBACK_KEY_DOWN,
+ __bluetooth_keyback_cb);
+ __bluetooth_remove_all_event(ad);
+ }
+ BT_DBG("Mouse event callback -");
+}
+
+static void __bluetooth_keyback_cb(void *data,
+ Evas *e, Evas_Object *obj, void *event_info)
+{
+ Evas_Event_Key_Down *ev = event_info;
+ struct bt_popup_appdata *ad = data;
+
+ BT_DBG("Keyboard event callback function is called %s+ ", ev->keyname);
+#if 0
+ if (!strcmp(ev->keyname, KEY_BACK)) {
+
+ evas_object_event_callback_del(obj, EVAS_CALLBACK_MOUSE_UP,
+ __bluetooth_mouseup_cb);
+ evas_object_event_callback_del(obj, EVAS_CALLBACK_KEY_DOWN,
+ __bluetooth_keyback_cb);
+ __bluetooth_remove_all_event(ad);
+ }
+#endif
+ BT_DBG("Keyboard Mouse event callback -");
+}
+
+static void __bluetooth_draw_popup(struct bt_popup_appdata *ad,
+ const char *title, char *text, char *btn1_text,
+ char *btn2_text, void (*func) (void *data,
+ Evas_Object *obj, void *event_info))
+{
+ Evas_Object *btn1;
+ Evas_Object *btn2;
+
+ BT_DBG("__bluetooth_draw_popup");
+
+ ad->popup = elm_popup_add(ad->layout);
+ elm_popup_align_set(ad->popup, ELM_NOTIFY_ALIGN_FILL, 1.0);
+
+ /*set window level to HIGH*/
+ __bluetooth_set_win_level(ad->popup);
+
+#ifdef TIZEN_REDWOOD
+ elm_object_style_set(ad->popup, "transparent");
+#endif
+ if (title != NULL) {
+ elm_object_part_text_set(ad->popup, "title,text", title);
+ }
+
+ if (text != NULL) {
+ char *markup_text = NULL;
+ markup_text = elm_entry_utf8_to_markup(text);
+ elm_object_text_set(ad->popup, markup_text);
+ free(markup_text);
+ }
+
+ if ((btn1_text != NULL) && (btn2_text != NULL)) {
+ btn1 = elm_button_add(ad->popup);
+ elm_object_style_set(btn1, "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_style_set(btn2, "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_style_set(btn1, "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);
+ }
+
+ evas_object_event_callback_add(ad->popup, EVAS_CALLBACK_MOUSE_UP,
+ __bluetooth_mouseup_cb, ad);
+ evas_object_event_callback_add(ad->popup, EVAS_CALLBACK_KEY_DOWN,
+ __bluetooth_keyback_cb, ad);
+
+ evas_object_show(ad->popup);
+ evas_object_show(ad->win_main);
+ elm_object_focus_set(ad->popup, EINA_TRUE);
+
+ BT_DBG("__bluetooth_draw_popup END");
+}
+
+static void __bluetooth_input_mouseup_cb(void *data,
+ Evas *e, Evas_Object *obj, void *event_info)
+{
+ FN_START;
+ Evas_Event_Mouse_Up *ev = event_info;
+ struct bt_popup_appdata *ad = data;
+ int response = BT_AGENT_CANCEL;
+ char *input_text = NULL;
+ char *convert_input_text = NULL;
+
+ BT_DBG("ev->button : %d", ev->button);
+
+ if (ev->button == 3) {
+ ret_if (ad == NULL);
+ evas_object_event_callback_del(ad->entry, EVAS_CALLBACK_MOUSE_UP,
+ __bluetooth_input_mouseup_cb);
+ evas_object_event_callback_del(ad->entry, EVAS_CALLBACK_KEY_DOWN,
+ __bluetooth_input_keyback_cb);
+ evas_object_event_callback_del(ad->popup, EVAS_CALLBACK_MOUSE_UP,
+ __bluetooth_input_mouseup_cb);
+ evas_object_event_callback_del(ad->popup, EVAS_CALLBACK_KEY_DOWN,
+ __bluetooth_input_keyback_cb);
+
+ /* 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 (convert_input_text == NULL)
+ return;
+
+ if (ad->event_type == BT_EVENT_PIN_REQUEST) {
+ dbus_g_proxy_call_no_reply(ad->agent_proxy,
+ "ReplyPinCode", G_TYPE_UINT, response,
+ 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, response,
+ G_TYPE_STRING, convert_input_text,
+ G_TYPE_INVALID, G_TYPE_INVALID);
+ }
+ __bluetooth_delete_input_view(ad);
+ free(convert_input_text);
+ if (ad->entry) {
+ evas_object_del(ad->entry);
+ ad->entry = NULL;
+ }
+ __bluetooth_win_del(ad);
+ }
+ FN_END;
+}
+
+static void __bluetooth_input_keyback_cb(void *data,
+ Evas *e, Evas_Object *obj, void *event_info)
+{
+ FN_START;
+ Evas_Event_Key_Down *ev = event_info;
+ struct bt_popup_appdata *ad = data;
+ int response = BT_AGENT_CANCEL;
+ char *input_text = NULL;
+ char *convert_input_text = NULL;
+
+#if 0
+ if (!strcmp(ev->keyname, KEY_BACK)) {
+ if (ad == NULL)
+ return;
+ evas_object_event_callback_del(ad->entry, EVAS_CALLBACK_MOUSE_UP,
+ __bluetooth_input_mouseup_cb);
+ evas_object_event_callback_del(ad->entry, EVAS_CALLBACK_KEY_DOWN,
+ __bluetooth_input_keyback_cb);
+ evas_object_event_callback_del(ad->popup, EVAS_CALLBACK_MOUSE_UP,
+ __bluetooth_input_mouseup_cb);
+ evas_object_event_callback_del(ad->popup, EVAS_CALLBACK_KEY_DOWN,
+ __bluetooth_input_keyback_cb);
+ /* 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 (convert_input_text == NULL)
+ return;
+
+ if (ad->event_type == BT_EVENT_PIN_REQUEST) {
+ BT_DBG("It is PIN Request event ");
+ dbus_g_proxy_call_no_reply(ad->agent_proxy,
+ "ReplyPinCode", G_TYPE_UINT, response,
+ G_TYPE_STRING, convert_input_text,
+ G_TYPE_INVALID, G_TYPE_INVALID);
+ } else {
+ BT_DBG("It is PASSKEYRequest event ");
+ dbus_g_proxy_call_no_reply(ad->agent_proxy,
+ "ReplyPasskey", G_TYPE_UINT, response,
+ G_TYPE_STRING, convert_input_text,
+ G_TYPE_INVALID, G_TYPE_INVALID);
+ }
+ __bluetooth_delete_input_view(ad);
+ free(convert_input_text);
+ __bluetooth_win_del(ad);
+ }
+#endif
+ FN_END;
+}
+
+static void __bluetooth_pin_check_clicked_cb(void *data, Evas_Object *obj,
+ void *event_info)
+{
+ FN_START;
+ ret_if(!obj || !data);
+
+ Eina_Bool state = elm_check_state_get(obj);
+
+ BT_INFO("Check %d", state);
+ if (state) {
+ elm_entry_password_set((Evas_Object *)data, EINA_FALSE);
+ } else {
+ elm_entry_password_set((Evas_Object *)data, EINA_TRUE);
+ }
+
+ FN_END;
+}
+
+static void __bluetooth_pswd_check_box_sel(void *data, Evas_Object *obj,
+ void *event_info)
+{
+ FN_START;
+ ret_if (!obj || !data);
+
+ Elm_Object_Item *item = NULL;
+ item = (Elm_Object_Item *)event_info;
+ ret_if (!item);
+
+ struct bt_popup_appdata *ad = data;
+ ret_if (!ad);
+
+ Evas_Object *content = elm_object_item_part_content_get(item, "elm.icon.2");
+ Evas_Object *ck = elm_object_part_content_get(content, "elm.swallow.content");
+
+ elm_genlist_item_selected_set(item, EINA_FALSE);
+
+ Eina_Bool state = elm_check_state_get(ck);
+
+ elm_check_state_set(ck, !state);
+
+ if (ad->entry) {
+ __bluetooth_pin_check_clicked_cb(ad->entry, ck, NULL);
+ }
+
+ FN_END;
+}
+
+static void __bluetooth_entry_edit_mode_show_cb(void *data, Evas *e, Evas_Object *obj,
+ void *event_info)
+{
+ FN_START;
+ evas_object_event_callback_del(obj, EVAS_CALLBACK_SHOW,
+ __bluetooth_entry_edit_mode_show_cb);
+
+ elm_object_focus_set(obj, EINA_TRUE);
+ FN_END;
+}
+
+static void __bluetooth_entry_activated_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ FN_START;
+ if (!obj)
+ return;
+
+ elm_object_focus_set(obj, EINA_FALSE);
+ FN_END;
+}
+
+
+
+static Evas_Object *__bluetooth_passwd_entry_icon_get(
+ void *data, Evas_Object *obj, const char *part)
+{
+ FN_START;
+ retv_if (obj == NULL || data == NULL, NULL);
+
+ Evas_Object *entry = NULL;
+ Evas_Object *layout = NULL;
+ Evas_Object *button = NULL;
+ struct bt_popup_appdata *ad = data;
+ static Elm_Entry_Filter_Limit_Size limit_filter_data;
+
+ if (!strcmp(part, "elm.icon.entry")) {
+ layout = elm_layout_add(obj);
+ elm_layout_file_set(layout, CUSTOM_POPUP_PATH, "entry_style");
+ evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+
+
+ static Elm_Entry_Filter_Accept_Set accept_set = {
+ .accepted = "0123456789",
+ .rejected = NULL
+ };
+
+ entry = ea_editfield_add(layout, EA_EDITFIELD_SCROLL_SINGLELINE_PASSWORD);
+#if 0
+ ea_entry_selection_back_event_allow_set(entry, EINA_TRUE);
+#endif
+ evas_object_size_hint_weight_set(entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(entry, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_entry_single_line_set(entry, EINA_TRUE);
+ elm_entry_prediction_allow_set(entry, EINA_FALSE);
+ elm_entry_scrollable_set(entry, EINA_TRUE);
+ elm_object_signal_emit(entry, "elm,action,hide,search_icon", "");
+ elm_object_part_text_set(entry, "elm.guide", BT_STR_PIN);
+
+ elm_entry_markup_filter_append(entry, elm_entry_filter_accept_set,
+ &accept_set);
+
+ elm_entry_cnp_mode_set(entry, ELM_CNP_MODE_PLAINTEXT);
+
+ elm_entry_password_set(entry, EINA_TRUE);
+ elm_entry_input_panel_layout_set(entry, ELM_INPUT_PANEL_LAYOUT_NUMBERONLY);
+
+ elm_entry_input_panel_return_key_type_set(entry, ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DONE);
+ elm_entry_input_panel_return_key_disabled_set(entry, EINA_TRUE);
+
+ if (ad->event_type == BT_EVENT_PASSKEY_REQUEST)
+ limit_filter_data.max_char_count = BT_PK_MLEN;
+ else
+ limit_filter_data.max_char_count = BT_PIN_MLEN;
+
+ elm_entry_markup_filter_append(entry,
+ elm_entry_filter_limit_size, &limit_filter_data);
+
+ evas_object_event_callback_add(entry, EVAS_CALLBACK_KEY_DOWN,
+ __bluetooth_entry_keydown_cb, ad);
+
+ evas_object_smart_callback_add(entry, "activated",
+ __bluetooth_entry_activated_cb, ad);
+ evas_object_smart_callback_add(entry, "changed",
+ __bluetooth_entry_change_cb, ad);
+
+ evas_object_event_callback_add(entry, EVAS_CALLBACK_SHOW,
+ __bluetooth_entry_edit_mode_show_cb, ad);
+
+ elm_object_part_content_set(layout, "entry_part", entry);
+ //evas_object_show(entry);
+ //elm_object_focus_set(entry, EINA_TRUE);
+
+ ad->entry = entry;
+
+ }
+
+ FN_END;
+ return layout;
+}
+
+static char *__bluetooth_popup_desc_label_get(void *data, Evas_Object *obj,
+ const char *part)
+{
+ retv_if (!data, NULL);
+
+ if (!strcmp(part, "elm.text.multiline"))
+ return (char *)data;
+ return NULL;
+}
+
+static char *__bluetooth_access_check_label_get(void *data, Evas_Object *obj,
+ const char *part)
+{
+ FN_START;
+ retv_if (!data, NULL);
+ retv_if (!strcmp(part, "elm.text.main.left"),
+ g_strdup(BT_STR_DO_NOT_SHOW_AGAIN));
+ FN_END;
+ return NULL;
+}
+
+static char *__bluetooth_passwd_show_passwd_label_get(void *data, Evas_Object *obj,
+ const char *part)
+{
+ FN_START;
+ retv_if (!data, NULL);
+ retv_if (!strcmp(part, "elm.text.main.left"), g_strdup(BT_STR_SHOW_PIN));
+ FN_END;
+ return NULL;
+}
+static Evas_Object *__bluetooth_access_check_icon_get(
+ void *data, Evas_Object *obj, const char *part)
+
+{
+ FN_START;
+ retv_if (strcmp(part, "elm.icon.2"), NULL);
+ struct bt_popup_appdata *ad = data;
+ retv_if(!ad, NULL);
+ Evas_Object *layout = NULL;
+ layout = elm_layout_add(obj);
+
+ elm_layout_theme_set(layout, "layout", "list/C/type.2", "default");
+ Evas_Object *check = elm_check_add(layout);
+ evas_object_propagate_events_set(check, EINA_FALSE);
+ elm_object_style_set(check, "popup");
+ if (ad->make_trusted == 0)
+ elm_check_state_set(check, EINA_FALSE);
+ else
+ elm_check_state_set(check, EINA_TRUE);
+ evas_object_size_hint_align_set(check, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(check, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_smart_callback_add(check, "changed",
+ __bluetooth_auth_check_clicked_cb, ad);
+
+ elm_object_tree_focus_allow_set(check, EINA_FALSE);
+ elm_layout_content_set(layout, "elm.swallow.content", check);
+ FN_END;
+ return layout;
+}
+static Evas_Object *__bluetooth_passwd_show_passwd_icon_get(
+ void *data, Evas_Object *obj, const char *part)
+
+{
+ FN_START;
+ retv_if (strcmp(part, "elm.icon.2"), NULL);
+ struct bt_popup_appdata *ad = data;
+ retv_if(!ad, NULL);
+ Evas_Object *layout = NULL;
+ layout = elm_layout_add(obj);
+
+ elm_layout_theme_set(layout, "layout", "list/C/type.2", "default");
+ Evas_Object *check = elm_check_add(layout);
+ evas_object_propagate_events_set(check, EINA_FALSE);
+ elm_object_style_set(check, "popup");
+ elm_check_state_set(check, EINA_FALSE);
+ evas_object_size_hint_align_set(check, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(check, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_smart_callback_add(check, "changed",
+ __bluetooth_pin_check_clicked_cb, ad->entry);
+
+ elm_object_tree_focus_allow_set(check, EINA_FALSE);
+ elm_layout_content_set(layout, "elm.swallow.content", check);
+ FN_END;
+ return layout;
+}
+
+static void __bluetooth_draw_input_view(struct bt_popup_appdata *ad,
+ const char *title, const char *text,
+ void (*func)
+ (void *data, Evas_Object *obj, void *event_info))
+{
+ FN_START;
+ Evas_Object *conformant = NULL;
+ Evas_Object *content = NULL;
+ Evas_Object *layout = NULL;
+ Evas_Object *passpopup = NULL;
+ Evas_Object *label = NULL;
+ Evas_Object *entry = NULL;
+ Evas_Object *check = NULL;
+ Evas_Object *l_button = NULL;
+ Evas_Object *r_button = NULL;
+ Ecore_IMF_Context *imf_context;
+ static Elm_Entry_Filter_Limit_Size limit_filter_data;
+ Evas_Object *genlist = NULL;
+ Elm_Object_Item *git = NULL;
+
+ ret_if(ad == NULL || ad->win_main == NULL || ad->layout == NULL);
+
+ evas_object_show(ad->win_main);
+
+ passpopup = elm_popup_add(ad->layout);
+ elm_object_content_set(ad->layout, passpopup);
+ elm_object_style_set(passpopup, "no_effect");
+ ad->popup = passpopup;
+
+ /*set window level to HIGH*/
+ __bluetooth_set_win_level(ad->popup);
+
+ elm_object_part_text_set(passpopup, "title,text", title);
+
+ elm_object_style_set(passpopup, "transparent");
+
+ layout = elm_layout_add(passpopup);
+
+ ad->rotation = elm_win_rotation_get(ad->win_main);
+ BT_INFO("Start angle: %d", ad->rotation);
+
+ if (ad->rotation == BT_ROTATE_0 ||
+ ad->rotation == BT_ROTATE_180)
+ elm_layout_file_set(layout, CUSTOM_POPUP_PATH, "passwd_popup");
+ else
+ elm_layout_file_set(layout, CUSTOM_POPUP_PATH, "passwd_popup_landscape_ly");
+ evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+
+ genlist = elm_genlist_add(layout);
+ evas_object_size_hint_weight_set(genlist,
+ EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(genlist, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
+
+ /* Description */
+ ad->passwd_desc_itc = elm_genlist_item_class_new();
+ if (ad->passwd_desc_itc) {
+ ad->passwd_desc_itc->item_style = "multiline_main";
+ ad->passwd_desc_itc->func.text_get = __bluetooth_popup_desc_label_get;
+ ad->passwd_desc_itc->func.content_get = NULL;
+ ad->passwd_desc_itc->func.state_get = NULL;
+ ad->passwd_desc_itc->func.del = NULL;
+
+ git = elm_genlist_item_append(genlist, ad->passwd_desc_itc, g_strdup(text), NULL,
+ ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ elm_genlist_item_select_mode_set(git,
+ ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
+ }
+
+ /* Entry genlist item */
+ ad->passwd_entry_itc = elm_genlist_item_class_new();
+ if (ad->passwd_entry_itc) {
+ ad->passwd_entry_itc->item_style = "entry.icon";
+ ad->passwd_entry_itc->func.text_get = NULL;
+ ad->passwd_entry_itc->func.content_get = __bluetooth_passwd_entry_icon_get;
+ ad->passwd_entry_itc->func.state_get = NULL;
+ ad->passwd_entry_itc->func.del = NULL;
+
+ elm_genlist_item_append(genlist, ad->passwd_entry_itc, ad,
+ NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ }
+
+ /* Show password */
+ ad->passwd_show_passwd_itc = elm_genlist_item_class_new();
+ if (ad->passwd_show_passwd_itc) {
+ ad->passwd_show_passwd_itc->item_style = "1line";
+ ad->passwd_show_passwd_itc->func.text_get = __bluetooth_passwd_show_passwd_label_get;
+ ad->passwd_show_passwd_itc->func.content_get = __bluetooth_passwd_show_passwd_icon_get;
+ ad->passwd_show_passwd_itc->func.state_get = NULL;
+ ad->passwd_show_passwd_itc->func.del = NULL;
+
+ git = elm_genlist_item_append(genlist, ad->passwd_show_passwd_itc, ad,
+ NULL, ELM_GENLIST_ITEM_NONE,
+ __bluetooth_pswd_check_box_sel, ad);
+ }
+
+ l_button = elm_button_add(passpopup);
+ elm_object_style_set(l_button, "popup");
+ elm_object_text_set(l_button, BT_STR_CANCEL);
+ elm_object_part_content_set(passpopup, "button1", l_button);
+ evas_object_smart_callback_add(l_button, "clicked", func, ad);
+ elm_object_tree_focus_allow_set(l_button, EINA_FALSE);
+
+
+ r_button = elm_button_add(passpopup);
+ elm_object_style_set(r_button, "popup");
+ elm_object_text_set(r_button, BT_STR_PAIR);
+ elm_object_part_content_set(passpopup, "button2", r_button);
+ evas_object_smart_callback_add(r_button, "clicked", func, ad);
+ elm_object_disabled_set(r_button, EINA_TRUE);
+ elm_object_tree_focus_allow_set(r_button, EINA_FALSE);
+ ad->edit_field_save_btn = r_button;
+
+
+ evas_object_event_callback_add(ad->popup, EVAS_CALLBACK_MOUSE_UP,
+ __bluetooth_input_mouseup_cb, ad);
+ evas_object_event_callback_add(ad->popup, EVAS_CALLBACK_KEY_DOWN,
+ __bluetooth_input_keyback_cb, ad);
+
+ evas_object_event_callback_add(r_button, EVAS_CALLBACK_MOUSE_UP,
+ __bluetooth_input_mouseup_cb, ad);
+ evas_object_event_callback_add(r_button, EVAS_CALLBACK_KEY_DOWN,
+ __bluetooth_input_keyback_cb, ad);
+
+ evas_object_event_callback_add(l_button, EVAS_CALLBACK_MOUSE_UP,
+ __bluetooth_input_mouseup_cb, ad);
+ evas_object_event_callback_add(l_button, EVAS_CALLBACK_KEY_DOWN,
+ __bluetooth_input_keyback_cb, ad);
+
+#if 0
+ elm_genlist_realization_mode_set(genlist, EINA_TRUE);
+#endif
+ evas_object_show(genlist);
+ elm_object_part_content_set(layout, "elm.swallow.layout", genlist);
+
+ elm_object_content_set(passpopup, layout);
+ evas_object_show(passpopup);
+ evas_object_show(layout);
+
+ FN_END;
+}
+
+static void __bluetooth_draw_access_request_popup(struct bt_popup_appdata *ad,
+ const char *title, char *text, 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 };
+ Evas_Object *layout = NULL;
+ Evas_Object *btn1 = NULL;
+ Evas_Object *btn2 = NULL;
+ Evas_Object *genlist = NULL;
+ Elm_Object_Item *git = NULL;
+
+ BT_DBG("+");
+ ad->make_trusted = FALSE;
+
+ ad->popup = elm_popup_add(ad->layout);
+ elm_popup_align_set(ad->popup, ELM_NOTIFY_ALIGN_FILL, 1.0);
+
+ /*set window level to HIGH*/
+ __bluetooth_set_win_level(ad->popup);
+
+ if (title != NULL) {
+ elm_object_part_text_set(ad->popup, "title,text", title);
+ }
+
+ /* layout */
+ layout = elm_layout_add(ad->popup);
+ elm_layout_file_set(layout, CUSTOM_POPUP_PATH, "access_req_popup");
+ evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+
+ genlist = elm_genlist_add(layout);
+ elm_genlist_homogeneous_set(genlist, EINA_TRUE);
+ evas_object_size_hint_weight_set(genlist,
+ EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(genlist, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
+
+ /* Description text*/
+ ad->desc_itc = elm_genlist_item_class_new();
+ if (ad->desc_itc) {
+ ad->desc_itc->item_style = "multiline_main";
+ ad->desc_itc->func.text_get = __bluetooth_popup_desc_label_get;
+ ad->desc_itc->func.content_get = NULL;
+ ad->desc_itc->func.state_get = NULL;
+ ad->desc_itc->func.del = NULL;
+
+ git = elm_genlist_item_append(genlist, ad->desc_itc, g_strdup(text), NULL,
+ ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ elm_genlist_item_select_mode_set(git,
+ ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
+ }
+
+ /* Do not show again */
+ ad->check_itc = elm_genlist_item_class_new();
+ if (ad->check_itc) {
+ ad->check_itc->item_style = "1line";
+ ad->check_itc->func.text_get = __bluetooth_access_check_label_get;
+ ad->check_itc->func.content_get = __bluetooth_access_check_icon_get;
+ ad->check_itc->func.state_get = NULL;
+ ad->check_itc->func.del = NULL;
+
+ git = elm_genlist_item_append(genlist, ad->check_itc, ad,
+ NULL, ELM_GENLIST_ITEM_NONE,
+ __bluetooth_auth_check_label_clicked_cb, ad);
+ }
+
+ if (btn1_text != NULL && btn2_text != NULL) {
+ /* Cancel button */
+ btn1 = elm_button_add(ad->popup);
+ elm_object_style_set(btn1, "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);
+
+ /* Allow button */
+ btn2 = elm_button_add(ad->popup);
+ elm_object_style_set(btn2, "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);
+ }
+
+#if 0
+ elm_genlist_realization_mode_set(genlist, EINA_TRUE);
+#endif
+ evas_object_show(genlist);
+ elm_object_part_content_set(layout, "elm.swallow.layout", genlist);
+
+ elm_object_content_set(ad->popup, layout);
+ evas_object_show(ad->popup);
+ evas_object_show(ad->win_main);
+ BT_DBG("-");
+}
+
+static void __bluetooth_draw_information_popup(struct bt_popup_appdata *ad,
+ const char *title, char *text, char *btn1_text,
+ void (*func) (void *data, Evas_Object *obj, void *event_info))
+{
+ BT_DBG("+");
+ Evas_Object *btn1 = NULL;
+
+ ad->popup = elm_popup_add(ad->layout);
+ elm_popup_align_set(ad->popup, ELM_NOTIFY_ALIGN_FILL, 1.0);
+ ea_object_event_callback_add(ad->popup, EA_CALLBACK_BACK, func, ad);
+
+ /*set window level to HIGH*/
+ __bluetooth_set_win_level(ad->popup);
+
+ if (title)
+ elm_object_part_text_set(ad->popup, "title,text", title);
+
+ if (text)
+ elm_object_text_set(ad->popup, text);
+
+ if (btn1_text != NULL) {
+ /* OK button */
+ btn1 = elm_button_add(ad->popup);
+ elm_object_style_set(btn1, "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);
+ }
+
+ evas_object_show(ad->popup);
+ evas_object_show(ad->win_main);
+ BT_DBG("-");
+}
+
+static void __bluetooth_delete_input_view(struct bt_popup_appdata *ad)
+{
+ FN_START;
+ __bluetooth_ime_hide();
+ FN_END;
+}
+
+static DBusGProxy* __bluetooth_create_agent_proxy(DBusGConnection *conn,
+ const char *path)
+{
+#ifdef __ENABLE_BLUEZ5__
+ return dbus_g_proxy_new_for_name(conn, "org.projectx.bt", path,
+ "org.bluez.Agent1");
+#else
+ return dbus_g_proxy_new_for_name(conn, "org.projectx.bt", path,
+ "org.bluez.Agent");
+#endif
+}
+
+static void
+__bluetooth_popup_block_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ FN_START;
+ if(obj)
+ evas_object_del(obj);
+}
+
+static void
+__bluetooth_popup_timeout_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ FN_START;
+ if(obj)
+ evas_object_del(obj);
+}
+
+static void __bluetooth_draw_toast_popup(struct bt_popup_appdata *ad, char *toast_text)
+{
+ FN_START;
+ ad->popup = elm_popup_add(ad->win_main);
+ elm_object_style_set(ad->popup, "toast");
+ evas_object_size_hint_weight_set(ad->popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ ea_object_event_callback_add(ad->popup, EA_CALLBACK_BACK, ea_popup_back_cb, NULL);
+ elm_object_part_text_set(ad->popup,"elm.text.content", toast_text);
+ evas_object_smart_callback_add(ad->popup, "block,clicked", __bluetooth_popup_block_clicked_cb, NULL);
+
+ __bluetooth_set_win_level(ad->popup);
+
+ evas_object_show(ad->popup);
+ FN_END;
+}
+
+/* AUL bundle handler */
+static int __bluetooth_launch_handler(struct bt_popup_appdata *ad,
+ void *reset_data, const char *event_type)
+{
+ FN_START;
+ 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;
+ const char *agent_path;
+ char *conv_str = NULL;
+
+ if (!reset_data || !event_type)
+ return -1;
+
+ BT_INFO("Event Type = %s[0X%X]", event_type, ad->event_type);
+
+ if (!strcasecmp(event_type, "pin-request")) {
+ device_name = bundle_get_val(kb, "device-name");
+ agent_path = bundle_get_val(kb, "agent-path");
+
+ ad->agent_proxy = __bluetooth_create_agent_proxy(ad->conn, agent_path);
+ retv_if(!ad->agent_proxy, -1);
+
+ if (device_name)
+ conv_str = elm_entry_utf8_to_markup(device_name);
+
+ snprintf(view_title, BT_TITLE_STR_MAX_LEN,
+ "%s", BT_STR_BLUETOOTH_PAIRING_REQUEST);
+
+ snprintf(text, BT_GLOBALIZATION_STR_LENGTH,
+ BT_STR_ENTER_THE_PIN_TO_PAIR, conv_str);
+
+ if (conv_str)
+ free(conv_str);
+
+ /* Request user inputted PIN for basic pairing */
+ __bluetooth_draw_input_view(ad, view_title, text,
+ __bluetooth_input_request_cb);
+ } else if (!strcasecmp(event_type, "passkey-confirm-request")) {
+ device_name = bundle_get_val(kb, "device-name");
+ passkey = bundle_get_val(kb, "passkey");
+ agent_path = bundle_get_val(kb, "agent-path");
+
+ ad->agent_proxy = __bluetooth_create_agent_proxy(ad->conn, agent_path);
+ if (!ad->agent_proxy)
+ return -1;
+
+ if (device_name && passkey) {
+
+ snprintf(view_title, BT_TITLE_STR_MAX_LEN,
+ BT_STR_CONFIRM_PASSKEY_PS_TO_PAIR_WITH_PS,
+ passkey, device_name);
+
+ BT_INFO("title: %s", view_title);
+
+ __bluetooth_draw_popup(ad, BT_STR_BLUETOOTH_PAIRING_REQUEST,
+ view_title, BT_STR_CANCEL, BT_STR_CONFIRM,
+ __bluetooth_passkey_confirm_cb);
+ } else {
+ timeout = BT_ERROR_TIMEOUT;
+ }
+ } else if (!strcasecmp(event_type, "passkey-request")) {
+ const char *device_name = NULL;
+
+ device_name = bundle_get_val(kb, "device-name");
+ agent_path = bundle_get_val(kb, "agent-path");
+
+ ad->agent_proxy = __bluetooth_create_agent_proxy(ad->conn, agent_path);
+ if (!ad->agent_proxy)
+ return -1;
+
+ if (device_name)
+ conv_str = elm_entry_utf8_to_markup(device_name);
+
+ snprintf(view_title, BT_TITLE_STR_MAX_LEN,
+ "%s", BT_STR_BLUETOOTH_PAIRING_REQUEST);
+
+ snprintf(text, BT_GLOBALIZATION_STR_LENGTH,
+ BT_STR_ENTER_THE_PIN_TO_PAIR, conv_str);
+
+ if (conv_str)
+ free(conv_str);
+
+ /* Request user inputted Passkey for basic pairing */
+ __bluetooth_draw_input_view(ad, view_title, text,
+ __bluetooth_input_request_cb);
+
+ } else if (!strcasecmp(event_type, "passkey-display-request")) {
+ device_name = bundle_get_val(kb, "device-name");
+ passkey = bundle_get_val(kb, "passkey");
+
+ if (device_name && passkey) {
+
+ snprintf(view_title, BT_TITLE_STR_MAX_LEN,
+ BT_STR_ENTER_PS_ON_PS_TO_PAIR, passkey, device_name);
+
+ BT_INFO("title: %s", view_title);
+
+ __bluetooth_draw_popup(ad, BT_STR_SHOW_PASSWORD, view_title,
+ BT_STR_CANCEL, NULL,
+ __bluetooth_input_cancel_cb);
+ } else {
+ timeout = BT_ERROR_TIMEOUT;
+ }
+ } else if (!strcasecmp(event_type, "authorize-request")) {
+ timeout = BT_AUTHORIZATION_TIMEOUT;
+
+ device_name = bundle_get_val(kb, "device-name");
+ agent_path = bundle_get_val(kb, "agent-path");
+
+ ad->agent_proxy = __bluetooth_create_agent_proxy(ad->conn, agent_path);
+ if (!ad->agent_proxy)
+ return -1;
+
+ 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_auth_popup(ad, view_title, BT_STR_CANCEL, BT_STR_ACCEPT,
+ __bluetooth_authorization_request_cb);
+ } else if (!strcasecmp(event_type, "app-confirm-request")) {
+ BT_DBG("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, NULL, title, BT_STR_CANCEL, BT_STR_OK,
+ __bluetooth_app_confirm_cb);
+ } else if (strcasecmp(type, "onebtn") == 0) {
+ timeout = BT_NOTIFICATION_TIMEOUT;
+ __bluetooth_draw_popup(ad, NULL, title, BT_STR_OK, NULL,
+ __bluetooth_app_confirm_cb);
+ } else if (strcasecmp(type, "none") == 0) {
+ timeout = BT_NOTIFICATION_TIMEOUT;
+ __bluetooth_draw_popup(ad, NULL, title, NULL, NULL,
+ __bluetooth_app_confirm_cb);
+ }
+ } else if (!strcasecmp(event_type, "push-authorize-request")) {
+ timeout = BT_AUTHORIZATION_TIMEOUT;
+
+ device_name = bundle_get_val(kb, "device-name");
+ file = bundle_get_val(kb, "file");
+
+ if (device_name) {
+ snprintf(view_title, BT_TITLE_STR_MAX_LEN,
+ BT_STR_RECEIVE_PS_FROM_PS_Q, file, device_name);
+ }
+
+ __bluetooth_draw_popup(ad, BT_STR_RECEIVE_FILE, view_title, BT_STR_CANCEL, BT_STR_OK,
+ __bluetooth_push_authorization_request_cb);
+ } else if (!strcasecmp(event_type, "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, BT_STR_RECEIVE_FILE, view_title,
+ BT_STR_CANCEL, BT_STR_OK,
+ __bluetooth_app_confirm_cb);
+ } else if (!strcasecmp(event_type, "keyboard-passkey-request")) {
+ device_name = bundle_get_val(kb, "device-name");
+ passkey = bundle_get_val(kb, "passkey");
+
+ if (device_name && passkey) {
+ snprintf(view_title, BT_TITLE_STR_MAX_LEN,
+ BT_STR_ENTER_PS_ON_PS_TO_PAIR, passkey, device_name);
+
+ BT_INFO("title: %s", view_title);
+
+ __bluetooth_draw_popup(ad, BT_STR_BLUETOOTH_PAIRING_REQUEST,
+ view_title,
+ BT_STR_CANCEL, NULL,
+ __bluetooth_input_cancel_cb);
+ } else {
+ timeout = BT_ERROR_TIMEOUT;
+ }
+ } else if (!strcasecmp(event_type, "bt-information")) {
+ BT_DBG("bt-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, NULL, title, BT_STR_OK, NULL,
+ __bluetooth_app_confirm_cb);
+ } else if (strcasecmp(type, "none") == 0) {
+ __bluetooth_draw_popup(ad, NULL, title, NULL, NULL,
+ __bluetooth_app_confirm_cb);
+ }
+ } else if (!strcasecmp(event_type, "exchange-request")) {
+ timeout = BT_AUTHORIZATION_TIMEOUT;
+
+ device_name = bundle_get_val(kb, "device-name");
+ agent_path = bundle_get_val(kb, "agent-path");
+
+ ad->agent_proxy = __bluetooth_create_agent_proxy(ad->conn, agent_path);
+ if (!ad->agent_proxy)
+ return -1;
+
+ if (device_name) {
+ snprintf(view_title, BT_TITLE_STR_MAX_LEN,
+ BT_STR_WANTS_TO_SEND_YOU_A_FILE, device_name);
+ }
+
+ __bluetooth_draw_popup(ad, BT_STR_RECEIVE_FILE,
+ view_title, BT_STR_CANCEL, BT_STR_ACCEPT,
+ __bluetooth_authorization_request_cb);
+ } else if (!strcasecmp(event_type, "phonebook-request")) {
+ timeout = BT_AUTHORIZATION_TIMEOUT;
+
+ device_name = bundle_get_val(kb, "device-name");
+ agent_path = bundle_get_val(kb, "agent-path");
+
+ ad->agent_proxy = __bluetooth_create_agent_proxy(ad->conn, agent_path);
+ if (!ad->agent_proxy)
+ return -1;
+
+ if (device_name)
+ conv_str = elm_entry_utf8_to_markup(device_name);
+
+#ifdef TIZEN_REDWOOD
+ snprintf(view_title, BT_TITLE_STR_MAX_LEN,
+ BT_STR_ALLOW_PS_PHONEBOOK_ACCESS_Q, conv_str);
+#else
+ snprintf(view_title, BT_TITLE_STR_MAX_LEN,
+ BT_STR_PS_CONTACT_REQUEST, conv_str);
+#endif
+
+ if (conv_str)
+ free(conv_str);
+
+#ifdef TIZEN_REDWOOD
+ __bluetooth_draw_auth_popup(ad, view_title, BT_STR_CANCEL, BT_STR_OK,
+ __bluetooth_authorization_request_cb);
+#else
+ __bluetooth_draw_access_request_popup(ad, BT_STR_ALLOW_APP_PERMISSION,
+ view_title, BT_STR_CANCEL, BT_STR_ALLOW,
+ __bluetooth_authorization_request_cb);
+#endif
+ } else if (!strcasecmp(event_type, "message-request")) {
+ timeout = BT_AUTHORIZATION_TIMEOUT;
+
+ device_name = bundle_get_val(kb, "device-name");
+ agent_path = bundle_get_val(kb, "agent-path");
+
+ ad->agent_proxy = __bluetooth_create_agent_proxy(ad->conn, agent_path);
+ if (!ad->agent_proxy)
+ return -1;
+
+ if (device_name)
+ conv_str = elm_entry_utf8_to_markup(device_name);
+
+#ifdef TIZEN_REDWOOD
+ snprintf(view_title, BT_TITLE_STR_MAX_LEN,
+ BT_STR_ALLOW_PS_TO_ACCESS_MESSAGES_Q, conv_str);
+#else
+ snprintf(view_title, BT_TITLE_STR_MAX_LEN,
+ BT_STR_PS_MESSAGE_REQUEST, conv_str);
+#endif
+
+ if (conv_str)
+ free(conv_str);
+
+#ifdef TIZEN_REDWOOD
+ __bluetooth_draw_auth_popup(ad, view_title, BT_STR_CANCEL, BT_STR_OK,
+ __bluetooth_authorization_request_cb);
+#else
+ __bluetooth_draw_access_request_popup(ad, BT_STR_ALLOW_APP_PERMISSION,
+ view_title, BT_STR_CANCEL, BT_STR_ALLOW,
+ __bluetooth_authorization_request_cb);
+#endif
+ } else if (!strcasecmp(event_type, "pairing-retry-request")) {
+ int ret;
+ 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_UNABLE_TO_PAIR, conv_str);
+
+ if (conv_str)
+ free(conv_str);
+
+ ret = notification_status_message_post(view_title);
+ if (ret != NOTIFICATION_ERROR_NONE)
+ BT_ERR("notification_status_message_post() is failed : %d\n", ret);
+ } else if (!strcasecmp(event_type, "remote-legacy-pair-failed")) {
+ BT_DBG("remote-legacy-pair-failed");
+ device_name = bundle_get_val(kb, "device-name");
+
+ if (device_name)
+ conv_str = elm_entry_utf8_to_markup(device_name);
+ snprintf(text, BT_GLOBALIZATION_STR_LENGTH,
+ BT_STR_UNABLE_TO_PAIR, conv_str);
+ if (conv_str)
+ free(conv_str);
+
+ __bluetooth_draw_information_popup(ad, "Bluetooth Error",
+ text, BT_STR_OK,
+ __bluetooth_information_cb);
+ } else if (!strcasecmp(event_type, "music-auto-connect-request")) {
+ __bluetooth_draw_toast_popup(ad, "Connecting...");
+ } else {
+ return -1;
+ }
+
+ if (ad->event_type != BT_EVENT_FILE_RECEIVED && timeout != 0) {
+ ad->timer = ecore_timer_add(timeout, (Ecore_Task_Cb)
+ __bluetooth_request_timeout_cb, ad);
+ }
+ BT_DBG("-");
+ return 0;
+}
+
+static void __popup_terminate(void)
+{
+ BT_DBG("+");
+ elm_exit();
+ BT_DBG("-");
+}
+
+static void __bluetooth_win_del(void *data)
+{
+ BT_DBG("+");
+ struct bt_popup_appdata *ad = (struct bt_popup_appdata *)data;
+
+ __bluetooth_cleanup(ad);
+ __bluetooth_cleanup_win(ad);
+ __popup_terminate();
+ BT_DBG("+");
+}
+
+static void __bluetooth_set_win_level(Evas_Object *parent)
+{
+ ret_if(!parent);
+ Ecore_X_Window xwin;
+ int lock_state;
+
+ xwin = elm_win_xwindow_get(parent);
+ if (xwin == 0) {
+ BT_ERR("elm_win_xwindow_get is failed");
+ } else {
+ BT_DBG("Setting window type");
+#if 0
+ ecore_x_netwm_window_type_set(xwin,
+ ECORE_X_WINDOW_TYPE_NOTIFICATION);
+#endif
+ if (vconf_get_int(VCONFKEY_IDLE_LOCK_STATE, &lock_state) != 0) {
+ BT_ERR("Fail to get the lock_state value");
+ }
+
+/*
+ Issue: Pairing request pop appears in the Lock screen when DUT is locked
+ and observed inconsistency. (TMWC-746)
+ In platform image, don't have the additional logic to handle this.
+ So just the set notification level as LOW.
+*/
+#if 0
+ if (lock_state == VCONFKEY_IDLE_UNLOCK) {
+ utilx_set_system_notification_level(ecore_x_display_get(),
+ xwin, UTILX_NOTIFICATION_LEVEL_HIGH);
+ } else
+ utilx_set_system_notification_level(ecore_x_display_get(),
+ xwin, UTILX_NOTIFICATION_LEVEL_LOW);
+#endif
+ }
+}
+
+static Evas_Object *__bluetooth_create_win(const char *name)
+{
+ Evas_Object *eo;
+ int w;
+ int h;
+
+ eo = elm_win_add(NULL, name, ELM_WIN_BASIC);
+ retv_if(!eo, NULL);
+
+ elm_win_alpha_set(eo, EINA_TRUE);
+ /* Handle rotation */
+ if (elm_win_wm_rotation_supported_get(eo)) {
+ int rots[4] = {0, 90, 180, 270};
+ elm_win_wm_rotation_available_rotations_set(eo,
+ (const int*)(&rots), 4);
+ }
+ elm_win_title_set(eo, name);
+ elm_win_borderless_set(eo, EINA_TRUE);
+#if 0
+ ecore_x_window_size_get(ecore_x_window_root_first_get(),
+ &w, &h);
+ evas_object_resize(eo, w, h);
+#endif
+ 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_ERR("ERROR: Can't get on system bus [%s]",
+ err->message);
+ g_error_free(err);
+ return;
+ }
+
+ ad->conn = conn;
+
+ ad->obex_proxy = dbus_g_proxy_new_for_name(conn,
+ "org.bluez.frwk_agent",
+ "/org/obex/ops_agent",
+ "org.openobex.Agent");
+ if (!ad->obex_proxy)
+ BT_ERR("Could not create obex dbus proxy");
+
+ if (!__bluetooth_init_app_signal(ad))
+ BT_ERR("__bt_syspopup_init_app_signal failed");
+}
+
+static void __bluetooth_vconf_change_cb(keynode_t *key, void *data)
+{
+ retm_if(NULL == key, "key is NULL");
+ retm_if(NULL == data, "data is NULL");
+ struct bt_popup_appdata *ad = data;
+
+ char *vconf_name = vconf_keynode_get_name(key);
+
+ if (!g_strcmp0(vconf_name, VCONFKEY_IDLE_LOCK_STATE) &&
+ ad->popup)
+ __bluetooth_set_win_level(ad->popup);
+}
+
+static bool __bluetooth_create(void *data)
+{
+ struct bt_popup_appdata *ad = data;
+ Evas_Object *win = NULL;
+ Evas_Object *conformant = NULL;
+ Evas_Object *layout = NULL;
+ int ret;
+
+ BT_DBG("__bluetooth_create() start.");
+
+ /* create window */
+ win = __bluetooth_create_win(PACKAGE);
+ retv_if (win == NULL, false);
+
+#if 0
+ /* Enable Changeable UI feature */
+ ea_theme_changeable_ui_enabled_set(EINA_TRUE);
+#endif
+
+ evas_object_smart_callback_add(win, "wm,rotation,changed",
+ __bt_main_win_rot_changed_cb, data);
+ ad->win_main = win;
+
+ conformant = elm_conformant_add(ad->win_main);
+ retv_if(!conformant, false);
+
+ elm_win_conformant_set(ad->win_main, EINA_TRUE);
+ elm_win_resize_object_add(ad->win_main, 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);
+ ad->conform = conformant;
+
+ layout = elm_layout_add(conformant);
+ elm_object_content_set(conformant, layout);
+ ad->layout = layout;
+ evas_object_show(layout);
+
+ /* init internationalization */
+ bindtextdomain(BT_COMMON_PKG, BT_LOCALEDIR);
+ textdomain(BT_COMMON_PKG);
+
+ ecore_imf_init();
+
+ __bluetooth_session_init(ad);
+ ret = vconf_notify_key_changed(VCONFKEY_IDLE_LOCK_STATE,
+ __bluetooth_vconf_change_cb, ad);
+ if (ret != 0)
+ BT_ERR("vconf_notify_key_changed fail!");
+ if (bt_initialize() != BT_ERROR_NONE) {
+ BT_ERR("bt_initialize is failed");
+ }
+
+ return true;
+}
+
+static void __bluetooth_terminate(void *data)
+{
+ struct bt_popup_appdata *ad = data;
+
+ if (bt_deinitialize() != BT_ERROR_NONE) {
+ BT_ERR("bt_deinitialize is failed");
+ }
+ __bluetooth_ime_hide();
+
+ if (ad->conn) {
+ dbus_g_connection_unref(ad->conn);
+ ad->conn = NULL;
+ }
+
+ if (ad->popup)
+ evas_object_del(ad->popup);
+
+ if (ad->win_main)
+ evas_object_del(ad->win_main);
+
+ ad->popup = NULL;
+ ad->win_main = NULL;
+}
+
+static void __bluetooth_pause(void *data)
+{
+ return;
+}
+
+static void __bluetooth_resume(void *data)
+{
+ return;
+}
+
+static void __bluetooth_reset(app_control_h app_control, void *data)
+{
+ struct bt_popup_appdata *ad = data;
+ bundle *b = NULL;
+ const char *event_type = NULL;
+ int ret = 0;
+
+ BT_DBG("__bluetooth_reset()");
+
+ if (ad == NULL) {
+ BT_ERR("App data is NULL");
+ return;
+ }
+ ret = app_control_export_as_bundle(app_control, &b);
+ if (ret != 0) {
+ BT_ERR("Failed to Convert the service handle to bundle data");
+ free(b);
+ return;
+ }
+ /* Start Main UI */
+ event_type = bundle_get_val(b, "event-type");
+ BT_DBG("event-type: %s", event_type);
+
+ if (event_type != NULL) {
+ if (!strcasecmp(event_type, "terminate")) {
+ __bluetooth_win_del(ad);
+ goto release;
+ }
+
+ if (syspopup_has_popup(b))
+ __bluetooth_cleanup(ad); /* Destroy the existing popup*/
+
+ __bluetooth_parse_event(ad, event_type);
+
+ if (syspopup_reset(b) == -1 &&
+ syspopup_create(b, &handler, ad->win_main, ad) == -1) {
+ BT_ERR("Both syspopup_create and syspopup_reset failed");
+ __bluetooth_remove_all_event(ad);
+ } else {
+ ret = __bluetooth_launch_handler(ad,
+ b, event_type);
+
+ if (ret != 0)
+ __bluetooth_remove_all_event(ad);
+
+ __bluetooth_notify_event(ad);
+
+ /* Change LCD brightness */
+ ret = device_display_change_state(DISPLAY_STATE_NORMAL);
+ if (ret != 0)
+ BT_ERR("Fail to change LCD");
+ }
+ } else {
+ BT_ERR("event type is NULL ");
+ }
+release :
+ bundle_free(b);
+}
+
+EXPORT int main(int argc, char *argv[])
+{
+ BT_DBG("Start bt-syspopup main()");
+
+ ui_app_lifecycle_callback_s callback = {0,};
+
+ struct bt_popup_appdata ad = {0,};
+
+ callback.create = __bluetooth_create;
+ callback.terminate = __bluetooth_terminate;
+ callback.pause = __bluetooth_pause;
+ callback.resume = __bluetooth_resume;
+ callback.app_control = __bluetooth_reset;
+
+ BT_DBG("ui_app_main() is called.");
+ int ret = ui_app_main(argc, argv, &callback, &ad);
+ if (ret != APP_ERROR_NONE) {
+ BT_ERR("ui_app_main() is failed. err = %d", ret);
+ }
+
+ BT_DBG("End bt-syspopup main()");
+ return ret;
+}
--- /dev/null
+/*
+* bt-syspopup
+*
+* Copyright 2013 Samsung Electronics Co., Ltd
+*
+* Contact: Hocheol Seo <hocheol.seo@samsung.com>
+* GirishAshok Joshi <girish.joshi@samsung.com>
+* DoHyun Pyun <dh79.pyun@samsung.com>
+*
+* Licensed under the Flora License, Version 1.1 (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.
+*
+*/
+
+#ifndef __DEF_BT_SYSPOPUP_H_
+#define __DEF_BT_SYSPOPUP_H_
+
+#include <Elementary.h>
+#include <dlog.h>
+#include <glib.h>
+#include <dbus/dbus-glib.h>
+#include <player.h>
+
+#ifndef PACKAGE_NAME
+#define PACKAGE_NAME "org.tizen.bt-syspopup"
+#endif
+
+#ifndef PREFIX
+#define PREFIX "/usr/apps"PACKAGE_NAME
+#endif
+
+#define EXPORT __attribute__((visibility("default")))
+
+#define TEMP_DIR "/tmp"
+
+#define PACKAGE "bt-syspopup"
+#define APPNAME "bt-syspopup"
+#define ICON_DIR PREFIX"/res/default/small/icon"
+
+#define CUSTOM_POPUP_PATH PREFIX"/res/edje/custom_popup.edj"
+
+#define BT_COMMON_PKG "ug-bluetooth-efl"
+#define BT_LOCALEDIR "/usr/apps/ug-bluetooth-efl/shared/res/locale"
+
+#define _EDJ(obj) elm_layout_edje_get(obj)
+
+#define BT_AUTHENTICATION_TIMEOUT 35
+#define BT_AUTHORIZATION_TIMEOUT 25
+#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
+
+#undef LOG_TAG
+#define LOG_TAG "BLUETOOTH_SYSPOPUP"
+
+
+#define BT_DBG(format, args...) SLOGD(format, ##args)
+#define BT_ERR(format, args...) SLOGE(format, ##args)
+#define BT_INFO(format, args...) SLOGI(format, ##args)
+
+#define FN_START BT_DBG("[ENTER FUNC]");
+#define FN_END BT_DBG("[EXIT FUNC]");
+
+#define BT_DBG_SECURE(fmt, args...) SECURE_SLOGD(fmt, ##args)
+#define BT_ERR_SECURE(fmt, args...) SECURE_SLOGE(fmt, ##args)
+
+#define ret_if(expr) \
+ do { \
+ if (expr) { \
+ BT_ERR("(%s) return", #expr); \
+ return; \
+ } \
+ } while (0);
+
+#define retv_if(expr, val) \
+ do { \
+ if (expr) { \
+ BT_ERR("(%s) return", #expr); \
+ return (val); \
+ } \
+ } while (0);
+
+#define retm_if(expr, fmt, arg...) \
+ do { \
+ if (expr) { \
+ BT_ERR(fmt, ##arg); \
+ BT_ERR("(%s) return", #expr); \
+ return; \
+ } \
+ } while (0);
+
+#define retvm_if(expr, val, fmt, arg...) \
+ do { \
+ if (expr) { \
+ BT_ERR(fmt, ##arg); \
+ BT_ERR("(%s) return", #expr); \
+ return (val); \
+ } \
+ } while (0);
+
+#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_FILE \
+ dgettext(BT_COMMON_PKG, "IDS_BT_HEADER_RECEIVE_FILES_ABB")
+
+#define BT_STR_RECEIVE_PS_FROM_PS_Q \
+ dgettext(BT_COMMON_PKG, "IDS_BT_POP_RECEIVE_PS_FROM_PS_Q")
+
+#define BT_STR_WANTS_TO_SEND_YOU_A_FILE \
+ dgettext(BT_COMMON_PKG, "IDS_BT_POP_PS_WANTS_TO_SEND_YOU_A_FILE")
+
+#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")
+
+#define BT_STR_ENTER_PS_ON_PS_TO_PAIR \
+ dgettext(BT_COMMON_PKG, "IDS_BT_POP_ENTER_P1SS_ON_P2SS_TO_PAIR_THEN_PRESS_ENTER")
+
+#define BT_STR_RECEIVE_FILE_FROM_PS_Q \
+ dgettext(BT_COMMON_PKG, "IDS_BT_POP_RECEIVE_FILE_FROM_PS_Q")
+
+/* Need to convert the design ID */
+#define BT_STR_BLUETOOTH_PAIRING_REQUEST \
+ dgettext(BT_COMMON_PKG, "IDS_BT_HEADER_BLUETOOTH_PAIRING_REQUEST")
+
+#define BT_STR_ENTER_THE_PIN_TO_PAIR \
+ dgettext(BT_COMMON_PKG, "IDS_BT_POP_ENTER_THE_PIN_TO_PAIR_WITH_PS_HTRY_0000_OR_1234")
+
+#define BT_STR_SHOW_PASSWORD \
+ dgettext(BT_COMMON_PKG, "IDS_BT_BODY_SHOW_PASSWORD")
+
+#define BT_STR_SHOW_PIN \
+ dgettext(BT_COMMON_PKG, "IDS_ST_MBODY_SHOW_PIN")
+
+#define BT_STR_CONFIRM_PASSKEY_PS_TO_PAIR_WITH_PS \
+ dgettext(BT_COMMON_PKG, "IDS_BT_POP_CONFIRM_THE_PIN_HP1SS_TO_PAIR_WITH_P2SS")
+
+#define BT_STR_ALLOW_PS_PHONEBOOK_ACCESS_Q \
+ dgettext(BT_COMMON_PKG, "IDS_BT_POP_PS_IS_REQUESTING_PERMISSION_TO_CONNECT_TO_YOUR_CONTACTS")
+
+#define BT_STR_ALLOW_PS_TO_ACCESS_MESSAGES_Q \
+ dgettext(BT_COMMON_PKG, "IDS_BT_POP_PS_IS_REQUESTING_PERMISSION_TO_CONNECT_TO_YOUR_MESSAGES")
+
+#define BT_STR_DONT_ASK_AGAIN \
+ dgettext(BT_COMMON_PKG, "IDS_BT_BODY_DONT_ASK_AGAIN")
+
+#define BT_STR_PIN_ERROR_TRY_AGAIN_Q \
+ dgettext(BT_COMMON_PKG, "IDS_BT_POP_INCORRECT_PIN_TRY_AGAIN_Q")
+
+#define BT_STR_TIMEOUT_TRY_AGAIN_Q \
+ dgettext(BT_COMMON_PKG, "IDS_BT_POP_BLUETOOTH_TIMEOUT_TRY_AGAIN_Q")
+
+#define BT_STR_PIN \
+ dgettext(BT_COMMON_PKG, "IDS_ST_BODY_PIN")
+
+#define BT_STR_UNABLE_TO_PAIR \
+ dgettext(BT_COMMON_PKG, "IDS_NFC_TPOP_FAILED_TO_PAIR_WITH_PS")
+
+#define BT_STR_ACCESS_REQUEST\
+ dgettext(BT_COMMON_PKG, "IDS_BT_HEADER_ACCESS_REQUEST")
+
+#define BT_STR_PS_CONTACT_REQUEST\
+ dgettext(BT_COMMON_PKG, "IDS_BT_POP_PS_IS_REQUESTING_PERMISSION_TO_ACCESS_YOUR_CONTACTS")
+
+#define BT_STR_PS_MESSAGE_REQUEST\
+ dgettext(BT_COMMON_PKG, "IDS_BT_POP_PS_IS_REQUESTING_PERMISSION_TO_ACCESS_YOUR_MESSAGES")
+
+#define BT_STR_DO_NOT_SHOW_AGAIN\
+ dgettext(BT_COMMON_PKG, "IDS_EMAIL_BODY_DO_NOT_SHOW_AGAIN_VZW")
+
+#define BT_STR_ALLOW_APP_PERMISSION\
+ dgettext(BT_COMMON_PKG, "IDS_BT_HEADER_ALLOW_APPLICATION_PERMISSION")
+
+#define BT_STR_OK dgettext(BT_COMMON_PKG, "IDS_BT_BUTTON_OK")
+#define BT_STR_PAIR dgettext(BT_COMMON_PKG, "IDS_BT_BUTTON_PAIR")
+#define BT_STR_CONFIRM dgettext(BT_COMMON_PKG, "IDS_COM_SK_CONFIRM")
+#define BT_STR_RECEIVE dgettext(BT_COMMON_PKG, "IDS_COM_BODY_RECEIVE")
+#define BT_STR_YES dgettext(BT_COMMON_PKG, "IDS_BR_SK_YES")
+#define BT_STR_NO dgettext(BT_COMMON_PKG, "IDS_BR_SK_NO")
+#define BT_STR_DONE dgettext(BT_COMMON_PKG, "IDS_BR_SK_DONE")
+#define BT_STR_CANCEL dgettext(BT_COMMON_PKG, "IDS_BR_SK_CANCEL")
+#define BT_STR_ALLOW dgettext(BT_COMMON_PKG, "IDS_BR_OPT_ALLOW")
+#define BT_STR_ACCEPT dgettext(BT_COMMON_PKG, "IDS_BT_BUTTON_ACCEPT")
+
+#define VCONF_NOTI_SOUND "db/setting/sound/noti/msg_ringtone_path"
+
+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_RECEIVED = 0x0100,
+ BT_EVENT_KEYBOARD_PASSKEY_REQUEST = 0x0200,
+ BT_EVENT_INFORMATION = 0x0400,
+ BT_EVENT_TERMINATE = 0x0800,
+ BT_EVENT_EXCHANGE_REQUEST = 0x1000,
+ BT_EVENT_PHONEBOOK_REQUEST = 0x2000,
+ BT_EVENT_MESSAGE_REQUEST = 0x4000,
+ BT_EVENT_RETRY_PAIR_REQUEST = 0x8000,
+ BT_EVENT_MUSIC_AUTO_CONNECT_REQUEST = 0x1100,
+ BT_EVENT_LEGACY_PAIR_FAILED_FROM_REMOTE,
+} bt_popup_event_type_t;
+
+typedef enum {
+ BT_AGENT_ACCEPT,
+ BT_AGENT_REJECT,
+ BT_AGENT_CANCEL,
+ BT_CORE_AGENT_TIMEOUT,
+ BT_AGENT_ACCEPT_ALWAYS,
+} bt_agent_accept_type_t;
+
+typedef enum {
+ BT_ROTATE_0 = 0,
+ BT_ROTATE_90 = 90,
+ BT_ROTATE_180 = 180,
+ BT_ROTATE_270 = 270,
+} bt_rotate_mode_t;
+
+struct bt_popup_appdata {
+ Evas *evas;
+ Evas_Object *win_main;
+ Evas_Object *conform;
+ Evas_Object *layout;
+ Evas_Object *popup;
+
+ /* Passkey layout objects */
+ Evas_Object *entry;
+ Evas_Object *edit_field_save_btn;
+ Evas_Object *ticker_noti;
+ Elm_Genlist_Item_Class *passwd_desc_itc;
+ Elm_Genlist_Item_Class *passwd_entry_itc;
+ Elm_Genlist_Item_Class *passwd_show_passwd_itc;
+
+ /*Access Request layout objects */
+ Elm_Genlist_Item_Class *desc_itc;
+ Elm_Genlist_Item_Class *check_itc;
+
+ Ecore_Timer *timer;
+
+ DBusGProxy *agent_proxy;
+ DBusGProxy *obex_proxy;
+ E_DBus_Connection *EDBusHandle;
+ DBusGConnection *conn;
+
+ int changed_mode;
+ bt_rotate_mode_t rotation;
+ gboolean make_trusted;
+ bt_popup_event_type_t event_type;
+
+ player_h player;
+ Ecore_Timer *playing_timer;
+};
+
+#endif /* __DEF_BT_SYSPOPUP_H_ */
--- /dev/null
+/*
+* bt-syspopup
+*
+* Copyright 2013 Samsung Electronics Co., Ltd
+*
+* Contact: Hocheol Seo <hocheol.seo@samsung.com>
+* GirishAshok Joshi <girish.joshi@samsung.com>
+* DoHyun Pyun <dh79.pyun@samsung.com>
+*
+* Licensed under the Flora License, Version 1.1 (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.
+*
+*/
+
+#include <stdio.h>
+#include <dd-display.h>
+#include <app.h>
+#include <Ecore_X.h>
+#include <utilX.h>
+#include <vconf.h>
+#include <vconf-keys.h>
+#include <syspopup.h>
+#include <E_DBus.h>
+#include <aul.h>
+#include <bluetooth.h>
+#include <feedback.h>
+#include <dd-deviced.h>
+#include <efl_assist.h>
+#include "bt-syspopup-w.h"
+#include <dbus/dbus-glib-lowlevel.h>
+#include <bundle_internal.h>
+
+#define COLOR_TABLE "/usr/apps/org.tizen.bt-syspopup/shared/res/tables/org.tizen.bt-syspopup_ChangeableColorTable.xml"
+#define FONT_TABLE "/usr/apps/org.tizen.bt-syspopup/shared/res/tables/org.tizen.bt-syspopup_FontInfoTable.xml"
+
+static char pin_value[BT_PIN_MLEN + 1] = {0,};
+static int pin_index = 0;
+static Ecore_Timer* pass_timer = 0;
+
+static struct _info {
+ const char *part_name;
+ const char *popup_name;
+ int pressed;
+ const char *tts_name;
+ Evas_Object *tts_button;
+} keypad_info[12] = {
+ {"button_00", "popup_00", 0, "0", NULL},
+ {"button_01", "popup_01", 0, "1", NULL},
+ {"button_02", "popup_02", 0, "2", NULL},
+ {"button_03", "popup_03", 0, "3", NULL},
+ {"button_04", "popup_04", 0, "4", NULL},
+ {"button_05", "popup_05", 0, "5", NULL},
+ {"button_06", "popup_06", 0, "6", NULL},
+ {"button_07", "popup_07", 0, "7", NULL},
+ {"button_08", "popup_08", 0, "8", NULL},
+ {"button_09", "popup_09", 0, "9", NULL},
+ {"confirm", "popup_confirm", 0, "Enter", NULL},
+ {"button_clear", "popup_clear", 0, "Back", NULL},
+};
+
+static void __bluetooth_delete_input_view(struct bt_popup_appdata *ad);
+static void __bluetooth_win_del(void *data);
+
+static void __bluetooth_set_win_level(Evas_Object *parent);
+
+static void __bluetooth_input_keyback_cb(void *data,
+ Evas *e, Evas_Object *obj, void *event_info);
+
+static void __bluetooth_input_mouseup_cb(void *data,
+ Evas *e, Evas_Object *obj, void *event_info);
+
+static void __bluetooth_keyback_cb(void *data,
+ Evas *e, Evas_Object *obj, void *event_info);
+
+static void __bluetooth_mouseup_cb(void *data,
+ Evas *e, Evas_Object *obj, void *event_info);
+
+static void __bluetooth_keyback_auth_cb(void *data,
+ Evas *e, Evas_Object *obj, void *event_info);
+
+static void __bluetooth_mouseup_auth_cb(void *data,
+ Evas *e, Evas_Object *obj, void *event_info);
+static void __bluetooth_terminate(void *data);
+
+static int __bt_error_toast_timeout_cb(void *data);
+
+static void __bt_draw_error_toast_popup(struct bt_popup_appdata *ad, char *toast_text);
+
+static void __bt_draw_toast_popup(struct bt_popup_appdata *ad, char *toast_text);
+
+static void __bluetooth_remove_all_event(struct bt_popup_appdata *ad);
+
+static int __bluetooth_term(bundle *b, void *data)
+{
+ BT_DBG("System-popup: terminate");
+ __bluetooth_remove_all_event((struct bt_popup_appdata *)data);
+ __bluetooth_terminate(data);
+ return 0;
+}
+
+static int __bluetooth_timeout(bundle *b, void *data)
+{
+ BT_DBG("System-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)
+{
+ BT_DBG("+");
+
+ if (ad == NULL)
+ return;
+
+ if (ad->viberation_id > 0) {
+ g_source_remove(ad->viberation_id);
+ ad->viberation_id = 0;
+ }
+
+ if (ad->timer) {
+ ecore_timer_del(ad->timer);
+ ad->timer = NULL;
+ }
+
+ if (ad->popup) {
+ elm_access_object_unregister(ad->popup);
+ evas_object_del(ad->popup);
+ ad->popup = NULL;
+ }
+
+ if (ad->ly_pass) {
+ evas_object_del(ad->ly_pass);
+ ad->ly_pass = NULL;
+ }
+
+ if (ad->ly_keypad) {
+ evas_object_del(ad->ly_keypad);
+ ad->ly_keypad = NULL;
+ }
+
+ if (ad->win_main) {
+ evas_object_del(ad->win_main);
+ ad->win_main = NULL;
+ }
+
+ if (ad->agent_proxy) {
+ g_object_unref(ad->agent_proxy);
+ ad->agent_proxy = NULL;
+ }
+
+ BT_DBG("-");
+}
+
+static void __bluetooth_set_win_level(Evas_Object *parent)
+{
+ Ecore_X_Window xwin;
+ xwin = elm_win_xwindow_get(parent);
+ if (xwin == 0) {
+ BT_ERR("elm_win_xwindow_get is failed");
+ } else {
+ BT_DBG("Setting window type");
+ 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_HIGH);
+ }
+}
+
+static void __lock_display()
+{
+ int ret = display_lock_state(LCD_NORMAL, GOTO_STATE_NOW | HOLD_KEY_BLOCK, 0);
+ if (ret < 0)
+ BT_ERR("LCD Lock failed");
+}
+
+static void __unlock_display()
+{
+ int ret = display_unlock_state(LCD_NORMAL, PM_RESET_TIMER);
+ if (ret < 0)
+ BT_ERR("LCD Unlock failed");
+}
+
+static void __bluetooth_notify_event(feedback_pattern_e feedback)
+{
+ int result;
+
+ BT_DBG("Notify event");
+
+ result = feedback_initialize();
+ if (result != FEEDBACK_ERROR_NONE) {
+ BT_ERR("feedback_initialize error : %d", result);
+ return;
+ }
+
+ result = feedback_play(feedback);
+ BT_INFO("feedback [%d], ret value [%d]", feedback, result);
+
+ result = feedback_deinitialize();
+ if (result != FEEDBACK_ERROR_NONE) {
+ BT_INFO("feedback_initialize error : %d", result);
+ return;
+ }
+}
+
+static gboolean __bluetooth_pairing_pattern_cb(gpointer data)
+{
+ __bluetooth_notify_event(FEEDBACK_PATTERN_BT_WAITING);
+
+ return TRUE;
+}
+
+static void __bluetooth_parse_event(struct bt_popup_appdata *ad, const char *event_type)
+{
+ BT_DBG("+");
+
+ if (!strcasecmp(event_type, "pin-request"))
+ ad->event_type = BT_EVENT_PIN_REQUEST;
+ else if (!strcasecmp(event_type, "passkey-confirm-request"))
+ ad->event_type = BT_EVENT_PASSKEY_CONFIRM_REQUEST;
+ else if (!strcasecmp(event_type, "passkey-request"))
+ ad->event_type = BT_EVENT_PASSKEY_REQUEST;
+ else if (!strcasecmp(event_type, "authorize-request"))
+ ad->event_type = BT_EVENT_AUTHORIZE_REQUEST;
+ else if (!strcasecmp(event_type, "app-confirm-request"))
+ ad->event_type = BT_EVENT_APP_CONFIRM_REQUEST;
+ else if (!strcasecmp(event_type, "push-authorize-request"))
+ ad->event_type = BT_EVENT_PUSH_AUTHORIZE_REQUEST;
+ else if (!strcasecmp(event_type, "confirm-overwrite-request"))
+ ad->event_type = BT_EVENT_CONFIRM_OVERWRITE_REQUEST;
+ else if (!strcasecmp(event_type, "keyboard-passkey-request"))
+ ad->event_type = BT_EVENT_KEYBOARD_PASSKEY_REQUEST;
+ else if (!strcasecmp(event_type, "bt-information"))
+ ad->event_type = BT_EVENT_INFORMATION;
+ else if (!strcasecmp(event_type, "exchange-request"))
+ ad->event_type = BT_EVENT_EXCHANGE_REQUEST;
+ else if (!strcasecmp(event_type, "phonebook-request"))
+ ad->event_type = BT_EVENT_PHONEBOOK_REQUEST;
+ else if (!strcasecmp(event_type, "message-request"))
+ ad->event_type = BT_EVENT_MESSAGE_REQUEST;
+ else if (!strcasecmp(event_type, "unable-to-pairing"))
+ ad->event_type = BT_EVENT_UNABLE_TO_PAIRING;
+ else if (!strcasecmp(event_type, "handsfree-disconnect-request"))
+ ad->event_type = BT_EVENT_HANDSFREE_DISCONNECT_REQUEST;
+ else if (!strcasecmp(event_type, "handsfree-connect-request"))
+ ad->event_type = BT_EVENT_HANDSFREE_CONNECT_REQUEST;
+ else if (!strcasecmp(event_type, "music-auto-connect-request"))
+ ad->event_type = BT_EVENT_HANDSFREE_AUTO_CONNECT_REQUEST;
+ else if (!strcasecmp(event_type, "system-reset-request"))
+ ad->event_type = BT_EVENT_SYSTEM_RESET_REQUEST;
+ else
+ ad->event_type = 0x0000;
+
+ BT_DBG("-");
+ return;
+
+}
+
+static void __bluetooth_request_to_cancel(void)
+{
+ bt_device_cancel_bonding();
+}
+
+static void __bluetooth_remove_all_event(struct bt_popup_appdata *ad)
+{
+ BT_INFO("Remove event 0X%X", ad->event_type);
+ switch (ad->event_type) {
+ case BT_EVENT_PIN_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_KEYBOARD_PASSKEY_REQUEST:
+
+ __bluetooth_request_to_cancel();
+
+ 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);
+ __unlock_display();
+
+ 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;
+ int response;
+
+ 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 = BT_AGENT_REJECT;
+
+ 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:
+ case BT_EVENT_EXCHANGE_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_CONFIRM_OVERWRITE_REQUEST: {
+ DBusMessage *msg;
+ int response = BT_AGENT_REJECT;
+
+ msg = dbus_message_new_signal(BT_SYS_POPUP_IPC_RESPONSE_OBJECT,
+ BT_SYS_POPUP_INTERFACE,
+ BT_SYS_POPUP_METHOD_RESPONSE);
+ if (msg == NULL) {
+ BT_ERR("msg == NULL, Allocation failed");
+ break;
+ }
+
+ 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_SYSTEM_RESET_REQUEST:
+
+ dbus_g_proxy_call_no_reply(ad->agent_proxy,
+ "ReplyConfirmation",
+ G_TYPE_UINT, BT_AGENT_CANCEL,
+ G_TYPE_INVALID, G_TYPE_INVALID);
+ __unlock_display();
+
+ break;
+
+ default:
+ break;
+ }
+
+ __bluetooth_win_del(ad);
+}
+
+static void _bt_clear_btn_up_cb(void *data, Evas_Object *o, const char *emission, const char *source)
+{
+ BT_DBG("+");
+ struct bt_popup_appdata *ad = (struct bt_popup_appdata *)data;
+ ret_if(ad == NULL);
+
+ int i = 0;
+ char buf[20] = {0,};
+
+ if(pin_index > 0) {
+ pin_value[pin_index-1] = 0;
+
+ pin_index--;
+
+ for(i = 0; i < pin_index; i++) {
+ strcat(buf, "*");
+ }
+ elm_object_part_text_set(ad->ly_pass, "elm.text.password", buf);
+ }
+}
+
+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_DBG("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_cancel_cb(void *data,
+ Evas_Object *obj, void *event_info)
+{
+ struct bt_popup_appdata *ad = (struct bt_popup_appdata *)data;
+
+ bt_device_cancel_bonding();
+
+ __bluetooth_win_del(ad);
+}
+
+static void __bluetooth_send_signal_pairing_confirm_result(void *data, int response)
+{
+ if (data == NULL)
+ return;
+
+ struct bt_popup_appdata *ad = (struct bt_popup_appdata *)data;
+ DBusMessage *msg = NULL;
+
+ BT_DBG("+");
+
+ msg = dbus_message_new_signal(BT_SYS_POPUP_IPC_RESPONSE_OBJECT,
+ BT_SYS_POPUP_INTERFACE,
+ BT_SYS_POPUP_METHOD_RESPONSE);
+
+ 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);
+
+ BT_DBG("-");
+}
+
+static void __bluetooth_send_signal_reset_confirm_result(void *data, int response)
+{
+ if (data == NULL)
+ return;
+
+ struct bt_popup_appdata *ad = (struct bt_popup_appdata *)data;
+ DBusMessage *msg = NULL;
+
+ BT_DBG("+");
+
+ msg = dbus_message_new_signal(BT_SYS_POPUP_IPC_RESPONSE_OBJECT,
+ BT_SYS_POPUP_INTERFACE,
+ BT_SYS_POPUP_METHOD_RESET_RESPONSE);
+
+ 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);
+
+ BT_DBG("-");
+}
+
+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 (!g_strcmp0(event, BT_STR_OK)) {
+ __bluetooth_send_signal_pairing_confirm_result(ad, 1);
+ dbus_g_proxy_call_no_reply(ad->agent_proxy, "ReplyConfirmation",
+ G_TYPE_UINT, BT_AGENT_ACCEPT,
+ G_TYPE_INVALID, G_TYPE_INVALID);
+ } else {
+ __bluetooth_send_signal_pairing_confirm_result(ad, 0);
+ dbus_g_proxy_call_no_reply(ad->agent_proxy, "ReplyConfirmation",
+ G_TYPE_UINT, BT_AGENT_CANCEL,
+ G_TYPE_INVALID, G_TYPE_INVALID);
+ }
+ __unlock_display();
+
+ evas_object_del(obj);
+ __bluetooth_win_del(ad);
+}
+
+static void __bluetooth_reset_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ DBusMessage *message = NULL;
+ DBusConnection *conn = NULL;
+ int reset = 0;
+
+ if (obj == NULL || data == NULL)
+ return;
+
+ struct bt_popup_appdata *ad = (struct bt_popup_appdata *)data;
+ const char *event = elm_object_text_get(obj);
+
+ __bluetooth_send_signal_pairing_confirm_result(ad, 0);
+ dbus_g_proxy_call_no_reply(ad->agent_proxy, "ReplyConfirmation",
+ G_TYPE_UINT, BT_AGENT_CANCEL,
+ G_TYPE_INVALID, G_TYPE_INVALID);
+
+ if (!g_strcmp0(event, BT_STR_RESET)) {
+ BT_INFO("Confirm Soft reset");
+ reset = 1;
+ }
+ __bluetooth_send_signal_reset_confirm_result(ad, reset);
+
+ __unlock_display();
+
+ 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_ERR("e_dbus_bus_get failed");
+ return FALSE;
+ }
+
+ BT_DBG("e_dbus_bus_get success ");
+ return TRUE;
+}
+
+static void __bluetooth_app_confirm_cb(void *data,
+ Evas_Object *obj, void *event_info)
+{
+ BT_DBG("__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;
+
+ msg = dbus_message_new_signal(BT_SYS_POPUP_IPC_RESPONSE_OBJECT,
+ BT_SYS_POPUP_INTERFACE,
+ BT_SYS_POPUP_METHOD_RESPONSE);
+
+ if (!g_strcmp0(event, BT_STR_OK))
+ response = BT_AGENT_ACCEPT;
+ else
+ response = BT_AGENT_REJECT;
+
+ 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;
+ guint reply_val;
+
+ if (obj == NULL || ad == NULL)
+ return;
+
+ const char *event = elm_object_text_get(obj);
+
+ if (!g_strcmp0(event, BT_STR_OK)) {
+ reply_val = (ad->make_trusted == TRUE) ?
+ BT_AGENT_ACCEPT_ALWAYS : BT_AGENT_ACCEPT;
+ } else {
+ reply_val = BT_AGENT_CANCEL;
+ }
+
+ dbus_g_proxy_call_no_reply(ad->agent_proxy, "ReplyAuthorize",
+ G_TYPE_UINT, reply_val,
+ G_TYPE_INVALID, G_TYPE_INVALID);
+
+ ad->make_trusted = FALSE;
+
+ __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 (!g_strcmp0(event, BT_STR_OK))
+ 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_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 Eina_Bool timer_cb(void *data)
+{
+ struct bt_popup_appdata *ad = (struct bt_popup_appdata *)data;
+ retv_if(ad == NULL, ECORE_CALLBACK_CANCEL);
+
+ char buf[BT_PIN_MLEN + 1] = {0,};
+ int i = 0;
+
+ if(pass_timer != NULL) {
+ ecore_timer_del(pass_timer);
+ pass_timer = NULL;
+ }
+
+ if(pin_index != 0) {
+ for(i = 0; i < pin_index; i++) {
+ strcat(buf,"*");
+ }
+ elm_object_part_text_set(ad->ly_pass, "elm.text.password", buf);
+ }
+
+ return ECORE_CALLBACK_CANCEL;
+}
+
+static void __bluetooth_auth_check_clicked_cb(void *data, Evas_Object *obj,
+ void *event_info)
+{
+ struct bt_popup_appdata *ad = data;
+ Eina_Bool state = elm_check_state_get(obj);
+
+ BT_INFO("Check %d", state);
+ ad->make_trusted = state;
+}
+
+static void __bluetooth_mouseup_auth_cb(void *data,
+ Evas *e, Evas_Object *obj, void *event_info)
+{
+ Evas_Event_Mouse_Up *ev = event_info;
+ struct bt_popup_appdata *ad = data;
+ DBusMessage *msg = NULL;
+ int response = BT_AGENT_REJECT;
+
+ BT_DBG("Mouse event callback function is called + ");
+
+ if (ev->button == 3) {
+ evas_object_event_callback_del(obj, EVAS_CALLBACK_MOUSE_UP,
+ __bluetooth_mouseup_auth_cb);
+ evas_object_event_callback_del(obj, EVAS_CALLBACK_KEY_DOWN,
+ __bluetooth_keyback_auth_cb);
+ msg = dbus_message_new_signal(BT_SYS_POPUP_IPC_RESPONSE_OBJECT,
+ BT_SYS_POPUP_INTERFACE,
+ BT_SYS_POPUP_METHOD_RESPONSE);
+
+ 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);
+ __bluetooth_win_del(ad);
+ }
+ BT_DBG("Mouse event callback -");
+}
+
+static void __bluetooth_keyback_auth_cb(void *data,
+ Evas *e, Evas_Object *obj, void *event_info)
+{
+ Evas_Event_Key_Down *ev = event_info;
+ struct bt_popup_appdata *ad = data;
+ DBusMessage *msg = NULL;
+ int response = BT_AGENT_REJECT;
+
+ BT_DBG("Keyboard event callback function is called + ");
+
+ if (!strcmp(ev->keyname, KEY_BACK)) {
+ evas_object_event_callback_del(obj, EVAS_CALLBACK_MOUSE_UP,
+ __bluetooth_mouseup_auth_cb);
+ evas_object_event_callback_del(obj, EVAS_CALLBACK_KEY_DOWN,
+ __bluetooth_keyback_auth_cb);
+
+ msg = dbus_message_new_signal(BT_SYS_POPUP_IPC_RESPONSE_OBJECT,
+ BT_SYS_POPUP_INTERFACE,
+ BT_SYS_POPUP_METHOD_RESPONSE);
+
+ 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);
+ __bluetooth_win_del(ad);
+ }
+ BT_DBG("Keyboard Mouse event callback -");
+}
+
+static void __bluetooth_draw_auth_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 };
+ Evas_Object *btn1;
+ Evas_Object *btn2;
+ Evas_Object *layout;
+ Evas_Object *label;
+ Evas_Object *label2;
+ Evas_Object *check;
+ Evas_Object *ao = NULL;
+ BT_DBG("+");
+
+ ad->make_trusted = TRUE;
+
+ ad->popup = elm_popup_add(ad->win_main);
+ evas_object_size_hint_weight_set(ad->popup, EVAS_HINT_EXPAND,
+ EVAS_HINT_EXPAND);
+
+ elm_object_style_set(ad->popup, "transparent");
+
+ layout = elm_layout_add(ad->popup);
+ elm_layout_file_set(layout, CUSTOM_POPUP_PATH, "auth_popup");
+ evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND,
+ EVAS_HINT_EXPAND);
+
+ if (title != NULL) {
+ snprintf(temp_str, BT_TITLE_STR_MAX_LEN + BT_TEXT_EXTRA_LEN,
+ "%s", title);
+
+ label = elm_label_add(ad->popup);
+ elm_object_style_set(label, "popup/default");
+ elm_label_line_wrap_set(label, ELM_WRAP_MIXED);
+ elm_object_text_set(label, temp_str);
+ evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(label, EVAS_HINT_FILL,
+ EVAS_HINT_FILL);
+ elm_object_part_content_set(layout, "popup_title", label);
+ evas_object_show(label);
+ }
+
+ check = elm_check_add(ad->popup);
+ elm_check_state_set(check, EINA_TRUE);
+ evas_object_size_hint_align_set(check, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(check, EVAS_HINT_EXPAND,
+ EVAS_HINT_EXPAND);
+ evas_object_smart_callback_add(check, "changed",
+ __bluetooth_auth_check_clicked_cb, ad);
+ elm_object_part_content_set(layout, "check", check);
+ evas_object_show(check);
+
+ label2 = elm_label_add(ad->popup);
+ elm_object_style_set(label2, "popup/default");
+ elm_label_line_wrap_set(label2, ELM_WRAP_MIXED);
+ elm_object_text_set(label2, BT_STR_DONT_ASK_AGAIN);
+ evas_object_size_hint_weight_set(label2, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(label2, EVAS_HINT_FILL,
+ EVAS_HINT_FILL);
+ elm_object_part_content_set(layout, "check_label", label2);
+ evas_object_show(label2);
+
+ evas_object_show(layout);
+ elm_object_content_set(ad->popup, layout);
+
+ btn1 = elm_button_add(ad->popup);
+ elm_object_style_set(btn1, "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_style_set(btn2, "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);
+
+ evas_object_event_callback_add(ad->popup, EVAS_CALLBACK_MOUSE_UP,
+ __bluetooth_mouseup_auth_cb, ad);
+ evas_object_event_callback_add(ad->popup, EVAS_CALLBACK_KEY_DOWN,
+ __bluetooth_keyback_auth_cb, ad);
+
+ evas_object_show(ad->popup);
+ evas_object_show(ad->win_main);
+
+ ao = elm_access_object_register(ad->popup, ad->win_main);
+ if (ao != NULL) {
+ elm_access_info_set(ao, ELM_ACCESS_INFO, temp_str);
+ } else {
+ BT_ERR("elm_access_object_register error!");
+ }
+
+ BT_DBG("-");
+}
+
+static void __bluetooth_draw_reset_popup(struct bt_popup_appdata *ad,
+ const char *msg, char *btn1_text,
+ char *btn2_text, void (*func) (void *data,
+ Evas_Object *obj, void *event_info))
+{
+ char *txt;
+ Evas_Object *btn1;
+ Evas_Object *btn2;
+ Evas_Object *label;
+ Evas_Object *ao = NULL;
+
+ BT_DBG("+");
+
+ ad->popup = elm_popup_add(ad->win_main);
+ if (ad->popup == NULL) {
+ BT_ERR("elm_popup_add is failed");
+ return;
+ }
+ evas_object_size_hint_weight_set(ad->popup,
+ EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_object_part_text_set(ad->popup, "title,text", BT_STR_TITLE_CONNECT);
+ ea_object_event_callback_add(ad->popup, EA_CALLBACK_BACK,
+ ea_popup_back_cb, NULL);
+
+ if (msg != NULL) {
+ txt = elm_entry_utf8_to_markup(msg);
+ elm_object_text_set(ad->popup, txt);
+ free(txt);
+ }
+
+ btn1 = elm_button_add(ad->popup);
+ elm_object_style_set(btn1, "popup");
+ evas_object_size_hint_weight_set(btn1, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ 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_style_set(btn2, "popup");
+ evas_object_size_hint_weight_set(btn2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ 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);
+
+ evas_object_show(ad->popup);
+ evas_object_show(ad->win_main);
+ elm_object_focus_set(ad->popup, EINA_TRUE);
+
+ ao = elm_access_object_register(ad->popup, ad->win_main);
+ if (ao != NULL) {
+ elm_access_info_set(ao, ELM_ACCESS_INFO, msg);
+ } else {
+ BT_ERR("elm_access_object_register error!");
+ }
+
+ BT_DBG("-");
+}
+
+static void __bluetooth_mouseup_cb(void *data,
+ Evas *e, Evas_Object *obj, void *event_info)
+{
+ Evas_Event_Mouse_Up *ev = event_info;
+ struct bt_popup_appdata *ad = data;
+
+ BT_DBG("Mouse event callback function is called + ");
+
+ if (ev->button == 3) {
+ evas_object_event_callback_del(obj, EVAS_CALLBACK_MOUSE_UP,
+ __bluetooth_mouseup_cb);
+ evas_object_event_callback_del(obj, EVAS_CALLBACK_KEY_DOWN,
+ __bluetooth_keyback_cb);
+ __bluetooth_remove_all_event(ad);
+ }
+ BT_DBG("Mouse event callback -");
+}
+
+static void __bluetooth_keyback_cb(void *data,
+ Evas *e, Evas_Object *obj, void *event_info)
+{
+ Evas_Event_Key_Down *ev = event_info;
+ struct bt_popup_appdata *ad = data;
+
+ BT_INFO("Keyboard event callback function is called %s+ ", ev->keyname);
+
+ if (!strcmp(ev->keyname, KEY_BACK)) {
+
+ evas_object_event_callback_del(obj, EVAS_CALLBACK_MOUSE_UP,
+ __bluetooth_mouseup_cb);
+ evas_object_event_callback_del(obj, EVAS_CALLBACK_KEY_DOWN,
+ __bluetooth_keyback_cb);
+ __bluetooth_remove_all_event(ad);
+ }
+ BT_DBG("Keyboard Mouse event callback -");
+}
+
+char* __bluetooth_convert_rgba_to_hex(int r, int g, int b, int a)
+{
+ int hexcolor = 0;
+ char* string = NULL;
+
+ string = g_try_malloc0(sizeof(char )* 255);
+
+ hexcolor = (r << 24) + (g << 16) + (b << 8) + a;
+ sprintf(string, "%08x", hexcolor );
+
+ return string;
+}
+
+
+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))
+{
+ BT_DBG("__bluetooth_draw_popup");
+ Evas_Object *btn1;
+ Evas_Object *btn2;
+ Evas_Object *bg;
+ Evas_Object *label = NULL;
+ Evas_Object *scroller;
+ Evas_Object *default_ly;
+ Evas_Object *layout;
+ Evas_Object *scroller_layout;
+ Evas_Object *ao = NULL;
+ char *txt;
+ char *buf;
+ int r = 0, g = 0, b = 0, a = 0;
+ char *font;
+ int size;
+
+
+ bg = elm_bg_add(ad->win_main);
+ evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(ad->win_main, bg);
+ evas_object_show(bg);
+
+ default_ly = elm_layout_add(bg);
+ elm_layout_theme_set(default_ly, "layout", "application", "default");
+ evas_object_size_hint_weight_set(default_ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_object_part_content_set(bg, "elm.swallow.content", default_ly);
+ evas_object_show(default_ly);
+
+ layout = elm_layout_add(default_ly);
+ elm_layout_file_set(layout, CUSTOM_POPUP_PATH, "passkey_confirm_popup");
+ evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_object_part_content_set(default_ly, "elm.swallow.content", layout);
+ evas_object_show(layout);
+
+ scroller = elm_scroller_add(layout);
+ elm_object_style_set(scroller, "effect");
+ evas_object_size_hint_weight_set(scroller, EVAS_HINT_EXPAND,
+ EVAS_HINT_EXPAND);
+ evas_object_show(scroller);
+
+ scroller_layout = elm_layout_add(scroller);
+ elm_layout_file_set(scroller_layout, CUSTOM_POPUP_PATH, "passkey_confirm_popup_scroller");
+ evas_object_size_hint_weight_set(scroller_layout, EVAS_HINT_EXPAND,
+ EVAS_HINT_EXPAND);
+
+ if (title) {
+ BT_INFO("Title %s", title);
+ label = elm_label_add(scroller_layout);
+ elm_label_line_wrap_set(label, ELM_WRAP_MIXED);
+ ea_theme_color_get("AT012",&r, &g, &b, &a,
+ NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL);
+ ea_theme_font_get("AT012", &font, &size);
+ BT_INFO("font : %s, size : %d", font, size);
+
+ elm_object_part_content_set(scroller_layout, "elm.text.block", label);
+ evas_object_show(label);
+
+ txt = elm_entry_utf8_to_markup(title);
+
+ buf = g_strdup_printf("<font=%s><font_size=%d><color=#%s>%s</color></font_size></font>",
+ font, size,
+ __bluetooth_convert_rgba_to_hex(r, g, b, a),
+ txt);
+ free(txt);
+
+ elm_object_text_set(label, buf);
+ g_free(font);
+ g_free(buf);
+ }
+
+ elm_object_content_set(scroller, scroller_layout);
+ elm_object_part_content_set(layout, "scroller", scroller);
+
+ elm_object_content_set(ad->win_main, bg);
+
+ btn1 = elm_button_add(layout);
+ elm_object_text_set(btn1,BT_STR_CANCEL);
+ evas_object_size_hint_weight_set(btn1, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_object_part_content_set(layout, "btn1", btn1);
+ evas_object_smart_callback_add(btn1, "clicked", func, ad);
+
+ btn2 = elm_button_add(layout);
+ elm_object_text_set(btn2,BT_STR_OK);
+ evas_object_size_hint_weight_set(btn2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_object_part_content_set(layout, "btn2", btn2);
+ evas_object_smart_callback_add(btn2, "clicked", func, ad);
+
+ evas_object_show(ad->win_main);
+
+ ao = elm_access_object_register(label, layout);
+ if (ao != NULL) {
+ elm_access_info_set(ao, ELM_ACCESS_INFO, title);
+ } else {
+ BT_ERR("elm_access_object_register error!");
+ }
+
+ BT_DBG("__bluetooth_draw_popup END");
+}
+
+static void __bluetooth_draw_loading_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))
+{
+ BT_DBG("+");
+ Evas_Object *btn1;
+ Evas_Object *btn2;
+ Evas_Object *bg;
+ Evas_Object *label = NULL;
+ Evas_Object *scroller;
+ Evas_Object *default_ly;
+ Evas_Object *layout;
+ Evas_Object *scroller_layout;
+ Evas_Object *ao;
+ char *txt;
+ char *buf;
+ int r = 0, g = 0, b = 0, a = 0;
+ char *font;
+ int size;
+
+ __bluetooth_set_win_level(ad->win_main);
+
+ bg = elm_bg_add(ad->win_main);
+ evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(ad->win_main, bg);
+ evas_object_show(bg);
+
+ default_ly = elm_layout_add(bg);
+ elm_layout_theme_set(default_ly, "layout", "application", "default");
+ evas_object_size_hint_weight_set(default_ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_object_part_content_set(bg, "elm.swallow.content", default_ly);
+ evas_object_show(default_ly);
+
+ layout = elm_layout_add(default_ly);
+ elm_layout_file_set(layout, CUSTOM_POPUP_PATH, "passkey_confirm");
+ evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_object_part_content_set(default_ly, "elm.swallow.content", layout);
+ evas_object_show(layout);
+
+ scroller = elm_scroller_add(layout);
+ elm_object_style_set(scroller, "effect");
+ evas_object_size_hint_weight_set(scroller, EVAS_HINT_EXPAND,
+ EVAS_HINT_EXPAND);
+ evas_object_show(scroller);
+
+ scroller_layout = elm_layout_add(scroller);
+ elm_layout_file_set(scroller_layout, CUSTOM_POPUP_PATH, "passkey_confirm_scroller");
+ evas_object_size_hint_weight_set(scroller_layout, EVAS_HINT_EXPAND,
+ EVAS_HINT_EXPAND);
+
+ if (title) {
+ BT_INFO("Title %s", title);
+ label = elm_label_add(scroller_layout);
+ elm_object_style_set(label, "popup/default");
+ elm_label_line_wrap_set(label, ELM_WRAP_MIXED);
+ elm_object_part_content_set(scroller_layout, "elm.text.block", label);
+ evas_object_show(label);
+
+ txt = elm_entry_utf8_to_markup(title);
+ ea_theme_color_get("AT012",&r, &g, &b, &a,
+ NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL);
+ ea_theme_font_get("AT012", &font, &size);
+ buf = g_strdup_printf("<font=%s><font_size=%d><color=#%s>%s</color></font_size></font>",
+ font, size,
+ __bluetooth_convert_rgba_to_hex(r, g, b, a),
+ txt);
+ free(txt);
+
+ elm_object_text_set(label, buf);
+ g_free(buf);
+ g_free(font);
+ }
+
+ elm_object_content_set(scroller, scroller_layout);
+ elm_object_part_content_set(layout, "scroller", scroller);
+
+ elm_object_content_set(ad->win_main, bg);
+
+ btn1 = elm_button_add(layout);
+ elm_object_text_set(btn1,BT_STR_CANCEL);
+ evas_object_size_hint_weight_set(btn1, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_object_part_content_set(layout, "btn1", btn1);
+ evas_object_smart_callback_add(btn1, "clicked", func, ad);
+
+ btn2 = elm_button_add(layout);
+ elm_object_text_set(btn2,BT_STR_OK);
+ evas_object_size_hint_weight_set(btn2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_object_part_content_set(layout, "btn2", btn2);
+ evas_object_smart_callback_add(btn2, "clicked", func, ad);
+
+ evas_object_show(ad->win_main);
+
+ ao = elm_access_object_register(label, layout);
+ if (ao != NULL) {
+ elm_access_info_set(ao, ELM_ACCESS_INFO, title);
+ } else {
+ BT_ERR("elm_access_object_register error!");
+ }
+
+ BT_DBG("__bluetooth_draw_loading_popup END");
+}
+
+static void __bluetooth_draw_text_popup(struct bt_popup_appdata *ad,
+ const char *text,
+ char *btn1_text, char *btn2_text,
+ void (*func) (void *data,
+ Evas_Object *obj, void *event_info))
+{
+ BT_DBG("__bluetooth_draw_text_popup");
+ Evas_Object *btn1;
+ Evas_Object *btn2;
+ Evas_Object *label;
+ Evas_Object *scroller_layout;
+ Evas_Object *ao = NULL;
+ char *txt;
+ char *buf;
+ int r = 0, g = 0, b = 0, a = 0;
+ char *font;
+ int size;
+
+ ret_if(!ad);
+
+ ad->popup = elm_popup_add(ad->win_main);
+ evas_object_size_hint_weight_set(ad->popup, EVAS_HINT_EXPAND,
+ EVAS_HINT_EXPAND);
+ ea_object_event_callback_add(ad->popup, EA_CALLBACK_BACK,
+ ea_popup_back_cb, NULL);
+
+ __bluetooth_set_win_level(ad->popup);
+ txt = elm_entry_utf8_to_markup(text);
+ elm_object_text_set(ad->popup, txt);
+ free(txt);
+
+ btn1 = elm_button_add(ad->popup);
+ elm_object_style_set(btn1, "popup");
+ evas_object_size_hint_weight_set(btn1, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ 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_style_set(btn2, "popup");
+ evas_object_size_hint_weight_set(btn2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ 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);
+
+ evas_object_show(ad->popup);
+ evas_object_show(ad->win_main);
+ elm_object_focus_set(ad->popup, EINA_TRUE);
+ BT_DBG("__bluetooth_draw_text_popup END");
+}
+
+static void __bluetooth_input_mouseup_cb(void *data,
+ Evas *e, Evas_Object *obj, void *event_info)
+{
+ Evas_Event_Mouse_Up *ev = event_info;
+ struct bt_popup_appdata *ad = data;
+ int response = BT_AGENT_CANCEL;
+ char *input_text = NULL;
+ char *convert_input_text = NULL;
+ BT_DBG("Mouse event callback function is called + ");
+
+ if (ev->button == 3) {
+ if (ad == NULL)
+ return;
+ evas_object_event_callback_del(ad->entry, EVAS_CALLBACK_MOUSE_UP,
+ __bluetooth_input_mouseup_cb);
+ evas_object_event_callback_del(ad->entry, EVAS_CALLBACK_KEY_DOWN,
+ __bluetooth_input_keyback_cb);
+ evas_object_event_callback_del(ad->popup, EVAS_CALLBACK_MOUSE_UP,
+ __bluetooth_input_mouseup_cb);
+ evas_object_event_callback_del(ad->popup, EVAS_CALLBACK_KEY_DOWN,
+ __bluetooth_input_keyback_cb);
+
+ /* 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 (convert_input_text == NULL)
+ return;
+
+ if (ad->event_type == BT_EVENT_PIN_REQUEST) {
+ dbus_g_proxy_call_no_reply(ad->agent_proxy,
+ "ReplyPinCode", G_TYPE_UINT, response,
+ 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, response,
+ G_TYPE_STRING, convert_input_text,
+ G_TYPE_INVALID, G_TYPE_INVALID);
+ }
+ __bluetooth_delete_input_view(ad);
+ free(convert_input_text);
+ if (ad->entry) {
+ evas_object_del(ad->entry);
+ ad->entry = NULL;
+ }
+ __bluetooth_win_del(ad);
+ }
+ BT_DBG("Mouse event callback -");
+}
+
+static void __bluetooth_input_keyback_cb(void *data,
+ Evas *e, Evas_Object *obj, void *event_info)
+{
+ Evas_Event_Key_Down *ev = event_info;
+ struct bt_popup_appdata *ad = data;
+ int response = BT_AGENT_CANCEL;
+ char *input_text = NULL;
+ char *convert_input_text = NULL;
+
+
+ BT_DBG("Keyboard event callback function is called + ");
+
+ if (!strcmp(ev->keyname, KEY_BACK)) {
+ if (ad == NULL)
+ return;
+ evas_object_event_callback_del(ad->entry, EVAS_CALLBACK_MOUSE_UP,
+ __bluetooth_input_mouseup_cb);
+ evas_object_event_callback_del(ad->entry, EVAS_CALLBACK_KEY_DOWN,
+ __bluetooth_input_keyback_cb);
+ evas_object_event_callback_del(ad->popup, EVAS_CALLBACK_MOUSE_UP,
+ __bluetooth_input_mouseup_cb);
+ evas_object_event_callback_del(ad->popup, EVAS_CALLBACK_KEY_DOWN,
+ __bluetooth_input_keyback_cb);
+ /* 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 (convert_input_text == NULL)
+ return;
+
+ if (ad->event_type == BT_EVENT_PIN_REQUEST) {
+ BT_DBG("It is PIN Request event ");
+ dbus_g_proxy_call_no_reply(ad->agent_proxy,
+ "ReplyPinCode", G_TYPE_UINT, response,
+ G_TYPE_STRING, convert_input_text,
+ G_TYPE_INVALID, G_TYPE_INVALID);
+ } else {
+ BT_DBG("It is PASSKEYRequest event ");
+ dbus_g_proxy_call_no_reply(ad->agent_proxy,
+ "ReplyPasskey", G_TYPE_UINT, response,
+ G_TYPE_STRING, convert_input_text,
+ G_TYPE_INVALID, G_TYPE_INVALID);
+ }
+ __bluetooth_delete_input_view(ad);
+ free(convert_input_text);
+ __bluetooth_win_del(ad);
+ }
+ BT_DBG("Keyboard Mouse event callback -");
+}
+
+void __bt_handle_keypad_value(void *data,int index)
+{
+ struct bt_popup_appdata *ad = (struct bt_popup_appdata *)data;
+ ret_if(ad == NULL);
+ int max_value = 0;
+ if(ad->event_type == BT_EVENT_PIN_REQUEST) {
+ max_value = BT_PIN_MLEN;
+ } else {
+ max_value = BT_PK_MLEN;
+ }
+
+ if (pin_index >= max_value) {
+ if(index >= 0 && index <= 9) {
+ char buf[512] = { 0, };
+ snprintf(buf,sizeof(buf),BT_STR_PIN_LENGTH_ERROR,max_value);
+ __bt_draw_error_toast_popup(ad, buf);
+
+ if(ad->timer != NULL) {
+ ecore_timer_del(ad->timer);
+ ad->timer = NULL;
+ }
+ ad->timer = ecore_timer_add(BT_TOAST_NOTIFICATION_TIMEOUT,
+ (Ecore_Task_Cb)__bt_error_toast_timeout_cb, ad);
+ return;
+ }
+ }
+
+ if(index >= 0 && index <= 9) {
+ char buf[20] = { 0, };
+ char buf1[20] = { 0, };
+ int i = 0;
+
+ snprintf(buf, sizeof(buf), "%d", index);
+ strcpy(&pin_value[pin_index++], buf);
+
+ if(pin_index == 0) {
+ } else {
+ for(i = 0; i < pin_index-1; i++) {
+ strcat(buf1,"*");
+ }
+ }
+ strcat(buf1,buf);
+
+ elm_object_part_text_set(ad->ly_pass, "elm.text.password", buf1);
+ pass_timer = ecore_timer_add(1.5f, (Ecore_Task_Cb)timer_cb, data);
+
+ } else if(index == 10) {//OK
+ char *input_text = NULL;
+
+ if (ad == NULL)
+ return;
+
+ if (pin_value)
+ BT_DBG_SECURE("PIN/Passkey[%s] event[%d] response[%s]",
+ pin_value, ad->event_type, "Accept");
+
+ if(ad->event_type == BT_EVENT_PIN_REQUEST) {
+ dbus_g_proxy_call_no_reply(ad->agent_proxy,
+ "ReplyPinCode", G_TYPE_UINT, BT_AGENT_ACCEPT,
+ G_TYPE_STRING, pin_value,
+ 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, pin_value,
+ G_TYPE_INVALID, G_TYPE_INVALID);
+ }
+ memset(pin_value, 0x00, sizeof(pin_value));
+ pin_index = 0;
+
+ __bluetooth_win_del(ad);
+
+ } else if(index == 11) {
+ /* Clear button */
+ _bt_clear_btn_up_cb(ad, NULL, NULL, NULL);
+ }
+}
+
+static void __bt_keypad_clicked_cb(void *data, Evas_Object *obj, const char *emission, const char *source)
+{
+ struct bt_popup_appdata *ad = data;
+ ret_if(ad == NULL);
+
+ int idx = (int)evas_object_data_get(obj, "__INDEX__");
+
+ __bt_handle_keypad_value(ad, idx);
+}
+static void __bluetooth_draw_input_view(struct bt_popup_appdata *ad,
+ const char *title, const char *text)
+{
+ BT_DBG("__bluetooth_draw_input_view");
+ Evas_Object *bg = NULL;
+ Evas_Object *layout = NULL;
+ Evas_Object *label = NULL;
+ Evas_Object *default_ly = NULL;
+ Evas_Object *scroller;
+ Elm_Object_Item *navi_item;
+ static char *buf;
+ int i = 0, r = 0, g = 0, b = 0, a = 0;
+ char *font;
+ int size;
+
+ if (ad == NULL || ad->win_main == NULL) {
+ BT_ERR("Invalid parameter");
+ return;
+ }
+
+ bg = elm_bg_add(ad->win_main);
+ evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(ad->win_main, bg);
+ evas_object_show(bg);
+
+ default_ly = elm_layout_add(bg);
+ elm_layout_theme_set(default_ly, "layout", "application", "default");
+ evas_object_size_hint_weight_set(default_ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_object_part_content_set(bg, "elm.swallow.content", default_ly);
+ evas_object_show(default_ly);
+
+ Evas_Object *naviframe;
+
+ naviframe = elm_naviframe_add(default_ly);
+ elm_object_part_content_set(default_ly, "elm.swallow.content", naviframe);
+
+ layout = elm_layout_add(default_ly);
+ elm_layout_file_set(layout, CUSTOM_POPUP_PATH, "passwd_popup");
+ evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+
+ ad->ly_pass = layout;
+
+ scroller = elm_scroller_add(layout);
+ evas_object_size_hint_weight_set(scroller, EVAS_HINT_EXPAND,
+ EVAS_HINT_EXPAND);
+ evas_object_show(scroller);
+
+ label = elm_label_add(layout);
+ elm_object_style_set(label, "popup/default");
+ elm_label_line_wrap_set(label, ELM_WRAP_CHAR);
+ ea_theme_color_get("AT012",&r, &g, &b, &a,
+ NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL);
+ if (EINA_TRUE == ea_theme_font_get("AT012", &font, &size))
+ BT_INFO("font : %s, size : %d", font, size);
+ else
+ BT_INFO("ea_theme_font_get fail!");
+ buf = g_strdup_printf("<font=%s><font_size=%d><color=#%s>%s</color></font_size></font>",
+ font, 28,
+ __bluetooth_convert_rgba_to_hex(r, g, b, a),
+ text);
+
+ BT_DBG("buf : %s, rgba:%d,%d,%d,%d", buf,r,g,b,a);
+
+ elm_object_text_set(label, buf);
+ g_free(buf);
+ evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(label, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(label);
+ elm_object_content_set(scroller, label);
+
+ elm_object_part_content_set(ad->ly_pass, "label", scroller);
+
+ BT_DBG("Create keypad");
+ Evas_Object *layout_key = elm_layout_add(ad->ly_pass);
+ elm_layout_file_set(layout_key, CUSTOM_POPUP_PATH, "keypad");
+
+ ad->ly_keypad = layout_key;
+ elm_object_part_content_set(ad->ly_pass, "sw.keypad", layout_key);
+ elm_object_part_text_set(layout_key, "confirm", "OK");
+
+ for (i = 0; i< 12; i++) {
+ Evas_Object *button = elm_button_add(layout_key);
+ char buf[32] = {0,};
+ if(button == NULL) {
+ BT_DBG("elm_button_add() failed");
+ continue;
+ }
+ elm_object_style_set(button, "focus");
+ snprintf(buf, sizeof(buf)-1, "%s,sw", keypad_info[i].part_name);
+ elm_object_part_content_set(layout_key, buf, button);
+ elm_access_info_set(button, ELM_ACCESS_INFO, keypad_info[i].tts_name);
+ evas_object_data_set(button, "__INDEX__", (void *)i);
+ evas_object_smart_callback_add(button, "clicked",
+ __bt_keypad_clicked_cb, ad);
+ keypad_info[i].tts_button = button;
+ }
+
+ navi_item = elm_naviframe_item_push(naviframe, BT_STR_PAIRING_REQUEST,
+ NULL, NULL, layout, NULL);
+ elm_naviframe_item_title_enabled_set(navi_item, EINA_TRUE, EINA_TRUE);
+ elm_naviframe_item_title_visible_set(navi_item, EINA_TRUE);
+ elm_object_content_set(ad->win_main, bg);
+ evas_object_show(naviframe);
+ evas_object_show(default_ly);
+ evas_object_show(layout);
+ evas_object_show(layout_key);
+ evas_object_show(ad->win_main);
+
+}
+
+static void __bluetooth_delete_input_view(struct bt_popup_appdata *ad)
+{
+ __bluetooth_ime_hide();
+}
+
+static DBusGProxy* __bluetooth_create_agent_proxy(DBusGConnection *conn,
+ const char *path)
+{
+ DBusGProxy *proxy;
+
+ proxy = dbus_g_proxy_new_for_name(conn, "org.projectx.bt",
+ path, "org.bluez.Agent1");
+ if (!proxy)
+ BT_ERR("dbus_g_proxy_new_for_name is failed");
+
+ return proxy;
+
+}
+
+#if 0
+static int __bt_get_vconf_setup_wizard()
+{
+ int wizard_state = VCONFKEY_SETUP_WIZARD_UNLOCK;
+
+ if (vconf_get_int(VCONFKEY_SETUP_WIZARD_STATE, &wizard_state))
+ BT_ERR("Fail to get Wizard State");
+
+ return wizard_state;
+}
+#endif
+
+/* 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;
+ const char *agent_path;
+ char *conv_str = NULL;
+
+ BT_DBG("+");
+
+ if (!reset_data || !event_type) {
+ BT_ERR("reset_data : %d, event_type : %d",
+ reset_data, event_type);
+ return -1;
+ }
+
+ BT_INFO("Event Type = %s[0X%X]", event_type, ad->event_type);
+
+ if (!strcasecmp(event_type, "pin-request")) {
+ device_name = bundle_get_val(kb, "device-name");
+ agent_path = bundle_get_val(kb, "agent-path");
+
+ ad->agent_proxy = __bluetooth_create_agent_proxy(ad->conn, agent_path);
+ if (!ad->agent_proxy)
+ return -1;
+
+ if (device_name)
+ conv_str = elm_entry_utf8_to_markup(device_name);
+
+ snprintf(view_title, BT_TITLE_STR_MAX_LEN,
+ "%s", BT_STR_PAIRING_REQUEST);
+
+ snprintf(text, BT_GLOBALIZATION_STR_LENGTH,
+ BT_STR_ENTER_PIN_TO_PAIR, conv_str);
+
+ if (conv_str)
+ free(conv_str);
+
+ /* Request user inputted PIN for basic pairing */
+ __bluetooth_draw_input_view(ad, view_title, text);
+ } else if (!strcasecmp(event_type, "passkey-confirm-request")) {
+ device_name = bundle_get_val(kb, "device-name");
+ passkey = bundle_get_val(kb, "passkey");
+ agent_path = bundle_get_val(kb, "agent-path");
+
+ ad->agent_proxy = __bluetooth_create_agent_proxy(ad->conn, agent_path);
+ if (!ad->agent_proxy)
+ return -1;
+
+ if (device_name && passkey) {
+ snprintf(view_title, BT_TITLE_STR_MAX_LEN,
+ BT_STR_CONFIRM_PASSKEY_PS_TO_PAIR_WITH_PS,
+ device_name, passkey);
+
+ BT_INFO("title: %s", view_title);
+
+ __bluetooth_draw_text_popup(ad, view_title,
+ BT_STR_CANCEL, BT_STR_OK,
+ __bluetooth_passkey_confirm_cb);
+ } else {
+ timeout = BT_ERROR_TIMEOUT;
+ }
+ } else if (!strcasecmp(event_type, "passkey-request")) {
+ const char *device_name = NULL;
+
+ device_name = bundle_get_val(kb, "device-name");
+ agent_path = bundle_get_val(kb, "agent-path");
+
+ ad->agent_proxy = __bluetooth_create_agent_proxy(ad->conn, agent_path);
+ if (!ad->agent_proxy)
+ return -1;
+
+ if (device_name)
+ conv_str = elm_entry_utf8_to_markup(device_name);
+
+ snprintf(view_title, BT_TITLE_STR_MAX_LEN,
+ "%s", BT_STR_PAIRING_REQUEST);
+
+ snprintf(text, BT_GLOBALIZATION_STR_LENGTH,
+ BT_STR_ENTER_PIN_TO_PAIR, conv_str);
+
+ if (conv_str)
+ free(conv_str);
+
+ /* Request user inputted Passkey for basic pairing */
+ __bluetooth_draw_input_view(ad, view_title, text);
+
+ } else if (!strcasecmp(event_type, "passkey-display-request")) {
+ 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(view_title, BT_TITLE_STR_MAX_LEN,
+ BT_STR_ENTER_PS_ON_PS_TO_PAIR, passkey, conv_str);
+
+ BT_INFO("title: %s", view_title);
+
+ if (conv_str)
+ free(conv_str);
+
+ __bluetooth_draw_popup(ad, view_title,
+ BT_STR_CANCEL, NULL,
+ __bluetooth_input_cancel_cb);
+ } else {
+ BT_ERR("wrong parameter : %s, %s", device_name, passkey);
+ timeout = BT_ERROR_TIMEOUT;
+ }
+ } else if (!strcasecmp(event_type, "authorize-request")) {
+ timeout = BT_AUTHORIZATION_TIMEOUT;
+
+ device_name = bundle_get_val(kb, "device-name");
+ agent_path = bundle_get_val(kb, "agent-path");
+
+ ad->agent_proxy = __bluetooth_create_agent_proxy(ad->conn, agent_path);
+ if (!ad->agent_proxy)
+ return -1;
+
+ 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_auth_popup(ad, view_title, BT_STR_CANCEL, BT_STR_OK,
+ __bluetooth_authorization_request_cb);
+ } else if (!strcasecmp(event_type, "app-confirm-request")) {
+ BT_DBG("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) {
+ BT_ERR("title is NULL");
+ return -1;
+ }
+
+ if (strcasecmp(type, "twobtn") == 0) {
+ __bluetooth_draw_popup(ad, title, BT_STR_CANCEL, BT_STR_OK,
+ __bluetooth_app_confirm_cb);
+ } else if (strcasecmp(type, "onebtn") == 0) {
+ timeout = BT_NOTIFICATION_TIMEOUT;
+ __bluetooth_draw_popup(ad, title, BT_STR_OK, 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")) {
+ 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_CANCEL, BT_STR_OK,
+ __bluetooth_push_authorization_request_cb);
+ } else if (!strcasecmp(event_type, "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_CANCEL, BT_STR_OK,
+ __bluetooth_app_confirm_cb);
+ } else if (!strcasecmp(event_type, "keyboard-passkey-request")) {
+ 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(view_title, BT_TITLE_STR_MAX_LEN,
+ BT_STR_ENTER_PS_ON_PS_TO_PAIR, passkey, conv_str);
+
+ BT_INFO("title: %s", view_title);
+
+ if (conv_str)
+ free(conv_str);
+
+ __bluetooth_draw_popup(ad, view_title,
+ BT_STR_CANCEL, NULL,
+ __bluetooth_input_cancel_cb);
+ } else {
+ BT_ERR("wrong parameter : %s, %s", device_name, passkey);
+ timeout = BT_ERROR_TIMEOUT;
+ }
+ } else if (!strcasecmp(event_type, "bt-information")) {
+ BT_DBG("bt-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) {
+ BT_ERR("titls is too long");
+ return -1;
+ }
+ } else {
+ BT_ERR("titls is NULL");
+ 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, "exchange-request")) {
+ timeout = BT_AUTHORIZATION_TIMEOUT;
+
+ device_name = bundle_get_val(kb, "device-name");
+ agent_path = bundle_get_val(kb, "agent-path");
+
+ ad->agent_proxy = __bluetooth_create_agent_proxy(ad->conn, agent_path);
+ if (!ad->agent_proxy)
+ return -1;
+
+ if (device_name)
+ conv_str = elm_entry_utf8_to_markup(device_name);
+
+ snprintf(view_title, BT_TITLE_STR_MAX_LEN,
+ BT_STR_RECEIVE_FILE_FROM_PS_Q, conv_str);
+
+ if (conv_str)
+ free(conv_str);
+
+ __bluetooth_draw_popup(ad, view_title, BT_STR_CANCEL, BT_STR_OK,
+ __bluetooth_authorization_request_cb);
+ } else if (!strcasecmp(event_type, "phonebook-request")) {
+ timeout = BT_AUTHORIZATION_TIMEOUT;
+
+ device_name = bundle_get_val(kb, "device-name");
+ agent_path = bundle_get_val(kb, "agent-path");
+
+ ad->agent_proxy = __bluetooth_create_agent_proxy(ad->conn, agent_path);
+ if (!ad->agent_proxy)
+ return -1;
+
+ if (device_name)
+ conv_str = elm_entry_utf8_to_markup(device_name);
+
+ snprintf(view_title, BT_TITLE_STR_MAX_LEN,
+ BT_STR_ALLOW_PS_PHONEBOOK_ACCESS_Q, conv_str);
+
+ if (conv_str)
+ free(conv_str);
+
+ __bluetooth_draw_auth_popup(ad, view_title, BT_STR_CANCEL, BT_STR_OK,
+ __bluetooth_authorization_request_cb);
+ } else if (!strcasecmp(event_type, "message-request")) {
+ timeout = BT_AUTHORIZATION_TIMEOUT;
+
+ device_name = bundle_get_val(kb, "device-name");
+ agent_path = bundle_get_val(kb, "agent-path");
+
+ ad->agent_proxy = __bluetooth_create_agent_proxy(ad->conn, agent_path);
+ if (!ad->agent_proxy)
+ return -1;
+
+ 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_ACCESS_MESSAGES_Q, conv_str);
+
+ if (conv_str)
+ free(conv_str);
+
+ __bluetooth_draw_auth_popup(ad, view_title, BT_STR_CANCEL, BT_STR_OK,
+ __bluetooth_authorization_request_cb);
+ } else if (!strcasecmp(event_type, "unable-to-pairing")) {
+ DBusMessage *msg = NULL;
+ int response = BT_AGENT_REJECT;
+
+ timeout = BT_TOAST_NOTIFICATION_TIMEOUT;
+ __bt_draw_toast_popup(ad, BT_STR_UNABLE_TO_CONNECT);
+ } else if (!strcasecmp(event_type, "handsfree-disconnect-request")) {
+#if 0
+ if (__bt_get_vconf_setup_wizard() == VCONFKEY_SETUP_WIZARD_LOCK) {
+ BT_DBG("VCONFKEY_SETUP_WIZARD_LOCK: No toast shown");
+ return -1;
+ }
+#endif
+ timeout = BT_TOAST_NOTIFICATION_TIMEOUT;
+ __bt_draw_toast_popup(ad, BT_STR_BLUETOOTH_HAS_BEEN_DISCONNECTED);
+
+ } else if (!strcasecmp(event_type, "handsfree-connect-request")) {
+#if 0
+ if (__bt_get_vconf_setup_wizard() == VCONFKEY_SETUP_WIZARD_LOCK) {
+ BT_DBG("VCONFKEY_SETUP_WIZARD_LOCK: No toast shown");
+ return -1;
+ }
+#endif
+
+ timeout = BT_TOAST_NOTIFICATION_TIMEOUT;
+ __bt_draw_toast_popup(ad, BT_STR_BLUETOOTH_CONNECTED);
+
+ } else if (!strcasecmp(event_type, "music-auto-connect-request")) {
+ timeout = BT_TOAST_NOTIFICATION_TIMEOUT;
+ __bt_draw_toast_popup(ad, BT_STR_AUTO_CONNECT);
+
+ } else if (!strcasecmp(event_type, "system-reset-request")) {
+ device_name = bundle_get_val(kb, "device-name");
+ agent_path = bundle_get_val(kb, "agent-path");
+
+ ad->agent_proxy = __bluetooth_create_agent_proxy(ad->conn, agent_path);
+ if (!ad->agent_proxy)
+ return -1;
+
+ if (device_name) {
+ snprintf(view_title, BT_TITLE_STR_MAX_LEN,
+ BT_STR_FACTORY_RESET, device_name, device_name);
+ __bluetooth_draw_reset_popup(ad, view_title,
+ BT_STR_CANCEL, BT_STR_RESET,
+ __bluetooth_reset_cb);
+ } else {
+ BT_ERR("device name NULL");
+ timeout = BT_ERROR_TIMEOUT;
+ }
+ } else {
+ BT_ERR("Unknown event_type : %s", event_type);
+ return -1;
+ }
+
+ if (ad->event_type != BT_EVENT_FILE_RECEIVED && timeout != 0) {
+ ad->timer = ecore_timer_add(timeout, (Ecore_Task_Cb)
+ __bluetooth_request_timeout_cb, ad);
+ }
+ BT_DBG("-");
+ return 0;
+}
+
+static Eina_Bool __bt_toast_mouseup_cb(void *data, int type, void *event)
+{
+ Ecore_Event_Key *ev = event;
+ struct bt_popup_appdata *ad;
+
+ ad = (struct bt_popup_appdata *)data;
+ if(ev == NULL || ev->keyname == NULL || ad == NULL){
+ return ECORE_CALLBACK_DONE;
+ }
+
+ __bluetooth_win_del(ad);
+
+ return ECORE_CALLBACK_DONE;
+}
+
+static void __bt_draw_toast_popup(struct bt_popup_appdata *ad, char *toast_text)
+{
+ Evas_Object *ao = NULL;
+
+ ad->popup = elm_popup_add(ad->win_main);
+ elm_object_style_set(ad->popup, "toast");
+ elm_popup_orient_set(ad->popup, ELM_POPUP_ORIENT_BOTTOM);
+ evas_object_size_hint_weight_set(ad->popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ ea_object_event_callback_add(ad->popup, EA_CALLBACK_BACK, ea_popup_back_cb, NULL);
+
+ elm_object_part_text_set(ad->popup,"elm.text", toast_text);
+
+ __bluetooth_set_win_level(ad->popup);
+
+ ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP, __bt_toast_mouseup_cb, ad);
+
+ evas_object_show(ad->popup);
+ evas_object_show(ad->win_main);
+ elm_object_focus_set(ad->popup, EINA_TRUE);
+
+ ao = elm_object_part_access_object_get(ad->popup, "access.outline");
+ if (ao != NULL)
+ elm_access_info_set(ao, ELM_ACCESS_INFO, toast_text);
+}
+
+static void __bt_draw_error_toast_popup(struct bt_popup_appdata *ad, char *toast_text)
+{
+ Evas_Object *ao = NULL;
+
+ ad->popup = elm_popup_add(ad->win_main);
+ elm_object_style_set(ad->popup, "toast");
+ elm_popup_orient_set(ad->popup, ELM_POPUP_ORIENT_BOTTOM);
+ evas_object_size_hint_weight_set(ad->popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ ea_object_event_callback_add(ad->popup, EA_CALLBACK_BACK, ea_popup_back_cb, NULL);
+ elm_object_part_text_set(ad->popup,"elm.text", toast_text);
+
+ __bluetooth_set_win_level(ad->popup);
+
+ evas_object_show(ad->popup);
+ evas_object_show(ad->win_main);
+ elm_object_focus_set(ad->popup, EINA_TRUE);
+
+ ao = elm_object_part_access_object_get(ad->popup, "access.outline");
+ if (ao != NULL)
+ elm_access_info_set(ao, ELM_ACCESS_INFO, toast_text);
+}
+
+static Eina_Bool __exit_idler_cb(void *data)
+{
+ elm_exit();
+ return ECORE_CALLBACK_CANCEL;
+}
+
+static void __popup_terminate(void)
+{
+ if (ecore_idler_add(__exit_idler_cb, NULL))
+ return;
+
+ __exit_idler_cb(NULL);
+}
+
+static void __bluetooth_win_del(void *data)
+{
+ struct bt_popup_appdata *ad = (struct bt_popup_appdata *)data;
+
+ __bluetooth_cleanup(ad);
+ __popup_terminate();
+}
+
+static int __bt_error_toast_timeout_cb(void *data)
+{
+ struct bt_popup_appdata *ad;
+
+ if (data == NULL)
+ return 0;
+
+ ad = (struct bt_popup_appdata *)data;
+
+ BT_DBG("Toast Popup timeout");
+
+ /* Destory toast popup and timer */
+ if (ad->timer) {
+ ecore_timer_del(ad->timer);
+ ad->timer = NULL;
+ }
+
+ if (ad->popup) {
+ elm_access_object_unregister(ad->popup);
+ evas_object_del(ad->popup);
+ ad->popup = NULL;
+ }
+ return 0;
+}
+static Evas_Object *__bluetooth_create_win(const char *name, void *data)
+{
+ Evas_Object *eo;
+ struct bt_popup_appdata *ad = (struct bt_popup_appdata *)data;
+ int w;
+ int h;
+
+ eo = elm_win_add(NULL, name, ELM_WIN_DIALOG_BASIC);
+ if (eo) {
+ elm_win_alpha_set(eo, EINA_TRUE);
+ 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_ERR("ERROR: Can't get on system bus [%s]",
+ err->message);
+ g_error_free(err);
+ return;
+ }
+
+ ad->conn = conn;
+
+ ad->obex_proxy = dbus_g_proxy_new_for_name(conn,
+ "org.bluez.frwk_agent",
+ "/org/obex/ops_agent",
+ "org.openobex.Agent");
+ if (!ad->obex_proxy)
+ BT_ERR("Could not create obex dbus proxy");
+
+ if (!__bluetooth_init_app_signal(ad))
+ BT_ERR("__bt_syspopup_init_app_signal failed");
+}
+
+void __bluetooth_set_color_table(void *data)
+{
+ FN_START;
+ struct bt_popup_appdata *ad = (struct bt_popup_appdata *)data;
+
+ /* Set color table */
+ ea_theme_changeable_ui_enabled_set(EINA_TRUE);
+ ad->color_table = ea_theme_color_table_new(COLOR_TABLE);
+ if (ad->color_table == NULL)
+ BT_ERR("ea_theme_color_table_new failed!");
+ else if (EINA_TRUE != ea_theme_colors_set(ad->color_table, EA_THEME_STYLE_DEFAULT))
+ BT_ERR("ea_theme_colors_set failed!");
+
+ ad->font_table = ea_theme_font_table_new(FONT_TABLE);
+ if (ad->font_table == NULL)
+ BT_ERR("ea_theme_color_table_new failed!");
+ else if (EINA_TRUE != ea_theme_fonts_set(ad->font_table))
+ BT_ERR("ea_theme_fonts_set failed!");
+
+ FN_END;
+}
+
+static bool __bluetooth_create(void *data)
+{
+ struct bt_popup_appdata *ad = data;
+ Evas_Object *win = NULL;
+
+ BT_DBG("__bluetooth_create() start.");
+
+ /* create window */
+ win = __bluetooth_create_win(PACKAGE, ad);
+ if (win == NULL) {
+ BT_ERR("__bluetooth_create_win is failed");
+ return false;
+ }
+ ad->win_main = win;
+ ad->viberation_id = 0;
+ /* Handle rotation */
+ if (elm_win_wm_rotation_supported_get(ad->win_main)) {
+ int rots[4] = {0, 90, 180, 270};
+ elm_win_wm_rotation_available_rotations_set(ad->win_main, rots, 4);
+ }
+
+ /* init internationalization */
+ bindtextdomain(BT_COMMON_PKG, BT_LOCALEDIR);
+ textdomain(BT_COMMON_PKG);
+
+ ecore_imf_init();
+ __bluetooth_set_color_table(ad);
+
+ __bluetooth_session_init(ad);
+ if (bt_initialize() != BT_ERROR_NONE) {
+ BT_ERR("bt_initialize is failed");
+ }
+
+ return true;
+}
+
+
+static int __vzw_launch_modem_syspopup(void)
+{
+ int ret;
+ bundle* b;
+
+ b = bundle_create();
+ if (!b) {
+ BT_ERR("Failed to create bundle");
+ return -1;
+ }
+
+ bundle_add(b, "event-type", "grayzone_alert");
+ ret = syspopup_launch("wc-syspopup", b);
+ if (ret < 0)
+ BT_ERR("Failed to launch syspopup");
+
+ bundle_free(b);
+
+ return ret;
+}
+
+static void __bluetooth_terminate(void *data)
+{
+ BT_DBG("__bluetooth_terminate()");
+
+ struct bt_popup_appdata *ad = data;
+
+ if (bt_deinitialize() != BT_ERROR_NONE) {
+ BT_ERR("bt_deinitialize is failed");
+ }
+ __bluetooth_ime_hide();
+
+ if (ad->conn) {
+ dbus_g_connection_unref(ad->conn);
+ ad->conn = NULL;
+ }
+
+ if (ad->color_table != NULL) {
+ ea_theme_color_table_free(ad->color_table);
+ ad->color_table = NULL;
+ }
+
+ if (ad->font_table != NULL) {
+ ea_theme_font_table_free(ad->font_table);
+ ad->font_table = NULL;
+ }
+
+ if (ad->popup)
+ evas_object_del(ad->popup);
+
+ if (ad->win_main)
+ evas_object_del(ad->win_main);
+
+ ad->popup = NULL;
+ ad->win_main = NULL;
+
+ if (ad->event_type == BT_EVENT_HANDSFREE_DISCONNECT_REQUEST) {
+ BT_ERR("Not supported in platform");
+ }
+}
+
+static void __bluetooth_pause(void *data)
+{
+ BT_DBG("__bluetooth_pause()");
+ return;
+}
+
+static void __bluetooth_resume(void *data)
+{
+ BT_DBG("__bluetooth_resume()");
+ return;
+}
+
+static void __bluetooth_reset(app_control_h app_control, void *user_data)
+{
+ struct bt_popup_appdata *ad = user_data;
+ bundle *b = NULL;
+ const char *event_type = NULL;
+ int block = 0;
+ int ret = 0;
+
+ BT_DBG("__bluetooth_reset()");
+
+ if (ad == NULL) {
+ BT_ERR("App data is NULL");
+ return;
+ }
+
+ ret = app_control_to_bundle(app_control, &b);
+
+ /* Start Main UI */
+ event_type = bundle_get_val(b, "event-type");
+ if (event_type == NULL) {
+ BT_ERR("event type is NULL");
+ return;
+ }
+ BT_INFO("event_type : %s", event_type);
+
+ __bluetooth_parse_event(ad, event_type);
+
+ if (!strcasecmp(event_type, "terminate")) {
+ BT_ERR("get terminate event");
+ __bluetooth_win_del(ad);
+ return;
+ }
+
+ if (syspopup_has_popup(b)) {
+ /* Destroy the existing popup*/
+ BT_ERR("Aleady popup existed");
+ __bluetooth_cleanup(ad);
+
+ /* create window */
+ ad->win_main = __bluetooth_create_win(PACKAGE, ad);
+ if (ad->win_main == NULL) {
+ BT_ERR("fail to create win!");
+ return;
+ }
+
+ ret = syspopup_reset(b);
+ if (ret == -1) {
+ BT_ERR("syspopup_reset err");
+ return;
+ }
+
+ goto DONE;
+ }
+
+ ret = syspopup_create(b, &handler, ad->win_main, ad);
+ if (ret == -1) {
+ BT_ERR("syspopup_create err");
+ __bluetooth_remove_all_event(ad);
+ return;
+ }
+
+
+DONE:
+ ret = __bluetooth_launch_handler(ad, b, event_type);
+
+ if (vconf_get_bool(VCONFKEY_SETAPPL_BLOCKMODE_WEARABLE_BOOL, &block)) {
+ BT_ERR("Get Block Status fail!!");
+ }
+
+ if (ret != 0) {
+ BT_ERR("__bluetooth_launch_handler is failed. event[%d], ret[%d]",
+ ad->event_type, ret);
+ __bluetooth_remove_all_event(ad);
+ }
+
+ if (!block) {
+ /* Change LCD brightness */
+ if (display_change_state(LCD_NORMAL) != 0)
+ BT_ERR("Fail to change LCD");
+
+ if (ad->event_type == BT_EVENT_HANDSFREE_DISCONNECT_REQUEST) {
+ __bluetooth_notify_event(FEEDBACK_PATTERN_DISCONNECTED);
+ } else if (ad->event_type == BT_EVENT_HANDSFREE_CONNECT_REQUEST) {
+ __bluetooth_notify_event(FEEDBACK_PATTERN_CONNECTED);
+ } else if (ad->event_type == BT_EVENT_PASSKEY_CONFIRM_REQUEST ||
+ ad->event_type == BT_EVENT_SYSTEM_RESET_REQUEST) {
+ __bluetooth_notify_event(FEEDBACK_PATTERN_BT_PAIRING);
+ ad->viberation_id = g_timeout_add(BT_VIBERATION_INTERVAL,
+ __bluetooth_pairing_pattern_cb, NULL);
+ __lock_display();
+ }
+ }
+
+ return;
+}
+
+static void __bluetooth_lang_changed_cb(app_event_info_h event_info, void *data)
+{
+ BT_DBG("+");
+ ret_if(data == NULL);
+ BT_DBG("-");
+}
+
+EXPORT int main(int argc, char *argv[])
+{
+ struct bt_popup_appdata ad;
+ memset(&ad, 0x0, sizeof(struct bt_popup_appdata));
+
+ ui_app_lifecycle_callback_s event_callback = {0,};
+ app_event_handler_h handlers[5] = {NULL, };
+
+ event_callback.create = __bluetooth_create;
+ event_callback.terminate = __bluetooth_terminate;
+ event_callback.pause = __bluetooth_pause;
+ event_callback.resume = __bluetooth_resume;
+ event_callback.app_control = __bluetooth_reset;
+
+ ui_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY],
+ APP_EVENT_LOW_MEMORY, NULL, NULL);
+ ui_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY],
+ APP_EVENT_LOW_BATTERY, NULL, NULL);
+ ui_app_add_event_handler(&handlers[APP_EVENT_DEVICE_ORIENTATION_CHANGED],
+ APP_EVENT_DEVICE_ORIENTATION_CHANGED, NULL, NULL);
+ ui_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED],
+ APP_EVENT_LANGUAGE_CHANGED, __bluetooth_lang_changed_cb, NULL);
+ ui_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED],
+ APP_EVENT_REGION_FORMAT_CHANGED, NULL, NULL);
+
+ return ui_app_main(argc, argv, &event_callback, &ad);
+}
--- /dev/null
+/*
+* bt-syspopup
+*
+* Copyright 2013 Samsung Electronics Co., Ltd
+*
+* Contact: Hocheol Seo <hocheol.seo@samsung.com>
+* GirishAshok Joshi <girish.joshi@samsung.com>
+* DoHyun Pyun <dh79.pyun@samsung.com>
+*
+* Licensed under the Flora License, Version 1.1 (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.
+*
+*/
+
+#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 PACKAGE_NAME
+#define PACKAGE_NAME "org.tizen.bt-syspopup"
+#endif
+
+#ifndef PREFIX
+#define PREFIX "/usr/apps"PACKAGE_NAME
+#endif
+
+#define EXPORT __attribute__((visibility("default")))
+
+#define TEMP_DIR "/tmp"
+
+#define PACKAGE "bt-syspopup"
+#define APPNAME "bt-syspopup"
+#define ICON_DIR PREFIX"/res/default/small/icon"
+
+#define CUSTOM_POPUP_PATH PREFIX"/res/edje/custom_popup.edj"
+#define POPUP_IMAGE_PATH PREFIX"/res/images"
+
+#define BT_COMMON_PKG "bluetooth"
+#define BT_LOCALEDIR "/usr/apps/org.tizen.bluetooth/shared/res/locale"
+
+#define _EDJ(obj) elm_layout_edje_get(obj)
+
+#define BT_AUTHENTICATION_TIMEOUT 35
+#define BT_AUTHORIZATION_TIMEOUT 25
+#define BT_NOTIFICATION_TIMEOUT 2
+#define BT_ERROR_TIMEOUT 1
+#define BT_TOAST_NOTIFICATION_TIMEOUT 3
+#define BT_PAIR_RETRY_TIMEOUT 5
+
+#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_SET_FONT_SIZE "<font_size=%d>%s</font_size>"
+#define BT_TITLE_FONT_30 30
+
+#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_VIBERATION_INTERVAL 2000
+
+#undef LOG_TAG
+#define LOG_TAG "BLUETOOTH_SYSPOPUP"
+
+#define BT_DBG(format, args...) SLOGD(format, ##args)
+#define BT_ERR(format, args...) SLOGE(format, ##args)
+#define BT_INFO(format, args...) SLOGI(format, ##args)
+
+#define FUNCTION_TRACE
+#ifdef FUNCTION_TRACE
+#define FN_START BT_DBG("[ENTER FUNC]");
+#define FN_END BT_DBG("[EXIT FUNC]");
+#else
+#define FN_START
+#define FN_END
+#endif
+
+#define BT_DBG_SECURE(fmt, args...) SECURE_SLOGD(fmt, ##args)
+#define BT_ERR_SECURE(fmt, args...) SECURE_SLOGE(fmt, ##args)
+
+#define ret_if(expr) do { \
+ if (expr) { \
+ return; \
+ } \
+ } while (0)
+#define retv_if(expr, val) do { \
+ if (expr) { \
+ return (val); \
+ } \
+ } while (0)
+#define retm_if(expr, fmt, arg...) do { \
+ if (expr) { \
+ BT_ERR(fmt, ##arg); \
+ return; \
+ } \
+ } while (0)
+#define retvm_if(expr, val, fmt, arg...) do { \
+ if (expr) { \
+ BT_ERR(fmt, ##arg); \
+ return (val); \
+ } \
+ } while (0)
+
+#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"
+#define BT_SYS_POPUP_METHOD_RESET_RESPONSE "ResetResponse"
+
+/* 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")
+
+#define BT_STR_ENTER_PS_ON_PS_TO_PAIR \
+ dgettext(BT_COMMON_PKG, "IDS_BT_BODY_ENTER_P1SS_ON_P2SS_TO_PAIR_THEN_TAP_RETURN_OR_ENTER")
+
+#define BT_STR_RECEIVE_FILE_FROM_PS_Q \
+ dgettext(BT_COMMON_PKG, "IDS_BT_POP_RECEIVE_FILE_FROM_PS_Q")
+
+/* Need to convert the design ID */
+#define BT_STR_PAIRING_REQUEST \
+ dgettext(BT_COMMON_PKG, "IDS_BT_BODY_PAIRING_REQUEST")
+
+#define BT_STR_ENTER_PIN_TO_PAIR \
+ dgettext(BT_COMMON_PKG, "IDS_BT_POP_ENTER_PIN_TO_PAIR_WITH_PS_HTRY_0000_OR_1234")
+
+#define BT_STR_SHOW_PASSWORD \
+ dgettext(BT_COMMON_PKG, "IDS_BT_BODY_SHOW_PASSWORD")
+
+#define BT_STR_CONFIRM_PASSKEY_PS_TO_PAIR_WITH_PS \
+ dgettext(BT_COMMON_PKG, "IDS_BT_POP_CONFIRM_PASSKEY_IS_P2SS_TO_PAIR_WITH_P1SS")
+
+#define BT_STR_ALLOW_PS_PHONEBOOK_ACCESS_Q \
+ dgettext(BT_COMMON_PKG, "IDS_BT_BODY_ALLOW_PS_PHONEBOOK_ACCESS")
+
+#define BT_STR_ALLOW_PS_TO_ACCESS_MESSAGES_Q \
+ dgettext(BT_COMMON_PKG, "IDS_BT_POP_ALLOW_PS_TO_ACCESS_MESSAGES_Q")
+
+#define BT_STR_DONT_ASK_AGAIN \
+ dgettext(BT_COMMON_PKG, "IDS_BT_BODY_DONT_ASK_AGAIN")
+
+#define BT_STR_UNABLE_TO_CONNECT \
+ dgettext(BT_COMMON_PKG, "IDS_BT_POP_UNABLE_TO_CONNECT")
+
+#define BT_STR_TIMEOUT_TRY_AGAIN_Q \
+ dgettext(BT_COMMON_PKG, "IDS_BT_POP_PAIRRETRY")
+
+#define BT_STR_BLUETOOTH_ERROR_TRY_AGAIN_Q \
+ dgettext(BT_COMMON_PKG, "IDS_BT_POP_BLUETOOTH_ERROR_TRY_AGAIN_Q")
+#define BT_STR_TAP_TO_ENTER \
+ dgettext(BT_COMMON_PKG, "IDS_SIM_BODY_TAP_TO_ENTER_ABB")
+
+#define BT_STR_OK dgettext(BT_COMMON_PKG, "IDS_BT_BUTTON_OK_ABB")
+#define BT_STR_CANCEL dgettext(BT_COMMON_PKG, "IDS_BT_BUTTON_CANCEL")
+
+#define BT_STR_BLUETOOTH_CONNECTED \
+ dgettext(BT_COMMON_PKG, "IDS_BT_POP_BLUETOOTH_CONNECTED")
+#define BT_STR_BLUETOOTH_HAS_BEEN_DISCONNECTED \
+ dgettext(BT_COMMON_PKG, "IDS_BT_POP_BLUETOOTH_HAS_BEEN_DISCONNECTED")
+#define BT_STR_AUTO_CONNECT \
+ dgettext(BT_COMMON_PKG, "IDS_BT_POP_CONNECTING_TO_BLUETOOTH_STEREO_HEADSET_ING")
+
+#define BT_STR_TITLE_CONNECT dgettext(BT_COMMON_PKG, "IDS_BT_HEADER_CONNECT")
+
+#define BT_STR_FACTORY_RESET \
+ dgettext(BT_COMMON_PKG, "IDS_WMGR_BODY_PS_IS_ATTEMPTING_TO_CONNECT_TO_YOUR_GEAR_TO_CONNECT_TO_PS_THE_GEAR_WILL_BE_RESET_TO_ITS_FACTORY_SETTINGS")
+
+#define BT_STR_RESET dgettext(BT_COMMON_PKG, "IDS_ST_BUTTON_RESET_ABB2")
+
+#define BT_STR_PIN_LENGTH_ERROR "Pin must contain no more than %d digits"
+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_RECEIVED = 0x0100,
+ BT_EVENT_KEYBOARD_PASSKEY_REQUEST = 0x0200,
+ BT_EVENT_INFORMATION = 0x0400,
+ BT_EVENT_TERMINATE = 0x0800,
+ BT_EVENT_EXCHANGE_REQUEST = 0x1000,
+ BT_EVENT_PHONEBOOK_REQUEST = 0x2000,
+ BT_EVENT_MESSAGE_REQUEST = 0x4000,
+ BT_EVENT_UNABLE_TO_PAIRING = 0x8000,
+ BT_EVENT_HANDSFREE_CONNECT_REQUEST = 0x1100,
+ BT_EVENT_HANDSFREE_DISCONNECT_REQUEST = 0x1200,
+ BT_EVENT_HANDSFREE_AUTO_CONNECT_REQUEST = 0x1600,
+ BT_EVENT_SYSTEM_RESET_REQUEST = 0x10000,
+} bt_popup_event_type_t;
+
+typedef enum {
+ BT_AGENT_ACCEPT,
+ BT_AGENT_REJECT,
+ BT_AGENT_CANCEL,
+ BT_CORE_AGENT_TIMEOUT,
+ BT_AGENT_ACCEPT_ALWAYS,
+} bt_agent_accept_type_t;
+
+struct bt_popup_appdata {
+ Evas *evas;
+ Evas_Object *win_main;
+ Evas_Object *popup;
+ Evas_Object *ly_pass;
+ Evas_Object *ly_keypad;
+
+ /* Passkey layout objects */
+ Evas_Object *entry;
+ Evas_Object *edit_field_save_btn;
+ Evas_Object *ticker_noti;
+
+ Ea_Theme_Color_Table *color_table;
+ Ea_Theme_Font_Table *font_table;
+
+ Ecore_Timer *timer;
+
+ DBusGProxy *agent_proxy;
+ DBusGProxy *obex_proxy;
+ E_DBus_Connection *EDBusHandle;
+ DBusGConnection *conn;
+
+ int changed_mode;
+ gboolean make_trusted;
+ guint viberation_id;
+ bt_popup_event_type_t event_type;
+};
+
+#endif /* __DEF_BT_SYSPOPUP_H_ */
+++ /dev/null
-/*
- *
- * Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0
- *
- * 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.
- *
- */
-
-#include <stdio.h>
-#include <pmapi.h>
-#include <appcore-efl.h>
-#include <vconf.h>
-#include <vconf-keys.h>
-#include <syspopup.h>
-#include <E_DBus.h>
-#include <aul.h>
-#include <bluetooth-api.h>
-#include <feedback.h>
-#include <linux/input.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_DBG("System-popup: terminate");
- return 0;
-}
-
-static int __bluetooth_timeout(bundle *b, void *data)
-{
- BT_DBG("System-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);
- ad->popup = NULL;
- }
-
- if (ad->win_main) {
- evas_object_del(ad->win_main);
- ad->win_main = NULL;
- }
-
- if (ad->agent_proxy) {
- g_object_unref(ad->agent_proxy);
- ad->agent_proxy = NULL;
- }
-}
-
-static void __bluetooth_notify_event(void)
-{
- int result;
-
- BT_DBG("Notify event");
-
- result = feedback_initialize();
- if (result != FEEDBACK_ERROR_NONE) {
- BT_ERR("feedback_initialize error : %d", result);
- return;
- }
-
- result = feedback_play(FEEDBACK_PATTERN_GENERAL);
- BT_DBG("ret value : %d", result);
-
- result = feedback_deinitialize();
- if (result != FEEDBACK_ERROR_NONE) {
- BT_DBG("feedback_initialize error : %d", result);
- return;
- }
-}
-
-static void __bluetooth_parse_event(struct bt_popup_appdata *ad, const char *event_type)
-{
- if (!strcasecmp(event_type, "pin-request"))
- ad->event_type = BT_EVENT_PIN_REQUEST;
- else if (!strcasecmp(event_type, "passkey-confirm-request"))
- ad->event_type = BT_EVENT_PASSKEY_CONFIRM_REQUEST;
- else if (!strcasecmp(event_type, "passkey-request"))
- ad->event_type = BT_EVENT_PASSKEY_REQUEST;
- else if (!strcasecmp(event_type, "authorize-request"))
- ad->event_type = BT_EVENT_AUTHORIZE_REQUEST;
- else if (!strcasecmp(event_type, "app-confirm-request"))
- ad->event_type = BT_EVENT_APP_CONFIRM_REQUEST;
- else if (!strcasecmp(event_type, "push-authorize-request"))
- ad->event_type = BT_EVENT_PUSH_AUTHORIZE_REQUEST;
- else if (!strcasecmp(event_type, "confirm-overwrite-request"))
- ad->event_type = BT_EVENT_CONFIRM_OVERWRITE_REQUEST;
- else if (!strcasecmp(event_type, "keyboard-passkey-request"))
- ad->event_type = BT_EVENT_KEYBOARD_PASSKEY_REQUEST;
- else if (!strcasecmp(event_type, "bt-information"))
- ad->event_type = BT_EVENT_INFORMATION;
- else if (!strcasecmp(event_type, "exchange-request"))
- ad->event_type = BT_EVENT_EXCHANGE_REQUEST;
- else if (!strcasecmp(event_type, "phonebook-request"))
- ad->event_type = BT_EVENT_PHONEBOOK_REQUEST;
- else if (!strcasecmp(event_type, "message-request"))
- ad->event_type = BT_EVENT_MESSAGE_REQUEST;
- else
- ad->event_type = 0x0000;
- return;
-}
-
-static void __bluetooth_request_to_cancel(void)
-{
- bluetooth_cancel_bonding();
-}
-
-static void __bluetooth_remove_all_event(struct bt_popup_appdata *ad)
-{
- switch (ad->event_type) {
- case BT_EVENT_PIN_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_KEYBOARD_PASSKEY_REQUEST:
-
- __bluetooth_request_to_cancel();
-
- 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:
- case BT_EVENT_EXCHANGE_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 (!g_strcmp0(ev->keyname, KEY_END) || !g_strcmp0(ev->keyname, KEY_SELECT)) {
- BT_DBG("Key [%s]", ev->keyname);
- /* remove_all_event(); */
-
- if (!g_strcmp0(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_DBG("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;
- char *input_text = NULL;
- char *convert_input_text = NULL;
-
- if (ad == NULL)
- return;
-
- /* 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 (!g_strcmp0(event, BT_STR_OK))
- response = 1;
- else
- response = 0;
-
- if (convert_input_text == NULL)
- return;
-
- BT_DBG("PIN/Passkey[%s] event[%d] response[%d]",
- convert_input_text, ad->event_type, response);
-
- if (response == 1) {
- BT_DBG("Done case");
- if (ad->event_type == BT_EVENT_PIN_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_DBG("Cancel case");
- if (ad->event_type == BT_EVENT_PIN_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_input_cancel_cb(void *data,
- Evas_Object *obj, void *event_info)
-{
- struct bt_popup_appdata *ad = (struct bt_popup_appdata *)data;
-
- bluetooth_cancel_bonding();
-
- __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 (!g_strcmp0(event, BT_STR_OK)) {
- 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_ERR("e_dbus_bus_get failed \n ");
- return FALSE;
- } else {
- BT_DBG("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_DBG("__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;
-
- msg = dbus_message_new_signal(BT_SYS_POPUP_IPC_RESPONSE_OBJECT,
- BT_SYS_POPUP_INTERFACE,
- BT_SYS_POPUP_METHOD_RESPONSE);
-
- if (!g_strcmp0(event, BT_STR_YES) || !g_strcmp0(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 (!g_strcmp0(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 (!g_strcmp0(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_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);
- elm_object_signal_emit(ad->editfield,
- "elm,state,eraser,hide",
- "elm");
- } else {
- elm_object_disabled_set(ad->edit_field_save_btn,
- EINA_FALSE);
- elm_object_signal_emit(ad->editfield,
- "elm,state,eraser,show",
- "elm");
- }
-
- 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 void __bluetooth_entry_focused_cb(void *data, Evas_Object *obj,
- void *event_info)
-{
- if (!elm_entry_is_empty(obj))
- elm_object_signal_emit(data, "elm,state,eraser,show", "elm");
-
- elm_object_signal_emit(data, "elm,state,guidetext,hide", "elm");
-}
-
-static void __bluetooth_entry_unfocused_cb(void *data, Evas_Object *obj,
- void *event_info)
-{
- if (elm_entry_is_empty(obj))
- elm_object_signal_emit(data, "elm,state,guidetext,show", "elm");
-
- elm_object_signal_emit(data, "elm,state,eraser,hide", "elm");
-}
-
-static void __bluetooth_eraser_clicked_cb(void* data, Evas_Object* obj,
- const char* emission, const char* source)
-{
- elm_entry_entry_set(data, "");
-}
-
-static void __bluetooth_check_chagned_cb(void *data, Evas_Object *obj,
- void *event_info)
-{
- Eina_Bool state = EINA_FALSE;
-
- if (obj == NULL)
- return;
-
- state = elm_check_state_get(obj);
- elm_entry_password_set(data, !state);
-}
-
-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 };
- Evas_Object *btn1;
- Evas_Object *btn2;
-
- BT_DBG("__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);
-
- elm_object_style_set(ad->popup, "transparent");
-
- if (title != NULL) {
- snprintf(temp_str, BT_TITLE_STR_MAX_LEN+BT_TEXT_EXTRA_LEN,
- "<align=center>%s</align>", title);
- elm_object_text_set(ad->popup, temp_str);
- }
-
- if ((btn1_text != NULL) && (btn2_text != NULL)) {
- btn1 = elm_button_add(ad->popup);
- elm_object_style_set(btn1, "popup_button/default");
- 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_style_set(btn2, "popup_button/default");
- 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_style_set(btn1, "popup_button/default");
- 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);
- }
-
- evas_object_show(ad->popup);
- evas_object_show(ad->win_main);
-
- BT_DBG("__bluetooth_draw_popup END");
-}
-
-static void __bluetooth_draw_input_view(struct bt_popup_appdata *ad,
- const char *title, const char *text,
- void (*func)
- (void *data, Evas_Object *obj, void *event_info))
-{
- Evas_Object *conformant = NULL;
- Evas_Object *content = NULL;
- Evas_Object *layout = NULL;
- Evas_Object *passpopup = NULL;
- Evas_Object *label = NULL;
- Evas_Object *editfield = NULL;
- Evas_Object *entry = NULL;
- Evas_Object *check = NULL;
- Evas_Object *l_button = NULL;
- Evas_Object *r_button = NULL;
-
- if (ad == NULL || ad->win_main == NULL) {
- BT_ERR("Invalid parameter");
- return;
- }
-
- evas_object_show(ad->win_main);
-
- conformant = elm_conformant_add(ad->win_main);
- if (conformant == NULL) {
- BT_ERR("conformant is NULL");
- return;
- }
- ad->popup = conformant;
-
- elm_win_conformant_set(ad->win_main, EINA_TRUE);
- elm_win_resize_object_add(ad->win_main, 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);
-
- content = elm_layout_add(conformant);
- elm_object_content_set(conformant, content);
-
- passpopup = elm_popup_add(content);
- elm_object_part_text_set(passpopup, "title,text", title);
-
- elm_object_style_set(passpopup, "transparent");
-
- layout = elm_layout_add(passpopup);
- elm_layout_file_set(layout, CUSTOM_POPUP_PATH, "popup_checkview_image");
- evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-
- label = elm_label_add(passpopup);
- elm_object_style_set(label, "popup/default");
- elm_label_line_wrap_set(label, ELM_WRAP_CHAR);
- elm_object_text_set(label, text);
- evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(label, EVAS_HINT_FILL, EVAS_HINT_FILL);
- evas_object_show(label);
-
- editfield = elm_layout_add(passpopup);
- elm_layout_theme_set(editfield, "layout", "editfield", "default");
- 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->editfield = editfield;
-
- entry = elm_entry_add(passpopup);
- elm_entry_single_line_set(entry, EINA_TRUE);
- elm_entry_scrollable_set(entry, EINA_TRUE);
- elm_entry_prediction_allow_set(entry, EINA_FALSE);
- elm_entry_password_set(entry, TRUE);
- elm_entry_input_panel_layout_set(entry, ELM_INPUT_PANEL_LAYOUT_NUMBERONLY);
- elm_object_part_content_set(editfield, "elm.swallow.content", entry);
- ad->entry = entry;
-
- evas_object_smart_callback_add(entry, "changed",
- __bluetooth_entry_change_cb,
- ad);
-
- evas_object_smart_callback_add(entry, "focused",
- __bluetooth_entry_focused_cb,
- editfield);
-
- evas_object_smart_callback_add(entry, "unfocused",
- __bluetooth_entry_unfocused_cb,
- editfield);
-
- elm_object_signal_callback_add(editfield, "elm,eraser,clicked", "elm",
- (Edje_Signal_Cb)__bluetooth_eraser_clicked_cb,
- entry);
-
- evas_object_show(entry);
- evas_object_show(editfield);
-
- check = elm_check_add(passpopup);
- elm_object_text_set(check, BT_STR_SHOW_PASSWORD);
- elm_object_focus_allow_set(check, EINA_FALSE);
- evas_object_size_hint_weight_set(check, EVAS_HINT_EXPAND,
- EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(check, EVAS_HINT_FILL,
- EVAS_HINT_FILL);
- evas_object_smart_callback_add(check, "changed",
- __bluetooth_check_chagned_cb, entry);
- evas_object_show(check);
-
- l_button = elm_button_add(ad->win_main);
- elm_object_style_set(l_button, "popup_button/default");
- elm_object_text_set(l_button, BT_STR_OK);
- elm_object_part_content_set(passpopup, "button1", l_button);
- evas_object_smart_callback_add(l_button, "clicked", func, ad);
- elm_object_disabled_set(l_button, EINA_TRUE);
-
- ad->edit_field_save_btn = l_button;
-
- r_button = elm_button_add(ad->win_main);
- elm_object_style_set(r_button, "popup_button/default");
- elm_object_text_set(r_button, BT_STR_CANCEL);
- elm_object_part_content_set(passpopup, "button2", r_button);
- evas_object_smart_callback_add(r_button, "clicked", func, ad);
-
- elm_object_part_content_set(layout, "elm.swallow.content", label);
- elm_object_part_content_set(layout, "elm.swallow.entry", editfield);
- elm_object_part_content_set(layout, "elm.swallow.end", check);
-
- evas_object_show(layout);
- evas_object_show(content);
- evas_object_show(passpopup);
- elm_object_content_set(passpopup, layout);
- elm_object_focus_set(entry, EINA_TRUE);
-}
-
-static void __bluetooth_delete_input_view(struct bt_popup_appdata *ad)
-{
- __bluetooth_ime_hide();
-}
-
-static DBusGProxy* __bluetooth_create_agent_proxy(DBusGConnection *conn,
- const char *path)
-{
- return dbus_g_proxy_new_for_name(conn, "org.projectx.bt", path,
- "org.bluez.Agent1");
-}
-
-/* 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;
- const char *agent_path;
- char *conv_str = NULL;
-
- BT_DBG("__bluetooth_launch_handler");
-
- if (!reset_data || !event_type)
- return -1;
-
- if (!strcasecmp(event_type, "pin-request")) {
- device_name = bundle_get_val(kb, "device-name");
- agent_path = bundle_get_val(kb, "agent-path");
-
- ad->agent_proxy = __bluetooth_create_agent_proxy(ad->conn, agent_path);
- if (!ad->agent_proxy)
- return -1;
-
- if (device_name)
- conv_str = elm_entry_utf8_to_markup(device_name);
-
- snprintf(view_title, BT_TITLE_STR_MAX_LEN,
- "%s", BT_STR_BLUETOOTH_PAIRING_REQUEST);
-
- snprintf(text, BT_GLOBALIZATION_STR_LENGTH,
- BT_STR_ENTER_PIN_TO_PAIR, conv_str);
-
- if (conv_str)
- free(conv_str);
-
- /* Request user inputted PIN for basic pairing */
- __bluetooth_draw_input_view(ad, view_title, text,
- __bluetooth_input_request_cb);
- } else if (!strcasecmp(event_type, "passkey-confirm-request")) {
- device_name = bundle_get_val(kb, "device-name");
- passkey = bundle_get_val(kb, "passkey");
- agent_path = bundle_get_val(kb, "agent-path");
-
- ad->agent_proxy = __bluetooth_create_agent_proxy(ad->conn, agent_path);
- if (!ad->agent_proxy)
- return -1;
-
- if (device_name && passkey) {
- conv_str = elm_entry_utf8_to_markup(device_name);
-
- snprintf(view_title, BT_TITLE_STR_MAX_LEN,
- BT_STR_CONFIRM_PASSKEY_PS_TO_PAIR_WITH_PS,
- conv_str, passkey);
-
- BT_DBG("title: %s", view_title);
-
- if (conv_str)
- free(conv_str);
-
- __bluetooth_draw_popup(ad, view_title,
- BT_STR_OK, BT_STR_CANCEL,
- __bluetooth_passkey_confirm_cb);
- } else {
- timeout = BT_ERROR_TIMEOUT;
- }
- } else if (!strcasecmp(event_type, "passkey-request")) {
- const char *device_name = NULL;
-
- device_name = bundle_get_val(kb, "device-name");
- agent_path = bundle_get_val(kb, "agent-path");
-
- ad->agent_proxy = __bluetooth_create_agent_proxy(ad->conn, agent_path);
- if (!ad->agent_proxy)
- return -1;
-
- if (device_name)
- conv_str = elm_entry_utf8_to_markup(device_name);
-
- snprintf(view_title, BT_TITLE_STR_MAX_LEN,
- "%s", BT_STR_BLUETOOTH_PAIRING_REQUEST);
-
- snprintf(text, BT_GLOBALIZATION_STR_LENGTH,
- BT_STR_ENTER_PIN_TO_PAIR, conv_str);
-
- if (conv_str)
- free(conv_str);
-
- /* Request user inputted Passkey for basic pairing */
- __bluetooth_draw_input_view(ad, view_title, text,
- __bluetooth_input_request_cb);
-
- } else if (!strcasecmp(event_type, "passkey-display-request")) {
- 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(view_title, BT_TITLE_STR_MAX_LEN,
- BT_STR_ENTER_PS_ON_PS_TO_PAIR, passkey, conv_str);
-
- BT_DBG("title: %s", view_title);
-
- if (conv_str)
- free(conv_str);
-
- __bluetooth_draw_popup(ad, view_title,
- BT_STR_CANCEL, NULL,
- __bluetooth_input_cancel_cb);
- } else {
- timeout = BT_ERROR_TIMEOUT;
- }
- } else if (!strcasecmp(event_type, "authorize-request")) {
- timeout = BT_AUTHORIZATION_TIMEOUT;
-
- device_name = bundle_get_val(kb, "device-name");
- agent_path = bundle_get_val(kb, "agent-path");
-
- ad->agent_proxy = __bluetooth_create_agent_proxy(ad->conn, agent_path);
- if (!ad->agent_proxy)
- return -1;
-
- 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_DBG("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")) {
- 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")) {
- 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_app_confirm_cb);
- } else if (!strcasecmp(event_type, "keyboard-passkey-request")) {
- 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(view_title, BT_TITLE_STR_MAX_LEN,
- BT_STR_ENTER_PS_ON_PS_TO_PAIR, passkey, conv_str);
-
- BT_DBG("title: %s", view_title);
-
- if (conv_str)
- free(conv_str);
-
- __bluetooth_draw_popup(ad, view_title,
- BT_STR_CANCEL, NULL,
- __bluetooth_input_cancel_cb);
- } else {
- timeout = BT_ERROR_TIMEOUT;
- }
- } else if (!strcasecmp(event_type, "bt-information")) {
- BT_DBG("bt-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, "exchange-request")) {
- timeout = BT_AUTHORIZATION_TIMEOUT;
-
- device_name = bundle_get_val(kb, "device-name");
- agent_path = bundle_get_val(kb, "agent-path");
-
- ad->agent_proxy = __bluetooth_create_agent_proxy(ad->conn, agent_path);
- if (!ad->agent_proxy)
- return -1;
-
- if (device_name)
- conv_str = elm_entry_utf8_to_markup(device_name);
-
- snprintf(view_title, BT_TITLE_STR_MAX_LEN,
- BT_STR_EXCHANGE_OBJECT_WITH_PS_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, "phonebook-request")) {
- timeout = BT_AUTHORIZATION_TIMEOUT;
-
- device_name = bundle_get_val(kb, "device-name");
- agent_path = bundle_get_val(kb, "agent-path");
-
- ad->agent_proxy = __bluetooth_create_agent_proxy(ad->conn, agent_path);
- if (!ad->agent_proxy)
- return -1;
-
- if (device_name)
- conv_str = elm_entry_utf8_to_markup(device_name);
-
- snprintf(view_title, BT_TITLE_STR_MAX_LEN,
- BT_STR_ALLOW_PS_PHONEBOOK_ACCESS_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, "message-request")) {
- timeout = BT_AUTHORIZATION_TIMEOUT;
-
- device_name = bundle_get_val(kb, "device-name");
- agent_path = bundle_get_val(kb, "agent-path");
-
- ad->agent_proxy = __bluetooth_create_agent_proxy(ad->conn, agent_path);
- if (!ad->agent_proxy)
- return -1;
-
- 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_ACCESS_MESSAGES_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 {
- return -1;
- }
-
- if (ad->event_type != BT_EVENT_FILE_RECEIVED && timeout != 0) {
- 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;
-
- 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);
- }
-
- 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_ERR("ERROR: Can't get on system bus [%s]",
- err->message);
- g_error_free(err);
- return;
- }
-
- ad->conn = conn;
-
- ad->obex_proxy = dbus_g_proxy_new_for_name(conn,
- "org.bluez.frwk_agent",
- "/org/obex/ops_agent",
- "org.openobex.Agent");
- if (!ad->obex_proxy)
- BT_ERR("Could not create obex dbus proxy");
-
- if (!__bluetooth_init_app_signal(ad))
- BT_ERR("__bt_syspopup_init_app_signal failed");
-}
-
-static int __bluetooth_create(void *data)
-{
- struct bt_popup_appdata *ad = data;
- Evas_Object *win = NULL;
-
- BT_DBG("__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;
-
- __bluetooth_ime_hide();
-
- if (ad->conn) {
- dbus_g_connection_unref(ad->conn);
- ad->conn = NULL;
- }
-
- if (ad->event_handle)
- ecore_event_handler_del(ad->event_handle);
-
- if (ad->popup)
- evas_object_del(ad->popup);
-
- if (ad->win_main)
- evas_object_del(ad->win_main);
-
- ad->popup = 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_DBG("__bluetooth_reset()\n");
-
- if (ad == NULL) {
- BT_ERR("App data is NULL\n");
- return -1;
- }
-
- /* Start Main UI */
- event_type = bundle_get_val(b, "event-type");
-
- if (event_type != NULL) {
- if (!strcasecmp(event_type, "terminate")) {
- __bluetooth_win_del(ad);
- return 0;
- }
-
- if (syspopup_has_popup(b)) {
- /* Destroy the existing popup*/
- __bluetooth_cleanup(ad);
- /* create window */
- ad->win_main = __bluetooth_create_win(PACKAGE);
- if (ad->win_main == NULL)
- return -1;
- }
-
- __bluetooth_parse_event(ad, event_type);
-
- elm_win_alpha_set(ad->win_main, EINA_TRUE);
-
- ret = syspopup_create(b, &handler, ad->win_main, ad);
- if (ret == -1) {
- BT_ERR("syspopup_create err");
- __bluetooth_remove_all_event(ad);
- } else {
- ret = __bluetooth_launch_handler(ad,
- b, event_type);
-
- if (ret != 0)
- __bluetooth_remove_all_event(ad);
-
- __bluetooth_notify_event();
-
- /* Change LCD brightness */
- ret = pm_change_state(LCD_NORMAL);
- if (ret != 0)
- BT_ERR("Fail to change LCD");
- }
- } else {
- BT_ERR("event type is NULL \n");
- }
-
- return 0;
-}
-
-EXPORT 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);
-}
-
+++ /dev/null
-/*
- *
- * Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0
- *
- * 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.
- *
- */
-
-#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 PACKAGE_NAME
-#define PACKAGE_NAME "org.tizen.bt-syspopup"
-#endif
-
-#ifndef PREFIX
-#define PREFIX tzplatform_mkpath(TZ_SYS_RW_APP, PACKAGE_NAME);
-#endif
-
-#define EXPORT __attribute__((visibility("default")))
-
-#define TEMP_DIR "/tmp"
-
-#define PACKAGE "bt-syspopup"
-#define APPNAME "bt-syspopup"
-#define ICON_DIR PREFIX"/res/default/small/icon"
-
-#define CUSTOM_POPUP_PATH PREFIX"/res/edje/custom_popup.edj"
-
-#define BT_COMMON_PKG "ug-setting-bluetooth-efl"
-#define BT_COMMON_RES "/usr/ug/res/locale"
-
-#define _EDJ(obj) elm_layout_edje_get(obj)
-
-#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
-
-#undef LOG_TAG
-#define LOG_TAG "BT_SYSPOPUP"
-
-#define BT_DBG(format, args...) SLOGD(format, ##args)
-#define BT_ERR(format, args...) SLOGE(format, ##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")
-
-#define BT_STR_ENTER_PS_ON_PS_TO_PAIR \
- dgettext(BT_COMMON_PKG, "IDS_BT_BODY_ENTER_P1SS_ON_P2SS_TO_PAIR_THEN_TAP_RETURN_OR_ENTER")
-
-#define BT_STR_EXCHANGE_OBJECT_WITH_PS_Q \
- dgettext(BT_COMMON_PKG, "IDS_BT_POP_EXCHANGEOBJECT")
-
-/* Need to convert the design ID */
-#define BT_STR_BLUETOOTH_PAIRING_REQUEST \
- dgettext(BT_COMMON_PKG, "IDS_BT_HEADER_BLUETOOTH_PAIRING_REQUEST")
-
-#define BT_STR_ENTER_PIN_TO_PAIR \
- dgettext(BT_COMMON_PKG, "IDS_BT_POP_ENTER_PIN_TO_PAIR_WITH_PS_HTRY_0000_OR_1234")
-
-#define BT_STR_SHOW_PASSWORD \
- dgettext(BT_COMMON_PKG, "IDS_BT_BODY_SHOW_PASSWORD")
-
-#define BT_STR_CONFIRM_PASSKEY_PS_TO_PAIR_WITH_PS \
- dgettext(BT_COMMON_PKG, "IDS_BT_POP_CONFIRM_PASSKEY_IS_P2SS_TO_PAIR_WITH_P1SS")
-
-#define BT_STR_ALLOW_PS_PHONEBOOK_ACCESS_Q \
- dgettext(BT_COMMON_PKG, "IDS_BT_BODY_ALLOW_PS_PHONEBOOK_ACCESS")
-
-#define BT_STR_ALLOW_PS_TO_ACCESS_MESSAGES_Q \
- dgettext(BT_COMMON_PKG, "IDS_BT_POP_ALLOW_PS_TO_ACCESS_MESSAGES_Q")
-
-#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_RECEIVED = 0x0100,
- BT_EVENT_KEYBOARD_PASSKEY_REQUEST = 0x0200,
- BT_EVENT_INFORMATION = 0x0400,
- BT_EVENT_TERMINATE = 0x0800,
- BT_EVENT_EXCHANGE_REQUEST = 0x1000,
- BT_EVENT_PHONEBOOK_REQUEST = 0x2000,
- BT_EVENT_MESSAGE_REQUEST = 0x4000,
-} 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 *popup;
-
- /* Passkey layout objects */
- Evas_Object *entry;
- Evas_Object *editfield;
- 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;
- DBusGConnection *conn;
-
- int changed_mode;
- bt_popup_event_type_t event_type;
-};
-
-#endif /* __DEF_BT_SYSPOPUP_H_ */
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<ChangeableColorTable num="1">
+ <Theme style="Dark">
+ <ChangeableColorInfo id="AO011" inputColor="1" hue="-2" saturation="29" value="0" alpha="100" maxValue="14" />
+ <ChangeableColorInfo id="AO013L2" inputColor="3" hue="4" saturation="66" value="65" alpha="100" />
+ <ChangeableColorInfo id="AO014" inputColor="W" hue="0" saturation="0" value="0" alpha="100" />
+ <ChangeableColorInfo id="AT012" inputColor="W" hue="0" saturation="0" value="0" alpha="100" />
+ <ChangeableColorInfo id="AT013" inputColor="3" hue="4" saturation="66" value="65" alpha="100" />
+ <ChangeableColorInfo id="AT0131" inputColor="W" hue="0" saturation="0" value="0" alpha="100" />
+ <ChangeableColorInfo id="AT0132" inputColor="3" hue="4" saturation="66" value="65" alpha="100" />
+ <ChangeableColorInfo id="B011" inputColor="1" hue="-2" saturation="29" value="0" alpha="100" maxValue="14" />
+ <ChangeableColorInfo id="AO012L1" inputColor="K" hue="0" saturation="0" value="12" alpha="100" />
+ <ChangeableColorInfo id="AO012L2" inputColor="K" hue="0" saturation="0" value="22" alpha="100" />
+ <ChangeableColorInfo id="AO012L2P" inputColor="K" hue="0" saturation="0" value="9" alpha="100" />
+ <ChangeableColorInfo id="AO013" inputColor="W" hue="0" saturation="0" value="0" alpha="100" />
+ </Theme>
+ <Theme style="Light">
+ <ChangeableColorInfo id="AO011" inputColor="1" hue="0" saturation="0" value="98" alpha="100" fixedHue="true" fixedSaturation="true" fixedValue="true" />
+ <ChangeableColorInfo id="AO013L2" inputColor="3" hue="4" saturation="66" value="65" alpha="100" />
+ <ChangeableColorInfo id="AO014" inputColor="W" hue="0" saturation="0" value="-78" alpha="100" />
+ <ChangeableColorInfo id="AT012" inputColor="W" hue="0" saturation="0" value="-95" alpha="100" />
+ <ChangeableColorInfo id="AT013" inputColor="3" hue="4" saturation="66" value="65" alpha="100" />
+ <ChangeableColorInfo id="AT0131" inputColor="W" hue="0" saturation="0" value="-95" alpha="100" />
+ <ChangeableColorInfo id="AT0132" inputColor="3" hue="4" saturation="66" value="65" alpha="100" />
+ <ChangeableColorInfo id="B011" inputColor="1" hue="0" saturation="0" value="98" alpha="100" fixedHue="true" fixedSaturation="true" fixedValue="true" />
+ <ChangeableColorInfo id="AO012L1" inputColor="K" hue="0" saturation="0" value="12" alpha="100"/>
+ <ChangeableColorInfo id="AO012L2" inputColor="K" hue="0" saturation="0" value="22" alpha="100"/>
+ <ChangeableColorInfo id="AO012L2P" inputColor="K" hue="0" saturation="0" value="9" alpha="100"/>
+ <ChangeableColorInfo id="AO013" inputColor="W" hue="0" saturation="0" value="0" alpha="100"/>
+ </Theme>
+</ChangeableColorTable>
+<ChangeableColorTable num="2">
+ <Theme style="Dark">
+ </Theme>
+ <Theme style="Light">
+ </Theme>
+</ChangeableColorTable>
+<ChangeableColorTable num="3">
+ <Theme style="Dark">
+ </Theme>
+ <Theme style="Light">
+ </Theme>
+</ChangeableColorTable>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<FontInfoTable>
+ <FontInfo id="AT012" style="R" size="32" />
+ <FontInfo id="AT013" style="R" size="36" />
+ <FontInfo id="AT0131" style="R" size="32" />
+ <FontInfo id="AT0132" style="R" size="32" />
+</FontInfoTable>