summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsegwon <segwon.han@samsung.com>2016-11-24 16:22:16 +0900
committersegwon <segwon.han@samsung.com>2016-11-24 16:22:52 +0900
commit51a6f643a57c4f9f37ac8ad66a3c64d6322ffd41 (patch)
treec04b62e934e662658791684d429269ccb0e23747
parent7478c9ed5cfdb7fc3dbc717b3c8022bfa9ce0d6f (diff)
downloadd2d-conv-setting-51a6f643a57c4f9f37ac8ad66a3c64d6322ffd41.tar.gz
d2d-conv-setting-51a6f643a57c4f9f37ac8ad66a3c64d6322ffd41.tar.bz2
d2d-conv-setting-51a6f643a57c4f9f37ac8ad66a3c64d6322ffd41.zip
Development the Wearable Setting Application
Signed-off-by: segwon <segwon.han@samsung.com> Change-Id: Ia7506a7d28a6e1e0eeb21b4153f88910530152b2
-rw-r--r--CMakeLists.txt7
-rw-r--r--inc/convergence.h18
-rw-r--r--inc/language.h4
-rw-r--r--inc/main.h97
-rwxr-xr-xorg.tizen.d2d-conv-setting.xml2
-rw-r--r--packaging/d2d-conv-setting.spec2
-rw-r--r--po/en_US.po45
-rw-r--r--po/ko_KR.po45
-rw-r--r--res/images/device_type_icon_camera.pngbin0 -> 899 bytes
-rw-r--r--res/images/device_type_icon_computer.pngbin0 -> 379 bytes
-rw-r--r--res/images/device_type_icon_display.pngbin0 -> 310 bytes
-rw-r--r--res/images/device_type_icon_gaming.pngbin0 -> 997 bytes
-rw-r--r--res/images/device_type_icon_headphone.pngbin0 -> 1006 bytes
-rw-r--r--res/images/device_type_icon_headset.pngbin0 -> 1158 bytes
-rw-r--r--res/images/device_type_icon_keyboard.pngbin0 -> 360 bytes
-rw-r--r--res/images/device_type_icon_medical.pngbin0 -> 943 bytes
-rw-r--r--res/images/device_type_icon_mobilephone.pngbin0 -> 318 bytes
-rw-r--r--res/images/device_type_icon_mouse.pngbin0 -> 791 bytes
-rw-r--r--res/images/device_type_icon_multimedia.pngbin0 -> 496 bytes
-rw-r--r--res/images/device_type_icon_network_infrastructure.pngbin0 -> 577 bytes
-rw-r--r--res/images/device_type_icon_printer.pngbin0 -> 640 bytes
-rw-r--r--res/images/device_type_icon_storage.pngbin0 -> 284 bytes
-rw-r--r--res/images/device_type_icon_wrist.pngbin0 -> 697 bytes
-rw-r--r--res/images/popup_btn_cancel.pngbin0 -> 1184 bytes
-rw-r--r--res/images/popup_btn_check.pngbin0 -> 1392 bytes
-rw-r--r--src/convergence/convergence_power_manager.c28
-rw-r--r--src/main.c90
-rw-r--r--src/ui/setting_home.c171
-rw-r--r--src/ui/setting_item_allowed_device_list.c274
-rw-r--r--src/ui/setting_item_denied_device_list.c274
-rw-r--r--src/ui/setting_item_device_list.c109
-rw-r--r--src/ui/setting_item_discovery.c312
-rw-r--r--src/ui/setting_item_power.c90
-rw-r--r--src/ui/setting_item_sign.c100
-rw-r--r--src/util.c24
35 files changed, 1413 insertions, 279 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index bc378ca..ba6b89f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -5,7 +5,6 @@ SET(PACKAGE org.tizen.d2d-conv-setting)
FILE(GLOB SRCS
src/*.c
src/ui/*.c
- src/convergence/*.c
)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/inc)
@@ -26,9 +25,10 @@ ENDFOREACH(flag)
pkg_check_modules(TIZEN_PKG REQUIRED
dlog
+ appcore-efl
capi-appfw-application
capi-system-system-settings
- appcore-efl
+ capi-system-device
capi-appfw-app-manager
d2d-conv-manager
)
@@ -48,11 +48,13 @@ SET(BINDIR "${PREFIX}/bin")
SET(SHDIR "${PREFIX}/shared")
SET(RESDIR "${PREFIX}/res")
SET(LOCALEDIR "${RESDIR}/locale")
+SET(IMGDIR "${RESDIR}/images")
ADD_DEFINITIONS("-DPACKAGE=\"${PACKAGE}\"")
ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
ADD_DEFINITIONS("-DRESDIR=\"${RESDIR}\"")
ADD_DEFINITIONS("-DLOCALE_DIR=\"${LOCALEDIR}\"")
+ADD_DEFINITIONS("-DICON_DIR=\"${IMGDIR}\"")
ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS})
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${PKG_LDFLAGS})
@@ -64,5 +66,6 @@ INSTALL(FILES ${CMAKE_SOURCE_DIR}/${PACKAGE}.png DESTINATION ${SHDIR}/res/)
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/${PACKAGE}.xml ${CMAKE_SOURCE_DIR}/${PACKAGE}.xml @ONLY)
INSTALL(FILES ${CMAKE_SOURCE_DIR}/${PACKAGE}.xml DESTINATION ${PKG_MANIFEST_PATH})
+INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/res/images/ DESTINATION ${IMGDIR} FILES_MATCHING PATTERN "*.png")
# i18n
ADD_SUBDIRECTORY(po)
diff --git a/inc/convergence.h b/inc/convergence.h
deleted file mode 100644
index c190ece..0000000
--- a/inc/convergence.h
+++ /dev/null
@@ -1,18 +0,0 @@
-#ifndef CONVERGENCE_H_
-#define CONVERGENCE_H_
-
-#include <dlog.h>
-#include <glib.h>
-#include <d2d_conv_internal.h>
-
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-#define LOG_TAG "D2D-CONV-SETTING"
-
-/* convergence power manager */
-extern void convergence_power_on();
-extern void convergence_power_off();
-extern int get_convergence_power_state();
-
-#endif /* CONVERGENCE_H_ */
diff --git a/inc/language.h b/inc/language.h
deleted file mode 100644
index 1150946..0000000
--- a/inc/language.h
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <libintl.h>
-
-#define POWER_ON_SIGN_TEXT dgettext(PACKAGE, "CONV_SETTING_APP_POWER_ON")
-#define POWER_OFF_SIGN_TEXT dgettext(PACKAGE, "CONV_SETTING_APP_POWER_OFF") \ No newline at end of file
diff --git a/inc/main.h b/inc/main.h
index ee78051..20471ad 100644
--- a/inc/main.h
+++ b/inc/main.h
@@ -1,42 +1,113 @@
+/*
+ * Copyright (c) 2016 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 __main_H__
#define __main_H__
+#include <stdlib.h>
#include <app.h>
#include <Elementary.h>
#include <system_settings.h>
#include <efl_extension.h>
+#include <device/haptic.h>
#include <dlog.h>
#include <glib.h>
-#include "convergence.h"
-#include "language.h"
+#include <libintl.h>
+#include <d2d_conv_manager.h>
+#include <d2d_conv_internal.h>
#ifdef LOG_TAG
#undef LOG_TAG
#endif
#define LOG_TAG "D2D-CONV-SETTING"
+#ifdef PACKAGE
+#undef PACKAGE
+#endif
#define PACKAGE "org.tizen.d2d-conv-setting"
-typedef enum state
-{
+#ifdef ICON_DIR
+#undef ICON_DIR
+#endif
+#define ICON_DIR "/usr/apps/org.tizen.d2d-conv-setting/res/images"
+
+typedef enum state {
POWER_OFF = 0,
POWER_ON,
- SCAN_START,
- SCAN_STOP,
+ DISCOVERY_START,
+ DISCOVERY_STOP,
CHANGE_LANGUAGE
} state_e;
+typedef struct device_info {
+ int index;
+ char *list_type;
+ char *name;
+ char *type;
+ char *mac_address;
+} device_info_s;
+
+typedef struct appdata {
+ Evas_Object *win;
+ Evas_Object *conform;
+ Evas_Object *nf;
+ Eext_Circle_Surface *circle_surface;
+} appdata_s;
+
+appdata_s *ad;
-/* state event lisetner */
-typedef void (*event_listener)(state_e state);
-extern void add_state_change_event_listener(event_listener listener);
-extern void state_change_event(state_e state);
+#define STORAGE_SIZE 30
+
+#define LIST_TYPE_PERMITTED "permitted_list"
+#define LIST_TYPE_DENIED "denied_list"
+#define LIST_TYPE_DISCOVERED "discovered_list"
+
+#define DEVICE_TYPE_MOBILE "MOBILE"
+#define DEVICE_TYPE_WEARABLE "WEARABLE"
+#define DEVICE_TYPE_TV "TV"
+
+#define TITLE_TEXT dgettext(PACKAGE, "D2D_CONV_SETTING_W_TITLE_TEXT")
+#define ACCESS_CONTROL_TEXT dgettext(PACKAGE, "D2D_CONV_SETTING_W_ACCESS_CONTROL_TEXT")
+#define NOTICE_TEXT dgettext(PACKAGE, "D2D_CONV_SETTING_W_NOTICE_TEXT")
+#define POWER_ON_NOTICE_TEXT dgettext(PACKAGE, "D2D_CONV_SETTING_W_POWER_ON_NOTICE_TEXT")
+#define POWER_OFF_NOTICE_TEXT dgettext(PACKAGE, "D2D_CONV_SETTING_W_POWER_OFF_NOTICE_TEXT")
+#define TURN_ON_THE_POWER_TEXT dgettext(PACKAGE, "D2D_CONV_SETTING_W_TURN_ON_THE_POWER_TEXT")
+#define ALLOWED_DEVICE_LIST_TEXT dgettext(PACKAGE, "D2D_CONV_SETTING_W_ALLOWED_DEVICE_LIST_TEXT")
+#define DENIED_DEVICE_LIST_TEXT dgettext(PACKAGE, "D2D_CONV_SETTING_W_DENIED_DEVICE_LIST_TEXT")
+#define AVAILABLE_DEVICE_LIST_TEXT dgettext(PACKAGE, "D2D_CONV_SETTING_W_AVAILABLE_DEVICE_LIST_TEXT")
+#define ALLOW_SELECT_POPUP_TEXT dgettext(PACKAGE, "D2D_CONV_SETTING_W_ALLOW_SELECT_POPUP_TEXT")
+#define DENY_SELECT_POPUP_TEXT dgettext(PACKAGE, "D2D_CONV_SETTING_W_DENY_SELECT_POPUP_TEXT")
+#define REMOVE_SELECT_POPUP_TEXT dgettext(PACKAGE, "D2D_CONV_SETTING_W_REMOVE_SELECT_POPUP_TEXT")
+#define ALLOW_BUTTON_TEXT dgettext(PACKAGE, "D2D_CONV_SETTING_W_ALLOW_BUTTON_TEXT")
+#define DENY_BUTTON_TEXT dgettext(PACKAGE, "D2D_CONV_SETTING_W_DENY_BUTTON_TEXT")
+#define REMOVE_BUTTON_TEXT dgettext(PACKAGE, "D2D_CONV_SETTING_W_REMOVE_BUTTON_TEXT")
/* setting ui */
-extern void create_setting_menu(Evas_Object *parent);
-extern void create_setting_item_power(Evas_Object *parent);
-extern void create_setting_item_sign(Evas_Object *parent);
+extern void show_setting_menu();
+extern void show_setting_item_sign();
+extern void show_setting_item_device_list();
+extern void show_setting_item_allowed_device_list();
+extern void show_setting_item_denied_device_list();
+extern void show_setting_item_discovery();
+
+extern int get_convergence_power_state();
+
+/* util */
+extern void do_haptic(int count);
#endif /* __main_H__ */
diff --git a/org.tizen.d2d-conv-setting.xml b/org.tizen.d2d-conv-setting.xml
index d996877..4e17fc2 100755
--- a/org.tizen.d2d-conv-setting.xml
+++ b/org.tizen.d2d-conv-setting.xml
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns="http://tizen.org/ns/packages" package="@PACKAGE@" api-version="3.0" version="@PKG_VERSION@" install-location="internal-only">
- <profile name="mobile"/>
<label>d2d-setting</label>
<description>Tizen D2D Convergence Setting Application</description>
@@ -18,6 +17,7 @@
<privilege>http://tizen.org/privilege/internet</privilege>
<privilege>http://tizen.org/privilege/externalstorage</privilege>
<privilege>http://tizen.org/privilege/content.write</privilege>
+ <privilege>http://tizen.org/privilege/haptic</privilege>
</privileges>
</manifest>
diff --git a/packaging/d2d-conv-setting.spec b/packaging/d2d-conv-setting.spec
index 8c8a53d..ff66a27 100644
--- a/packaging/d2d-conv-setting.spec
+++ b/packaging/d2d-conv-setting.spec
@@ -11,6 +11,7 @@ BuildRequires: pkgconfig(efl-extension)
BuildRequires: pkgconfig(capi-appfw-application)
BuildRequires: pkgconfig(capi-system-system-settings)
BuildRequires: pkgconfig(capi-appfw-app-manager)
+BuildRequires: pkgconfig(capi-system-device)
BuildRequires: pkgconfig(d2d-conv-manager)
BuildRequires: app-core-efl-devel
BuildRequires: efl-extension-devel
@@ -41,6 +42,7 @@ cp %{_builddir}/%{buildsubdir}/LICENSE %{buildroot}/%{_datadir}/license/%{name}
%files
%defattr(-,root,root,-)
%{_pkg_dir}/bin/*
+%{_pkg_dir}/res/*
%{_pkg_dir}/shared/*
%{_datadir}/locale/*/LC_MESSAGES/*.mo
%{TZ_SYS_RO_PACKAGES}/%{name}.xml
diff --git a/po/en_US.po b/po/en_US.po
index 30ee3fe..f2601fd 100644
--- a/po/en_US.po
+++ b/po/en_US.po
@@ -1,5 +1,44 @@
-msgid "CONV_SETTING_APP_POWER_ON"
+msgid "D2D_CONV_SETTING_W_TITLE_TEXT"
+msgstr "Convergence"
+
+msgid "D2D_CONV_SETTING_W_ACCESS_CONTROL_TEXT"
+msgstr "Access Control"
+
+msgid "D2D_CONV_SETTING_W_NOTICE_TEXT"
+msgstr "Notice"
+
+msgid "D2D_CONV_SETTING_W_POWER_ON_NOTICE_TEXT"
msgstr "Now, you can experience a variety of convergence features! Please be aware that a remote device can launch an application on your device or access data in your application. A notice will appear when your device is accessed by remote devices. You can disable this feature by clicking the button again."
-msgid "CONV_SETTING_APP_POWER_OFF"
-msgstr "You can experience a variety of convergence feature, if you enable TIZEN Convergence - an application on a separate device can be launched remotely, or communicate between applications on separate devices. Please be aware that remote device can launch an application on your device or access data in your application. A notice will appear when your device is accessed by remote devices." \ No newline at end of file
+msgid "D2D_CONV_SETTING_W_POWER_OFF_NOTICE_TEXT"
+msgstr "You can experience a variety of convergence feature, if you enable TIZEN Convergence an application on a separate device can be launched remotely, or communicate between applications on separate devices. Please be aware that remote device can launch an application on your device or access data in your application. A notice will appear when your device is accessed by remote devices."
+
+msgid "D2D_CONV_SETTING_W_TURN_ON_THE_POWER_TEXT"
+msgstr "If you want using this service, turn on the power of 'Convergence'."
+
+msgid "D2D_CONV_SETTING_W_ALLOWED_DEVICE_LIST_TEXT"
+msgstr "Allowed devices"
+
+msgid "D2D_CONV_SETTING_W_DENIED_DEVICE_LIST_TEXT"
+msgstr "Denied devices"
+
+msgid "D2D_CONV_SETTING_W_AVAILABLE_DEVICE_LIST_TEXT"
+msgstr "Available devices"
+
+msgid "D2D_CONV_SETTING_W_ALLOW_SELECT_POPUP_TEXT"
+msgstr "Do you really allow"
+
+msgid "D2D_CONV_SETTING_W_DENY_SELECT_POPUP_TEXT"
+msgstr "Do you really deny"
+
+msgid "D2D_CONV_SETTING_W_REMOVE_SELECT_POPUP_TEXT"
+msgstr "Do you really remove"
+
+msgid "D2D_CONV_SETTING_W_ALLOW_BUTTON_TEXT"
+msgstr "Allow"
+
+msgid "D2D_CONV_SETTING_W_DENY_BUTTON_TEXT"
+msgstr "Deny"
+
+msgid "D2D_CONV_SETTING_W_REMOVE_BUTTON_TEXT"
+msgstr "Remove" \ No newline at end of file
diff --git a/po/ko_KR.po b/po/ko_KR.po
index 96e9465..2fe40a7 100644
--- a/po/ko_KR.po
+++ b/po/ko_KR.po
@@ -1,5 +1,44 @@
-msgid "CONV_SETTING_APP_POWER_ON"
+msgid "D2D_CONV_SETTING_W_TITLE_TEXT"
+msgstr "컨버젼스"
+
+msgid "D2D_CONV_SETTING_W_ACCESS_CONTROL_TEXT"
+msgstr "접근 관리"
+
+msgid "D2D_CONV_SETTING_W_NOTICE_TEXT"
+msgstr "안내"
+
+msgid "D2D_CONV_SETTING_W_POWER_ON_NOTICE_TEXT"
msgstr "다양한 Convergence 기능을 경험할 수 있습니다! 단, 동일한 Wi-Fi 망 내 주변기기에서도 본 기기에 접근이 가능해지므로, 주변기기가 본 기기의 App을 실행하거나 data에 접근할 수도 있습니다. 주변기기 접근 시도 시 팝업창을 통해 이용자의 동의를 받아 본기능이 활성화 됩니다. 본 기능은 본 메뉴의 버튼을 다시 선택하여 끌 수 있습니다."
-msgid "CONV_SETTING_APP_POWER_OFF"
-msgstr "TIZEN Convergence 기능을 켜면, 동일한 Wi-Fi 망 내의 주변기기의 App을 실행하거나 App 간 통신이 가능하게 되며, 다양한 Convergence 기능을 경험할 수 있습니다. 단, 동일한 Wi-Fi 망 내 주변기기에서 주변기기가 본 기기의 App을 실행하거나 data에 접근을 요청할 수 있습니다." \ No newline at end of file
+msgid "D2D_CONV_SETTING_W_POWER_OFF_NOTICE_TEXT"
+msgstr "TIZEN Convergence 기능을 켜면, 동일한 Wi-Fi 망 내의 주변기기의 App을 실행하거나 App 간 통신이 가능하게 되며, 다양한 Convergence 기능을 경험할 수 있습니다. 단, 동일한 Wi-Fi 망 내 주변기기에서 주변기기가 본 기기의 App을 실행하거나 data에 접근을 요청할 수 있습니다."
+
+msgid "D2D_CONV_SETTING_W_TURN_ON_THE_POWER_TEXT"
+msgstr "이 기능을 사용하시려면, '컨버젼스'를 켜주세요."
+
+msgid "D2D_CONV_SETTING_W_ALLOWED_DEVICE_LIST_TEXT"
+msgstr "허용된 디바이스"
+
+msgid "D2D_CONV_SETTING_W_DENIED_DEVICE_LIST_TEXT"
+msgstr "차단된 디바이스"
+
+msgid "D2D_CONV_SETTING_W_AVAILABLE_DEVICE_LIST_TEXT"
+msgstr "디바이스 검색"
+
+msgid "D2D_CONV_SETTING_W_ALLOW_SELECT_POPUP_TEXT"
+msgstr "정말 허용하시겠습니까? 디바이스 : "
+
+msgid "D2D_CONV_SETTING_W_DENY_SELECT_POPUP_TEXT"
+msgstr "정말 차단하시겠습니까? 디바이스 : "
+
+msgid "D2D_CONV_SETTING_W_REMOVE_SELECT_POPUP_TEXT"
+msgstr "정말 제거하시겠습니까? 디바이스 : "
+
+msgid "D2D_CONV_SETTING_W_ALLOW_BUTTON_TEXT"
+msgstr "허용"
+
+msgid "D2D_CONV_SETTING_W_DENY_BUTTON_TEXT"
+msgstr "차단"
+
+msgid "D2D_CONV_SETTING_W_REMOVE_BUTTON_TEXT"
+msgstr "제거" \ No newline at end of file
diff --git a/res/images/device_type_icon_camera.png b/res/images/device_type_icon_camera.png
new file mode 100644
index 0000000..0a53ae9
--- /dev/null
+++ b/res/images/device_type_icon_camera.png
Binary files differ
diff --git a/res/images/device_type_icon_computer.png b/res/images/device_type_icon_computer.png
new file mode 100644
index 0000000..d941e88
--- /dev/null
+++ b/res/images/device_type_icon_computer.png
Binary files differ
diff --git a/res/images/device_type_icon_display.png b/res/images/device_type_icon_display.png
new file mode 100644
index 0000000..448db2c
--- /dev/null
+++ b/res/images/device_type_icon_display.png
Binary files differ
diff --git a/res/images/device_type_icon_gaming.png b/res/images/device_type_icon_gaming.png
new file mode 100644
index 0000000..db08feb
--- /dev/null
+++ b/res/images/device_type_icon_gaming.png
Binary files differ
diff --git a/res/images/device_type_icon_headphone.png b/res/images/device_type_icon_headphone.png
new file mode 100644
index 0000000..b746dd8
--- /dev/null
+++ b/res/images/device_type_icon_headphone.png
Binary files differ
diff --git a/res/images/device_type_icon_headset.png b/res/images/device_type_icon_headset.png
new file mode 100644
index 0000000..a17e799
--- /dev/null
+++ b/res/images/device_type_icon_headset.png
Binary files differ
diff --git a/res/images/device_type_icon_keyboard.png b/res/images/device_type_icon_keyboard.png
new file mode 100644
index 0000000..62d62f5
--- /dev/null
+++ b/res/images/device_type_icon_keyboard.png
Binary files differ
diff --git a/res/images/device_type_icon_medical.png b/res/images/device_type_icon_medical.png
new file mode 100644
index 0000000..44ea23d
--- /dev/null
+++ b/res/images/device_type_icon_medical.png
Binary files differ
diff --git a/res/images/device_type_icon_mobilephone.png b/res/images/device_type_icon_mobilephone.png
new file mode 100644
index 0000000..c2f5e46
--- /dev/null
+++ b/res/images/device_type_icon_mobilephone.png
Binary files differ
diff --git a/res/images/device_type_icon_mouse.png b/res/images/device_type_icon_mouse.png
new file mode 100644
index 0000000..463c19d
--- /dev/null
+++ b/res/images/device_type_icon_mouse.png
Binary files differ
diff --git a/res/images/device_type_icon_multimedia.png b/res/images/device_type_icon_multimedia.png
new file mode 100644
index 0000000..126caf2
--- /dev/null
+++ b/res/images/device_type_icon_multimedia.png
Binary files differ
diff --git a/res/images/device_type_icon_network_infrastructure.png b/res/images/device_type_icon_network_infrastructure.png
new file mode 100644
index 0000000..424e974
--- /dev/null
+++ b/res/images/device_type_icon_network_infrastructure.png
Binary files differ
diff --git a/res/images/device_type_icon_printer.png b/res/images/device_type_icon_printer.png
new file mode 100644
index 0000000..59a2f12
--- /dev/null
+++ b/res/images/device_type_icon_printer.png
Binary files differ
diff --git a/res/images/device_type_icon_storage.png b/res/images/device_type_icon_storage.png
new file mode 100644
index 0000000..3f5f708
--- /dev/null
+++ b/res/images/device_type_icon_storage.png
Binary files differ
diff --git a/res/images/device_type_icon_wrist.png b/res/images/device_type_icon_wrist.png
new file mode 100644
index 0000000..19f100b
--- /dev/null
+++ b/res/images/device_type_icon_wrist.png
Binary files differ
diff --git a/res/images/popup_btn_cancel.png b/res/images/popup_btn_cancel.png
new file mode 100644
index 0000000..5f346cb
--- /dev/null
+++ b/res/images/popup_btn_cancel.png
Binary files differ
diff --git a/res/images/popup_btn_check.png b/res/images/popup_btn_check.png
new file mode 100644
index 0000000..f20f62e
--- /dev/null
+++ b/res/images/popup_btn_check.png
Binary files differ
diff --git a/src/convergence/convergence_power_manager.c b/src/convergence/convergence_power_manager.c
deleted file mode 100644
index 80f31eb..0000000
--- a/src/convergence/convergence_power_manager.c
+++ /dev/null
@@ -1,28 +0,0 @@
-#include "convergence.h"
-
-extern void convergence_power_on()
-{
- int ret = conv_internal_set_activation_state(1);
- if (ret == CONV_ERROR_NONE) {
- dlog_print(DLOG_INFO, LOG_TAG, "convergence_power_on error. ret = %d", ret);
- }
-}
-
-extern void convergence_power_off()
-{
- int ret = conv_internal_set_activation_state(0);
- if (ret == CONV_ERROR_NONE) {
- dlog_print(DLOG_INFO, LOG_TAG, "convergence_power_off error. ret = %d", ret);
- }
-}
-
-extern int get_convergence_power_state()
-{
- int state;
- int ret = conv_internal_get_activation_state(&state);
- if (ret == CONV_ERROR_NONE) {
- dlog_print(DLOG_INFO, LOG_TAG, "get_convergence_power_state error. ret = %d", ret);
- }
-
- return state;
-}
diff --git a/src/main.c b/src/main.c
index bf099bc..5e92872 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1,26 +1,51 @@
+/*
+ * Copyright (c) 2016 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 "main.h"
static bool app_create(void *data)
{
- Evas_Object *win = elm_win_util_standard_add(PACKAGE, PACKAGE);
- elm_win_conformant_set(win, EINA_TRUE);
- elm_win_autodel_set(win, EINA_TRUE);
- evas_object_show(win);
-
- Evas_Object *conform = elm_conformant_add(win);
- elm_win_indicator_mode_set(win, ELM_WIN_INDICATOR_SHOW);
- elm_win_indicator_opacity_set(win, ELM_WIN_INDICATOR_OPAQUE);
- evas_object_size_hint_weight_set(conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_win_resize_object_add(win, conform);
- evas_object_show(conform);
-
- Evas_Object *nf = elm_naviframe_add(conform);
- eext_object_event_callback_add(nf, EEXT_CALLBACK_BACK, eext_naviframe_back_cb, NULL);
- evas_object_size_hint_weight_set(nf, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_object_content_set(conform, nf);
- evas_object_show(nf);
-
- create_setting_menu(nf);
+ /* Window */
+ ad->win = elm_win_util_standard_add(PACKAGE, PACKAGE);
+ elm_win_conformant_set(ad->win, EINA_TRUE);
+ elm_win_autodel_set(ad->win, EINA_TRUE);
+ if (elm_win_wm_rotation_supported_get(ad->win)) {
+ int rots[4] = { 0, 90, 180, 270 };
+ elm_win_wm_rotation_available_rotations_set(ad->win, (const int *)(&rots), 4);
+ }
+ evas_object_show(ad->win);
+
+ /* Conformant */
+ ad->conform = elm_conformant_add(ad->win);
+ evas_object_size_hint_weight_set(ad->conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(ad->win, ad->conform);
+ evas_object_show(ad->conform);
+
+ /* Circle Surface */
+ ad->circle_surface = eext_circle_surface_conformant_add(ad->conform);
+
+ /* Naviframe */
+ ad->nf = elm_naviframe_add(ad->conform);
+ eext_object_event_callback_add(ad->nf, EEXT_CALLBACK_BACK, eext_naviframe_back_cb, NULL);
+ evas_object_size_hint_weight_set(ad->nf, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_object_content_set(ad->conform, ad->nf);
+ evas_object_show(ad->nf);
+
+ /* Setting Menu */
+ show_setting_menu(ad->nf);
return true;
}
@@ -45,15 +70,28 @@ static void app_terminate(void *data)
// Empty
}
-int main(int argc, char *argv[])
+static void init_appdata()
{
- ui_app_lifecycle_callback_s event_callback = {0,};
+ ad = (appdata_s*)malloc(sizeof(appdata_s));
+ {
+ ad->win = NULL;
+ ad->conform = NULL;
+ ad->nf = NULL;
+ ad->circle_surface = NULL;
+ }
+}
- event_callback.create = app_create;
- event_callback.app_control = app_control;
- event_callback.pause = app_pause;
- event_callback.resume = app_resume;
- event_callback.terminate = app_terminate;
+int main(int argc, char *argv[])
+{
+ init_appdata();
+ ui_app_lifecycle_callback_s event_callback = {0,};
+ {
+ event_callback.create = app_create;
+ event_callback.app_control = app_control;
+ event_callback.pause = app_pause;
+ event_callback.resume = app_resume;
+ event_callback.terminate = app_terminate;
+ }
return ui_app_main(argc, argv, &event_callback, NULL);
}
diff --git a/src/ui/setting_home.c b/src/ui/setting_home.c
index 9c5c1fb..ac5b3a8 100644
--- a/src/ui/setting_home.c
+++ b/src/ui/setting_home.c
@@ -1,68 +1,163 @@
+/*
+ * Copyright (c) 2016 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 "main.h"
-static int listener_num = 0;
-static event_listener listeners[4];
+#define MENU_SIZE 3
-extern void add_state_change_event_listener(event_listener listener)
+static Eina_Bool setting_menu_pop_cb(void *data, Elm_Object_Item *it)
{
- listeners[listener_num++] = listener;
+ do_haptic(50);
+ ui_app_exit();
+ return EINA_FALSE;
}
-extern void state_change_event(state_e state)
+static void convergence_power_on()
{
- int index;
+ int ret = conv_internal_set_activation_state(1);
+ if (ret != CONV_ERROR_NONE) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "convergence_power_on error. ret = %d", ret);
+ }
+}
- for (index = 0; index < listener_num; index++) {
- listeners[index](state);
+static void convergence_power_off()
+{
+ int ret = conv_internal_set_activation_state(0);
+ if (ret != CONV_ERROR_NONE) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "convergence_power_off error. ret = %d", ret);
}
}
-static Eina_Bool setting_menu_pop_cb(void *data, Elm_Object_Item *it)
+extern int get_convergence_power_state()
{
- ui_app_exit();
- return EINA_FALSE;
+ int state = 0;
+ int ret = conv_internal_get_activation_state(&state);
+ if (ret != CONV_ERROR_NONE) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "get_convergence_power_state error. ret = %d", ret);
+ }
+ return state;
}
-static void app_language_changed(app_event_info_h event_info, void *user_data)
+typedef struct menu_info {
+ int index;
+ Elm_Object_Item *item;
+ char *text;
+ char *subtext;
+} menu_info_s;
+
+static menu_info_s **menu_info = NULL;
+
+static char *text_get_cb(void *data, Evas_Object *obj, const char *part)
{
- char *language;
+ int index = *(int*)data;
- int ret = app_event_get_language(event_info, &language);
- if (ret != APP_ERROR_NONE) {
- dlog_print(DLOG_ERROR, LOG_TAG, "app_event_get_language() failed. Err = %d.", ret);
- return;
+ if (!strcmp(part, "elm.text")) {
+ if (menu_info[index]->text == NULL){
+ return NULL;
+ }
+ return strdup((char*)menu_info[index]->text);
+
+ } else if (!strcmp(part, "elm.text.1")) {
+
+ if (get_convergence_power_state() == 0) {
+ menu_info[index]->subtext = "off";
+ } else {
+ menu_info[index]->subtext = "on";
+ }
+ return strdup((char*)menu_info[index]->subtext);
}
- dlog_print(DLOG_ERROR, LOG_TAG, "language = %s.", language);
+ return NULL;
+}
+
+static void menu_item_selected_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ int index = *(int*)data;
- if (language != NULL) {
- elm_language_set(language);
- free(language);
+ if(index == 3) {
+ return;
}
- dlog_print(DLOG_ERROR, LOG_TAG, "language = %s.", language);
+ do_haptic(50);
+
+ if (index == 0) {
+ if (get_convergence_power_state() == 0) {
+ convergence_power_on();
+ } else {
+ convergence_power_off();
+ }
+ elm_genlist_item_update(menu_info[index]->item);
- state_change_event(CHANGE_LANGUAGE);
+ } else if (index == 1) {
+ show_setting_item_device_list();
+
+ } else if (index == 2) {
+ show_setting_item_sign();
+ }
}
-extern void create_setting_menu(Evas_Object *parent)
+static void menu_item_append(Elm_Genlist_Item_Class *item_builder, Evas_Object *genlist, char *text, int index)
{
- app_event_handler_h handle = NULL;
- ui_app_add_event_handler(&handle, APP_EVENT_LANGUAGE_CHANGED, app_language_changed, NULL);
+ menu_info[index] = (menu_info_s *)calloc(sizeof(menu_info_s), 1);
+ {
+ menu_info[index]->index = index;
+ menu_info[index]->text = text;
+ menu_info[index]->item = elm_genlist_item_append(genlist, item_builder, &(menu_info[index]->index), NULL, ELM_GENLIST_ITEM_NONE, menu_item_selected_cb, &(menu_info[index]->index));
+ }
+}
- Evas_Object *background = elm_bg_add(parent);
- elm_object_content_set(parent, background);
- elm_bg_color_set(background, 255, 255, 255);
- evas_object_show(background);
+extern void show_setting_menu()
+{
+ menu_info = (menu_info_s **)calloc(sizeof(menu_info_s *), MENU_SIZE);
+
+ Evas_Object *menu = elm_genlist_add(ad->nf);
+ elm_genlist_mode_set(menu, ELM_LIST_COMPRESS);
- Evas_Object *layout = elm_grid_add(background);
- elm_object_content_set(background, layout);
- evas_object_show(layout);
+ Evas_Object *circle_genlist = eext_circle_object_genlist_add(menu, ad->circle_surface);
+ eext_circle_object_genlist_scroller_policy_set(circle_genlist, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
+ eext_rotary_object_event_activated_set(circle_genlist, EINA_TRUE);
{
- create_setting_item_power(layout);
- create_setting_item_sign(layout);
+ Elm_Genlist_Item_Class *style_1text_item_builder = elm_genlist_item_class_new();
+ {
+ style_1text_item_builder->item_style = "1text";
+ style_1text_item_builder->func.text_get = text_get_cb;
+ }
+
+ Elm_Genlist_Item_Class *style_2text_item_builder = elm_genlist_item_class_new();
+ {
+ style_2text_item_builder->item_style = "2text";
+ style_2text_item_builder->func.text_get = text_get_cb;
+ }
+
+ if(get_convergence_power_state() == 0){
+ menu_item_append(style_2text_item_builder, menu, "Power", 0);
+ } else {
+ menu_item_append(style_2text_item_builder, menu, "Power", 0);
+ }
+
+ menu_item_append(style_1text_item_builder, menu, ACCESS_CONTROL_TEXT, 1);
+ menu_item_append(style_1text_item_builder, menu, NOTICE_TEXT, 2);
+ menu_item_append(style_1text_item_builder, menu, NULL, 3);
+
+ elm_genlist_item_class_free(style_1text_item_builder);
+ elm_genlist_item_class_free(style_2text_item_builder);
+
}
+ evas_object_show(menu);
- Elm_Object_Item *menu = elm_naviframe_item_push(parent, "Convergence", NULL, NULL, background, NULL);
- elm_naviframe_item_pop_cb_set(menu, setting_menu_pop_cb, NULL);
-}
+ Elm_Object_Item *it = elm_naviframe_item_push(ad->nf, TITLE_TEXT, NULL, NULL, menu, NULL);
+ elm_naviframe_item_pop_cb_set(it, setting_menu_pop_cb, NULL);
+} \ No newline at end of file
diff --git a/src/ui/setting_item_allowed_device_list.c b/src/ui/setting_item_allowed_device_list.c
new file mode 100644
index 0000000..03b412d
--- /dev/null
+++ b/src/ui/setting_item_allowed_device_list.c
@@ -0,0 +1,274 @@
+/*
+ * Copyright (c) 2016 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 "main.h"
+
+static Elm_Genlist_Item_Class *item_builder = NULL;
+static Evas_Object *allowed_list = NULL;
+
+static int allowed_devices_index = -1;
+static device_info_s **allowed_devices_info = NULL;
+
+static Evas_Object *allowed_deivce_selected_menu = NULL;
+static device_info_s *selected_device = NULL;
+
+static Evas_Object *popup = NULL;
+
+static void cancel_btn_click_event(void *data, Evas_Object *obj, void *event_info)
+{
+ evas_object_del(popup);
+}
+
+static void ok_btn_click_event(void *data, Evas_Object *obj, void *event_info)
+{
+ do_haptic(50);
+
+ char *type = (char *)data;
+ if (!strcmp("Remove", type)) {
+ conv_internal_remove_acl_device(selected_device->mac_address);
+ } else if (!strcmp("Deny", type)) {
+ conv_internal_set_acl_state(selected_device->mac_address, selected_device->type, selected_device->name, 1);
+ }
+
+ evas_object_del(popup);
+}
+
+static void show_popup(char *type)
+{
+ popup = elm_popup_add(ad->win);
+ elm_object_style_set(popup, "circle");
+ evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ {
+ Evas_Object *layout = elm_layout_add(popup);
+ elm_layout_theme_set(layout, "layout", "popup", "content/circle/buttons2");
+ {
+ elm_object_part_text_set(layout, "elm.text.title", "Access Control");
+
+ char text[1000];
+ if (!strcmp("Remove", type)) {
+ snprintf(text, sizeof(text), "%s '%s'?", REMOVE_SELECT_POPUP_TEXT, selected_device->name);
+ } else if (!strcmp("Deny", type)) {
+ snprintf(text, sizeof(text), "%s '%s'?", DENY_SELECT_POPUP_TEXT, selected_device->name);
+ }
+
+ elm_object_part_text_set(layout, "elm.text", text);
+ elm_object_content_set(popup, layout);
+ }
+
+ Evas_Object *cancel_btn = elm_button_add(popup);
+ elm_object_style_set(cancel_btn, "popup/circle/left");
+ evas_object_size_hint_weight_set(cancel_btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ {
+ Evas_Object *cancel_btn_icon = elm_image_add(cancel_btn);
+ elm_image_file_set(cancel_btn_icon, ICON_DIR"/popup_btn_cancel.png", NULL);
+ evas_object_size_hint_weight_set(cancel_btn_icon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_object_part_content_set(cancel_btn, "elm.swallow.content", cancel_btn_icon);
+ evas_object_show(cancel_btn_icon);
+ }
+ elm_object_part_content_set(popup, "button1", cancel_btn);
+ evas_object_smart_callback_add(cancel_btn, "clicked", cancel_btn_click_event, type);
+
+ Evas_Object *ok_btn = elm_button_add(popup);
+ elm_object_style_set(ok_btn, "popup/circle/right");
+ evas_object_size_hint_weight_set(ok_btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ {
+ Evas_Object *ok_btn_icon = elm_image_add(ok_btn);
+ elm_image_file_set(ok_btn_icon, ICON_DIR"/popup_btn_check.png", NULL);
+ evas_object_size_hint_weight_set(ok_btn_icon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_object_part_content_set(ok_btn, "elm.swallow.content", ok_btn_icon);
+ evas_object_show(ok_btn_icon);
+ }
+ elm_object_part_content_set(popup, "button2", ok_btn);
+ evas_object_smart_callback_add(ok_btn, "clicked", ok_btn_click_event, type);
+ }
+ evas_object_show(popup);
+}
+
+static void set_acl_device_list();
+
+static Eina_Bool allowed_deivce_selected_menu_popup_cb(void *data, Elm_Object_Item *it)
+{
+ do_haptic(50);
+ elm_genlist_clear(allowed_list);
+ set_acl_device_list();
+ return EINA_TRUE;
+}
+
+static void allowed_deivce_selected_menu_selected_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ do_haptic(50);
+ char *type = (char *)data;
+ show_popup(type);
+}
+
+static char *selected_menu_text_get_cb(void *data, Evas_Object *obj, const char *part)
+{
+ if((char*)data == NULL) return NULL;
+ return strdup((char*)data);
+}
+
+static void show_allowed_device_selected_popup(void *data, Evas_Object *obj, void *event_info)
+{
+ device_info_s *info = (device_info_s *)data;
+
+ selected_device = (device_info_s *) calloc(sizeof(device_info_s), 1);
+ selected_device->index = info->index;
+ selected_device->list_type = info->list_type;
+ selected_device->name = info->name;
+ selected_device->type = info->type;
+ selected_device->mac_address = info->mac_address;
+
+ allowed_deivce_selected_menu = elm_genlist_add(ad->nf);
+ elm_genlist_mode_set(allowed_deivce_selected_menu, ELM_LIST_COMPRESS);
+
+ Evas_Object *circle_genlist = eext_circle_object_genlist_add(allowed_deivce_selected_menu, ad->circle_surface);
+ eext_circle_object_genlist_scroller_policy_set(circle_genlist, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
+ eext_rotary_object_event_activated_set(circle_genlist, EINA_TRUE);
+ {
+ Elm_Genlist_Item_Class *item_builder = elm_genlist_item_class_new();
+ {
+ item_builder->item_style = "1text";
+ item_builder->func.text_get = selected_menu_text_get_cb;
+ }
+
+ elm_genlist_item_append(allowed_deivce_selected_menu, item_builder, REMOVE_BUTTON_TEXT, NULL, ELM_GENLIST_ITEM_NONE, allowed_deivce_selected_menu_selected_cb, "Remove");
+ elm_genlist_item_append(allowed_deivce_selected_menu, item_builder, DENY_BUTTON_TEXT, NULL, ELM_GENLIST_ITEM_NONE, allowed_deivce_selected_menu_selected_cb, "Deny");
+ elm_genlist_item_class_free(item_builder);
+ }
+ evas_object_show(allowed_deivce_selected_menu);
+
+ Elm_Object_Item *it = elm_naviframe_item_push(ad->nf, ACCESS_CONTROL_TEXT, NULL, NULL, allowed_deivce_selected_menu, NULL);
+ elm_naviframe_item_pop_cb_set(it, allowed_deivce_selected_menu_popup_cb, NULL);
+}
+
+static char* text_get_cb(void *data, Evas_Object *obj, const char *part)
+{
+ dlog_print(DLOG_ERROR, LOG_TAG, "text_get_cb part = %s", part);
+
+ device_info_s *info = (device_info_s *)data;
+
+ if (!strcmp(part, "elm.text")) {
+ if (info->name == NULL) return NULL;
+ return strdup((char*)info->name);
+ } else if (!strcmp(part, "elm.text.1")) {
+ if (info->mac_address == NULL) return NULL;
+ return strdup((char*)info->mac_address);
+ }
+
+ return NULL;
+}
+
+static Evas_Object* content_get_cb(void *data, Evas_Object *obj, const char *part)
+{
+ dlog_print(DLOG_ERROR, LOG_TAG, "content_get_cb part = %s", part);
+
+ device_info_s *info = (device_info_s *)data;
+
+ if (!strcmp(part, "elm.icon")) {
+
+ Evas_Object *img = elm_image_add(obj);
+
+ if (info->type != NULL) {
+ if (!strcmp(DEVICE_TYPE_MOBILE, info->type)) {
+ elm_image_file_set(img, ICON_DIR"/device_type_icon_mobilephone.png", NULL);
+ } else if (!strcmp(DEVICE_TYPE_TV, info->type)) {
+ elm_image_file_set(img, ICON_DIR"/device_type_icon_display.png", NULL);
+ } else if (!strcmp(DEVICE_TYPE_WEARABLE, info->type)) {
+ elm_image_file_set(img, ICON_DIR"/device_type_icon_wrist.png", NULL);
+ } else {
+ elm_image_file_set(img, ICON_DIR"/device_type_icon_multimedia.png", NULL);
+ }
+
+ } else {
+ elm_image_file_set(img, ICON_DIR"/device_type_icon_multimedia.png", NULL);
+ }
+
+ return img;
+
+ } else {
+ return NULL;
+ }
+}
+
+static void acl_device_info(char *mac_address, char *device_type, char *device_name, int access_control_state, void *user_data)
+{
+ if(access_control_state == 0) {
+ int index = ++allowed_devices_index;
+ allowed_devices_info[index] = (device_info_s *) calloc(sizeof(device_info_s), 1);
+ allowed_devices_info[index]->list_type = LIST_TYPE_PERMITTED;
+ allowed_devices_info[index]->index = index;
+ allowed_devices_info[index]->name = strdup(device_name);
+ allowed_devices_info[index]->type = strdup(device_type);
+ allowed_devices_info[index]->mac_address = strdup(mac_address);
+
+ elm_genlist_item_append(allowed_list, item_builder, allowed_devices_info[index], NULL, ELM_GENLIST_ITEM_NONE, show_allowed_device_selected_popup, allowed_devices_info[index]);
+ }
+}
+
+static void set_acl_device_list()
+{
+ int index;
+
+ if (allowed_devices_info != NULL) {
+
+ for (index = 0; index < STORAGE_SIZE; index++) {
+ if(allowed_devices_info[index] == NULL) break;
+ free(allowed_devices_info[index]);
+ allowed_devices_info[index] = NULL;
+ }
+
+ free(allowed_devices_info);
+ allowed_devices_info = NULL;
+ }
+
+ allowed_devices_index = -1;
+ allowed_devices_info = (device_info_s **) calloc(STORAGE_SIZE, sizeof(device_info_s *));
+
+ conv_internal_get_acl_list(acl_device_info, NULL);
+}
+
+static Eina_Bool setting_menu_pop_cb(void *data, Elm_Object_Item *it)
+{
+ do_haptic(50);
+ return EINA_TRUE;
+}
+
+extern void show_setting_item_allowed_device_list()
+{
+ selected_device = (device_info_s *) calloc(sizeof(device_info_s), 1);
+
+ allowed_list = elm_genlist_add(ad->nf);
+ elm_genlist_mode_set(allowed_list, ELM_LIST_COMPRESS);
+
+ Evas_Object *circle_genlist = eext_circle_object_genlist_add(allowed_list, ad->circle_surface);
+ eext_circle_object_genlist_scroller_policy_set(circle_genlist, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
+ eext_rotary_object_event_activated_set(circle_genlist, EINA_TRUE);
+ {
+ item_builder = elm_genlist_item_class_new();
+ {
+ item_builder->item_style = "2text.1icon.divider";
+ item_builder->func.text_get = text_get_cb;
+ item_builder->func.content_get = content_get_cb;
+ }
+ }
+ evas_object_show(allowed_list);
+
+ Elm_Object_Item *it = elm_naviframe_item_push(ad->nf, ALLOWED_DEVICE_LIST_TEXT, NULL, NULL, allowed_list, NULL);
+ elm_naviframe_item_pop_cb_set(it, setting_menu_pop_cb, NULL);
+
+ set_acl_device_list();
+}
+
diff --git a/src/ui/setting_item_denied_device_list.c b/src/ui/setting_item_denied_device_list.c
new file mode 100644
index 0000000..21852c2
--- /dev/null
+++ b/src/ui/setting_item_denied_device_list.c
@@ -0,0 +1,274 @@
+/*
+ * Copyright (c) 2016 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 "main.h"
+
+static Elm_Genlist_Item_Class *item_builder = NULL;
+static Evas_Object *denied_list = NULL;
+
+static int denied_devices_index = -1;
+static device_info_s **denied_devices_info = NULL;
+
+static Evas_Object *denied_deivce_selected_menu = NULL;
+static device_info_s *selected_device = NULL;
+
+static Evas_Object *popup = NULL;
+
+static void cancel_btn_click_event(void *data, Evas_Object *obj, void *event_info)
+{
+ evas_object_del(popup);
+}
+
+static void ok_btn_click_event(void *data, Evas_Object *obj, void *event_info)
+{
+ do_haptic(50);
+
+ char *type = (char *)data;
+ if (!strcmp("Remove", type)) {
+ conv_internal_remove_acl_device(selected_device->mac_address);
+ } else if (!strcmp("Allow", type)) {
+ conv_internal_set_acl_state(selected_device->mac_address, selected_device->type, selected_device->name, 1);
+ }
+
+ evas_object_del(popup);
+}
+
+static void show_popup(char *type)
+{
+ popup = elm_popup_add(ad->win);
+ elm_object_style_set(popup, "circle");
+ evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ {
+ Evas_Object *layout = elm_layout_add(popup);
+ elm_layout_theme_set(layout, "layout", "popup", "content/circle/buttons2");
+ {
+ elm_object_part_text_set(layout, "elm.text.title", "Access Control");
+
+ char text[1000];
+ if (!strcmp("Remove", type)) {
+ snprintf(text, sizeof(text), "%s '%s'?", REMOVE_SELECT_POPUP_TEXT, selected_device->name);
+ } else if (!strcmp("Allow", type)) {
+ snprintf(text, sizeof(text), "%s '%s'?", ALLOW_SELECT_POPUP_TEXT, selected_device->name);
+ }
+
+ elm_object_part_text_set(layout, "elm.text", text);
+ elm_object_content_set(popup, layout);
+ }
+
+ Evas_Object *cancel_btn = elm_button_add(popup);
+ elm_object_style_set(cancel_btn, "popup/circle/left");
+ evas_object_size_hint_weight_set(cancel_btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ {
+ Evas_Object *cancel_btn_icon = elm_image_add(cancel_btn);
+ elm_image_file_set(cancel_btn_icon, ICON_DIR"/popup_btn_cancel.png", NULL);
+ evas_object_size_hint_weight_set(cancel_btn_icon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_object_part_content_set(cancel_btn, "elm.swallow.content", cancel_btn_icon);
+ evas_object_show(cancel_btn_icon);
+ }
+ elm_object_part_content_set(popup, "button1", cancel_btn);
+ evas_object_smart_callback_add(cancel_btn, "clicked", cancel_btn_click_event, type);
+
+ Evas_Object *ok_btn = elm_button_add(popup);
+ elm_object_style_set(ok_btn, "popup/circle/right");
+ evas_object_size_hint_weight_set(ok_btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ {
+ Evas_Object *ok_btn_icon = elm_image_add(ok_btn);
+ elm_image_file_set(ok_btn_icon, ICON_DIR"/popup_btn_check.png", NULL);
+ evas_object_size_hint_weight_set(ok_btn_icon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_object_part_content_set(ok_btn, "elm.swallow.content", ok_btn_icon);
+ evas_object_show(ok_btn_icon);
+ }
+ elm_object_part_content_set(popup, "button2", ok_btn);
+ evas_object_smart_callback_add(ok_btn, "clicked", ok_btn_click_event, type);
+ }
+ evas_object_show(popup);
+}
+
+static void set_acl_device_list();
+
+static Eina_Bool denied_deivce_selected_menu_popup_cb(void *data, Elm_Object_Item *it)
+{
+ do_haptic(50);
+ elm_genlist_clear(denied_list);
+ set_acl_device_list();
+ return EINA_TRUE;
+}
+
+static void denied_deivce_selected_menu_selected_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ do_haptic(50);
+ char *type = (char *)data;
+ show_popup(type);
+}
+
+static char *selected_menu_text_get_cb(void *data, Evas_Object *obj, const char *part)
+{
+ if((char*)data == NULL) return NULL;
+ return strdup((char*)data);
+}
+
+static void show_denied_device_selected_popup(void *data, Evas_Object *obj, void *event_info)
+{
+ device_info_s *info = (device_info_s *)data;
+
+ selected_device = (device_info_s *) calloc(sizeof(device_info_s), 1);
+ selected_device->index = info->index;
+ selected_device->list_type = info->list_type;
+ selected_device->name = info->name;
+ selected_device->type = info->type;
+ selected_device->mac_address = info->mac_address;
+
+ denied_deivce_selected_menu = elm_genlist_add(ad->nf);
+ elm_genlist_mode_set(denied_deivce_selected_menu, ELM_LIST_COMPRESS);
+
+ Evas_Object *circle_genlist = eext_circle_object_genlist_add(denied_deivce_selected_menu, ad->circle_surface);
+ eext_circle_object_genlist_scroller_policy_set(circle_genlist, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
+ eext_rotary_object_event_activated_set(circle_genlist, EINA_TRUE);
+ {
+ Elm_Genlist_Item_Class *item_builder = elm_genlist_item_class_new();
+ {
+ item_builder->item_style = "1text";
+ item_builder->func.text_get = selected_menu_text_get_cb;
+ }
+
+ elm_genlist_item_append(denied_deivce_selected_menu, item_builder, REMOVE_BUTTON_TEXT, NULL, ELM_GENLIST_ITEM_NONE, denied_deivce_selected_menu_selected_cb, "Remove");
+ elm_genlist_item_append(denied_deivce_selected_menu, item_builder, ALLOW_BUTTON_TEXT, NULL, ELM_GENLIST_ITEM_NONE, denied_deivce_selected_menu_selected_cb, "Allow");
+ elm_genlist_item_class_free(item_builder);
+ }
+ evas_object_show(denied_deivce_selected_menu);
+
+ Elm_Object_Item *it = elm_naviframe_item_push(ad->nf, ACCESS_CONTROL_TEXT, NULL, NULL, denied_deivce_selected_menu, NULL);
+ elm_naviframe_item_pop_cb_set(it, denied_deivce_selected_menu_popup_cb, NULL);
+}
+
+static char* text_get_cb(void *data, Evas_Object *obj, const char *part)
+{
+ dlog_print(DLOG_ERROR, LOG_TAG, "text_get_cb part = %s", part);
+
+ device_info_s *info = (device_info_s *)data;
+
+ if (!strcmp(part, "elm.text")) {
+ if (info->name == NULL) return NULL;
+ return strdup((char*)info->name);
+ } else if (!strcmp(part, "elm.text.1")) {
+ if (info->mac_address == NULL) return NULL;
+ return strdup((char*)info->mac_address);
+ }
+
+ return NULL;
+}
+
+static Evas_Object* content_get_cb(void *data, Evas_Object *obj, const char *part)
+{
+ dlog_print(DLOG_ERROR, LOG_TAG, "content_get_cb part = %s", part);
+
+ device_info_s *info = (device_info_s *)data;
+
+ if (!strcmp(part, "elm.icon")) {
+
+ Evas_Object *img = elm_image_add(obj);
+
+ if (info->type != NULL) {
+ if (!strcmp(DEVICE_TYPE_MOBILE, info->type)) {
+ elm_image_file_set(img, ICON_DIR"/device_type_icon_mobilephone.png", NULL);
+ } else if (!strcmp(DEVICE_TYPE_TV, info->type)) {
+ elm_image_file_set(img, ICON_DIR"/device_type_icon_display.png", NULL);
+ } else if (!strcmp(DEVICE_TYPE_WEARABLE, info->type)) {
+ elm_image_file_set(img, ICON_DIR"/device_type_icon_wrist.png", NULL);
+ } else {
+ elm_image_file_set(img, ICON_DIR"/device_type_icon_multimedia.png", NULL);
+ }
+
+ } else {
+ elm_image_file_set(img, ICON_DIR"/device_type_icon_multimedia.png", NULL);
+ }
+
+ return img;
+
+ } else {
+ return NULL;
+ }
+}
+
+static void acl_device_info(char *mac_address, char *device_type, char *device_name, int access_control_state, void *user_data)
+{
+ if(access_control_state == 1) {
+ int index = ++denied_devices_index;
+ denied_devices_info[index] = (device_info_s *) calloc(sizeof(device_info_s), 1);
+ denied_devices_info[index]->list_type = LIST_TYPE_DENIED;
+ denied_devices_info[index]->index = index;
+ denied_devices_info[index]->name = strdup(device_name);
+ denied_devices_info[index]->type = strdup(device_type);
+ denied_devices_info[index]->mac_address = strdup(mac_address);
+
+ elm_genlist_item_append(denied_list, item_builder, denied_devices_info[index], NULL, ELM_GENLIST_ITEM_NONE, show_denied_device_selected_popup, denied_devices_info[index]);
+ }
+}
+
+static void set_acl_device_list()
+{
+ int index;
+
+ if (denied_devices_info != NULL) {
+
+ for (index = 0; index < STORAGE_SIZE; index++) {
+ if(denied_devices_info[index] == NULL) break;
+ free(denied_devices_info[index]);
+ denied_devices_info[index] = NULL;
+ }
+
+ free(denied_devices_info);
+ denied_devices_info = NULL;
+ }
+
+ denied_devices_index = -1;
+ denied_devices_info = (device_info_s **) calloc(STORAGE_SIZE, sizeof(device_info_s *));
+
+ conv_internal_get_acl_list(acl_device_info, NULL);
+}
+
+static Eina_Bool setting_menu_pop_cb(void *data, Elm_Object_Item *it)
+{
+ do_haptic(50);
+ return EINA_TRUE;
+}
+
+extern void show_setting_item_denied_device_list()
+{
+ selected_device = (device_info_s *) calloc(sizeof(device_info_s), 1);
+
+ denied_list = elm_genlist_add(ad->nf);
+ elm_genlist_mode_set(denied_list, ELM_LIST_COMPRESS);
+
+ Evas_Object *circle_genlist = eext_circle_object_genlist_add(denied_list, ad->circle_surface);
+ eext_circle_object_genlist_scroller_policy_set(circle_genlist, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
+ eext_rotary_object_event_activated_set(circle_genlist, EINA_TRUE);
+ {
+ item_builder = elm_genlist_item_class_new();
+ {
+ item_builder->item_style = "2text.1icon.divider";
+ item_builder->func.text_get = text_get_cb;
+ item_builder->func.content_get = content_get_cb;
+ }
+ }
+ evas_object_show(denied_list);
+
+ Elm_Object_Item *it = elm_naviframe_item_push(ad->nf, DENIED_DEVICE_LIST_TEXT, NULL, NULL, denied_list, NULL);
+ elm_naviframe_item_pop_cb_set(it, setting_menu_pop_cb, NULL);
+
+ set_acl_device_list();
+}
+
diff --git a/src/ui/setting_item_device_list.c b/src/ui/setting_item_device_list.c
new file mode 100644
index 0000000..0c78567
--- /dev/null
+++ b/src/ui/setting_item_device_list.c
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 2016 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 "main.h"
+
+static Eina_Bool setting_menu_pop_cb(void *data, Elm_Object_Item *it)
+{
+ do_haptic(50);
+ return EINA_TRUE;
+}
+
+static char *text_get_cb(void *data, Evas_Object *obj, const char *part)
+{
+ if((char*)data == NULL) return NULL;
+ return strdup((char*)data);
+}
+
+static void menu_item_selected_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ char *menu = (char*)data;
+
+ if(menu == NULL) return;
+
+ do_haptic(50);
+
+ if (!strcmp(ALLOWED_DEVICE_LIST_TEXT, menu)) {
+ show_setting_item_allowed_device_list();
+ } else if (!strcmp(DENIED_DEVICE_LIST_TEXT, menu)) {
+ show_setting_item_denied_device_list();
+ } else if (!strcmp(AVAILABLE_DEVICE_LIST_TEXT, menu)) {
+ show_setting_item_discovery();
+ }
+}
+
+extern void show_setting_item_device_list()
+{
+ Elm_Object_Item *it = NULL;
+
+ if(get_convergence_power_state() == 0){
+
+ Evas_Object *box = elm_box_add(ad->nf);
+ elm_box_horizontal_set(box, EINA_FALSE);
+ {
+ Evas_Object *scroller = elm_scroller_add(box);
+ evas_object_size_hint_weight_set(scroller, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(scroller, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_scroller_policy_set(scroller, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
+ elm_object_style_set(scroller, "effect");
+ {
+ char buf[1024];
+ snprintf(buf, sizeof(buf), "<align=center><br>%s<br></align>", TURN_ON_THE_POWER_TEXT);
+
+ Evas_Object *sign_item = elm_label_add(scroller);
+ elm_object_text_set(sign_item, buf);
+ evas_object_size_hint_weight_set(sign_item, 0.5, 0.5);
+ elm_label_line_wrap_set(sign_item, ELM_WRAP_WORD);
+ // elm_label_wrap_width_set(sign_item, 200);
+ // evas_object_size_hint_min_set(sign_item, 100, 100);
+ elm_object_content_set(scroller, sign_item);
+ }
+ evas_object_show(scroller);
+ elm_box_pack_end(box, scroller);
+ }
+ evas_object_show(box);
+
+ it = elm_naviframe_item_push(ad->nf, TITLE_TEXT, NULL, NULL, box, NULL);
+
+ } else {
+
+ Evas_Object *menu = elm_genlist_add(ad->nf);
+ elm_genlist_mode_set(menu, ELM_LIST_COMPRESS);
+
+ Evas_Object *circle_genlist = eext_circle_object_genlist_add(menu, ad->circle_surface);
+ eext_circle_object_genlist_scroller_policy_set(circle_genlist, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
+ eext_rotary_object_event_activated_set(circle_genlist, EINA_TRUE);
+ {
+ Elm_Genlist_Item_Class *item_builder = elm_genlist_item_class_new();
+ {
+ item_builder->item_style = "1text";
+ item_builder->func.text_get = text_get_cb;
+ }
+
+ elm_genlist_item_append(menu, item_builder, ALLOWED_DEVICE_LIST_TEXT, NULL, ELM_GENLIST_ITEM_NONE, menu_item_selected_cb, ALLOWED_DEVICE_LIST_TEXT);
+ elm_genlist_item_append(menu, item_builder, DENIED_DEVICE_LIST_TEXT, NULL, ELM_GENLIST_ITEM_NONE, menu_item_selected_cb, DENIED_DEVICE_LIST_TEXT);
+ elm_genlist_item_append(menu, item_builder, AVAILABLE_DEVICE_LIST_TEXT, NULL, ELM_GENLIST_ITEM_NONE, menu_item_selected_cb, AVAILABLE_DEVICE_LIST_TEXT);
+ elm_genlist_item_append(menu, item_builder, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
+
+ elm_genlist_item_class_free(item_builder);
+ }
+ evas_object_show(menu);
+
+ it = elm_naviframe_item_push(ad->nf, TITLE_TEXT, NULL, NULL, menu, NULL);
+ }
+
+ elm_naviframe_item_pop_cb_set(it, setting_menu_pop_cb, NULL);
+}
diff --git a/src/ui/setting_item_discovery.c b/src/ui/setting_item_discovery.c
new file mode 100644
index 0000000..45e911d
--- /dev/null
+++ b/src/ui/setting_item_discovery.c
@@ -0,0 +1,312 @@
+/*
+ * Copyright (c) 2016 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 "main.h"
+
+#define DISCOVERY_TIME 100
+
+static conv_h conv_handle = NULL;
+
+static Elm_Genlist_Item_Class *item_builder = NULL;
+static Evas_Object *discovered_list = NULL;
+
+static int discovered_devices_index = -1;
+static device_info_s **discovered_devices_info = NULL;
+
+static Evas_Object *discovery_deivce_selected_menu = NULL;
+static device_info_s *selected_device = NULL;
+
+static Evas_Object *popup = NULL;
+
+static void cancel_btn_click_event(void *data, Evas_Object *obj, void *event_info)
+{
+ evas_object_del(popup);
+}
+
+static void ok_btn_click_event(void *data, Evas_Object *obj, void *event_info)
+{
+ do_haptic(50);
+
+ char *type = (char *)data;
+ if (!strcmp("Allow", type)) {
+ conv_internal_set_acl_state(selected_device->mac_address, selected_device->type, selected_device->name, 0);
+ } else if (!strcmp("Deny", type)) {
+ conv_internal_set_acl_state(selected_device->mac_address, selected_device->type, selected_device->name, 1);
+ }
+
+ evas_object_del(popup);
+}
+
+static void show_popup(char *type)
+{
+ popup = elm_popup_add(ad->win);
+ elm_object_style_set(popup, "circle");
+ evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ {
+ Evas_Object *layout = elm_layout_add(popup);
+ elm_layout_theme_set(layout, "layout", "popup", "content/circle/buttons2");
+ {
+ elm_object_part_text_set(layout, "elm.text.title", ACCESS_CONTROL_TEXT);
+
+ char text[1000];
+ if (!strcmp("Allow", type)) {
+ snprintf(text, sizeof(text), "%s '%s'?", ALLOW_SELECT_POPUP_TEXT, selected_device->name);
+ } else if (!strcmp("Deny", type)) {
+ snprintf(text, sizeof(text), "%s '%s'?", DENY_SELECT_POPUP_TEXT, selected_device->name);
+ }
+
+ elm_object_part_text_set(layout, "elm.text", text);
+ elm_object_content_set(popup, layout);
+ }
+
+ Evas_Object *cancel_btn = elm_button_add(popup);
+ elm_object_style_set(cancel_btn, "popup/circle/left");
+ evas_object_size_hint_weight_set(cancel_btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ {
+ Evas_Object *cancel_btn_icon = elm_image_add(cancel_btn);
+ elm_image_file_set(cancel_btn_icon, ICON_DIR"/popup_btn_cancel.png", NULL);
+ evas_object_size_hint_weight_set(cancel_btn_icon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_object_part_content_set(cancel_btn, "elm.swallow.content", cancel_btn_icon);
+ evas_object_show(cancel_btn_icon);
+ }
+ elm_object_part_content_set(popup, "button1", cancel_btn);
+ evas_object_smart_callback_add(cancel_btn, "clicked", cancel_btn_click_event, type);
+
+ Evas_Object *ok_btn = elm_button_add(popup);
+ elm_object_style_set(ok_btn, "popup/circle/right");
+ evas_object_size_hint_weight_set(ok_btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ {
+ Evas_Object *ok_btn_icon = elm_image_add(ok_btn);
+ elm_image_file_set(ok_btn_icon, ICON_DIR"/popup_btn_check.png", NULL);
+ evas_object_size_hint_weight_set(ok_btn_icon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_object_part_content_set(ok_btn, "elm.swallow.content", ok_btn_icon);
+ evas_object_show(ok_btn_icon);
+ }
+ elm_object_part_content_set(popup, "button2", ok_btn);
+ evas_object_smart_callback_add(ok_btn, "clicked", ok_btn_click_event, type);
+ }
+ evas_object_show(popup);
+}
+
+static Eina_Bool discovery_deivce_selected_menu_popup_cb(void *data, Elm_Object_Item *it)
+{
+ do_haptic(50);
+ return EINA_TRUE;
+}
+
+static void discovery_deivce_selected_menu_selected_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ do_haptic(50);
+ char *type = (char *)data;
+ show_popup(type);
+}
+
+static char *selected_menu_text_get_cb(void *data, Evas_Object *obj, const char *part)
+{
+ if((char*)data == NULL) return NULL;
+ return strdup((char*)data);
+}
+
+static void show_discovery_deivce_selected_menu(void *data, Evas_Object *obj, void *event_info)
+{
+ do_haptic(50);
+
+ device_info_s *info = (device_info_s *)data;
+
+ selected_device = (device_info_s *) calloc(sizeof(device_info_s), 1);
+ selected_device->index = info->index;
+ selected_device->list_type = info->list_type;
+ selected_device->name = info->name;
+ selected_device->type = info->type;
+ selected_device->mac_address = info->mac_address;
+
+ discovery_deivce_selected_menu = elm_genlist_add(ad->nf);
+ elm_genlist_mode_set(discovery_deivce_selected_menu, ELM_LIST_COMPRESS);
+
+ Evas_Object *circle_genlist = eext_circle_object_genlist_add(discovery_deivce_selected_menu, ad->circle_surface);
+ eext_circle_object_genlist_scroller_policy_set(circle_genlist, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
+ eext_rotary_object_event_activated_set(circle_genlist, EINA_TRUE);
+ {
+ Elm_Genlist_Item_Class *item_builder = elm_genlist_item_class_new();
+ {
+ item_builder->item_style = "1text";
+ item_builder->func.text_get = selected_menu_text_get_cb;
+ }
+
+ elm_genlist_item_append(discovery_deivce_selected_menu, item_builder, ALLOW_BUTTON_TEXT, NULL, ELM_GENLIST_ITEM_NONE, discovery_deivce_selected_menu_selected_cb, "Allow");
+ elm_genlist_item_append(discovery_deivce_selected_menu, item_builder, DENY_BUTTON_TEXT, NULL, ELM_GENLIST_ITEM_NONE, discovery_deivce_selected_menu_selected_cb, "Deny");
+ elm_genlist_item_class_free(item_builder);
+ }
+ evas_object_show(discovery_deivce_selected_menu);
+
+ Elm_Object_Item *it = elm_naviframe_item_push(ad->nf, ACCESS_CONTROL_TEXT, NULL, NULL, discovery_deivce_selected_menu, NULL);
+ elm_naviframe_item_pop_cb_set(it, discovery_deivce_selected_menu_popup_cb, NULL);
+}
+
+static char* text_get_cb(void *data, Evas_Object *obj, const char *part)
+{
+ device_info_s *info = (device_info_s *)data;
+
+ if (!strcmp(part, "elm.text")) {
+ if (info->name == NULL) return NULL;
+ return strdup((char*)info->name);
+ } else if (!strcmp(part, "elm.text.1")) {
+ if (info->mac_address == NULL) return NULL;
+ return strdup((char*)info->mac_address);
+ }
+
+ return NULL;
+}
+
+static Evas_Object* content_get_cb(void *data, Evas_Object *obj, const char *part)
+{
+ device_info_s *info = (device_info_s *)data;
+
+ if (!strcmp(part, "elm.icon")) {
+
+ Evas_Object *img = elm_image_add(obj);
+
+ if (info->type != NULL) {
+ if (!strcmp(DEVICE_TYPE_MOBILE, info->type)) {
+ elm_image_file_set(img, ICON_DIR"/device_type_icon_mobilephone.png", NULL);
+ } else if (!strcmp(DEVICE_TYPE_TV, info->type)) {
+ elm_image_file_set(img, ICON_DIR"/device_type_icon_display.png", NULL);
+ } else if (!strcmp(DEVICE_TYPE_WEARABLE, info->type)) {
+ elm_image_file_set(img, ICON_DIR"/device_type_icon_wrist.png", NULL);
+ } else {
+ elm_image_file_set(img, ICON_DIR"/device_type_icon_multimedia.png", NULL);
+ }
+
+ } else {
+ elm_image_file_set(img, ICON_DIR"/device_type_icon_multimedia.png", NULL);
+ }
+
+ return img;
+
+ } else {
+ return NULL;
+ }
+}
+
+static void discovery_foreach_cb(conv_device_h device_h, int result, void *data)
+{
+ char *device_id = NULL;
+ char *device_name = NULL;
+ char *device_type = NULL;
+
+ switch (result) {
+
+ case CONV_DISCOVERY_RESULT_ERROR :
+ return;
+
+ case CONV_DISCOVERY_RESULT_LOST :
+ return;
+
+ case CONV_DISCOVERY_RESULT_SUCCESS :
+
+ conv_device_get_property_string(device_h, CONV_DEVICE_ID, &device_id);
+ int device_id_index;
+ for (device_id_index = 0; device_id_index < 5; device_id_index++) {
+ device_id[2+(device_id_index*3)] = '-';
+ }
+
+ conv_device_get_property_string(device_h, CONV_DEVICE_NAME, &device_name);
+ conv_device_get_property_string(device_h, CONV_DEVICE_TYPE, &device_type);
+
+ int index = ++discovered_devices_index;
+ discovered_devices_info[index] = (device_info_s *) calloc(sizeof(device_info_s), 1);
+ discovered_devices_info[index]->list_type = LIST_TYPE_DISCOVERED;
+ discovered_devices_info[index]->index = index;
+ discovered_devices_info[index]->name = device_name;
+ discovered_devices_info[index]->type = device_type;
+ discovered_devices_info[index]->mac_address = device_id;
+
+ elm_genlist_item_append(discovered_list, item_builder, discovered_devices_info[index], NULL, ELM_GENLIST_ITEM_NONE, show_discovery_deivce_selected_menu, discovered_devices_info[index]);
+
+ break;
+
+ case CONV_DISCOVERY_RESULT_FINISHED :
+ conv_destroy(conv_handle);
+ conv_handle = NULL;
+ return;
+ }
+}
+
+static void discovery_start()
+{
+ if(conv_handle == NULL) {
+
+ int index;
+
+ if(discovered_devices_info != NULL) {
+
+ for (index = 0; index < STORAGE_SIZE; index++) {
+ if(discovered_devices_info[index] == NULL) break;
+ free(discovered_devices_info[index]);
+ discovered_devices_info[index] = NULL;
+ }
+
+ free(discovered_devices_info);
+ discovered_devices_info = NULL;
+ }
+
+ discovered_devices_index = -1;
+ discovered_devices_info = (device_info_s **) calloc(STORAGE_SIZE, sizeof(device_info_s *));
+
+ conv_create(&conv_handle);
+ conv_discovery_start(conv_handle, DISCOVERY_TIME, discovery_foreach_cb, NULL);
+ }
+}
+
+static void discovery_stop()
+{
+ if (conv_handle != NULL) {
+ conv_discovery_stop(conv_handle);
+ }
+}
+
+static Eina_Bool setting_menu_pop_cb(void *data, Elm_Object_Item *it)
+{
+ discovery_stop();
+ do_haptic(50);
+ return EINA_TRUE;
+}
+
+extern void show_setting_item_discovery()
+{
+ selected_device = (device_info_s *) calloc(sizeof(device_info_s), 1);
+
+ discovered_list = elm_genlist_add(ad->nf);
+ elm_genlist_mode_set(discovered_list, ELM_LIST_COMPRESS);
+
+ Evas_Object *circle_genlist = eext_circle_object_genlist_add(discovered_list, ad->circle_surface);
+ eext_circle_object_genlist_scroller_policy_set(circle_genlist, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
+ eext_rotary_object_event_activated_set(circle_genlist, EINA_TRUE);
+ {
+ item_builder = elm_genlist_item_class_new();
+ {
+ item_builder->item_style = "2text.1icon.divider";
+ item_builder->func.text_get = text_get_cb;
+ item_builder->func.content_get = content_get_cb;
+ }
+ }
+ evas_object_show(discovered_list);
+
+ Elm_Object_Item *it = elm_naviframe_item_push(ad->nf, ALLOWED_DEVICE_LIST_TEXT, NULL, NULL, discovered_list, NULL);
+ elm_naviframe_item_pop_cb_set(it, setting_menu_pop_cb, NULL);
+
+ discovery_start();
+}
diff --git a/src/ui/setting_item_power.c b/src/ui/setting_item_power.c
deleted file mode 100644
index 068abf6..0000000
--- a/src/ui/setting_item_power.c
+++ /dev/null
@@ -1,90 +0,0 @@
-#include "main.h"
-
-static Evas_Object *power_switch = NULL;
-
-static void state_change_event_listener (state_e state)
-{
- switch (state)
- {
- case POWER_ON :
- elm_check_state_set(power_switch, EINA_TRUE);
- break;
-
- case POWER_OFF :
- elm_check_state_set(power_switch, EINA_FALSE);
- break;
-
- default :
- break;
- }
-}
-
-static void power_switch_changed_cb(void *data, Evas_Object *obj, void *event_info)
-{
- if (elm_check_state_get(obj) == EINA_TRUE) {
- convergence_power_on();
- state_change_event(POWER_ON);
- } else {
- convergence_power_off();
- state_change_event(POWER_OFF);
- }
-}
-
-static Evas_Object* content_get_cb(void *data, Evas_Object *obj, const char *part)
-{
- if (!strcmp("elm.swallow.end", part)) {
-
- power_switch = elm_check_add(obj);
- elm_object_style_set(power_switch, "on&off");
- evas_object_smart_callback_add(power_switch, "changed", power_switch_changed_cb, NULL);
- return power_switch;
- }
-
- return NULL;
-}
-
-static char* text_get_cb(void *data, Evas_Object *obj, const char *part)
-{
- if (!strcmp("elm.text", part)) {
- return strdup("Convergence");
- }
-
- return NULL;
-}
-
-static void power_item_realized_cb(void *data, Evas_Object *obj, void *event_info)
-{
- if (get_convergence_power_state() == 1) {
- convergence_power_on();
- state_change_event(POWER_ON);
- }
-
- else {
- convergence_power_off();
- state_change_event(POWER_OFF);
- }
-}
-
-extern void create_setting_item_power(Evas_Object *parent)
-{
- add_state_change_event_listener(state_change_event_listener);
-
- Evas_Object *power_item = elm_genlist_add(parent);
- elm_genlist_mode_set(power_item, ELM_LIST_COMPRESS);
- evas_object_smart_callback_add(power_item, "realized", power_item_realized_cb, NULL);
- elm_grid_pack(parent, power_item, 0, 0, 100, 10);
- evas_object_show(power_item);
- {
- Elm_Genlist_Item_Class *item_builder = elm_genlist_item_class_new();
- {
- item_builder->item_style = "default";
- item_builder->func.content_get = content_get_cb;
- item_builder->func.text_get = text_get_cb;
- }
-
- Elm_Object_Item *item = elm_genlist_item_append(power_item, item_builder, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
- elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_NONE);
-
- elm_genlist_item_class_free(item_builder);
- }
-}
diff --git a/src/ui/setting_item_sign.c b/src/ui/setting_item_sign.c
index 3356d85..669f2a7 100644
--- a/src/ui/setting_item_sign.c
+++ b/src/ui/setting_item_sign.c
@@ -1,65 +1,59 @@
-#include "main.h"
-
-static Evas_Object *sign_item = NULL;
-static char *notice = NULL;
-
-static void state_change_event_listener (state_e state)
-{
- switch (state)
- {
- case POWER_ON :
- notice = POWER_ON_SIGN_TEXT;
- elm_genlist_realized_items_update(sign_item);
- break;
+/*
+ * Copyright (c) 2016 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.
+ */
- case POWER_OFF :
- notice = POWER_OFF_SIGN_TEXT;
- elm_genlist_realized_items_update(sign_item);
- break;
-
- case CHANGE_LANGUAGE :
- if (get_convergence_power_state() == 1) {
- notice = POWER_ON_SIGN_TEXT;
- } else {
- notice = POWER_OFF_SIGN_TEXT;
- }
- elm_genlist_realized_items_update(sign_item);
- break;
-
- default :
- break;
- }
-}
+#include "main.h"
-static char* text_get_cb(void *data, Evas_Object *obj, const char *part)
+static Eina_Bool setting_menu_pop_cb(void *data, Elm_Object_Item *it)
{
- if (!strcmp("elm.text.multiline", part)) {
- char buf[1024];
- snprintf(buf, sizeof(buf), "<font color=#3DB9CCFF>Notice</font><br>%s", notice);
- return strdup(buf);
- }
-
- return NULL;
+ do_haptic(50);
+ return EINA_TRUE;
}
-extern void create_setting_item_sign(Evas_Object *parent)
+extern void show_setting_item_sign()
{
- add_state_change_event_listener(state_change_event_listener);
-
- sign_item = elm_genlist_add(parent);
- elm_genlist_mode_set(sign_item, ELM_LIST_COMPRESS);
- elm_grid_pack(parent, sign_item, 0, 10, 100, 77);
- evas_object_show(sign_item);
+ Evas_Object *box = elm_box_add(ad->nf);
+ elm_box_horizontal_set(box, EINA_FALSE);
{
- Elm_Genlist_Item_Class *item_builder = elm_genlist_item_class_new();
+ Evas_Object *scroller = elm_scroller_add(box);
+ evas_object_size_hint_weight_set(scroller, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(scroller, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_scroller_policy_set(scroller, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
+ elm_object_style_set(scroller, "effect");
{
- item_builder->item_style = "multiline";
- item_builder->func.text_get = text_get_cb;
- }
+ char buf[1024];
+ if (get_convergence_power_state() == 0) {
+ snprintf(buf, sizeof(buf), "<align=center><br>[%s]<br><br>%s</align>", NOTICE_TEXT, POWER_OFF_NOTICE_TEXT);
+ } else {
+ snprintf(buf, sizeof(buf), "<align=center><br>[%s]<br><br>%s</align>", NOTICE_TEXT, POWER_ON_NOTICE_TEXT);
+ }
- Elm_Object_Item *item = elm_genlist_item_append(sign_item, item_builder, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
- elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_NONE);
+ Evas_Object *sign_item = elm_label_add(scroller);
+ elm_object_text_set(sign_item, buf);
+ evas_object_size_hint_weight_set(sign_item, 0.5, 0.5);
+ elm_label_line_wrap_set(sign_item, ELM_WRAP_WORD);
+ // elm_label_wrap_width_set(sign_item, 200);
+ // evas_object_size_hint_min_set(sign_item, 100, 100);
+ elm_object_content_set(scroller, sign_item);
+ }
- elm_genlist_item_class_free(item_builder);
+ evas_object_show(scroller);
+ elm_box_pack_end(box, scroller);
}
+ evas_object_show(box);
+
+ Elm_Object_Item *it = elm_naviframe_item_push(ad->nf, TITLE_TEXT, NULL, NULL, box, NULL);
+ elm_naviframe_item_pop_cb_set(it, setting_menu_pop_cb, NULL);
}
diff --git a/src/util.c b/src/util.c
new file mode 100644
index 0000000..ef5ac0b
--- /dev/null
+++ b/src/util.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2016 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 "main.h"
+
+extern void do_haptic(int count)
+{
+ haptic_device_h handle;
+ device_haptic_open(0, &handle);
+ device_haptic_vibrate(handle, count, 0, 0);
+} \ No newline at end of file