From a77400c0e118cf0c7369db1df11c630f769c2099 Mon Sep 17 00:00:00 2001 From: segwon Date: Tue, 15 Nov 2016 21:41:28 +0900 Subject: [PATCH] Addition ACL(discovery/permit/deny) module. Signed-off-by: segwon Change-Id: Ic1229fd8e7a673726d88797e5df16cda55d6e17f --- CMakeLists.txt | 8 +- inc/convergence.h | 18 - inc/language.h | 4 - inc/main.h | 34 +- org.tizen.d2d-conv-setting.xml | 1 + packaging/d2d-conv-setting.spec | 2 + po/en_US.po | 26 +- po/ko_KR.po | 26 +- res/images/device_type_icon_camera.png | Bin 0 -> 899 bytes res/images/device_type_icon_computer.png | Bin 0 -> 379 bytes res/images/device_type_icon_display.png | Bin 0 -> 310 bytes res/images/device_type_icon_gaming.png | Bin 0 -> 997 bytes res/images/device_type_icon_headphone.png | Bin 0 -> 1006 bytes res/images/device_type_icon_headset.png | Bin 0 -> 1158 bytes res/images/device_type_icon_keyboard.png | Bin 0 -> 360 bytes res/images/device_type_icon_medical.png | Bin 0 -> 943 bytes res/images/device_type_icon_mobilephone.png | Bin 0 -> 318 bytes res/images/device_type_icon_mouse.png | Bin 0 -> 791 bytes res/images/device_type_icon_multimedia.png | Bin 0 -> 496 bytes .../device_type_icon_network_infrastructure.png | Bin 0 -> 577 bytes res/images/device_type_icon_printer.png | Bin 0 -> 640 bytes res/images/device_type_icon_storage.png | Bin 0 -> 284 bytes res/images/device_type_icon_wrist.png | Bin 0 -> 697 bytes src/convergence/convergence_power_manager.c | 28 -- src/ui/setting_home.c | 14 +- src/ui/setting_item_device_list.c | 467 +++++++++++++++++++++ src/ui/setting_item_discovery_button.c | 51 +++ src/ui/setting_item_power.c | 28 +- src/ui/setting_item_sign.c | 19 +- src/util.c | 8 + 30 files changed, 646 insertions(+), 88 deletions(-) delete mode 100644 inc/convergence.h delete mode 100644 inc/language.h create mode 100644 res/images/device_type_icon_camera.png create mode 100644 res/images/device_type_icon_computer.png create mode 100644 res/images/device_type_icon_display.png create mode 100644 res/images/device_type_icon_gaming.png create mode 100644 res/images/device_type_icon_headphone.png create mode 100644 res/images/device_type_icon_headset.png create mode 100644 res/images/device_type_icon_keyboard.png create mode 100644 res/images/device_type_icon_medical.png create mode 100644 res/images/device_type_icon_mobilephone.png create mode 100644 res/images/device_type_icon_mouse.png create mode 100644 res/images/device_type_icon_multimedia.png create mode 100644 res/images/device_type_icon_network_infrastructure.png create mode 100644 res/images/device_type_icon_printer.png create mode 100644 res/images/device_type_icon_storage.png create mode 100644 res/images/device_type_icon_wrist.png delete mode 100644 src/convergence/convergence_power_manager.c create mode 100644 src/ui/setting_item_device_list.c create mode 100644 src/ui/setting_item_discovery_button.c create mode 100644 src/util.c diff --git a/CMakeLists.txt b/CMakeLists.txt index bc378ca..976bd87 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,7 @@ 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 -#include -#include - -#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 - -#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..a0bae6e 100644 --- a/inc/main.h +++ b/inc/main.h @@ -1,42 +1,60 @@ #ifndef __main_H__ #define __main_H__ +#include #include #include #include #include +#include #include #include -#include "convergence.h" -#include "language.h" +#include +#include +#include #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 -{ +typedef enum state { POWER_OFF = 0, POWER_ON, - SCAN_START, - SCAN_STOP, + DISCOVERY_START, + DISCOVERY_STOP, CHANGE_LANGUAGE - } state_e; +#define POWER_ON_SIGN_TEXT dgettext(PACKAGE, "CONV_SETTING_APP_POWER_ON") +#define DEVICE_LIST_SELECT_POPUP_TITLE_TEXT dgettext(PACKAGE, "CONV_DEVICE_LIST_SELECT_POPUP_TITLE") +#define DISCOVERED_LIST_SELECT_POPUP_CONTENT_TEXT dgettext(PACKAGE, "CONV_DISCOVERED_LIST_SELECT_POPUP_CONTENT") +#define PERMITTED_LIST_SELECT_POPUP_CONTENT_TEXT dgettext(PACKAGE, "CONV_PERMITTED_LIST_SELECT_POPUP_CONTENT") +#define DENIED_LIST_SELECT_POPUP_CONTENT_TEXT dgettext(PACKAGE, "CONV_DENIED_LIST_SELECT_POPUP_CONTENT") +#define DEVICE_LIST_SELECT_POPUP_CANCEL_BUTTON_TEXT dgettext(PACKAGE, "CONV_DEVICE_LIST_SELECT_POPUP_CANCEL_BUTTON") +#define DEVICE_LIST_SELECT_POPUP_PERMIT_BUTTON_TEXT dgettext(PACKAGE, "CONV_DEVICE_LIST_SELECT_POPUP_PERMIT_BUTTON") +#define DEVICE_LIST_SELECT_POPUP_DENY_BUTTON_TEXT dgettext(PACKAGE, "CONV_DEVICE_LIST_SELECT_POPUP_DENY_BUTTON") +#define DEVICE_LIST_SELECT_POPUP_REMOVE_BUTTON_TEXT dgettext(PACKAGE, "CONV_DEVICE_LIST_SELECT_POPUP_REMOVE_BUTTON") /* 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); - /* 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 create_setting_item_discovery_button(Evas_Object *parent); +extern void create_setting_item_device_list(Evas_Object *parent); +extern void create_setting_item_popup(Evas_Object *parent); + +/* 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..677c04b 100755 --- a/org.tizen.d2d-conv-setting.xml +++ b/org.tizen.d2d-conv-setting.xml @@ -18,6 +18,7 @@ http://tizen.org/privilege/internet http://tizen.org/privilege/externalstorage http://tizen.org/privilege/content.write + http://tizen.org/privilege/haptic 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..815524f 100644 --- a/po/en_US.po +++ b/po/en_US.po @@ -2,4 +2,28 @@ msgid "CONV_SETTING_APP_POWER_ON" 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 +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 "CONV_DEVICE_LIST_SELECT_POPUP_TITLE" +msgstr "Access Device Control" + +msgid "CONV_DISCOVERED_LIST_SELECT_POPUP_CONTENT" +msgstr " device selected. How do you want this device control?" + +msgid "CONV_PERMITTED_LIST_SELECT_POPUP_CONTENT" +msgstr " device state is permitted. How do you want access state changed?" + +msgid "CONV_DENIED_LIST_SELECT_POPUP_CONTENT" +msgstr " device state is denied. How do you want access state changed?" + +msgid "CONV_DEVICE_LIST_SELECT_POPUP_CANCEL_BUTTON" +msgstr "Cancel" + +msgid "CONV_DEVICE_LIST_SELECT_POPUP_PERMIT_BUTTON" +msgstr "Permit" + +msgid "CONV_DEVICE_LIST_SELECT_POPUP_DENY_BUTTON" +msgstr "Deny" + +msgid "CONV_DEVICE_LIST_SELECT_POPUP_REMOVE_BUTTON" +msgstr "Remove" diff --git a/po/ko_KR.po b/po/ko_KR.po index 96e9465..b10f532 100644 --- a/po/ko_KR.po +++ b/po/ko_KR.po @@ -2,4 +2,28 @@ msgid "CONV_SETTING_APP_POWER_ON" 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 +msgstr "TIZEN Convergence 기능을 켜면, 동일한 Wi-Fi 망 내의 주변기기의 App을 실행하거나 App 간 통신이 가능하게 되며, 다양한 Convergence 기능을 경험할 수 있습니다. 단, 동일한 Wi-Fi 망 내 주변기기에서 주변기기가 본 기기의 App을 실행하거나 data에 접근을 요청할 수 있습니다." + +msgid "CONV_DEVICE_LIST_SELECT_POPUP_TITLE" +msgstr "접근 디바이스 관리" + +msgid "CONV_DISCOVERED_LIST_SELECT_POPUP_CONTENT" +msgstr " 디바이스를 어떤 상태로 관리하시겠습니까?" + +msgid "CONV_PERMITTED_LIST_SELECT_POPUP_CONTENT" +msgstr " 디바이스는 현재 허용된 상태입니다. 어떤 상태로 변경하시겠습니까?" + +msgid "CONV_DENIED_LIST_SELECT_POPUP_CONTENT" +msgstr " 디바이스는 현재 거부된 상태입니다. 어떤 상태로 변경하시겠습니까?" + +msgid "CONV_DEVICE_LIST_SELECT_POPUP_CANCEL_BUTTON" +msgstr "취소" + +msgid "CONV_DEVICE_LIST_SELECT_POPUP_PERMIT_BUTTON" +msgstr "허용" + +msgid "CONV_DEVICE_LIST_SELECT_POPUP_DENY_BUTTON" +msgstr "거부" + +msgid "CONV_DEVICE_LIST_SELECT_POPUP_REMOVE_BUTTON" +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 0000000000000000000000000000000000000000..0a53ae98a02cf7bc323c29c155bb4828a811774a GIT binary patch literal 899 zcmV-}1AP36P)R32;bRa{vGi!~g&e!~vBn4jTXf02y>eSaefwW^{L9a%BKbX=8G4b8lvJAWvpy zX=7!7?KN=#00RR_L_t(&-tCz^h!a5+$4?RbI6)M|YqSsxKM_F`YZXq=Mw#qJI2$Eg zW+q!`aoAlDb#`VD( zTfA;3?>BGWd-H#jzGAW1*NfJZ&?$HdZVTMu@}9$WwHb4nI?)mEA#ZfC!~BV6!JT3C zpd;WA?R`x{qcQ)_kXKq}ADqc@OWfc=p{m+mQS!cj=Vo|q4Ps0Oi za^Ot=B3!kCTG@*gfD( ze{-llG*~LlY1l%cGr*dYwd%<(IMpv8!s}vRUR3U$+;HHx>b5~oZ)h(#^FKr6Rt15o z)#@xl#ZCY_4f%bIaD5%yET&3r`1o3<4H1`n%p=unQ8?9g2%EsmCb-7sYSbz?6xppH zK$eQFBrm=;T*v*Vkh4pt)(v{4xs%<;7C3-zpK`tvE6FWBM& z^0pB7xS^o8O`n#hS6cyxyc`SV=~!HFi25m`J|d)98^Gn2pwkT3A7U36S2s;T7dDxgbpqP)P=D`LQ9@))81Llj}~-FwjKcL|k;r$(-zT*YCzGZPR~H^M;C zUctn2So^G_qZ{TZIilA@evbj!o8kVu?wC1Y#&oGX3wgh>7A&ej_-+?!^zI#&nRp8u zx#LoG$>HiEO5pIc)4fxE&puCB10NCnJp&G`#@ivj%eC}SZ{hh3TIhxJ&#M$X1y8|~ ZvA;dR(pgfQ(H;N*002ovPDHLkV1fk?rd|L5 literal 0 HcmV?d00001 diff --git a/res/images/device_type_icon_computer.png b/res/images/device_type_icon_computer.png new file mode 100644 index 0000000000000000000000000000000000000000..d941e880e0beed1872120f8db125250cd661e6b8 GIT binary patch literal 379 zcmeAS@N?(olHy`uVBq!ia0vp^dLYcf1|-9GYMTQo#^NA%CnkpjwMT&*&H|6fVg?4j zBOuH;Rhv&5C@5Lt8c`CQpH@zA+#ykD^B*usRX z3q5>=YY*QJ`nA|({gZh0E~VqgB0AY*KKMVhix0ImTRmH%{FHY7!xSa6mM(72r&mt| z6v_qe^f?%NZ1%CH`5&0)PnUmCc$#ZR*Xz%>@()dBb!9I&z{oBGBerv%OUaix;dk-p z{Kd0H3;I8{=|1jM?Dl@yC=k2GQ^Eh3U8YvwDU1KN-UQ^nTG!XcB=f=M;rF?7DrL@8 z{QsJK>~`dO|0reg9lL%yMpw5K%~y}f{>r$ntA6$SP(kZIrOYw~-4D%wnD_)t+4x=? P7z_-au6{1-oD!M=fJ9G<$+@$BtN`Wgqz-2_9|Ol*YYUbd6KmS?#$0q4sA| z&h6AWI?08Z-A;4I_qw!Ir;D;v*KSPUKE^Rm{H>|}(d@k7ZQJ!fJXpG@NHiI{6Hf!JD-e2!2=M(&ZZ`Ou6T0#sw&gDvyEkcEUaA7E`I4~f%b8^`tWW( xGi~*KTRji3|L6U-n^)$?jDj#$pho*@W}E5GU5i3(ZGb*t@O1TaS?83{1ONeqb6NlZ literal 0 HcmV?d00001 diff --git a/res/images/device_type_icon_gaming.png b/res/images/device_type_icon_gaming.png new file mode 100644 index 0000000000000000000000000000000000000000..db08febd9f5c3327a3a5bd94cbfde22fed215e76 GIT binary patch literal 997 zcmVR32;bRa{vGi!~g&e!~vBn4jTXf02y>eSaefwW^{L9a%BKbX=8G4b8lvJAWvpy zX=7!7?KN=#00U)7L_t(&-tCx6j0`~-fEOWFSRtMvgm83mbK)SfE)t3A-XRl24E@+n z_8{ZnHC(!@iew1MgxfmEM8bjKu#vsEA}lA8C02xZ#cNqR{=et3Gpnnox~Iu*Qine~ zTb2I%tH1tdx8-uVw#g`y5?X;Pa0RZw6}SSQ_~68GmuVJrb&C(^7W+zU{+<~0E-|S= zvTnPqp3ctv4Bey$bj#~U9lGItBNlt2+4Kx?@+%Sr*G;|)VRf6A0>z|Hw`bh75{F*} zkPk(A;2_^Y*ZxGnL6HX585KfTM6r?-lCtT(mcYRU=EGHfka?MJ zF^gRn>FP3BZ{TwQH%UzXC7pGb#s&v#ACiTRDggI8W%F&mflPNJ#LjTz4YHH*!7X;b z(FfU`v~yw}xWvkq;UUQD-=$f!uW_F~E0s!9B7+l$uM67U%qbg4Uxh9)R#0k2DwSE=?1$BzegZjJ=bk^9wAPB6eV;5G#uwWFl3nPRSrv-ys{Ba~}Tl7@inGs8T zG;lU34$f|NI!bp3k-jJ{IM#wLgT0e~A1w&MvCY(M{zgt2-P`J<4mya;ScsK;{2(1v zIoH=Z!(b&pa7s_=GXuEHZhuG?gTD^y%LUh1=m5CG(Cj>@Yl4RGx*&kpB>jy9r+?_n z&uItQ%ku2%{nTym5gh6mPF%4+Pl$Tre<6;OpB^@{sZVeUT!AZa1+KsqcpUiy%>z=* TOil?i00000NkvXXu0mjfZuQYD literal 0 HcmV?d00001 diff --git a/res/images/device_type_icon_headphone.png b/res/images/device_type_icon_headphone.png new file mode 100644 index 0000000000000000000000000000000000000000..b746dd83a226863d33225d0580a1eaa9d3cd4436 GIT binary patch literal 1006 zcmVR32;bRa{vGi!~g&e!~vBn4jTXf02y>eSaefwW^{L9a%BKbX=8G4b8lvJAWvpy zX=7!7?KN=#00VAGL_t(&-tCz=h!jB-hCT2KRJ;+vKokTG3`EvI6ck-N5v=KHalmMp zsj6vV6;?&j&8n+Pa1v1ybpwwP#K;pdR1jAX6l4=c14Tvg!qr{JSG~z}b=OSKZcp1Q z8@yz${@$yDa{2pk=p|Y%7VBK67MXa`~V~|5CVU?X>hfa z0cgS=qCA`4iX+@R7xV*+xPM@etc(n<^cAQ85wDO_p3_SIfiUj~R2_@Ek--D44>FJ1 zriLpUt0->i@b-SWq9HiwcP{MeKCRl_Nx8nAdA20*{E|4;7##DWe>2Jf^+MHHejgEW-M2vt;RL_SL^xY}=KsT9SB6j!{e8bi2L!W>$Pz-tYjc0G&!BmV~c%(MWw$|mjL zp&Cy;IQ05ZaL-bv7+e{xdhM_;wH1epc^z=ko7#$lB`|{PmNr%3M6fz0i*E$EoKqep zHQ-oYwlLq3bB@o5bjw$6EDhkMd17-n?u5a0M;LV=G|QXy72O|+gRA+9y6t1WdFVq= zIGB{d_dIfqmuUsK8aUaQJ8Fs+>tG)_<%Lj%gJANX$2J5~jR5mw&CJGQ|MM!z7zG~% c|KGv?0!7hC7yTNa^#A|>07*qoM6N<$f;)l9P5=M^ literal 0 HcmV?d00001 diff --git a/res/images/device_type_icon_headset.png b/res/images/device_type_icon_headset.png new file mode 100644 index 0000000000000000000000000000000000000000..a17e79940dc93f0c4f59bfb6f08f168dfefe7d9c GIT binary patch literal 1158 zcmV;11bO?3P)R32;bRa{vGi!~g&e!~vBn4jTXf02y>eSaefwW^{L9a%BKbX=8G4b8lvJAWvpy zX=7!7?KN=#00ag}L_t(&-qo2)XcIvg$LkYRwD>$!R8T>bDn7u2pdu7ov=^(B&4LlB z5W2IQ_0U5vDpo~iXGSrC+G6n{cnBy6f?iZaM9_mMiir5=MWu=leAh?(W?O3Zm1L9M zO>!6tN&3xizWL8L-}g;jcXxMPEsnqpB}wl@8Ixrarmd1j5yB(^W1Fm#wMZwkv)SyZ zssWcf`SO^`2*T{Hq#C~^jc2_EO3}A5jb4;Bx(juYX_12q&w)p`ny`65^A5%MA*t*P z>g0I4-Fh9>OdO*9vHNByp%Ct6DYVT4NQ-P1ZN^kTOPg2U?Kjwpipx+v3CM+gS_xScJlOfb7()7ZVJ z^K3|gXW7FrL>|Qx9HGn@hfFZ;>&Q?}V%v!z!EO0DR8*H^8arU06AoyDyHqrGzStBrH1K?L>U^my zI9&60svDfF_K=G4s;a>;S??j0;>)s%fOpW%4sbJu`zW*QCp-#paT!VqJ#7W|V*o~Q zxrx7dbLSrELe(VraQmS~!BzITM#1T`ngkcUk!lBr^!AOL#&;L%_2|Lr?S#I6YHt1M zRxCG29rQs}fkU!aTzeu<2dhFJ-&hnl7+e7V@VZjqQ0M-EYV6xkGn5UuwJ5xeiZlSz zO>vE$8!-|xxJdNkDm!d#5V1og_s7i%Fl~ow<%XzOf&>@d6~%*$=@wBEincZ^;L>oP z@_iynW(4w-0(tQ~zjdXE2)RRiCcYD(x%SLnyvmQ4)Pf7Rp{amJzqoZ{?X6^4=PN+Z zSN=mAeWAU&XWr@M7wbBl41$6nET5DisZ3fogCbq>+nq|x_tis&L>(iZrun=kM# zG9j+8cit}=#voGJeew1wB8Mo={5;}@+XvKmGgA3O5gl>|==-sFeJ;m#N(BnZ(Qo}`IS`4j9ogPit-Phm1ga( zYe~6U>6Q9l)bFWA$q(7}bN6#^*UQWGzwG;c@3j;rnS%KRuhkDcJ+d|JQT5t?d;YJ` z(rDi?2WYN%U(t`uAH~797hf{H*U$B!VSDTAcW>st+mL-h){S*}k-35M^aT%n=BCx$ z-mD(EMu#K#xWfJ|WoIKd9^4{UaDb6r=EM4DZ2UW>dVVbq`~>tfgQu&X%Q~loCII^) Bll=ey literal 0 HcmV?d00001 diff --git a/res/images/device_type_icon_medical.png b/res/images/device_type_icon_medical.png new file mode 100644 index 0000000000000000000000000000000000000000..44ea23dc0e0aa99ef6066a281c470431689fd893 GIT binary patch literal 943 zcmV;g15o^lP)R32;bRa{vGi!~g&e!~vBn4jTXf02y>eSaefwW^{L9a%BKbX=8G4b8lvJAWvpy zX=7!7?KN=#00S>cL_t(&-tAdW$V^cb|NPAc3(0~gL@66&qpqGr$eF=I1+*shvW^+oJ@y*y0CsB>xE;0G2NX3mJ<0mlT+icsL zp&JmP#xz8nEtm=pb`25n5L0;vGjSR-zO~V4Ow9y11lfd$`xrCXj5O-J$3z|&t~j%z z{1iNIdYNzv=U&J8LR371bA`mfRhA*hQAFhLSkOTu;w7@34Iv-D23Ps0wjVzkT&lm* zF>ok>Qym5R7f}8zGg%4vDPha~p3v8Ml|XIa5NuDPKmjXJaSZ$%!qokf$`|2Bw16Yq zTMXs#H7)SW4E`Xp<*K&8;ijK62K4`|UycP1*`BYy&@|wxL6nJH8VOuoD&w*pQR@@S z#Bwj13LG(UGrClu`DYO1cxyev)ZLNRZ;`nl;xhilRN%^jbf9IzbucA+0321Ex#1aS za@=I#itmI2r{cM(z=4&1j;?WN^u}hKy7yxGI6tU6hJn3}gc(rM?UQMQvp(uP`1`2K zec~qPO3e(6XSKufBID^6rxbx~TjvsX%{_t3Awh6bjHy~9{B_{6nyd7HNNpR?B z?VK?FS0vnovH`9(A0pQ#k|&_n_x3L1{BSB=1=qycynz>qxD>VB>kC3kd1CTvZosR2 zbhzTo&P0M!bg~0MCoynj$yYET7iB7Xg2RPMsnVHpaPHOwWA4+orIE|4o8Rw=dtFgu_!G7{002ovPDHLkV1gW#z!?Al literal 0 HcmV?d00001 diff --git a/res/images/device_type_icon_mobilephone.png b/res/images/device_type_icon_mobilephone.png new file mode 100644 index 0000000000000000000000000000000000000000..c2f5e461ef6bce5315ed53b00246df586f73687e GIT binary patch literal 318 zcmeAS@N?(olHy`uVBq!ia0vp^dLYcf1|-9GYMTQo#^NA%CnkpjwMT&*&H|6fVg?4j zBOuH;Rhv&5C@5Lt8c`CQpH@n$o=7td8F< zH|12b_a2`2ub9~RWGo6E9B5=lF!Z>^Ep@jSo_@O_;>U8S1C9Sb_x!fd+w_OI>X>ZX zX0uyYm!A$fzsL9bQLnf2jjzs2HWXU@Tl}QhKZaKBua^vSGBtocVeoYIb6Mw<&;$TI C|9~X` literal 0 HcmV?d00001 diff --git a/res/images/device_type_icon_mouse.png b/res/images/device_type_icon_mouse.png new file mode 100644 index 0000000000000000000000000000000000000000..463c19d220db85bcd4457dea985f695de7ee124c GIT binary patch literal 791 zcmV+y1L*vTP)R32;bRa{vGi!~g&e!~vBn4jTXf02y>eSaefwW^{L9a%BKbX=8G4b8lvJAWvpy zX=7!7?KN=#00NguL_t(&-tC#ci_}0A$4|u{_yZN2Lo7rQK@b!K!NTf_Z4R`UWK%4P zN+6SA5UyBI3l}UVlK}}9a@Y#O79LuNrT>JW#Ua?7TAU{~{y^9FmR-10Hj^`X$p%t9 zLWX%WpG@9+$$V#~*XzyH(P{}z3f_{*PP{UIaqm=vBOv4Ys>9=_Zm5?TH@~pm6=vWF z^U)FdnalOHq8_A>mG!u}#e`W!$n`b`-(W%XnF)P+{6;DPXVRQv477 z{2H0*-QvJSgaMo3OGL*Jl;F!RJ!C*_V z;8`Zl3qJC%3>=co+t{w>YXOcwP{TwH&3C9OPq3C(29B|Zb=+o?Vl=P+e}nh?{jKo( zdW_m|o=QR`uT>V~4R{0IfH&X`cmv*mqs{qhUn$_MzpePKTLuv*r>&6eIol$BMG79o zFG;{rl_dq|W`PEL!5oFbf097MZmA>HVLAye)Q@SxL_Z?c4w+O(Z1VD^D~T|xFzzh5 z%nTc0$0}lG4w2zFmr4`%0sdxgc<@KLuJof6Tq&!1I}sZExNcW=c*SILlJV%p=AiX+ zRB)%_xDa*lHrEeXXx>eLU3NwM07~kasXd_W$m9?_$XWPcUBD{}J+(PmrncIG{{d>8 V+;&Cl!tek9002ovPDHLkV1lC8Z{Gj_ literal 0 HcmV?d00001 diff --git a/res/images/device_type_icon_multimedia.png b/res/images/device_type_icon_multimedia.png new file mode 100644 index 0000000000000000000000000000000000000000..126caf2954eeeb91c639f4849e42768451129e49 GIT binary patch literal 496 zcmeAS@N?(olHy`uVBq!ia0vp^dLYcf1|-9GYMTQo#^NA%CnkpjwMT&*&H|6fVg?4j zBOuH;Rhv&5C@5Lt8c`CQpH@ zIU^@0MWU<1!>a1a!^M2^r9W02c9*q#^&zl*^4kv^-kj@v7-_rzaB{f%7lyx_$2{=POwonB7xy+M~|9`tW9}B=%zu73N$O?$^A3 zw`rQCe9N=a4#m}-XR`%(&c57Z*|3yrNhv!|sC`1FAkUeO>0cE0V9aP)78&qol`;+08y*eZvX%Q literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..424e9749f8120fb200e8c2bd3bd29f00d54ff922 GIT binary patch literal 577 zcmV-H0>1r;P)R32;bRa{vGi!~g&e!~vBn4jTXf02y>eSaefwW^{L9a%BKbX=8G4b8lvJAWvpy zX=7!7?KN=#00F^CL_t(&-tE~jOT$1E0ALk#P*KED5!^&qM{y9*s*4UunxP;LCFahX z6j$SvTn-^)cXjCO4^R=DTm*3x2Q3ad34((0RjW101;hr@&^J7?yuN%nUN3i-Hp{Zw zvKW~}BfP2M%C_B8U^@fVP>QAAqySK>@4If%E_EjgSBc|kRQQ1)e7_NJF6VVArh6K! z>Ab6y?h3DUd5z>6?gd;I;7>ZL zP(G8V?lI2e2uFDK;2GTkWp>Z`IqC*q3a`YPYNUy{ftT1Ue&R32;bRa{vGi!~g&e!~vBn4jTXf02y>eSaefwW^{L9a%BKbX=8G4b8lvJAWvpy zX=7!7?KN=#00IC>L_t(&-tE~jO9L?!0N{!!D1taRDB|EGIJk(Di{MaHaLT0}x=FD~ zdXre3v>=iu0V%i?C!IvWLEIf2b@UH72)a1wpr~i=ih^e=wwI(=%`3q|t@P@`H5(vX>H8H9b9@Kl(z~wLAxb!ipVWl|TzZKk`ZF>v9j=}67NP(W zGd~uC6}Is09=ALiKX{E*#fQco4iTLVPfCc`QvBh6`ByC5!Y$mwTMWmnm_}mEL_o|B z)WPLO;CJELt3Ytn2?<+M1_!Q~gh(u#s8?i?9CdJ6N2D;{)(@u{;L>R&a6rUEa1Dt= z{q+jlkhno5@DveOL8XTHrFOWSnAP7BkCEXH=EuQcGV{9OsXV`^HZa4&R(c45wW&Wn`0){Vpib9tVrvnyp)b4%Nvx-wOAge)|LngQj*z zxd~0A30n<4(5tlVH+-%lXZyOjPKYfkI}n07wr8#;VR>b6kYne@&QEZutS;l2-x$j{ zW~WNv{^t|9A-owYUF90C1TL4taieuN=1)rCa+c4x@~EwOIAL=pUll*&vO*lO-#IN@ aQG5XZME{elJ{0o+00007?N@C z?ajSh4GJP{55F<3*L%YywQBFpvj?OzGS+AF{3_&?a=P48{^Qwu%Vzc`DPAjej;eIB z@!e71lhy9J?Xa5lX7R32;bRa{vGi!~g&e!~vBn4jTXf02y>eSaefwW^{L9a%BKbX=8G4b8lvJAWvpy zX=7!7?KN=#00KElL_t(&-tF1XOH@G|0C2%l$RGuS43Q`gLidiH_Yf4wcgIEc`fz8S zBjRD92wJ+#o0-eIh~hDV@Z^8s$)hFW&7g>gKoB~J;LpDET#G_#-Tl6Ky?BT3ZQtx? zXTLM^o$u>vG#XubjJ6*v#qpJ@d@;~zxN*F~nb4Mn_O#O|izxO6uSh!vB08XeGj0zn z+}`&BpWx;dgm#xI5dX$os^oTY<_Zqnjsn+TNpkzQfSP>|QVo;CtAQG1!fdC3{t?2w z3)JE@QaA{+k}CQqet`_mxPIgXoxr0LOqmBHaH#23Z}78N?igN@aWBrokyp4-pF4&_ zpl+NG=wq8}^}8~IL$G)~cW@kQ288_pG9Jkd+@amh!D?m$;WsmfJH$mZ_)AsEwfqy> zJ6y{6D)8v7`}-?%_D;L#OlBNQ)5+$x`4Q{uyX~Me%W=e493Ddb37@-nS#+k06VVJW z2mAQ>CrM$(b(u|>^;XcC?<&>08p0p&ESYIcq03x|Gv5wzrf0E!KW3pG&)v!C>YV@X z$S>dpynq+*yus_L?|d+dw({Si*`nB^x#dsm9j}+=DZNS4SD7~RKH(EWza)WIrMjK8 zgFT?jVe}=atA4T;92QNFlWH&BF4hqiW)I1`wPkKhnsB^1Jx!&}Tq?yqc(2?_rOhnN z8o+XQ(b&Hz+~T3!yIWa|Byc<+UX!LuO)q(YyT*?@-DqB+sBa+EEidq9+u=FUd(Js; fIiB0a`7gwGPBIUSl}=2l00000NkvXXu0mjfFEvVH literal 0 HcmV?d00001 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/ui/setting_home.c b/src/ui/setting_home.c index 9c5c1fb..0146921 100644 --- a/src/ui/setting_home.c +++ b/src/ui/setting_home.c @@ -1,7 +1,7 @@ #include "main.h" static int listener_num = 0; -static event_listener listeners[4]; +static event_listener listeners[10]; extern void add_state_change_event_listener(event_listener listener) { @@ -11,10 +11,8 @@ extern void add_state_change_event_listener(event_listener listener) extern void state_change_event(state_e state) { int index; - - for (index = 0; index < listener_num; index++) { + for (index = 0; index < listener_num; index++) listeners[index](state); - } } static Eina_Bool setting_menu_pop_cb(void *data, Elm_Object_Item *it) @@ -33,15 +31,11 @@ static void app_language_changed(app_event_info_h event_info, void *user_data) return; } - dlog_print(DLOG_ERROR, LOG_TAG, "language = %s.", language); - if (language != NULL) { elm_language_set(language); free(language); } - dlog_print(DLOG_ERROR, LOG_TAG, "language = %s.", language); - state_change_event(CHANGE_LANGUAGE); } @@ -59,8 +53,10 @@ extern void create_setting_menu(Evas_Object *parent) elm_object_content_set(background, layout); evas_object_show(layout); { - create_setting_item_power(layout); create_setting_item_sign(layout); + create_setting_item_discovery_button(layout); + create_setting_item_device_list(layout); + create_setting_item_power(layout); } Elm_Object_Item *menu = elm_naviframe_item_push(parent, "Convergence", NULL, NULL, background, NULL); diff --git a/src/ui/setting_item_device_list.c b/src/ui/setting_item_device_list.c new file mode 100644 index 0000000..e76e195 --- /dev/null +++ b/src/ui/setting_item_device_list.c @@ -0,0 +1,467 @@ +#include "main.h" + +#define DISCOVERY_TIME 8 +#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" + +typedef struct device_info { + int index; + char *list_type; + char *name; + char *type; + char *mac_address; +} device_info_s; + +device_info_s *selected_device = NULL; + +static Evas_Object *group_list_item = NULL; +static conv_h conv_handle = NULL; + +static Elm_Object_Item *discovered_device_group = NULL; +static Evas_Object *discovered_list = NULL; +static int discovered_devices_index = -1; +static device_info_s **discovered_devices_info = NULL; + +static Elm_Object_Item *permitted_device_group = NULL; +static Evas_Object *permitted_list = NULL; +static int permitted_devices_index = -1; +static device_info_s **permitted_devices_info = NULL; + +static Elm_Object_Item *denied_device_group = NULL; +static Evas_Object *denied_list = NULL; +static int denied_devices_index = -1; +static device_info_s **denied_devices_info = NULL; + +static Elm_Genlist_Item_Class *device_item_builder = NULL; + +static Evas_Object *popup = NULL; + +static void set_acl_device_list(); + +static void popup_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info) +{ + do_haptic(50); + + char *button_name = (char *)data; + dlog_print(DLOG_INFO, LOG_TAG, "Button Name : %s", button_name); + + if (!strcmp(DEVICE_LIST_SELECT_POPUP_PERMIT_BUTTON_TEXT, button_name)) { + conv_internal_set_acl_state(selected_device->mac_address, selected_device->type, selected_device->name, 0); + } else if (!strcmp(DEVICE_LIST_SELECT_POPUP_DENY_BUTTON_TEXT, button_name)) { + conv_internal_set_acl_state(selected_device->mac_address, selected_device->type, selected_device->name, 1); + } else if (!strcmp(DEVICE_LIST_SELECT_POPUP_REMOVE_BUTTON_TEXT, button_name)) { + conv_internal_remove_acl_device(selected_device->mac_address); + } + + set_acl_device_list(); + evas_object_del(popup); +} + +static void show_device_list_selected_popup(char *title_name, char *content, char *left_button_name, char *center_button_name, char *right_button_name) +{ + Evas_Object *parent = evas_object_smart_parent_get(group_list_item); + + popup = elm_popup_add(parent); + elm_popup_align_set(popup, ELM_NOTIFY_ALIGN_FILL, 1.0); + elm_object_part_text_set(popup, "title,text", title_name); + elm_object_text_set(popup, content); + eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, eext_popup_back_cb, NULL); + evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + + Evas_Object *left_button = elm_button_add(popup); + elm_object_style_set(left_button, "popup"); + elm_object_text_set(left_button, left_button_name); + elm_object_part_content_set(popup, "button1", left_button); + evas_object_smart_callback_add(left_button, "clicked", popup_btn_clicked_cb, left_button_name); + + Evas_Object *center_button = elm_button_add(popup); + elm_object_style_set(center_button, "popup"); + elm_object_text_set(center_button, center_button_name); + elm_object_part_content_set(popup, "button2", center_button); + evas_object_smart_callback_add(center_button, "clicked", popup_btn_clicked_cb, center_button_name); + + Evas_Object *right_button = elm_button_add(popup); + elm_object_style_set(right_button, "popup"); + elm_object_text_set(right_button, right_button_name); + elm_object_part_content_set(popup, "button3", right_button); + evas_object_smart_callback_add(right_button, "clicked", popup_btn_clicked_cb, right_button_name); + + evas_object_show(popup); +} + +static void device_list_select_cb(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; + + char *title = DEVICE_LIST_SELECT_POPUP_TITLE_TEXT; + char content[1024]; + char *left_button_text = NULL; + char *center_button_text = NULL; + char *right_button_text = NULL; + + if (!strcmp(selected_device->list_type, LIST_TYPE_PERMITTED)) { + snprintf(content, sizeof(content), "'%s'%s",selected_device->name ,PERMITTED_LIST_SELECT_POPUP_CONTENT_TEXT); + left_button_text = DEVICE_LIST_SELECT_POPUP_CANCEL_BUTTON_TEXT; + center_button_text = DEVICE_LIST_SELECT_POPUP_DENY_BUTTON_TEXT; + right_button_text = DEVICE_LIST_SELECT_POPUP_REMOVE_BUTTON_TEXT; + + } else if (!strcmp(selected_device->list_type, LIST_TYPE_DENIED)) { + snprintf(content, sizeof(content), "'%s'%s",selected_device->name ,DENIED_LIST_SELECT_POPUP_CONTENT_TEXT); + left_button_text = DEVICE_LIST_SELECT_POPUP_CANCEL_BUTTON_TEXT; + center_button_text = DEVICE_LIST_SELECT_POPUP_PERMIT_BUTTON_TEXT; + right_button_text = DEVICE_LIST_SELECT_POPUP_REMOVE_BUTTON_TEXT; + + } else if (!strcmp(selected_device->list_type, LIST_TYPE_DISCOVERED)) { + snprintf(content, sizeof(content), "'%s'%s",selected_device->name ,DISCOVERED_LIST_SELECT_POPUP_CONTENT_TEXT); + left_button_text = DEVICE_LIST_SELECT_POPUP_CANCEL_BUTTON_TEXT; + center_button_text = DEVICE_LIST_SELECT_POPUP_DENY_BUTTON_TEXT; + right_button_text = DEVICE_LIST_SELECT_POPUP_PERMIT_BUTTON_TEXT; + } + + show_device_list_selected_popup(title, content, left_button_text, center_button_text, right_button_text); +} + +static void gl_expanded_cb(void *data, Evas_Object *obj, void *event_info) +{ + int index; + + Elm_Object_Item *it = event_info; + Evas_Object *list = elm_object_item_widget_get(it); + + char *type = elm_object_item_data_get(it); + + if (!strcmp(LIST_TYPE_DISCOVERED, type)) { + for (index = 0; index <= discovered_devices_index; index++){ + if (discovered_devices_info[index] != NULL) { + elm_genlist_item_append(list, device_item_builder, discovered_devices_info[index], it, ELM_GENLIST_ITEM_NONE, device_list_select_cb, discovered_devices_info[index]); + } + } + } else if (!strcmp(LIST_TYPE_PERMITTED, type)) { + for (index = 0; index <= permitted_devices_index; index++){ + if (permitted_devices_info[index] != NULL) { + elm_genlist_item_append(list, device_item_builder, permitted_devices_info[index], it, ELM_GENLIST_ITEM_NONE, device_list_select_cb, discovered_devices_info[index]); + } + } + } else if (!strcmp(LIST_TYPE_DENIED, type)) { + for (index = 0; index <= denied_devices_index; index++){ + if (denied_devices_info[index] != NULL) { + elm_genlist_item_append(list, device_item_builder, denied_devices_info[index], it, ELM_GENLIST_ITEM_NONE, device_list_select_cb, discovered_devices_info[index]); + } + } + } + + elm_genlist_item_fields_update(it, "elm.swallow.end", ELM_GENLIST_ITEM_FIELD_CONTENT); +} + +static void gl_selected_cb(void *data, Evas_Object *obj, void *event_info) +{ + Elm_Object_Item *it = event_info; + elm_genlist_item_selected_set(it, EINA_FALSE); + + Eina_Bool expanded = elm_genlist_item_expanded_get(it); + elm_genlist_item_expanded_set(it, !expanded); +} + +static void gl_contracted_cb(void *data, Evas_Object *obj, void *event_info) +{ + Elm_Object_Item *it = event_info; + elm_genlist_item_subitems_clear(it); + elm_genlist_item_fields_update(it, "elm.swallow.end", ELM_GENLIST_ITEM_FIELD_CONTENT); +} + +static Evas_Object* create_image(Evas_Object *parent, Evas_Coord w, Evas_Coord h, char *type) +{ + Evas_Object *img; + img = elm_image_add(parent); + + if (type != NULL) { + if (!strcmp(DEVICE_TYPE_MOBILE, type)) { + elm_image_file_set(img, "usr/apps/org.tizen.d2d-conv-setting/res/images/device_type_icon_mobilephone.png", NULL); + } else if (!strcmp(DEVICE_TYPE_TV, type)) { + elm_image_file_set(img, "usr/apps/org.tizen.d2d-conv-setting/res/images/device_type_icon_display.png", NULL); + } else if (!strcmp(DEVICE_TYPE_WEARABLE, type)) { + elm_image_file_set(img, "usr/apps/org.tizen.d2d-conv-setting/res/images/device_type_icon_wrist.png", NULL); + } else { + elm_image_file_set(img, "usr/apps/org.tizen.d2d-conv-setting/res/images/device_type_icon_multimedia.png", NULL); + } + + } else { + elm_image_file_set(img, "usr/apps/org.tizen.d2d-conv-setting/res/images/device_type_icon_multimedia.png", NULL); + } + + evas_object_size_hint_min_set(img, ELM_SCALE_SIZE(w), ELM_SCALE_SIZE(h)); + return img; +} + +static Evas_Object* device_info_content_get_cb(void *data, Evas_Object *obj, const char *part) +{ + if (!strcmp("elm.swallow.icon", part)) { + device_info_s *item = (device_info_s *)data; + return create_image(obj, 32, 32, item->type); + } else { + return NULL; + } +} + +static char* device_info_text_cb(void *data, Evas_Object *obj, const char *part) +{ + device_info_s *item = (device_info_s *)data; + + if (!strcmp("elm.text", part)) { + return strdup(item->name); + } else if (!strcmp("elm.text.multiline", part)) { + return strdup(item->mac_address); + } 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, device_item_builder, discovered_devices_info[index], discovered_device_group, ELM_GENLIST_ITEM_NONE, device_list_select_cb, discovered_devices_info[index]); + elm_genlist_item_fields_update(discovered_device_group, "elm.swallow.end", ELM_GENLIST_ITEM_FIELD_CONTENT); + + break; + + case CONV_DISCOVERY_RESULT_FINISHED : + conv_destroy(conv_handle); + conv_handle = NULL; + state_change_event(DISCOVERY_STOP); + return; + } +} + +static void discovery_start() +{ + if(conv_handle == NULL) { + + int index; + + elm_genlist_item_subitems_clear(discovered_device_group); + elm_genlist_item_fields_update(discovered_device_group, "elm.swallow.end", ELM_GENLIST_ITEM_FIELD_CONTENT); + + 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 *)); + + elm_genlist_item_expanded_set(discovered_device_group, EINA_TRUE); + + 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 void state_change_event_listener (state_e state) +{ + switch (state) + { + case POWER_ON : + evas_object_show(group_list_item); + break; + case POWER_OFF : + evas_object_hide(group_list_item); + break; + case DISCOVERY_START : + discovery_start(); + break; + case DISCOVERY_STOP : + discovery_stop(); + break; + case CHANGE_LANGUAGE : + elm_genlist_realized_items_update(group_list_item); + break; + default : + break; + } +} + +static void acl_device_info(char *mac_address, char *device_type, char *device_name, int access_control_state, void *user_data) +{ + dlog_print(DLOG_ERROR, LOG_TAG, "Device_Type = %s", device_type); + + if(access_control_state == 0) { + int index = ++permitted_devices_index; + permitted_devices_info[index] = (device_info_s *) calloc(sizeof(device_info_s), 1); + permitted_devices_info[index]->list_type = LIST_TYPE_PERMITTED; + permitted_devices_info[index]->index = index; + permitted_devices_info[index]->name = strdup(device_name); + permitted_devices_info[index]->type = strdup(device_type); + permitted_devices_info[index]->mac_address = strdup(mac_address); + elm_genlist_item_append(permitted_list, device_item_builder, permitted_devices_info[index], permitted_device_group, ELM_GENLIST_ITEM_NONE, device_list_select_cb, permitted_devices_info[index]); + elm_genlist_item_fields_update(permitted_device_group, "elm.swallow.end", ELM_GENLIST_ITEM_FIELD_CONTENT); + + } else 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, device_item_builder, denied_devices_info[index], denied_device_group, ELM_GENLIST_ITEM_NONE, device_list_select_cb, denied_devices_info[index]); + elm_genlist_item_fields_update(denied_device_group, "elm.swallow.end", ELM_GENLIST_ITEM_FIELD_CONTENT); + } +} + +static void set_acl_device_list() +{ + int index; + + elm_genlist_item_subitems_clear(permitted_device_group); + elm_genlist_item_fields_update(permitted_device_group, "elm.swallow.end", ELM_GENLIST_ITEM_FIELD_CONTENT); + + if (permitted_devices_info != NULL) { + + for (index = 0; index < STORAGE_SIZE; index++) { + if(permitted_devices_info[index] == NULL) break; + free(permitted_devices_info[index]); + permitted_devices_info[index] = NULL; + } + + free(permitted_devices_info); + permitted_devices_info = NULL; + } + + permitted_devices_index = -1; + permitted_devices_info = (device_info_s **) calloc(STORAGE_SIZE, sizeof(device_info_s *)); + + elm_genlist_item_expanded_set(permitted_device_group, EINA_TRUE); + + elm_genlist_item_subitems_clear(denied_device_group); + elm_genlist_item_fields_update(denied_device_group, "elm.swallow.end", ELM_GENLIST_ITEM_FIELD_CONTENT); + + 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 *)); + + elm_genlist_item_expanded_set(denied_device_group, EINA_TRUE); + + conv_internal_get_acl_list(acl_device_info, NULL); +} + +static char* group_title_text_cb(void *data, Evas_Object *obj, const char *part) +{ + if (!strcmp("elm.text", part)) { + char buf[1024]; + snprintf(buf, sizeof(buf), "%s", (char *)data); + return strdup(buf); + } + return NULL; +} + +extern void create_setting_item_device_list(Evas_Object *parent) +{ + add_state_change_event_listener(state_change_event_listener); + + group_list_item = elm_genlist_add(parent); + elm_genlist_mode_set(group_list_item, ELM_LIST_COMPRESS); + + evas_object_smart_callback_add(group_list_item, "selected", gl_selected_cb, NULL); + evas_object_smart_callback_add(group_list_item, "expanded", gl_expanded_cb, NULL); + evas_object_smart_callback_add(group_list_item, "contracted", gl_contracted_cb, NULL); + + elm_grid_pack(parent, group_list_item, 0, 10, 100, 77); + { + Elm_Genlist_Item_Class *group_item_builder = elm_genlist_item_class_new(); + { + group_item_builder->item_style = "group_index/expandable"; + group_item_builder->func.text_get = group_title_text_cb; + } + + permitted_device_group = elm_genlist_item_append(group_list_item, group_item_builder, LIST_TYPE_PERMITTED, NULL, ELM_GENLIST_ITEM_TREE, NULL, NULL); + permitted_list = elm_object_item_widget_get(permitted_device_group); + + denied_device_group = elm_genlist_item_append(group_list_item, group_item_builder, LIST_TYPE_DENIED, NULL, ELM_GENLIST_ITEM_TREE, NULL, NULL); + denied_list = elm_object_item_widget_get(denied_device_group); + + discovered_device_group = elm_genlist_item_append(group_list_item, group_item_builder, LIST_TYPE_DISCOVERED, NULL, ELM_GENLIST_ITEM_TREE, NULL, NULL); + discovered_list = elm_object_item_widget_get(discovered_device_group); + + elm_genlist_item_class_free(group_item_builder); + } + + device_item_builder = elm_genlist_item_class_new(); + { + device_item_builder->item_style = "multiline"; + device_item_builder->func.content_get = device_info_content_get_cb; + device_item_builder->func.text_get = device_info_text_cb; + } + + set_acl_device_list(); +} \ No newline at end of file diff --git a/src/ui/setting_item_discovery_button.c b/src/ui/setting_item_discovery_button.c new file mode 100644 index 0000000..f820f05 --- /dev/null +++ b/src/ui/setting_item_discovery_button.c @@ -0,0 +1,51 @@ +#include "main.h" + +static Evas_Object *discovery_button_item = NULL; +static state_e discovery_state; + +static void state_change_event_listener (state_e state) +{ + switch (state) + { + case POWER_ON : + elm_object_disabled_set(discovery_button_item, EINA_FALSE); + break; + case POWER_OFF : + elm_object_disabled_set(discovery_button_item, EINA_TRUE); + break; + case DISCOVERY_START : + discovery_state = DISCOVERY_START; + elm_object_text_set(discovery_button_item, "Discovery Stop"); + break; + case DISCOVERY_STOP : + discovery_state = DISCOVERY_STOP; + elm_object_text_set(discovery_button_item, "Discovery Start"); + break; + default : + break; + } +} + +static void discovery_button_click_cb(void *data, Evas_Object *obj, void *event_info) +{ + if (discovery_state == DISCOVERY_START) { + state_change_event(DISCOVERY_STOP); + } else if (discovery_state == DISCOVERY_STOP) { + state_change_event(DISCOVERY_START); + } +} + +extern void create_setting_item_discovery_button(Evas_Object *parent) +{ + add_state_change_event_listener(state_change_event_listener); + + discovery_state = DISCOVERY_STOP; + + discovery_button_item = elm_button_add(parent); + elm_object_style_set(discovery_button_item, "bottom"); + elm_object_text_set(discovery_button_item, "Discovery Start"); + evas_object_smart_callback_add(discovery_button_item, "clicked", discovery_button_click_cb, NULL); + + elm_grid_pack(parent, discovery_button_item, 0, 87, 100, 13); + evas_object_show(discovery_button_item); +} diff --git a/src/ui/setting_item_power.c b/src/ui/setting_item_power.c index 068abf6..3e1624d 100644 --- a/src/ui/setting_item_power.c +++ b/src/ui/setting_item_power.c @@ -2,6 +2,32 @@ static Evas_Object *power_switch = NULL; +static void convergence_power_on() +{ + 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); + } +} + +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 int get_convergence_power_state() +{ + 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 state_change_event_listener (state_e state) { switch (state) @@ -87,4 +113,4 @@ extern void create_setting_item_power(Evas_Object *parent) elm_genlist_item_class_free(item_builder); } -} +} \ No newline at end of file diff --git a/src/ui/setting_item_sign.c b/src/ui/setting_item_sign.c index 3356d85..f13bb9c 100644 --- a/src/ui/setting_item_sign.c +++ b/src/ui/setting_item_sign.c @@ -1,31 +1,20 @@ #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); + evas_object_hide(sign_item); break; - case POWER_OFF : - notice = POWER_OFF_SIGN_TEXT; - elm_genlist_realized_items_update(sign_item); + evas_object_show(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; } @@ -34,11 +23,11 @@ static void state_change_event_listener (state_e state) static char* text_get_cb(void *data, Evas_Object *obj, const char *part) { if (!strcmp("elm.text.multiline", part)) { + char *notice = POWER_ON_SIGN_TEXT; char buf[1024]; snprintf(buf, sizeof(buf), "Notice
%s", notice); return strdup(buf); } - return NULL; } @@ -49,7 +38,6 @@ extern void create_setting_item_sign(Evas_Object *parent) 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); { Elm_Genlist_Item_Class *item_builder = elm_genlist_item_class_new(); { @@ -59,7 +47,6 @@ extern void create_setting_item_sign(Evas_Object *parent) 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); - elm_genlist_item_class_free(item_builder); } } diff --git a/src/util.c b/src/util.c new file mode 100644 index 0000000..df0d6f5 --- /dev/null +++ b/src/util.c @@ -0,0 +1,8 @@ +#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 -- 2.7.4