tizen 2.4 release accepted/tizen_2.4_mobile accepted/tizen/2.4/mobile/20151029.030840 submit/tizen_2.4/20151028.065115 tizen_2.4_mobile_release
authorjk7744.park <jk7744.park@samsung.com>
Mon, 26 Oct 2015 07:04:47 +0000 (16:04 +0900)
committerjk7744.park <jk7744.park@samsung.com>
Mon, 26 Oct 2015 07:04:47 +0000 (16:04 +0900)
28 files changed:
AUTHORS [new file with mode: 0644]
CMakeLists.txt [new file with mode: 0644]
LICENSE [new file with mode: 0644]
NOTICE [new file with mode: 0644]
org.tizen.voice-control-panel.manifest [new file with mode: 0644]
org.tizen.voice-control-panel.rule [new file with mode: 0644]
org.tizen.voice-control-panel.xml [new file with mode: 0644]
packaging/org.tizen.voice-control-panel.spec [new file with mode: 0644]
res/CMakeLists.txt [new file with mode: 0644]
res/edje/CMakeLists.txt [new file with mode: 0644]
res/edje/voice-control-panel.edc [new file with mode: 0644]
res/images/Voice_control_icon_arrow.png [new file with mode: 0644]
res/images/Voice_control_icon_mic.png [new file with mode: 0644]
res/images/Voice_control_icon_mute.png [new file with mode: 0644]
res/images/Voice_control_icon_setting.png [new file with mode: 0644]
res/po/CMakeLists.txt [new file with mode: 0644]
res/po/en_US.po [new file with mode: 0644]
res/po/ko_KR.po [new file with mode: 0644]
src/voice_control_panel_action.c [new file with mode: 0644]
src/voice_control_panel_action.h [new file with mode: 0644]
src/voice_control_panel_command.c [new file with mode: 0644]
src/voice_control_panel_command.h [new file with mode: 0644]
src/voice_control_panel_main.c [new file with mode: 0644]
src/voice_control_panel_main.h [new file with mode: 0644]
src/voice_control_panel_vc.c [new file with mode: 0644]
src/voice_control_panel_vc.h [new file with mode: 0644]
src/voice_control_panel_view.c [new file with mode: 0644]
src/voice_control_panel_view.h [new file with mode: 0644]

diff --git a/AUTHORS b/AUTHORS
new file mode 100644 (file)
index 0000000..5b78ff4
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1,3 @@
+Kwangyoun Kim <ky85.kim@samsung.com>
+Dongyeol Lee <dy3.lee@samsung.com>
+Wonnam Jang <wn.jang@samsung.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644 (file)
index 0000000..bf7daad
--- /dev/null
@@ -0,0 +1,65 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(voice-control-panel C)
+
+SET(HEADERS)
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+SET(EXEC_PREFIX "\${prefix}")
+SET(INCLUDEDIR "\${prefix}/include")
+
+SET(PACKAGE ${PROJECT_NAME})
+SET(PKGNAME "org.tizen.${PACKAGE}")
+SET(PKGDIR "${PREFIX}/apps/${PKGNAME}")
+SET(BINDIR "${PKGDIR}/bin")
+SET(RESDIR "${PKGDIR}/res")
+SET(DATADIR "/opt${PREFIX}/data")
+SET(LOCALEDIR "${RESDIR}/locale")
+SET(IMAGEDIR "${RESDIR}/images")
+
+SET(SRCS
+    src/voice_control_panel_action.c
+    src/voice_control_panel_command.c
+    src/voice_control_panel_main.c
+    src/voice_control_panel_view.c
+    src/voice_control_panel_vc.c
+)
+
+IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
+    SET(CMAKE_BUILD_TYPE "Release")
+ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "")
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(pkgs REQUIRED 
+       appcore-efl elementary ecore-imf ecore-x eina ecore ecore-input evas edje glib-2.0
+       capi-base-common voice-control-manager voice-control-setting aul capi-appfw-application
+       tapi capi-location-manager capi-network-wifi capi-network-bluetooth syspopup-caller
+)
+
+FOREACH(flag ${pkgs_CFLAGS})
+    SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+    SET(EXTRA_CXXFLAGS "${EXTRA_CXXFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall -fPIE")
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CXXFLAGS} -Wall -fPIE")
+SET(CMAKE_C_FLAGS_DEBUG "-O0 -g -Wall -fPIE")
+SET(CMAKE_C_FLAGS_RELEASE "-O2 -Wall -fPIE")
+SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -fPIE")
+SET(CMAKE_CXX_FLAGS_RELEASE "-O2 -g -fPIE")
+
+ADD_DEFINITIONS("-DPREFIX=\"${PREFIX}\"")
+ADD_DEFINITIONS("-DPACKAGE=\"${PACKAGE}\"")
+ADD_DEFINITIONS("-DPACKAGE_NAME=\"${PKGNAME}\"")
+ADD_DEFINITIONS("-DRESDIR=\"${RESDIR}\"")
+ADD_DEFINITIONS("-DDATADIR=\"${DATADIR}\"")
+ADD_DEFINITIONS("-DLOCALEDIR=\"${LOCALEDIR}\"")
+ADD_DEFINITIONS("-DIMAGEDIR=\"${IMAGEDIR}\"")
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -pie")
+
+ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS})
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS})
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${BINDIR})
+
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/org.tizen.voice-control-panel.rule DESTINATION  /etc/smack/accesses.d/)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/org.tizen.voice-control-panel.xml DESTINATION /usr/share/packages)
+
+ADD_SUBDIRECTORY(res)
diff --git a/LICENSE b/LICENSE
new file mode 100644 (file)
index 0000000..d645695
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the 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.
diff --git a/NOTICE b/NOTICE
new file mode 100644 (file)
index 0000000..6e32ab7
--- /dev/null
+++ b/NOTICE
@@ -0,0 +1,3 @@
+Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved.
+Except as noted, this software is licensed under Apache License, Version 2.
+Please, see the LICENSE file for Apache License terms and conditions.
diff --git a/org.tizen.voice-control-panel.manifest b/org.tizen.voice-control-panel.manifest
new file mode 100644 (file)
index 0000000..f6630b9
--- /dev/null
@@ -0,0 +1,15 @@
+<manifest>
+       <define>
+               <domain name="org.tizen.voice-control-panel" />
+       </define>
+       <request>
+               <domain name="org.tizen.voice-control-panel" />
+       </request>
+       <assign>
+               <filesystem path="/usr/share/packages/voice-control-panel.xml" label="_" />
+               <filesystem path="/usr/apps/org.tizen.voice-control-panel" label="org.tizen.voice-control-panel" />
+               <filesystem path="/usr/apps/org.tizen.voice-control-panel/res" label="org.tizen.voice-control-panel" />
+               <filesystem path="/usr/apps/org.tizen.voice-control-panel/bin/voice-control-panel" label="org.tizen.voice-control-panel" exec_label="org.tizen.voice-control-panel" />
+       </assign>
+
+</manifest>
diff --git a/org.tizen.voice-control-panel.rule b/org.tizen.voice-control-panel.rule
new file mode 100644 (file)
index 0000000..95f5f02
--- /dev/null
@@ -0,0 +1,5 @@
+org.tizen.voice-control-panel system::app_logging wx
+org.tizen.voice-control-panel bt-service::platform rw
+org.tizen.voice-control-panel tizen::vconf::public::r::platform::rw rw
+org.tizen.voice-control-panel tizen::vconf::platform::rw rw
+org.tizen.voice-control-panel syspopup::db rwx
diff --git a/org.tizen.voice-control-panel.xml b/org.tizen.voice-control-panel.xml
new file mode 100644 (file)
index 0000000..6d61502
--- /dev/null
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns="http://tizen.org/ns/packages" package="org.tizen.voice-control-panel" version="0.1" install-location="internal-only" api-version="2.4">
+        <label>Voice control panel</label>
+        <author email="ky85.kim@samsung.com" href="www.samsung.com">Kwangyoun Kim</author>
+        <description>Voice control panel Application</description>
+        <ui-application appid="org.tizen.voice-control-panel" exec="/usr/apps/org.tizen.voice-control-panel/bin/voice-control-panel" nodisplay="true" multiple="false" type="capp" taskmanage="false" process-pool="true">
+            <label>Voice control panel</label>
+       </ui-application>
+        <privileges>
+            <privilege>http://tizen.org/privilege/recorder</privilege>
+            <privilege>http://tizen.org/privilege/appmanager.launch</privilege>
+            <privilege>http://tizen.org/privilege/network.get</privilege>
+            <privilege>http://tizen.org/privilege/systemsettings.admin</privilege>
+            <privilege>http://tizen.org/privilege/bluetooth.admin</privilege>
+            <privilege>http://tizen.org/privilege/location.enable</privilege>
+        </privileges>
+</manifest>
diff --git a/packaging/org.tizen.voice-control-panel.spec b/packaging/org.tizen.voice-control-panel.spec
new file mode 100644 (file)
index 0000000..1e9175c
--- /dev/null
@@ -0,0 +1,70 @@
+Name:       org.tizen.voice-control-panel
+Summary:    Voice control panel(manager) application
+Version:    0.1.1
+Release:    1
+Group:      Graphics & UI Framework/Voice Framework
+License:    Apache-2.0
+Source0:    %{name}-%{version}.tar.gz
+BuildRequires:  cmake
+BuildRequires:  gettext-tools
+BuildRequires:  edje-tools
+BuildRequires:  gettext-tools
+BuildRequires:  pkgconfig(glib-2.0)
+BuildRequires:  pkgconfig(appcore-efl)
+BuildRequires:  pkgconfig(elementary)
+BuildRequires:  pkgconfig(ecore-imf)
+BuildRequires:  pkgconfig(ecore-x)
+BuildRequires:  pkgconfig(eina)
+BuildRequires:  pkgconfig(evas)
+BuildRequires:  pkgconfig(edje)
+BuildRequires:  pkgconfig(ecore)
+BuildRequires:  pkgconfig(ecore-file)
+BuildRequires:  pkgconfig(ecore-input)
+BuildRequires:  pkgconfig(dlog)
+
+BuildRequires:  pkgconfig(aul)
+BuildRequires:  pkgconfig(capi-appfw-application)
+BuildRequires:  pkgconfig(capi-base-common)
+BuildRequires:  pkgconfig(voice-control-manager)
+BuildRequires:  pkgconfig(voice-control-setting)
+BuildRequires:  pkgconfig(tapi)
+BuildRequires:  pkgconfig(capi-location-manager)
+BuildRequires:  pkgconfig(capi-network-wifi)
+BuildRequires:  pkgconfig(capi-network-bluetooth)
+BuildRequires:  pkgconfig(vconf)
+BuildRequires:  pkgconfig(syspopup-caller)
+
+%description
+Voice control panel(manager) application
+
+%prep
+%setup -q -n %{name}-%{version}
+
+%build
+export CFLAGS="$CFLAGS -DTIZEN_ENGINEER_MODE"
+export CXXFLAGS="$CXXFLAGS -DTIZEN_ENGINEER_MODE"
+export FFLAGS="$FFLAGS -DTIZEN_ENGINEER_MODE"
+export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE"
+export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE"
+export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE"
+
+cmake . -DCMAKE_INSTALL_PREFIX=/usr
+make %{?jobs:-j%jobs}
+
+%install
+rm -rf %{buildroot}
+mkdir -p %{buildroot}/usr/share/license
+install LICENSE %{buildroot}/usr/share/license/%{name}
+
+%make_install
+
+%files
+%manifest org.tizen.voice-control-panel.manifest
+/etc/smack/accesses.d/org.tizen.voice-control-panel.rule
+%defattr(-,root,root,-)
+/usr/apps/org.tizen.voice-control-panel/bin/*
+/usr/apps/org.tizen.voice-control-panel/res/edje/*
+/usr/apps/org.tizen.voice-control-panel/res/images/*
+/usr/apps/org.tizen.voice-control-panel/res/locale/*
+/usr/share/packages/org.tizen.voice-control-panel.xml
+/usr/share/license/%{name}
diff --git a/res/CMakeLists.txt b/res/CMakeLists.txt
new file mode 100644 (file)
index 0000000..b4fe940
--- /dev/null
@@ -0,0 +1,9 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+
+ADD_SUBDIRECTORY(edje)
+ADD_SUBDIRECTORY(po)
+
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/images/Voice_control_icon_mic.png DESTINATION ${IMAGEDIR})
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/images/Voice_control_icon_mute.png DESTINATION ${IMAGEDIR})
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/images/Voice_control_icon_setting.png DESTINATION ${IMAGEDIR})
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/images/Voice_control_icon_arrow.png DESTINATION ${IMAGEDIR})
\ No newline at end of file
diff --git a/res/edje/CMakeLists.txt b/res/edje/CMakeLists.txt
new file mode 100644 (file)
index 0000000..902acbe
--- /dev/null
@@ -0,0 +1,10 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+
+SET(EDJ_PATH "/usr/apps/org.tizen.voice-control-panel/res/edje/")
+
+ADD_CUSTOM_TARGET(voice-control-panel.edj
+    COMMAND edje_cc ${CMAKE_CURRENT_SOURCE_DIR}/voice-control-panel.edc voice-control-panel.edj
+    DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/voice-control-panel.edc
+)
+ADD_DEPENDENCIES(${PROJECT_NAME} voice-control-panel.edj)
+INSTALL(FILES voice-control-panel.edj DESTINATION ${EDJ_PATH})
\ No newline at end of file
diff --git a/res/edje/voice-control-panel.edc b/res/edje/voice-control-panel.edc
new file mode 100644 (file)
index 0000000..0d2a16f
--- /dev/null
@@ -0,0 +1,247 @@
+collections {
+   group { name: "main";
+      parts {
+         part { name: "bg";
+            type: RECT;
+            scale: 1;
+            mouse_events: 0;
+            description { state: "default" 0.0;
+               color: 0 136 170 255;
+               align: 0.5 0.5;
+               fixed: 0 0;
+               min: 0 0;
+               visible: 1;
+               rel1.relative: 0.00 0.00;
+               rel2.relative: 1.00 1.00;
+            }
+         }
+         part { name: "padding_left";
+            type: SPACER;
+            scale: 1;
+            description { state: "default" 0.0;
+               align: 0.5 0.5;
+               fixed: 0 0;
+               min: 0 0;
+               rel1.relative: 0.00 0.00;
+               rel2.relative: 0.0277 1.00;
+            }
+         }
+         part { name: "padding_right";
+            type: SPACER;
+            scale: 1;
+            description { state: "default" 0.0;
+               align: 0.5 0.5;
+               fixed: 0 0;
+               min: 0 0;
+               rel1.relative: 0.9723 0.00;
+               rel2.relative: 1.00 1.00;
+            }
+         }
+         part { name: "padding_top";
+            type: SPACER;
+            scale: 1;
+            description { state: "default" 0.0;
+               align: 0.5 0.5;
+               fixed: 0 0;
+               min: 0 0;
+               rel1.relative: 0.0277 0.00;
+               rel2.relative: 0.9723 0.2666;
+            }
+         }
+         part { name: "padding_bottom";
+            type: SPACER;
+            scale: 1;
+            description { state: "default" 0.0;
+               align: 0.5 0.5;
+               fixed: 0 0;
+               min: 0 0;
+               rel1.relative: 0.0277 0.7333;
+               rel2.relative: 0.9723 1.00;
+            }
+         }
+         part { name: "icon1";
+            type: SWALLOW;
+            scale: 1;
+            mouse_events: 0;
+            description { state: "default" 0.0;
+               align: 0.5 0.5;
+               fixed: 0 0;
+               min: 0 0;
+               visible: 1;
+               rel1.relative: 0.0277 0.2666;
+               rel2.relative: 0.0861 0.7333;
+            }
+         }
+         part { name: "icon2";
+            type: SWALLOW;
+            scale: 1;
+            mouse_events: 0;
+            description { state: "default" 0.0;
+               align: 0.5 0.5;
+               fixed: 0 0;
+               min: 0 0;
+               visible: 1;
+               rel1.relative: 0.0861 0.2666;
+               rel2.relative: 0.1444 0.7333;
+            }
+         }
+         part { name: "content";
+            type: SWALLOW;
+            scale: 1;
+            mouse_events: 0;
+            description { state: "default" 0.0;
+               align: 0.0 0.5;
+               fixed: 0 0;
+               min: 0 0;
+               visible: 1;
+               rel1.relative: 0.1444 0.2666;
+               rel2.relative: 0.9139 0.7333;
+            }
+         }
+         part { name: "icon3";
+            type: SWALLOW;
+            scale: 1;
+            mouse_events: 1;
+            description { state: "default" 0.0;
+               align: 0.5 0.5;
+               fixed: 0 0;
+               min: 0 0;
+               visible: 1;
+               rel1.relative: 0.9139 0.2666;
+               rel2.relative: 0.9723 0.7333;
+            }
+         }
+      }
+   }
+   group { name: "help";
+      parts {
+         part { name: "bg";
+            type: RECT;
+            scale: 1;
+            mouse_events: 0;
+            description { state: "default" 0.0;
+               color: 255 255 255 255;
+               align: 0.5 0.5;
+               fixed: 0 0;
+               min: 0 0;
+               visible: 0;
+               rel1.relative: 0.00 0.00;
+               rel2.relative: 1.00 1.00;
+            }
+         }
+         part { name: "padding_left";
+            type: SPACER;
+            scale: 1;
+            description { state: "default" 0.0;
+               align: 0.0 0.5;
+               fixed: 1 0;
+               min: 12 0;
+               max: 12 -1;
+               rel1.relative: 0.00 0.00;
+               rel2.relative: 0.00 1.00;
+            }
+         }
+         part { name: "padding_right";
+            type: SPACER;
+            scale: 1;
+            description { state: "default" 0.0;
+               align: 1.0 0.5;
+               fixed: 1 0;
+               min: 12 0;
+               max: 12 -1;
+               rel1.relative: 1.00 0.00;
+               rel2.relative: 1.00 1.00;
+            }
+         }
+         part { name: "padding_top";
+            type: SPACER;
+            scale: 1;
+            description { state: "default" 0.0;
+               align: 0.5 0.0;
+               fixed: 0 1;
+               min: 0 12;
+               max: -1 12;
+               rel1 {to: "padding_left"; relative: 1.00 0.00;}
+               rel2 {to: "padding_right"; relative: 0.00 0.00;}
+            }
+         }
+         part { name: "padding_bottom";
+            type: SPACER;
+            scale: 1;
+            description { state: "default" 0.0;
+               align: 0.5 1.0;
+               fixed: 0 1;
+               min: 0 12;
+               max: -1 12;
+               rel1 {to: "padding_left"; relative: 1.00 1.00;}
+               rel2 {to: "padding_right"; relative: 0.00 1.00;}
+            }
+         }
+         part { name: "outline_left";
+            type: RECT;
+            scale: 1;
+            description {state: "default" 0.0;
+               color: 2 61 132 255;
+               align: 0.0 0.5;
+               fixed: 1 0;
+               min: 2 0;
+               max: 2 -1;
+               rel1 {to: "padding_top"; relative: 0.00 1.00;}
+               rel2 {to: "padding_bottom"; relative: 0.00 0.00;}
+            }
+         }
+         part { name: "outline_right";
+            type: RECT;
+            scale: 1;
+            description {state: "default" 0.0;
+               color: 2 61 132 255;
+               align: 1.0 0.5;
+               fixed: 1 0;
+               min: 2 0;
+               max: 2 -1;
+               rel1 {to: "padding_top"; relative: 1.00 1.00;}
+               rel2 {to: "padding_bottom"; relative: 1.00 0.00;}
+            }
+         }
+         part { name: "outline_top";
+            type: RECT;
+            scale: 1;
+            description {state: "default" 0.0;
+               color: 2 61 132 255;
+               align: 0.5 0.0;
+               fixed: 0 1;
+               min: 0 2;
+               max: -1 2;
+               rel1 {to: "outline_left"; relative: 1.00 0.00;}
+               rel2 {to: "outline_right"; relative: 0.00 0.00;}
+            }
+         }
+         part { name: "outline_bottom";
+            type: RECT;
+            scale: 1;
+            description {state: "default" 0.0;
+               color: 2 61 132 255;
+               align: 0.5 1.0;
+               fixed: 0 1;
+               min: 0 2;
+               max: -1 2;
+               rel1 {to: "outline_left"; relative: 1.00 1.00;}
+               rel2 {to: "outline_right"; relative: 0.00 1.00;}
+            }
+         }
+         part { name: "content";
+            type: SWALLOW;
+            scale: 1;
+            mouse_events: 1;
+            description { state: "default" 0.0;
+               align: 0.5 0.5;
+               fixed: 0 0;
+               min: 0 0;
+               visible: 1;
+               rel1 {to: "outline_top"; relative: 0.00 1.00;}
+               rel2 {to: "outline_bottom"; relative: 1.00 0.00;}
+            }
+         }
+      }
+    }
+}
diff --git a/res/images/Voice_control_icon_arrow.png b/res/images/Voice_control_icon_arrow.png
new file mode 100644 (file)
index 0000000..6bbb2c6
Binary files /dev/null and b/res/images/Voice_control_icon_arrow.png differ
diff --git a/res/images/Voice_control_icon_mic.png b/res/images/Voice_control_icon_mic.png
new file mode 100644 (file)
index 0000000..0e3a54e
Binary files /dev/null and b/res/images/Voice_control_icon_mic.png differ
diff --git a/res/images/Voice_control_icon_mute.png b/res/images/Voice_control_icon_mute.png
new file mode 100644 (file)
index 0000000..7b30a46
Binary files /dev/null and b/res/images/Voice_control_icon_mute.png differ
diff --git a/res/images/Voice_control_icon_setting.png b/res/images/Voice_control_icon_setting.png
new file mode 100644 (file)
index 0000000..3ddb9e1
Binary files /dev/null and b/res/images/Voice_control_icon_setting.png differ
diff --git a/res/po/CMakeLists.txt b/res/po/CMakeLists.txt
new file mode 100644 (file)
index 0000000..0bc3aa4
--- /dev/null
@@ -0,0 +1,22 @@
+SET(POFILES en_US.po ko_KR.po)
+
+SET(MSGFMT "/usr/bin/msgfmt")
+
+FOREACH(pofile ${POFILES})
+       SET(pofile ${CMAKE_CURRENT_SOURCE_DIR}/${pofile})
+       MESSAGE("PO: ${pofile}")
+       GET_FILENAME_COMPONENT(absPofile ${pofile} ABSOLUTE)
+       GET_FILENAME_COMPONENT(lang ${absPofile} NAME_WE)
+       SET(moFile ${CMAKE_CURRENT_BINARY_DIR}/${lang}.mo)
+       ADD_CUSTOM_COMMAND(
+                       OUTPUT ${moFile}
+                       COMMAND ${MSGFMT} -o ${moFile} ${absPofile}
+                       DEPENDS ${absPofile}
+       )
+       INSTALL(FILES ${moFile}
+                       DESTINATION /usr/apps/org.tizen.voice-control-panel/res/locale/${lang}/LC_MESSAGES RENAME org.tizen.voice-control-panel.mo)
+       SET(moFiles ${moFiles} ${moFile})
+ENDFOREACH(pofile)
+
+MESSAGE(".mo files: ${moFiles}")
+ADD_CUSTOM_TARGET(po ALL DEPENDS ${moFiles})
diff --git a/res/po/en_US.po b/res/po/en_US.po
new file mode 100644 (file)
index 0000000..a83fa27
--- /dev/null
@@ -0,0 +1,95 @@
+msgid "IDS_HOMESCREEN"
+msgstr "Homescreen"
+
+msgid "IDS_NOTIFICATION"
+msgstr "Notification"
+
+msgid "IDS_INTERNET"
+msgstr "Internet"
+
+msgid "IDS_APPLICATION"
+msgstr "Application"
+
+msgid "IDS_TASK_MANAGER"
+msgstr "Task manager"
+
+msgid "IDS_SETTINGS"
+msgstr "Settings"
+
+msgid "IDS_HELP"
+msgstr "Help"
+
+msgid "IDS_CLOSE"
+msgstr "Close"
+
+msgid "IDS_WIFI"
+msgstr "Wifi"
+
+msgid "IDS_BLUETOOTH"
+msgstr "Bluetooth"
+
+msgid "IDS_AIRPLANE_MODE"
+msgstr "Airplane mode"
+
+msgid "IDS_GPS"
+msgstr "GPS"
+
+msgid "IDS_SOUND"
+msgstr "Sound"
+
+msgid "IDS_MORE"
+msgstr "More"
+
+msgid "IDS_PREVIOUS"
+msgstr "Previous"
+
+msgid "IDS_LISTENING"
+msgstr "Listening..."
+
+msgid "IDS_SORRY"
+msgstr "Sorry, I don't understand"
+
+msgid "IDS_HINT_HOMESCREEN"
+msgstr "Go to Homescreen"
+
+msgid "IDS_HINT_NOTIFICATION"
+msgstr "Open Norification panel"
+
+msgid "IDS_HINT_INTERNET"
+msgstr "Launch Internet application"
+
+msgid "IDS_HINT_APPLICATION"
+msgstr "Go to App tray"
+
+msgid "IDS_HINT_TASK_MANAGER"
+msgstr "Launch Task manager"
+
+msgid "IDS_HINT_SETTINGS"
+msgstr "Go to Settings command menu"
+
+msgid "IDS_HINT_HELP"
+msgstr "Show/Hide command menu"
+
+msgid "IDS_HINT_CLOSE"
+msgstr "Close voice control"
+
+msgid "IDS_HINT_WIFI"
+msgstr "Turn on/off Wifi"
+
+msgid "IDS_HINT_BLUETOOTH"
+msgstr "Turn on/off Bluetooth"
+
+msgid "IDS_HINT_AIRPLANE_MODE"
+msgstr "Turn on/off Airplane mode"
+
+msgid "IDS_HINT_GPS"
+msgstr "Turn on/off GPS"
+
+msgid "IDS_HINT_SOUND"
+msgstr "Turn on/off Sound"
+
+msgid "IDS_HINT_MORE"
+msgstr "Launch Setting application"
+
+msgid "IDS_HINT_PREVIOUS"
+msgstr "Go to Previous command menu"
\ No newline at end of file
diff --git a/res/po/ko_KR.po b/res/po/ko_KR.po
new file mode 100644 (file)
index 0000000..19b79fa
--- /dev/null
@@ -0,0 +1,95 @@
+msgid "IDS_HOMESCREEN"
+msgstr "\xED\x99\x88\xEC\x8A\xA4\xED\x81\xAC\xEB\xA6\xB0"
+
+msgid "IDS_NOTIFICATION"
+msgstr "\xEC\x95\x8C\xEB\xA6\xBC"
+
+msgid "IDS_INTERNET"
+msgstr "\xEC\x9D\xB8\xED\x84\xB0\xEB\x84\xB7"
+
+msgid "IDS_APPLICATION"
+msgstr "\xEC\x96\xB4\xED\x94\x8C\xEB\xA6\xAC\xEC\xBC\x80\xEC\x9D\xB4\xEC\x85\x98"
+
+msgid "IDS_TASK_MANAGER"
+msgstr "\xEC\x8B\xA4\xED\x96\x89\x20\xEC\xA4\x91"
+
+msgid "IDS_SETTINGS"
+msgstr "\xEC\x84\xA4\xEC\xA0\x95"
+
+msgid "IDS_HELP"
+msgstr "\xEB\x8F\x84\xEC\x9B\x80\xEB\xA7\x90"
+
+msgid "IDS_CLOSE"
+msgstr "\xEB\x8B\xAB\xEA\xB8\xB0"
+
+msgid "IDS_WIFI"
+msgstr "\xEC\x99\x80\xEC\x9D\xB4\xED\x8C\x8C\xEC\x9D\xB4"
+
+msgid "IDS_BLUETOOTH"
+msgstr "\xEB\xB8\x94\xEB\xA3\xA8\xED\x88\xAC\xEC\x8A\xA4"
+
+msgid "IDS_AIRPLANE_MODE"
+msgstr "\xEB\xB9\x84\xED\x96\x89\x20\xEB\xAA\xA8\xEB\x93\x9C"
+
+msgid "IDS_GPS"
+msgstr "\xEC\x9C\x84\xEC\xB9\x98"
+
+msgid "IDS_SOUND"
+msgstr "\xEC\x86\x8C\xEB\xA6\xAC"
+
+msgid "IDS_MORE"
+msgstr "\xEB\x8D\x94\xEB\xB3\xB4\xEA\xB8\xB0"
+
+msgid "IDS_PREVIOUS"
+msgstr "\xEC\x9D\xB4\xEC\xA0\x84"
+
+msgid "IDS_LISTENING"
+msgstr "\xEC\xA7\x80\xEA\xB8\x88\x20\xEB\xA7\x90\xED\x95\x98\xEC\x84\xB8\xEC\x9A\x94..."
+
+msgid "IDS_SORRY"
+msgstr "\xEB\x8B\xA4\xEC\x8B\x9C\x20\xED\x95\x9C\xEB\xB2\x88\x20\xEB\xA7\x90\xEC\x94\x80\xED\x95\xB4\xEC\xA3\xBC\xEC\x84\xB8\xEC\x9A\x94\x2E"
+
+msgid "IDS_HINT_HOMESCREEN"
+msgstr "\xED\x99\x88\x20\xED\x99\x94\xEB\xA9\xB4\xEC\x9C\xBC\xEB\xA1\x9C\x20\xEC\x9D\xB4\xEB\x8F\x99"
+
+msgid "IDS_HINT_NOTIFICATION"
+msgstr "\xEC\x95\x8C\xEB\xA6\xBC\x20\xED\x99\x94\xEB\xA9\xB4\x20\xED\x91\x9C\xEC\x8B\x9C"
+
+msgid "IDS_HINT_INTERNET"
+msgstr "\xEC\x9D\xB8\xED\x84\xB0\xEB\x84\xB7\x20\xEC\x96\xB4\xED\x94\x8C\xEB\xA6\xAC\xEC\xBC\x80\xEC\x9D\xB4\xEC\x85\x98\x20\xEC\x8B\xA4\xED\x96\x89"
+
+msgid "IDS_HINT_APPLICATION"
+msgstr "\xEC\x96\xB4\xED\x94\x8C\xEB\xA6\xAC\xEC\xBC\x80\xEC\x9D\xB4\xEC\x85\x98\x20\xEB\xAA\xA9\xEB\xA1\x9D"
+
+msgid "IDS_HINT_TASK_MANAGER"
+msgstr "\xEC\x8B\xA4\xED\x96\x89\x20\xEB\xAA\xA9\xEB\xA1\x9D\x20\xEC\x97\xB4\xEA\xB8\xB0"
+
+msgid "IDS_HINT_SETTINGS"
+msgstr "\xEC\x84\xA4\xEC\xA0\x95\x20\xEB\xAA\x85\xEB\xA0\xB9\xEC\x96\xB4\x20\xEB\xAA\xA9\xEB\xA1\x9D\xEC\x9C\xBC\xEB\xA1\x9C\x20\xEC\x9D\xB4\xEB\x8F\x99"
+
+msgid "IDS_HINT_HELP"
+msgstr "\xEB\xAA\x85\xEB\xA0\xB9\xEC\x96\xB4\x20\xEB\xAA\xA9\xEB\xA1\x9D\x20\xEB\xB3\xB4\xEC\x97\xAC\xEC\xA3\xBC\xEA\xB8\xB0\x2F\xEC\xA7\x80\xEC\x9A\xB0\xEA\xB8\xB0"
+
+msgid "IDS_HINT_CLOSE"
+msgstr "\xEC\x9D\x8C\xEC\x84\xB1\x20\xEB\xAA\x85\xEB\xA0\xB9\x20\xEC\xA2\x85\xEB\xA3\x8C"
+
+msgid "IDS_HINT_WIFI"
+msgstr "\xEC\x99\x80\xEC\x9D\xB4\xED\x8C\x8C\xEC\x9D\xB4\x20\xEC\xBC\x9C\xEA\xB8\xB0\x2F\xEB\x81\x84\xEA\xB8\xB0"
+
+msgid "IDS_HINT_BLUETOOTH"
+msgstr "\xEB\xB8\x94\xEB\xA3\xA8\xED\x88\xAC\xEC\x8A\xA4\x20\xEC\xBC\x9C\xEA\xB8\xB0\x2F\xEB\x81\x84\xEA\xB8\xB0"
+
+msgid "IDS_HINT_AIRPLANE_MODE"
+msgstr "\xEB\xB9\x84\xED\x96\x89\x20\xEB\xAA\xA8\xEB\x93\x9C\x20\xEC\xBC\x9C\xEA\xB8\xB0\x2F\xEB\x81\x84\xEA\xB8\xB0"
+
+msgid "IDS_HINT_GPS"
+msgstr "\xEC\x9C\x84\xEC\xB9\x98\x20\xEC\xBC\x9C\xEA\xB8\xB0\x2F\xEB\x81\x84\xEA\xB8\xB0"
+
+msgid "IDS_HINT_SOUND"
+msgstr "\xEC\x86\x8C\xEB\xA6\xAC\x20\xEC\xBC\x9C\xEA\xB8\xB0\x2F\xEB\x81\x84\xEA\xB8\xB0"
+
+msgid "IDS_HINT_MORE"
+msgstr "\xEC\x84\xA4\xEC\xA0\x95\x20\xEC\x96\xB4\xED\x94\x8C\xEB\xA6\xAC\xEC\xBC\x80\xEC\x9D\xB4\xEC\x85\x98\x20\xEC\x8B\xA4\xED\x96\x89"
+
+msgid "IDS_HINT_PREVIOUS"
+msgstr "\xEC\x9D\xB4\xEC\xA0\x84\x20\xEB\xAA\x85\xEB\xA0\xB9\xEC\x96\xB4\x20\xEB\xAA\xA9\xEB\xA1\x9D\xEC\x9C\xBC\xEB\xA1\x9C\x20\xEC\x9D\xB4\xEB\x8F\x99"
\ No newline at end of file
diff --git a/src/voice_control_panel_action.c b/src/voice_control_panel_action.c
new file mode 100644 (file)
index 0000000..5526d24
--- /dev/null
@@ -0,0 +1,462 @@
+/*
+*  Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved 
+*  Licensed under the Apache License, Version 2.0 (the "License");
+*  you may not use this file except in compliance with the License.
+*  You may obtain a copy of the License at
+*  http://www.apache.org/licenses/LICENSE-2.0
+*  Unless required by applicable law or agreed to in writing, software
+*  distributed under the License is distributed on an "AS IS" BASIS,
+*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+*  See the License for the specific language governing permissions and
+*  limitations under the License.
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdbool.h>
+
+#include <fcntl.h>
+#include <linux/input.h>
+#include <linux/uinput.h>
+
+#include <app.h>
+#include <aul.h>
+#include <bluetooth.h>
+#include <dlog.h>
+#include <wifi.h>
+#include <ITapiModem.h>
+#include <locations.h>
+#include <tapi_common.h>
+#include <syspopup_caller.h>
+#include <vconf.h>
+
+#include "voice_control_panel_main.h"
+#include "voice_control_panel_action.h"
+#include "voice_control_panel_command.h"
+#include "voice_control_panel_view.h"
+
+static void __vc_panel_action_send_key_event(void *data, Ecore_Thread *thread)
+{
+       LOGD( "==== Send Key Event ====");
+
+       int keynum = (int)data;
+       LOGD( "Key - %d", keynum);
+       
+       int fd;
+       fd = open("/dev/uinput", O_WRONLY | O_NONBLOCK);
+       if (0 > fd) {
+               LOGE( "[ERROR] Fail to open dev");
+               return;
+       }
+
+       int ret;
+       struct uinput_user_dev uidev;
+       memset(&uidev, 0, sizeof(uidev));
+       snprintf(uidev.name, UINPUT_MAX_NAME_SIZE, "vc-keyevent");
+       uidev.id.bustype = BUS_USB;
+       uidev.id.vendor = 1;
+       uidev.id.product = 1;
+       uidev.id.version = 1;
+
+       ret = write(fd, &uidev, sizeof(uidev));
+       if (sizeof(uidev) != ret) {
+               LOGE( "[ERROR] Fail to write info");
+               close(fd);
+               return;
+       }
+
+       ret = ioctl(fd, UI_SET_EVBIT, EV_KEY);
+       if (0 != ret) {
+               LOGE( "[ERROR] Fail to ioctl");
+               close(fd);
+               return;
+       }
+
+       ret = ioctl(fd, UI_SET_EVBIT, EV_SYN);
+       if (0 != ret) {
+               LOGE( "[ERROR] Fail to ioctl");
+               close(fd);
+               return;
+       }
+
+       ret = ioctl (fd, UI_SET_KEYBIT, keynum);
+       if (0 != ret) {
+               LOGE( "[ERROR] Fail to register key");
+               close(fd);
+               return;
+       }
+
+       ret = ioctl(fd, UI_DEV_CREATE);
+       if (0 != ret) {
+               LOGE( "[ERROR] Fail to create");
+               close(fd);
+               return;
+       }
+
+       usleep(1000000);
+
+       struct input_event ev;
+       memset(&ev, 0, sizeof(ev));
+       ev.type = EV_KEY;
+       ev.code = keynum;
+       ev.value = 1;
+
+       ret = write(fd, &ev, sizeof(ev));
+       if (0 > ret) {
+               LOGE( "[ERROR] Fail to send key event");
+               close(fd);
+               return;
+       }
+
+       memset(&ev, 0, sizeof(ev));
+       ev.type = EV_SYN;
+       ev.code = 0;
+       ev.value = 0;
+
+       ret = write(fd, &ev, sizeof(ev));
+       if (0 > ret) {
+               LOGE( "[ERROR] Fail to send sync event");
+               close(fd);
+               return;
+       }
+
+       usleep(1000000);
+
+       ret = ioctl(fd, UI_DEV_DESTROY);
+       if (0 != ret) {
+               LOGE( "[ERROR] Fail to destroy");
+               close(fd);
+               return;
+       }
+
+       LOGD( "====");
+       LOGD( " ");
+
+       close(fd);
+       return;
+}
+
+static void __vc_panel_action_launch_app(const char* app_id)
+{
+       LOGD("==== Launch app(%s) ====", app_id);
+       app_control_h app_control;
+       app_control_create(&app_control);
+       app_control_set_app_id(app_control, app_id);
+       app_control_send_launch_request(app_control, NULL, NULL);
+       app_control_destroy(app_control);
+       LOGD("====");
+       LOGD("");
+}
+
+static void __wifi_activated_cb(wifi_error_e result, void* user_data)
+{
+       int ret;
+       ret = wifi_deinitialize();
+       if (0 != ret)
+               LOGE("Fail to wifi deinit");
+
+       return;
+}
+
+static void __wifi_deactivated_cb(wifi_error_e result, void* user_data)
+{
+       int ret;
+       ret = wifi_deinitialize();
+       if (0 != ret)
+               LOGE("Fail to wifi deinit");
+
+       return;
+}
+
+static void __vc_panel_action_wifi()
+{
+       int ret;
+       ret = wifi_initialize();
+       if (0 != ret) {
+               LOGE("wifi init fail");
+               return;
+       }
+
+       bool state = false;
+       ret = wifi_is_activated(&state);
+       if (0 != ret) {
+               LOGE("Fail to get wifi state");
+               return;
+       }
+
+       if (false == state) {
+               ret = wifi_activate_with_wifi_picker_tested(__wifi_activated_cb, NULL);
+               if (0 != ret) {
+                       LOGE("Fail to wifi activate");
+                       ret = wifi_deinitialize();
+                       if (0 != ret)
+                               LOGE("Fail to wifi deinit");
+                       return;
+               }
+       } else {
+               ret = wifi_deactivate(__wifi_deactivated_cb, NULL);
+               if (0 != ret) {
+                       LOGE("Fail to wifi deactivate");
+                       ret = wifi_deinitialize();
+                       if (0 != ret)
+                               LOGE("Fail to wifi deinit");
+                       return;
+               }
+       }
+       return;
+}
+
+static void __vc_panel_action_bt()
+{
+       int ret;
+       ret = bt_initialize();
+       if (0 != ret) {
+               LOGE("BT init fail");
+               return;
+       }
+
+       bt_adapter_state_e state = BT_ADAPTER_DISABLED;
+       ret = bt_adapter_get_state(&state);
+       if (0 != ret) {
+               LOGE("Fail to get bt state");
+               return;
+       }
+
+       if (BT_ADAPTER_DISABLED == state) {
+               LOGD("BT enable");
+               ret = bt_adapter_enable();
+               if (0 != ret)
+                       LOGE("Fail to bt enable");
+       } else {
+               LOGD("BT disable");
+               ret = bt_adapter_disable();
+               if (0 != ret)
+                       LOGE("Fail to bt disable");
+       }
+
+       ret = bt_deinitialize();
+       if (0 != ret)
+               LOGE("BT deinit fail");
+
+       return;
+}
+
+static void __flight_response_cb(TapiHandle *handle, int result, void *data, void *user_data)
+{
+       LOGD("result (%d), data(%d)", result, (int *)data);
+
+       int ret;
+       if (0 == data) {
+               ret = tel_set_flight_mode(handle, TAPI_POWER_FLIGHT_MODE_ENTER, NULL, NULL);
+               if (0 != ret)
+                       LOGE("Fail to set filght mode enter");
+       } else {
+               ret = tel_set_flight_mode(handle, TAPI_POWER_FLIGHT_MODE_LEAVE, NULL, NULL);
+               if (0 != ret)
+                       LOGE("Fail to set flight mode leave");
+       }
+       return;
+}
+
+static void __vc_panel_action_flight()
+{
+       int ret;
+
+       TapiHandle *tapi_handle = NULL;
+
+       tapi_handle = tel_init(NULL);
+       if (NULL == tapi_handle) {
+               LOGE("Fail to tel init");
+               return;
+       }
+
+       ret = tel_get_flight_mode(tapi_handle, __flight_response_cb, NULL);
+       if (0 != ret) {
+               LOGE("Fail to get flight mode");
+               ret = tel_deinit(tapi_handle);
+               if (0 != ret)
+                       LOGE("Fail to tel deinit");
+               return;
+       }
+
+       return;
+}
+
+static void __vc_panel_action_gps_syspopup_launch()
+{
+       syspopup_launch("gps-syspopup", NULL);
+}
+
+static void __vc_panel_action_gps()
+{
+       int enable = 0;
+
+       int ret;
+       bool enabled = false;
+       ret = location_manager_is_enabled_method(LOCATIONS_METHOD_HYBRID, &enabled);
+       if (0 != ret) {
+               LOGD("Fail to get location enabled");
+       } else {
+               LOGD("Location (%d)", enabled);
+               if (false == enabled) {
+                       __vc_panel_action_gps_syspopup_launch();
+               } else {
+                       ret = location_manager_enable_method(LOCATIONS_METHOD_GPS, false);
+                       if (0 != ret) {
+                               LOGD("Fail to set gps disable");
+                       }
+                       ret = location_manager_enable_method(LOCATIONS_METHOD_WPS, false);
+                       if (0 != ret) {
+                               LOGD("Fail to set wps disalbe");
+                       }
+               }
+       }
+
+       return;
+}
+
+static void __vc_panel_action_sound()
+{
+       int sound_state = 1;
+       int vib_state = 1;
+
+       int ret;
+       ret = vconf_get_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, &sound_state);
+       if (0 != ret)
+               LOGE("Fail to get sound state");
+
+       ret = vconf_get_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, &vib_state);
+       if (0 != ret)
+               LOGE("Fail to get vib state");
+
+       LOGD("Sound (%d), Vib (%d)", sound_state, vib_state);
+
+       if (1 == sound_state && 1 == vib_state) {
+               ret = vconf_set_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, 0);
+               if (0 != ret)
+                       LOGE("Fail to set sound state");
+       } else if (1 == sound_state && 0 == vib_state) {
+               ret = vconf_set_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, 1);
+               if (0 != ret)
+                       LOGE("Fail to set vib state");
+               ret = vconf_set_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, 0);
+               if (0 != ret)
+                       LOGE("Fail to set sound state");
+       } else if (0 == sound_state && 1 == vib_state) {
+               ret = vconf_set_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, 0);
+               if (0 != ret)
+                       LOGE("Fail to set vib state");
+       } else if (0 == sound_state && 0 == vib_state) {
+               ret = vconf_set_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, 1);
+               if (0 != ret)
+                       LOGE("Fail to set sound state");
+       }
+
+       return;
+}
+
+bool vc_panel_action(const char* result, void *data)
+{
+       if (NULL == result)
+               return false;
+
+       LOGD( "==== Action - %s ====", result);
+
+       appdata *ad = (appdata *)data;
+
+       if (1 == ad->current_depth) {
+               if (!strcmp(result, _("IDS_HOMESCREEN"))) {
+                       char *path = NULL;
+                       path = vconf_get_str(VCONFKEY_SETAPPL_SELECTED_PACKAGE_NAME);
+                       if (NULL != path) {
+                               __vc_panel_action_launch_app(path);
+                               free(path);
+                       }
+                       return true;
+               } else if (!strcmp(result, _("IDS_NOTIFICATION"))) {
+                       __vc_panel_action_launch_app("org.tizen.quickpanel");
+                       return true;
+               } else if (!strcmp(result, _("IDS_INTERNET"))) {
+                       __vc_panel_action_launch_app("org.tizen.browser");
+                       return true;
+               } else if (!strcmp(result, _("IDS_TASK_MANAGER"))) {
+                       __vc_panel_action_launch_app("org.tizen.task-mgr");
+                       return true;
+               } else if (!strcmp(result, _("IDS_SCROLL_UP"))) {
+                       LOGD("Scroll up");
+                       return true;
+               } else if (!strcmp(result, _("IDS_SCROLL_DOWN"))) {
+                       LOGD("Scroll down");
+                       return true;
+               } else if (!strcmp(result, _("IDS_HELP"))) {
+                       if (0 == ad->show_help) {
+                               vc_panel_view_show_help(ad);
+                       } else {
+                               vc_panel_view_hide_help(ad);
+                       }
+                       return true;
+               } else if (!strcmp(result, _("IDS_CLOSE"))) {
+                       return false;
+               }
+               
+               int i;
+               for (i = 0; i < NUM_COMMAND_1ST; i++) {
+                       if (NULL == g_command_1st[i])
+                               continue;
+
+                       if (!strcmp(result, _(g_command_1st[i]))) {
+                               ad->current_path[0] = i;
+                               ad->current_depth = 2;
+                       }
+               }
+       } else if (2 == ad->current_depth) {
+               if (!strcmp(result, _("IDS_WIFI"))) {
+                       LOGD("Wifi");
+                       __vc_panel_action_wifi();
+                       return true;
+               } else if (!strcmp(result, _("IDS_BLUETOOTH"))) {
+                       LOGD("Bluetooth");
+                       __vc_panel_action_bt();
+                       return true;
+               } else if (!strcmp(result, _("IDS_AIRPLANE_MODE"))) {
+                       LOGD("Airplane mode");
+                       __vc_panel_action_flight();
+                       return true;
+               } else if (!strcmp(result, _("IDS_GPS"))) {
+                       LOGD("GPS");
+                       __vc_panel_action_gps();
+                       return true;
+               } else if (!strcmp(result, _("IDS_SOUND"))) {
+                       LOGD("SOUND");
+                       __vc_panel_action_sound();
+                       return true;
+               } else if (!strcmp(result, _("IDS_MORE"))) {
+                       ad->current_path[0] = -1;
+                       ad->current_depth = 1;
+                       __vc_panel_action_launch_app("org.tizen.setting");
+                       return true;
+               } else if (!strcmp(result, _("IDS_PREVIOUS"))) {
+                       ad->current_path[0] = -1;
+                       ad->current_depth = 1;
+                       return true;
+               } else if (!strcmp(result, _("IDS_HELP"))) {
+                       if (0 == ad->show_help) {
+                               vc_panel_view_show_help(ad);
+                       } else {
+                               vc_panel_view_hide_help(ad);
+                       }
+                       return true;
+               } else if (!strcmp(result, _("IDS_CLOSE"))) {
+                       return false;
+               }
+       }
+
+       LOGD( "====");
+       LOGD( " ");
+
+       return true;
+}
+
+/*
+vi:ts=4:ai:nowrap:expandtab
+*/
diff --git a/src/voice_control_panel_action.h b/src/voice_control_panel_action.h
new file mode 100644 (file)
index 0000000..9e37cd3
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+*  Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved 
+*  Licensed under the Apache License, Version 2.0 (the "License");
+*  you may not use this file except in compliance with the License.
+*  You may obtain a copy of the License at
+*  http://www.apache.org/licenses/LICENSE-2.0
+*  Unless required by applicable law or agreed to in writing, software
+*  distributed under the License is distributed on an "AS IS" BASIS,
+*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+*  See the License for the specific language governing permissions and
+*  limitations under the License.
+*/
+
+#ifndef __VOICE_CONTROL_PANEL_ACTION_H
+#define __VOICE_CONTROL_PANEL_ACTION_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+bool vc_panel_action(const char* result, void* data);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __VOICE_CONTROL_PANEL_VIEW_H */
+
+/*
+vi:ts=4:ai:nowrap:expandtab
+*/
diff --git a/src/voice_control_panel_command.c b/src/voice_control_panel_command.c
new file mode 100644 (file)
index 0000000..ea37265
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+*  Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved 
+*  Licensed under the Apache License, Version 2.0 (the "License");
+*  you may not use this file except in compliance with the License.
+*  You may obtain a copy of the License at
+*  http://www.apache.org/licenses/LICENSE-2.0
+*  Unless required by applicable law or agreed to in writing, software
+*  distributed under the License is distributed on an "AS IS" BASIS,
+*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+*  See the License for the specific language governing permissions and
+*  limitations under the License.
+*/
+
+#include <stdio.h>
+
+#include "voice_control_panel_command.h"
+
+char* g_command_1st[NUM_COMMAND_1ST] = {
+       "IDS_HOMESCREEN", "IDS_INTERNET", "IDS_TASK_MANAGER", "IDS_SETTINGS", "IDS_HELP", "IDS_CLOSE"
+};
+char *g_hint_1st[NUM_COMMAND_1ST] = {
+       "IDS_HINT_HOMESCREEN", "IDS_HINT_INTERNET", "IDS_HINT_TASK_MANAGER", "IDS_HINT_SETTINGS", "IDS_HINT_HELP", "IDS_HINT_CLOSE"
+};
+
+char* g_command_2nd[NUM_COMMAND_1ST][NUM_COMMAND_2ND] = {
+       {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
+       {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
+       {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
+       {"IDS_WIFI", "IDS_BLUETOOTH", "IDS_GPS","IDS_SOUND", "IDS_MORE", "IDS_PREVIOUS", "IDS_HELP", "IDS_CLOSE"},
+       {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
+       {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
+};
+
+char* g_hint_2nd[NUM_COMMAND_1ST][NUM_COMMAND_2ND] = {
+       {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
+       {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
+       {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
+       {"IDS_HINT_WIFI", "IDS_HINT_BLUETOOTH", "IDS_HINT_GPS", "IDS_HINT_SOUND", "IDS_HINT_MORE", "IDS_HINT_PREVIOUS", "IDS_HINT_HELP", "IDS_HINT_CLOSE"},
+       {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
+       {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
+};
+/*
+vi:ts=4:ai:nowrap:expandtab
+*/
diff --git a/src/voice_control_panel_command.h b/src/voice_control_panel_command.h
new file mode 100644 (file)
index 0000000..d3f7bd8
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+*  Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved 
+*  Licensed under the Apache License, Version 2.0 (the "License");
+*  you may not use this file except in compliance with the License.
+*  You may obtain a copy of the License at
+*  http://www.apache.org/licenses/LICENSE-2.0
+*  Unless required by applicable law or agreed to in writing, software
+*  distributed under the License is distributed on an "AS IS" BASIS,
+*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+*  See the License for the specific language governing permissions and
+*  limitations under the License.
+*/
+
+#ifndef __VOICE_CONTROL_PANEL_COMMAND_H
+#define __VOICE_CONTROL_PANEL_COMMAND_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define        NUM_COMMAND_DEPTH       2
+
+#define NUM_COMMAND_1ST                6
+#define NUM_COMMAND_2ND                8
+
+extern char* g_command_1st[NUM_COMMAND_1ST];
+extern char* g_command_2nd[NUM_COMMAND_1ST][NUM_COMMAND_2ND];
+
+extern char* g_hint_1st[NUM_COMMAND_1ST];
+extern char* g_hint_2nd[NUM_COMMAND_1ST][NUM_COMMAND_2ND];
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __VOICE_CONTROL_PANEL_VIEW_H */
+
+/*
+vi:ts=4:ai:nowrap:expandtab
+*/
diff --git a/src/voice_control_panel_main.c b/src/voice_control_panel_main.c
new file mode 100644 (file)
index 0000000..1670520
--- /dev/null
@@ -0,0 +1,210 @@
+/*
+*  Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved 
+*  Licensed under the Apache License, Version 2.0 (the "License");
+*  you may not use this file except in compliance with the License.
+*  You may obtain a copy of the License at
+*  http://www.apache.org/licenses/LICENSE-2.0
+*  Unless required by applicable law or agreed to in writing, software
+*  distributed under the License is distributed on an "AS IS" BASIS,
+*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+*  See the License for the specific language governing permissions and
+*  limitations under the License.
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdbool.h>
+
+#include <voice_control_setting.h>
+
+#include "voice_control_panel_main.h"
+#include "voice_control_panel_view.h"
+#include "voice_control_panel_vc.h"
+
+static void __vc_enabled_changed_cb(bool enabled, void* user_data)
+{
+       LOGD("Voice control enabled changed to (%d)", enabled);
+
+       if (false == enabled) {
+               ui_app_exit();
+       }
+}
+
+static bool app_create(void *data)
+{
+       LOGD("");
+
+       appdata *ad = (appdata *)data;
+
+       /* Check voice control enabled */
+       if (0 != vc_setting_initialize()) {
+               LOGE("Fail to init");
+       }
+
+       bool enabled;
+       if (0 != vc_setting_get_enabled(&enabled)) {
+               LOGE("Fail to get enabled");
+               vc_setting_deinitialize();
+               return false;
+       }
+       if (false == enabled) {
+               LOGE("Voice control is disabled");
+               vc_setting_deinitialize();
+               return false;
+       }
+       
+       if (0 != vc_setting_set_enabled_changed_cb(__vc_enabled_changed_cb, NULL)) {
+               LOGE("Fail to set enabled cb");
+       }
+
+       char* lang = NULL;
+       if (0 != vc_setting_get_language(&lang)) {
+               LOGE("Fail to get language");
+               return false;
+       }
+
+       char loc[64] = {'\0',};
+       snprintf(loc, 64, "%s.UTF-8", lang);
+       
+       setlocale(LC_ALL, loc);
+       
+       bindtextdomain("org.tizen.voice-control-panel", "/usr/apps/org.tizen.voice-control-panel/res/locale");
+       textdomain("org.tizen.voice-control-panel");
+
+       if (NULL != lang) {
+           free(lang);
+           lang = NULL;
+       }
+
+       /* Create View */
+       if (0 != vc_panel_view_create(ad)) {
+               LOGE( "[ERROR] Fail to create view");
+               return -1;
+       }
+
+       /* Initialize Voice Control */
+       if (0 != vc_panel_vc_init(ad)) {
+               LOGE( "[ERROR] Fail to vc init");
+               return -1;
+       }
+
+       return true;
+}
+
+static void app_control(app_control_h app_control, void *data)
+{
+       LOGD("");
+
+       appdata *ad = (appdata *)data;
+       LOGD("state - %d", ad->app_state);
+
+       if (0 != ad->app_state) {
+               ui_app_exit();
+               return;
+       }
+
+       if (ad->win) {
+               elm_win_activate(ad->win);
+       }
+       ad->app_state = APP_STATE_INIT;
+}
+
+static void app_pause(void *data)
+{
+       LOGD("");
+
+       appdata *ad = (appdata *)data;
+       ad->app_state = APP_STATE_PAUSE;
+       ui_app_exit();
+}
+
+static void app_resume(void *data)
+{
+       LOGD("");
+
+       appdata *ad = (appdata *)data;
+       if(ad->app_state == APP_STATE_PAUSE) {
+               if (ad->win) {
+                       elm_win_activate(ad->win);
+               }
+       }
+       ad->app_state = APP_STATE_SERVICE;
+
+       vc_panel_vc_start(ad);
+}
+
+static void app_terminate(void *data)
+{
+       LOGD("");
+
+       appdata *ad = (appdata *)data;
+       ad->app_state = APP_STATE_TERMINATE;
+       
+       vc_panel_vc_cancel(ad);
+
+       vc_panel_view_destroy(ad);
+
+       vc_setting_deinitialize();
+
+       if (0 != vc_panel_vc_deinit(data)) {
+               LOGE( "[ERROR] Fail to vc deinit");
+       }
+
+}
+
+static void ui_app_lang_changed(app_event_info_h event_info, void *user_data)
+{
+       LOGD("");
+}
+
+static void ui_app_orient_changed(app_event_info_h event_info, void *user_data)
+{
+       LOGD("");
+}
+
+static void ui_app_region_changed(app_event_info_h event_info, void *user_data)
+{
+       LOGD("");
+}
+
+static void ui_app_low_battery(app_event_info_h event_info, void *user_data)
+{
+       LOGD("");
+}
+
+static void ui_app_low_memory(app_event_info_h event_info, void *user_data)
+{
+       LOGD("");
+}
+
+int main (int argc, char *argv[])
+{
+       appdata ad = {0,};
+       int ret = 0;
+
+       ui_app_lifecycle_callback_s event_callback = {0,};
+       app_event_handler_h handlers[5] = {NULL, };
+
+       event_callback.create = app_create;
+       event_callback.terminate = app_terminate;
+       event_callback.pause = app_pause;
+       event_callback.resume = app_resume;
+       event_callback.app_control = app_control;
+
+       ui_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY, ui_app_low_battery, &ad);
+       ui_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, ui_app_low_memory, &ad);
+       ui_app_add_event_handler(&handlers[APP_EVENT_DEVICE_ORIENTATION_CHANGED], APP_EVENT_DEVICE_ORIENTATION_CHANGED, ui_app_orient_changed, &ad);
+       ui_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, ui_app_lang_changed, &ad);
+       ui_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, ui_app_region_changed, &ad);
+
+       ret = ui_app_main(argc, argv, &event_callback, &ad);
+       if (ret != APP_ERROR_NONE) {
+               LOGW("ui_app_main failed, Err=%d\n", ret);
+       }
+
+       return ret;
+}
+
+/*
+vi:ts=4:ai:nowrap:expandtab
+*/
diff --git a/src/voice_control_panel_main.h b/src/voice_control_panel_main.h
new file mode 100644 (file)
index 0000000..b3202f6
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+*  Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved 
+*  Licensed under the Apache License, Version 2.0 (the "License");
+*  you may not use this file except in compliance with the License.
+*  You may obtain a copy of the License at
+*  http://www.apache.org/licenses/LICENSE-2.0
+*  Unless required by applicable law or agreed to in writing, software
+*  distributed under the License is distributed on an "AS IS" BASIS,
+*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+*  See the License for the specific language governing permissions and
+*  limitations under the License.
+*/
+
+#ifndef __VOICE_CONTROL_PANEL_MAIN_H
+#define __VOICE_CONTROL_PANEL_MAIN_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <app.h>
+#include <glib.h>
+#include <Elementary.h>
+#include <dlog.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG        "vcp"
+#define _(S)   gettext(S)
+
+enum {
+       APP_STATE_INIT = 1,
+       APP_STATE_PAUSE,
+       APP_STATE_SERVICE,
+       APP_STATE_TERMINATE,
+};
+
+typedef struct _appdata {
+       /* GUI */
+       float scale_w;
+       float scale_h;
+
+       Evas_Object *win;
+       Evas_Object *layout_main;
+       Evas_Object *image_mic;
+       Evas_Object *image_arrow;
+       Evas_Object *content_box;
+       Evas_Object *image_setting;
+
+       Evas_Object *help_win;
+       Evas_Object *help_genlist;
+       Evas_Object *help_layout;
+
+       Elm_Theme *theme;
+
+       int app_state;
+
+       int show_help;
+
+       int current_depth;
+       int current_path[2];
+
+       GList *cmd_list;
+}appdata;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __VOICE_CONTROL_PANEL_MAIN_H */
+
+/*
+vi:ts=4:ai:nowrap:expandtab
+*/
diff --git a/src/voice_control_panel_vc.c b/src/voice_control_panel_vc.c
new file mode 100644 (file)
index 0000000..c6b1569
--- /dev/null
@@ -0,0 +1,554 @@
+/*
+*  Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved 
+*  Licensed under the Apache License, Version 2.0 (the "License");
+*  you may not use this file except in compliance with the License.
+*  You may obtain a copy of the License at
+*  http://www.apache.org/licenses/LICENSE-2.0
+*  Unless required by applicable law or agreed to in writing, software
+*  distributed under the License is distributed on an "AS IS" BASIS,
+*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+*  See the License for the specific language governing permissions and
+*  limitations under the License.
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdbool.h>
+
+#include <dlog.h>
+#include <Elementary.h>
+
+#include <voice_control_command.h>
+#include <voice_control_common.h>
+#include <voice_control_manager.h>
+
+#include "voice_control_panel_action.h"
+#include "voice_control_panel_command.h"
+#include "voice_control_panel_main.h"
+#include "voice_control_panel_vc.h"
+#include "voice_control_panel_view.h"
+
+static vc_cmd_list_h g_cmd_list_1st;
+static vc_cmd_list_h g_cmd_list_2nd[NUM_COMMAND_1ST];
+
+#define TIMEOUT        5
+static Ecore_Timer *g_timeout_timer = NULL;
+static Ecore_Timer *g_restart_timer = NULL;
+
+static bool __current_command_cb(vc_cmd_h vc_command, void* user_data)
+{
+       appdata *ad = (appdata *)user_data;
+
+       int type;
+       if (0 != vc_cmd_get_type(vc_command, &type)) {
+               LOGE("[ERROR] Fail to get type");
+               return false;
+       }
+
+       if (VC_COMMAND_TYPE_FOREGROUND == type || VC_COMMAND_TYPE_BACKGROUND == type) {
+               char *cmd = NULL;
+               if (0 != vc_cmd_get_command(vc_command, &cmd)) {
+                       LOGE("[ERROR] Fail to get command");
+                       return false;
+               }
+
+               if (NULL != cmd) {
+                       ad->cmd_list = g_list_append(ad->cmd_list, strdup(cmd));
+                       LOGD("Add command List (%s)", cmd);
+                       free(cmd);
+                       cmd = NULL;
+               }
+       }
+
+       return true;
+}
+
+static int __vc_panel_vc_get_current_commands(void *data)
+{
+       appdata *ad = (appdata *)data;
+
+       LOGD("==== Get current commands ====");
+       if (0 < g_list_length(ad->cmd_list)) {
+               GList *iter = NULL;
+               iter = g_list_first(ad->cmd_list);
+
+               while (NULL != iter) {
+                       char *cmd = iter->data;
+                       if (NULL != cmd) {
+                               free(cmd);
+                               cmd = NULL;
+                       }
+
+                       ad->cmd_list = g_list_remove_link(ad->cmd_list, iter);
+                       iter = g_list_first(ad->cmd_list);
+               }
+       }
+       
+       vc_cmd_list_h vc_cmd_list;
+       if (0 != vc_mgr_get_current_commands(&vc_cmd_list)) {
+               LOGE("[ERROR] Fail to get current commands");
+               if (0 != vc_cmd_list_destroy(vc_cmd_list, true)) {
+                       LOGE("[WARNING] Fail to cmd list destroy");
+               }
+               return -1;
+       }
+
+       if (0 != vc_cmd_list_foreach_commands(vc_cmd_list, __current_command_cb, ad)) {
+               LOGE("[ERROR] Fail to get current commands");
+               if (0 != vc_cmd_list_destroy(vc_cmd_list, true)) {
+                       LOGE("[WARNING] Fail to cmd list destroy");
+               }
+               return -1;
+       }
+
+       if (0 != vc_cmd_list_destroy(vc_cmd_list, true)) {
+               LOGE("[WARNING] Fail to cmd list destroy");
+       }
+
+       return 0;
+}
+
+static void __vc_panel_vc_destroy_command_list()
+{
+       LOGD( "==== Destroy Command List ====");
+
+       if (0 != vc_cmd_list_destroy(g_cmd_list_1st, true)) {
+               LOGE("[WARNING] Fail to destroy list");
+       }
+
+       int i;
+       for (i = 0; i < NUM_COMMAND_1ST; i++) {
+               if (0 != vc_cmd_list_destroy(g_cmd_list_2nd[i], true)) {
+                       LOGE("[WARNING] Fail to destroy list");
+               }
+       }
+       
+       LOGD( "====");
+       LOGD( " ");
+}
+
+static int __vc_panel_vc_create_command_list()
+{
+       LOGD( "==== Create Command List ====");
+
+       /* 1st depth */
+       if (0 != vc_cmd_list_create(&g_cmd_list_1st)) {
+               LOGE( "[ERROR] Fail to cmd list create");
+               return -1;
+       }
+
+       int i;
+       for (i = 0; i < NUM_COMMAND_1ST; i++) {
+               vc_cmd_h cmd;
+               if (0 != vc_cmd_create(&cmd)) {
+                       LOGE( "[ERROR] Fail to cmd create");
+                       return -1;
+               }
+               if (0 != vc_cmd_set_command(cmd, _(g_command_1st[i]))) {
+                       LOGE( "[ERROR] Fail to set command");
+                       vc_cmd_destroy(cmd);
+                       return -1;
+               }
+               if (0 != vc_cmd_set_type(cmd, VC_COMMAND_TYPE_SYSTEM)) {
+                       LOGE( "[ERROR] Fail to set type");
+                       vc_cmd_destroy(cmd);
+                       return -1;
+               }
+               if (0 != vc_cmd_set_format(cmd, VC_CMD_FORMAT_FIXED)) {
+                       LOGE( "[ERROR] Fail to set format");
+                       vc_cmd_destroy(cmd);
+                       return -1;
+               }
+               if (0 != vc_cmd_list_add(g_cmd_list_1st, cmd)) {
+                       LOGE( "[ERROR] Fail to list add");
+                       vc_cmd_destroy(cmd);
+                       return -1;
+               }
+       }
+
+       /* 2nd depth */
+       for (i = 0; i < NUM_COMMAND_1ST; i++) {
+               if (0 != vc_cmd_list_create(&g_cmd_list_2nd[i])) {
+                       LOGE( "[ERROR] Fail to list create");
+                       return -1;
+               }
+
+               int j;
+               for (j = 0; j < NUM_COMMAND_2ND; j++) {
+                       if (NULL != g_command_2nd[i][j]) {
+                               vc_cmd_h cmd;
+                               if (0 != vc_cmd_create(&cmd)) {
+                                       LOGE( "[ERROR] Fail to cmd create");
+                                       return -1;
+                               }
+                               if (0 != vc_cmd_set_command(cmd, _(g_command_2nd[i][j]))) {
+                                       LOGE( "[ERROR] Fail to set command");
+                                       vc_cmd_destroy(cmd);
+                                       return -1;
+                               }
+                               if (0 != vc_cmd_set_type(cmd, VC_COMMAND_TYPE_SYSTEM)) {
+                                       LOGE( "[ERROR] Fail to set type");
+                                       vc_cmd_destroy(cmd);
+                                       return -1;
+                               }
+                               if (0 != vc_cmd_set_format(cmd, VC_CMD_FORMAT_FIXED)) {
+                                       LOGE( "[ERROR] Fail to set format");
+                                       vc_cmd_destroy(cmd);
+                                       return -1;
+                               }
+                               if (0 != vc_cmd_list_add(g_cmd_list_2nd[i], cmd)) {
+                                       LOGE( "[ERROR] Fail to list add");
+                                       vc_cmd_destroy(cmd);
+                                       return -1;
+                               }
+                       }
+               }
+       }
+
+       return 0;
+}
+
+static Eina_Bool __start_cb(void *data)
+{
+       appdata *ad = (appdata *)data;
+
+       vc_service_state_e state;
+       if (0 != vc_mgr_get_service_state(&state)) {
+           LOGE("[ERROR] Fail to get service state");
+           return EINA_FALSE;
+       }
+
+       if (VC_SERVICE_STATE_READY != state) {
+           LOGD("[WARNING] Wait for service state ready");
+           return EINA_TRUE;
+       }
+
+       if (0 != vc_mgr_set_recognition_mode(VC_RECOGNITION_MODE_RESTART_AFTER_REJECT)) {
+               LOGE( "[ERROR] Fail to set recognition mode");
+       }
+       if (0 != vc_mgr_set_command_list(g_cmd_list_1st)) {
+               LOGE( "[ERROR] Fail to set command list");
+       }
+
+       if (0 != __vc_panel_vc_get_current_commands(ad)) {
+               LOGE("[ERROR] Fail to get current commands");
+       }
+
+       if (0 != vc_mgr_start(false)) {
+               LOGE( "[ERROR] Fail to start");
+       }
+
+       return EINA_FALSE;
+}
+
+static void __vc_panel_vc_state_changed_cb(vc_state_e previous, vc_state_e current, void *user_data)
+{
+       LOGD( "==== State is changed ====");
+       LOGD( "Previous(%d) -> Current(%d)", previous, current);
+}
+
+static void __vc_panel_vc_reset(void *data)
+{
+       appdata *ad = (appdata *)data;
+
+       ad->current_depth = 1;
+       ad->current_path[0] = -1;
+       ad->current_path[1] = -1;
+
+       if (0 != vc_mgr_set_command_list(g_cmd_list_1st)) {
+               LOGE( "[ERROR] Fail to set command list");
+       }
+}
+
+static Eina_Bool __vc_panel_finalize(void *data)
+{
+       LOGD("=== Finalize ===");
+       if (g_timeout_timer != NULL) {
+               ecore_timer_del(g_timeout_timer);
+               g_timeout_timer = NULL;
+       }
+       ui_app_exit();
+       return EINA_FALSE;
+}
+
+static Eina_Bool __vc_panel_vc_restart(void *data)
+{
+       LOGD( "==== Restart ====");
+
+       appdata *ad = (appdata *)data;
+
+       vc_service_state_e state;
+       if (0 != vc_mgr_get_service_state(&state)) {
+           LOGE("[ERROR] Fail to get service state");
+           return EINA_FALSE;
+       }
+
+       if (VC_SERVICE_STATE_READY != state) {
+           LOGD("[WARNING] Wait for service state ready");
+           return EINA_TRUE;
+       }
+
+       /* set current command list */
+       if (1 == ad->current_depth) {
+               if (0 != vc_mgr_set_command_list(g_cmd_list_1st)) {
+                       LOGE( "[ERROR] Fail to set command list");
+               }
+       } else if (2 == ad->current_depth) {
+               if (0 != vc_mgr_set_command_list(g_cmd_list_2nd[ad->current_path[0]])) {
+                       LOGE( "[ERROR] Fail to set command list");
+               }
+       }
+
+       vc_panel_view_show(ad);
+
+       if (0 != __vc_panel_vc_get_current_commands(ad)) {
+               LOGE("[ERROR] Fail to get current commands");
+       }
+
+       if (0 != vc_mgr_start(false)) {
+               LOGE( "[ERROR] Fail to start");
+       }
+
+       LOGD( "====");
+       LOGD( " ");
+
+       return EINA_FALSE;
+}
+
+static void __vc_panel_vc_service_state_changed_cb(vc_service_state_e previous, vc_service_state_e current, void *user_data)
+{
+       LOGD( "==== Service state is changed ====");
+       LOGD( "Previous(%d) -> Current(%d)", previous, current);
+       
+       appdata *ad = (appdata *)user_data;
+
+       if (VC_SERVICE_STATE_READY == previous && VC_SERVICE_STATE_RECORDING == current) {
+               LOGD( "==== Show by recording ====");
+               vc_panel_view_show(ad);
+               if (NULL != g_timeout_timer) {
+                       ecore_timer_reset(g_timeout_timer);
+               }
+       } else if ((VC_SERVICE_STATE_RECORDING == previous || VC_SERVICE_STATE_PROCESSING == previous) && VC_SERVICE_STATE_READY == current) {
+               if (APP_STATE_SERVICE == ad->app_state) {
+                       LOGD("==== Restart ====");
+                       if (NULL != g_restart_timer) {
+                               ecore_timer_del(g_restart_timer);
+                       }
+                       g_restart_timer = ecore_timer_add(0.5, __vc_panel_vc_restart, user_data);
+               } else {
+                       LOGD("==== Hide ====");
+                       __vc_panel_vc_reset(ad);
+               }
+       }
+
+       if (VC_SERVICE_STATE_RECORDING == current) {
+               if (NULL != g_timeout_timer) {
+                       ecore_timer_reset(g_timeout_timer);
+               }
+       }
+}
+
+static Eina_Bool __hide_result(void *data)
+{
+       LOGD("");
+       vc_panel_view_show(data);
+
+       return EINA_FALSE;
+}
+
+static bool __vc_panel_vc_all_result_cb(vc_result_event_e event, vc_cmd_list_h vc_cmd_list, const char* result, const char* msg, void *user_data)
+{
+       LOGD( "==== All result cb ====");
+
+       if (VC_RESULT_EVENT_REJECTED == event) {
+               LOGD("Rejected event");
+               vc_panel_view_show_result(user_data, _("IDS_SORRY"));
+               ecore_timer_add(0.5, __hide_result, user_data);
+       } else {
+               if (NULL != result) {
+                       LOGD( "Result Text - %s", result);
+                       vc_panel_view_show_result(user_data, result);
+               
+               if (strcmp(result, _("IDS_HELP"))) {
+                       vc_panel_view_hide_help(user_data);
+               }
+        }
+       }
+
+       return true;
+}
+
+static void __vc_panel_vc_result_cb(vc_result_event_e event, vc_cmd_list_h vc_cmd_list, const char* result, void *user_data)
+{
+       LOGD( "==== Result cb ====");
+
+       if (NULL != result) {
+               LOGD( "Result Text - %s", result);
+
+               bool ret;
+               ret = vc_panel_action(result, user_data);
+               if (true != ret) {
+                       ecore_idler_add(__vc_panel_finalize, user_data);
+               }
+       }
+}
+
+static void __vc_panel_vc_speech_detected_cb(void *user_data)
+{
+       LOGD("==== Speech detected ====");
+       if (NULL != g_timeout_timer)
+               ecore_timer_reset(g_timeout_timer);
+}
+
+static void __vc_panel_vc_language_changed_cb(const char* previous, const char* current, void* user_data)
+{
+       LOGD("Language is changed (%s) to (%s)", previous, current);
+
+       char loc[64] = {'\0', };
+       snprintf(loc, 64, "%s.UTF-8", current);
+
+       setlocale(LC_ALL, loc);
+
+       __vc_panel_vc_destroy_command_list();
+       if (0 != __vc_panel_vc_create_command_list()) {
+               LOGE("[ERROR] Fail to create command list");
+       }
+}
+
+int vc_panel_vc_start(void *data)
+{
+       if (NULL != g_timeout_timer)
+               ecore_timer_reset(g_timeout_timer);
+
+       ecore_timer_add(0, __start_cb, data);
+       return 0;
+}
+
+int vc_panel_vc_cancel(void *data)
+{
+       vc_service_state_e service_state;
+
+       if (0 != vc_mgr_get_service_state(&service_state)) {
+               LOGE( "[ERROR] Fail to get service state");
+               return -1;
+       }
+
+       if ((VC_SERVICE_STATE_RECORDING == service_state) || (VC_SERVICE_STATE_PROCESSING == service_state)) {
+               LOGD( "==== service state (%d)", service_state);
+
+               if (0 != vc_mgr_cancel()) {
+                       LOGE( "[ERROR] Fail to cancel");
+                       return -1;
+               }
+       }
+
+       return 0;
+}
+
+int vc_panel_vc_init(void *data)
+{
+       LOGD( "==== Initialze Voice control ====");
+
+       if (0 != vc_mgr_initialize()) {
+               LOGE( "[ERROR] Fail to initialize");
+               return -1;
+       }
+
+       if (0 != vc_mgr_set_state_changed_cb(__vc_panel_vc_state_changed_cb, data)) {
+               LOGE( "[ERROR] Fail to set state changed cb");
+               return -1;
+       }
+
+       if (0 != vc_mgr_set_service_state_changed_cb(__vc_panel_vc_service_state_changed_cb, data)) {
+               LOGE( "[ERROR] Fail to set service state changed cb");
+               return -1;
+       }
+
+       if (0 != vc_mgr_set_all_result_cb(__vc_panel_vc_all_result_cb, data)) {
+               LOGE( "[ERROR] Fail to set all result cb");
+               return -1;
+       }
+
+       if (0 != vc_mgr_set_result_cb(__vc_panel_vc_result_cb, data)) {
+               LOGE( "[ERROR] Fail to set result cb");
+               return -1;
+       }
+
+       if (0 != vc_mgr_set_speech_detected_cb(__vc_panel_vc_speech_detected_cb, data)) {
+               LOGE("[ERROR] Fail to set speech detected cb");
+               return -1;
+       }
+
+       if (0 != vc_mgr_set_current_language_changed_cb(__vc_panel_vc_language_changed_cb, data)) {
+               LOGE("[ERROR] Fail to set language changed cb");
+               return -1;
+       }
+
+       if (0 != vc_mgr_prepare()) {
+               LOGE( "[ERROR] Fail to prepare");
+               return -1;
+       }
+
+       if (0 != __vc_panel_vc_create_command_list()) {
+               LOGE( "[ERROR] Fail to create command list");
+               return -1;
+       }
+
+       if (NULL == g_timeout_timer) {
+               g_timeout_timer = ecore_timer_add(TIMEOUT, __vc_panel_finalize, NULL);
+       }
+
+       LOGD( "====");
+       LOGD( " ");
+
+       return 0;
+}
+
+int vc_panel_vc_deinit(void *data)
+{
+       LOGD( "==== De-initialize Voice control ====");
+
+       appdata *ad = (appdata *)data;
+
+       if (g_restart_timer != NULL) {
+               ecore_timer_del(g_restart_timer);
+               g_restart_timer = NULL;
+       }
+
+       if (g_timeout_timer != NULL) {
+               ecore_timer_del(g_timeout_timer);
+               g_timeout_timer = NULL;
+       }
+
+       if (0 < g_list_length(ad->cmd_list)) {
+               GList *iter = NULL;
+               iter = g_list_first(ad->cmd_list);
+
+               while (NULL != iter) {
+                       char *cmd = iter->data;
+                       if (NULL != cmd) {
+                               free(cmd);
+                               cmd = NULL;
+                       }
+
+                       ad->cmd_list = g_list_remove_link(ad->cmd_list, iter);
+                       iter = g_list_first(ad->cmd_list);
+               }
+       }
+
+       __vc_panel_vc_destroy_command_list();
+
+       if (0 != vc_mgr_deinitialize()) {
+               LOGE( "[ERROR] Fail to deinitialize");
+               return -1;
+       }
+
+       LOGD( "====");
+       LOGD( " ");
+
+       return 0;
+}
+
+/*
+vi:ts=4:ai:nowrap:expandtab
+*/
diff --git a/src/voice_control_panel_vc.h b/src/voice_control_panel_vc.h
new file mode 100644 (file)
index 0000000..7fce7f9
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+*  Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved 
+*  Licensed under the Apache License, Version 2.0 (the "License");
+*  you may not use this file except in compliance with the License.
+*  You may obtain a copy of the License at
+*  http://www.apache.org/licenses/LICENSE-2.0
+*  Unless required by applicable law or agreed to in writing, software
+*  distributed under the License is distributed on an "AS IS" BASIS,
+*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+*  See the License for the specific language governing permissions and
+*  limitations under the License.
+*/
+
+#ifndef __VOICE_CONTROL_PANEL_VC_H
+#define __VOICE_CONTROL_PANEL_VC_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int vc_panel_vc_start(void *data);
+int vc_panel_vc_cancel(void *data);
+int vc_panel_vc_init(void *data);
+int vc_panel_vc_deinit(void *data);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __VOICE_CONTROL_PANEL_VC_H */
+
+/*
+vi:ts=4:ai:nowrap:expandtab
+*/
diff --git a/src/voice_control_panel_view.c b/src/voice_control_panel_view.c
new file mode 100644 (file)
index 0000000..8585352
--- /dev/null
@@ -0,0 +1,390 @@
+/*
+*  Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved 
+*  Licensed under the Apache License, Version 2.0 (the "License");
+*  you may not use this file except in compliance with the License.
+*  You may obtain a copy of the License at
+*  http://www.apache.org/licenses/LICENSE-2.0
+*  Unless required by applicable law or agreed to in writing, software
+*  distributed under the License is distributed on an "AS IS" BASIS,
+*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+*  See the License for the specific language governing permissions and
+*  limitations under the License.
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdbool.h>
+
+#include <app_control.h>
+#include <dlog.h>
+#include <Elementary.h>
+#include <Ecore_X.h>
+
+#include "voice_control_panel_command.h"
+#include "voice_control_panel_main.h"
+#include "voice_control_panel_view.h"
+
+#define MAIN_LAYOUT_EDJ                "/usr/apps/org.tizen.voice-control-panel/res/edje/voice-control-panel.edj"
+#define MIC_IMAGE              "/usr/apps/org.tizen.voice-control-panel/res/images/Voice_control_icon_mic.png"
+#define MUTE_IMAGE             "/usr/apps/org.tizen.voice-control-panel/res/images/Voice_control_icon_mute.png"
+#define SETTING_IMAGE          "/usr/apps/org.tizen.voice-control-panel/res/images/Voice_control_icon_setting.png"
+#define ARROW_IMAGE            "/usr/apps/org.tizen.voice-control-panel/res/images/Voice_control_icon_arrow.png"
+
+static Elm_Genlist_Item_Class *g_itc = NULL;
+static Elm_Genlist_Item_Class *g_itc_for_app = NULL;
+static appdata *g_ad = NULL;
+
+static char *__help_text_get(void *data, Evas_Object *obj, const char *part)
+{
+       if (NULL == part) {
+               return NULL;
+       }
+
+       int idx = (int *)data;
+
+       if (!strcmp("elm.text.main.left.top", part)) {
+               if (1 == g_ad->current_depth) {
+                       return strdup(_(g_command_1st[idx]));
+               } else if (2 == g_ad->current_depth) {
+                       return strdup(_(g_command_2nd[g_ad->current_path[0]][idx]));
+               }
+       } else if (!strcmp("elm.text.sub.left.bottom", part)) {
+               if (1 == g_ad->current_depth) {
+                       return strdup(_(g_hint_1st[idx]));
+               } else if (2 == g_ad->current_depth) {
+                       return strdup(_(g_hint_2nd[g_ad->current_path[0]][idx]));
+               }
+       }
+       return NULL;
+}
+
+static char *__help_text_get_for_app(void *data, Evas_Object *obj, const char *part)
+{
+       if (NULL == part || NULL == data) {
+               return NULL;
+       }
+
+       char *cmd = (char *)data;
+
+       if (!strcmp("elm.text.main.left", part)) {
+               LOGD("cmd (%s)", cmd);
+               return strdup(cmd);
+       }
+       return NULL;
+}
+
+int vc_panel_view_show_help(void *data)
+{
+       LOGD( "==== Show help ====");
+
+       appdata *ad = (appdata *)data;
+
+       if (NULL != ad->help_genlist) {
+               elm_genlist_clear(ad->help_genlist);
+       }
+
+       int i;
+       Elm_Object_Item *it = NULL;
+       if (1 == ad->current_depth) {
+               for (i = 0; i < NUM_COMMAND_1ST; i++) {
+                       if (NULL != g_command_1st[i]) {
+                               it = elm_genlist_item_append(ad->help_genlist, g_itc, (void *)i, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
+                               elm_genlist_item_select_mode_set(it, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
+                       }
+               }
+       } else if (2 == ad->current_depth) {
+               for (i = 0; i < NUM_COMMAND_2ND; i++) {
+                       if (NULL != g_command_2nd[ad->current_path[0]][i]) {
+                               it = elm_genlist_item_append(ad->help_genlist, g_itc, (void *)i, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
+                               elm_genlist_item_select_mode_set(it, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
+                       }
+               }
+       }
+
+       GList *iter = NULL;
+       for (i = 0; i < g_list_length(ad->cmd_list); i++) {
+               iter = g_list_nth(ad->cmd_list, i);
+               if (NULL != iter) {
+                       char *cmd = iter->data;
+                       if (NULL != cmd) {
+                               LOGD("Add list - (%s)", cmd);
+                               char *tmp = strdup(cmd);
+                               it = elm_genlist_item_append(ad->help_genlist, g_itc_for_app, (void *)tmp, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
+                               elm_genlist_item_select_mode_set(it, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
+                       }
+               }
+       }
+
+       evas_object_show(ad->help_win);
+       ad->show_help = 1;
+
+       LOGD( "====");
+       LOGD( " ");
+       
+       return 0;
+}
+
+int vc_panel_view_hide_help(void *data)
+{
+       LOGD( "==== Hide help ====");
+
+       appdata *ad = (appdata *)data;
+
+       evas_object_hide(ad->help_win);
+       ad->show_help = 0;
+
+       return 0;
+}
+
+int vc_panel_view_show_result(void *data, const char *result)
+{
+       LOGD("==== Show result ====");
+
+       appdata *ad = (appdata *)data;
+
+       elm_box_clear(ad->content_box);
+
+       Evas_Object *label = elm_label_add(ad->content_box);
+       evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       evas_object_size_hint_align_set(label, 0.0, 0.0);
+       char text[256] = {'\0', };
+       snprintf(text, 256, "<font=Tizen:style=Regular><font_size=30><color=#FFFFFFFF>%s</color></font_size></font>", result);
+       elm_object_text_set(label, text);
+       elm_box_pack_end(ad->content_box, label);
+       evas_object_show(label);
+
+       return 0;
+}
+
+int vc_panel_view_show(void *data)
+{
+       LOGD( "==== Show content ====");
+
+       appdata *ad = (appdata *)data;
+       LOGD( "Current Depth = %d", ad->current_depth);
+
+       Evas_Object *box = elm_box_add(ad->layout_main);
+       elm_box_padding_set(box, 0, 0);
+       elm_box_horizontal_set(box, EINA_TRUE);
+       elm_box_homogeneous_set(box, EINA_FALSE);
+       evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       elm_box_align_set(box, 0.0, 0.0);
+       int image_size = 42 * ad->scale_h;
+
+       if (1 == ad->current_depth) {
+               Evas_Object *label = elm_label_add(box);
+               evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+               evas_object_size_hint_align_set(label, 0.0, 0.0);
+               char text1[256] = {'\0', };
+               snprintf(text1, 256, "<font=Tizen:style=Regular><font_size=30><color=#FFFFFFFF>%s</color></font_size></font>", _("IDS_LISTENING"));
+               elm_object_text_set(label, text1);
+               elm_box_pack_end(box, label);
+               evas_object_show(label);
+       } else if (2 == ad->current_depth) {
+               Evas_Object *label1 = elm_label_add(box);
+               evas_object_size_hint_align_set(label1, 0.0, 0.5);
+               char text1[256] = {'\0', };
+               snprintf(text1, 256, "<font=Tizen:style=Regular><font_size=30><color=#FFFFFFB8>%s</color></font_size></font>", _(g_command_1st[ad->current_path[0]]));
+               elm_object_text_set(label1, text1);
+               elm_box_pack_end(box, label1);
+               evas_object_show(label1);
+
+               Evas_Object *image_arrow = elm_image_add(box);
+               elm_image_file_set(image_arrow, ARROW_IMAGE, NULL);
+               evas_object_size_hint_min_set(image_arrow, image_size, image_size);
+               elm_box_pack_end(box, image_arrow);
+               evas_object_show(image_arrow);
+
+               Evas_Object *label2 = elm_label_add(box);
+               evas_object_size_hint_align_set(label2, 0.0, 0.5);
+               char text2[256] = {'\0', };
+               snprintf(text2, 256, "<font=Tizen:style=Regular><font_size=30><color=#FFFFFFFF>%s</color><font_size></font>", _("IDS_LISTENING"));
+               elm_object_text_set(label2, text2);
+               elm_box_pack_end(box, label2);
+               evas_object_show(label2);
+       }
+
+       elm_object_part_content_set(ad->layout_main, "content", box);
+       evas_object_show(box);
+       ad->content_box = box;
+
+       evas_object_show(ad->win);
+
+       return 0;
+}
+
+int vc_panel_view_hide(void *data)
+{
+       appdata *ad = (appdata *)data;
+
+       evas_object_hide(ad->win);
+
+       vc_panel_view_hide_help(ad);
+
+       return 0;
+}
+
+static void __vc_panel_setting_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+       LOGD("==== Setting Clicked ====");
+       
+       app_control_h app_control;
+       app_control_create(&app_control);
+       app_control_set_app_id(app_control, "org.tizen.voice-setting");
+       app_control_add_extra_data(app_control, "show", "voice-control");
+       app_control_send_launch_request(app_control, NULL, NULL);
+       app_control_destroy(app_control);
+
+       ui_app_exit();
+
+       LOGD("====");
+       LOGD("");
+}
+
+int vc_panel_view_create(void *data)
+{
+       LOGD( "==== Create View ====");
+
+       appdata *ad = (appdata *)data;
+       g_ad = ad;
+
+       elm_theme_extension_add(NULL, MAIN_LAYOUT_EDJ);
+
+       /* Window */
+       Evas_Object *win = elm_win_add(NULL, "voice-control-panel", ELM_WIN_UTILITY);
+       int x,y,w,h;
+       elm_win_screen_size_get(win, &x, &y, &w, &h);
+       LOGD("Size x(%d), y(%d), w(%d), h(%d)", x, y, w, h);
+       elm_win_autodel_set(win, EINA_TRUE);
+       elm_win_title_set(win, "voice-control-panel");
+       elm_win_borderless_set(win, EINA_TRUE);
+       elm_win_alpha_set(win, EINA_TRUE);
+       
+       ad->scale_w = w / 720.0;
+       ad->scale_h = h / 1280.0;
+
+       int scaled_h = 90 * ad->scale_h;
+       LOGD("%d", scaled_h);
+       evas_object_resize(win, w, scaled_h);
+       evas_object_move(win, 0, h - scaled_h);
+
+       elm_win_prop_focus_skip_set(win, EINA_TRUE);
+       Ecore_X_Window_State state[3];
+       state[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
+       state[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
+       state[2] = ECORE_X_WINDOW_STATE_ABOVE;
+
+       Ecore_X_Window xwin = elm_win_xwindow_get(win);
+       ecore_x_netwm_window_state_set(xwin, state, 3);
+
+       ad->win = win;
+
+       /* Layout Main */
+       Evas_Object *layout = elm_layout_add(win);
+       elm_layout_file_set(layout, MAIN_LAYOUT_EDJ, "main");
+       elm_win_resize_object_add(win, layout);
+       evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       evas_object_show(layout);
+       ad->layout_main = layout;
+
+       /* Image MIC */
+       Evas_Object *image_mic = elm_image_add(layout);
+       elm_image_file_set(image_mic, MIC_IMAGE, NULL);
+       elm_object_part_content_set(layout, "icon1", image_mic);
+       evas_object_show(image_mic);
+       ad->image_mic = image_mic;
+
+       /* Image arrow */
+       Evas_Object *image_arrow = elm_image_add(layout);
+       elm_image_file_set(image_arrow, ARROW_IMAGE, NULL);
+       elm_object_part_content_set(layout, "icon2", image_arrow);
+       evas_object_show(image_arrow);
+       ad->image_arrow = image_arrow;
+
+       /* Image Setting */
+       Evas_Object *image_setting = elm_image_add(layout);
+       elm_image_file_set(image_setting, SETTING_IMAGE, NULL);
+       elm_object_part_content_set(layout, "icon3", image_setting);
+       evas_object_smart_callback_add(image_setting, "clicked", __vc_panel_setting_clicked_cb, ad);
+       evas_object_show(image_setting);
+       ad->image_setting = image_setting;
+
+       ad->current_depth = 1;
+
+       Evas_Object *help_win = elm_win_add(NULL, "voice-control-panel-help", ELM_WIN_UTILITY);
+       elm_win_autodel_set(help_win, EINA_TRUE);
+       elm_win_title_set(help_win, "voice-control-panel-help");
+       elm_win_borderless_set(help_win, EINA_TRUE);
+       elm_win_alpha_set(help_win, EINA_TRUE);
+       evas_object_resize(help_win, w, h / 2);
+       evas_object_move(help_win, 0, h - (h / 2) - (90 * ad->scale_h));
+
+       elm_win_prop_focus_skip_set(help_win, EINA_TRUE);
+       Ecore_X_Window help_xwin = elm_win_xwindow_get(help_win);
+       ecore_x_netwm_window_state_set(help_xwin, state, 3);
+
+       ad->help_win = help_win;
+
+       Evas_Object *help_layout = elm_layout_add(help_win);
+       elm_layout_file_set(help_layout, "/usr/apps/org.tizen.voice-control-panel/res/edje/voice-control-panel.edj", "help");
+       elm_win_resize_object_add(help_win, help_layout);
+       evas_object_size_hint_weight_set(help_layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       evas_object_show(help_layout);
+       ad->help_layout = help_layout;
+
+       Evas_Object *genlist = elm_genlist_add(ad->help_layout);
+       elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
+       elm_genlist_homogeneous_set(genlist, EINA_FALSE);
+       elm_object_part_content_set(ad->help_layout, "content", genlist);
+       evas_object_show(genlist);
+       ad->help_genlist = genlist;
+
+       g_itc = elm_genlist_item_class_new();
+       if (NULL == g_itc) {
+               LOGE("Fail to new item class");
+               return -1;
+       }
+       g_itc->item_style = "2line.top";
+       g_itc->func.text_get = __help_text_get;
+       g_itc->func.content_get = NULL;
+       g_itc->func.state_get = NULL;
+       g_itc->func.del = NULL;
+
+       g_itc_for_app = elm_genlist_item_class_new();
+       if (NULL == g_itc_for_app) {
+               LOGE("Fail to new item class");
+               return -1;
+       }
+       g_itc_for_app->item_style = "1line";
+       g_itc_for_app->func.text_get = __help_text_get_for_app;
+       g_itc_for_app->func.content_get = NULL;
+       g_itc_for_app->func.state_get = NULL;
+       g_itc_for_app->func.del = NULL;
+
+       ad->show_help = 0;
+
+       LOGD( "====");
+       LOGD( " ");
+
+       return 0;
+}
+
+void vc_panel_view_destroy(void *data)
+{
+       LOGD("");
+       if (NULL != g_itc) {
+               elm_genlist_item_class_free(g_itc);
+               g_itc = NULL;
+       }
+
+       if (NULL != g_itc_for_app) {
+               elm_genlist_item_class_free(g_itc_for_app);
+               g_itc_for_app = NULL;
+       }
+
+       return;
+}
+
+/*
+vi:ts=4:ai:nowrap:expandtab
+*/
diff --git a/src/voice_control_panel_view.h b/src/voice_control_panel_view.h
new file mode 100644 (file)
index 0000000..e5795d8
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+*  Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved 
+*  Licensed under the Apache License, Version 2.0 (the "License");
+*  you may not use this file except in compliance with the License.
+*  You may obtain a copy of the License at
+*  http://www.apache.org/licenses/LICENSE-2.0
+*  Unless required by applicable law or agreed to in writing, software
+*  distributed under the License is distributed on an "AS IS" BASIS,
+*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+*  See the License for the specific language governing permissions and
+*  limitations under the License.
+*/
+
+#ifndef __VOICE_CONTROL_PANEL_VIEW_H
+#define __VOICE_CONTROL_PANEL_VIEW_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int vc_panel_view_create(void *data);
+
+void vc_panel_view_destroy(void *data);
+
+int vc_panel_view_show(void *data);
+
+int vc_panel_view_hide(void *data);
+
+int vc_panel_view_show_help(void *data);
+
+int vc_panel_view_hide_help(void *data);
+
+int vc_panel_view_show_result(void *data, const char *result);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __VOICE_CONTROL_PANEL_VIEW_H */
+
+/*
+vi:ts=4:ai:nowrap:expandtab
+*/