summaryrefslogtreecommitdiffstats
path: root/demo#3/common/libhomescreen
diff options
context:
space:
mode:
Diffstat (limited to 'demo#3/common/libhomescreen')
-rw-r--r--demo#3/common/libhomescreen/CMakeLists.txt43
-rw-r--r--demo#3/common/libhomescreen/LICENSE54
-rw-r--r--demo#3/common/libhomescreen/README.md29
-rw-r--r--demo#3/common/libhomescreen/include/CMakeLists.txt19
-rw-r--r--demo#3/common/libhomescreen/include/hmi-debug.h70
-rw-r--r--demo#3/common/libhomescreen/include/libhomescreen.hpp101
-rw-r--r--demo#3/common/libhomescreen/libhomescreen.pc.in12
-rw-r--r--demo#3/common/libhomescreen/sample/simple-egl/CMakeLists.txt70
-rw-r--r--demo#3/common/libhomescreen/sample/simple-egl/LICENSE.APL-2.0204
-rw-r--r--demo#3/common/libhomescreen/sample/simple-egl/LICENSE.MIT23
-rw-r--r--demo#3/common/libhomescreen/sample/simple-egl/README.md27
-rw-r--r--demo#3/common/libhomescreen/sample/simple-egl/include/hmi-debug.h70
-rw-r--r--demo#3/common/libhomescreen/sample/simple-egl/include/platform.h115
-rw-r--r--demo#3/common/libhomescreen/sample/simple-egl/package/hvac/config.xml16
-rw-r--r--demo#3/common/libhomescreen/sample/simple-egl/package/hvac/icon.svg279
-rw-r--r--demo#3/common/libhomescreen/sample/simple-egl/package/navi/config.xml16
-rw-r--r--demo#3/common/libhomescreen/sample/simple-egl/package/navi/icon.svg279
-rw-r--r--demo#3/common/libhomescreen/sample/simple-egl/package/root/config.xml16
-rw-r--r--demo#3/common/libhomescreen/sample/simple-egl/package/root/icon.svg279
-rw-r--r--demo#3/common/libhomescreen/sample/simple-egl/src/simple-egl.cpp681
-rw-r--r--demo#3/common/libhomescreen/sample/template/LICENSE.APL-2.0204
-rw-r--r--demo#3/common/libhomescreen/sample/template/README.md25
-rw-r--r--demo#3/common/libhomescreen/sample/template/main.cpp225
-rw-r--r--demo#3/common/libhomescreen/sample/template/smhandler.cpp157
-rw-r--r--demo#3/common/libhomescreen/sample/template/smhandler.h58
-rw-r--r--demo#3/common/libhomescreen/sample/template/wmhandler.cpp39
-rw-r--r--demo#3/common/libhomescreen/sample/template/wmhandler.h47
-rw-r--r--demo#3/common/libhomescreen/src/CMakeLists.txt48
-rw-r--r--demo#3/common/libhomescreen/src/libhomescreen.cpp643
29 files changed, 3849 insertions, 0 deletions
diff --git a/demo#3/common/libhomescreen/CMakeLists.txt b/demo#3/common/libhomescreen/CMakeLists.txt
new file mode 100644
index 0000000..29adeee
--- /dev/null
+++ b/demo#3/common/libhomescreen/CMakeLists.txt
@@ -0,0 +1,43 @@
+#
+# Copyright (c) 2017 TOYOTA MOTOR CORPORATION
+#
+# 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.
+#
+
+project(libhomescreen C CXX)
+
+cmake_minimum_required(VERSION 2.8)
+
+set(PROJECT_NAME "LIBHOMESCREEN")
+set(PROJECT_VERSION "1.0")
+set(PROJECT_PRETTY_NAME "LIBHOMESCREEN")
+set(PROJECT_DESCRIPTION "Library for accessing agl service homescreen 2017 with C/C++")
+set(PROJECT_INCLUDEDIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR})
+set(PROJECT_LIBDIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR})
+set(LIBHOMESCREEN_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/include)
+
+# get pkgconfig
+INCLUDE(FindPkgConfig)
+link_libraries(-Wl,--as-needed -Wl,--gc-sections -Wl,--no-undefined)
+
+set(CMAKE_BUILD_TYPE Debug)
+set(USE_HMI_DEBUG FALSE)
+
+add_subdirectory(src)
+add_subdirectory(include)
+
+#generate configure file
+configure_file(libhomescreen.pc.in libhomescreen.pc @ONLY)
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/libhomescreen.pc
+ DESTINATION
+ ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
diff --git a/demo#3/common/libhomescreen/LICENSE b/demo#3/common/libhomescreen/LICENSE
new file mode 100644
index 0000000..31c692a
--- /dev/null
+++ b/demo#3/common/libhomescreen/LICENSE
@@ -0,0 +1,54 @@
+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:
+
+ You must give any other recipients of the Work or Derivative Works a copy of this License; and
+ You must cause any modified files to carry prominent notices stating that You changed the files; and
+ 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
+ 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
diff --git a/demo#3/common/libhomescreen/README.md b/demo#3/common/libhomescreen/README.md
new file mode 100644
index 0000000..24e5e56
--- /dev/null
+++ b/demo#3/common/libhomescreen/README.md
@@ -0,0 +1,29 @@
+This project contains:
+
+libhomescreen: HomeScreen API C++ shared library
+
+AGL repo for source code:
+https://gerrit.automotivelinux.org/gerrit/p/src/libhomescreen.git
+
+AGL repo for bitbake recipe:
+https://gerrit.automotivelinux.org/gerrit/gitweb?p=AGL/meta-agl-devel.git;a=blob;f=recipes-demo-hmi/libhomescreen/libhomescreen_git.bb
+
+Quickstart:
+
+Instructions for building libhomescreen
+---------------------------------------
+
+The libhomescreen is part of the
+packagegroup-hmi-framework
+packagegroup.
+
+This also includes the following apps:
+- agl-service-windowmanager-2017
+- agl-service-soundmanager-2017
+- agl-service-homescreen-2017
+- homescreen-2017
+- onscreenapp-2017
+
+To build all the above, follow the instrucions on the AGL
+source meta-agl/scripts/aglsetup.sh -m m3ulcb agl-demo agl-devel agl-appfw-smack agl-hmi-framework
+bitbake agl-demo-platform
diff --git a/demo#3/common/libhomescreen/include/CMakeLists.txt b/demo#3/common/libhomescreen/include/CMakeLists.txt
new file mode 100644
index 0000000..bb37242
--- /dev/null
+++ b/demo#3/common/libhomescreen/include/CMakeLists.txt
@@ -0,0 +1,19 @@
+#
+# Copyright (c) 2017 TOYOTA MOTOR CORPORATION
+#
+# 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.
+#
+
+if(DEFINED CMAKE_INSTALL_INCLUDEDIR)
+ INSTALL(FILES libhomescreen.hpp DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
+endif(DEFINED CMAKE_INSTALL_INCLUDEDIR)
diff --git a/demo#3/common/libhomescreen/include/hmi-debug.h b/demo#3/common/libhomescreen/include/hmi-debug.h
new file mode 100644
index 0000000..28705f5
--- /dev/null
+++ b/demo#3/common/libhomescreen/include/hmi-debug.h
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2017 TOYOTA MOTOR CORPORATION
+ *
+ * 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 __HMI_DEBUG_H__
+#define __HMI_DEBUG_H__
+
+#include <time.h>
+#include <stdio.h>
+#include <stdarg.h>
+#include <string.h>
+#include <stdlib.h>
+
+enum LOG_LEVEL{
+ LOG_LEVEL_NONE = 0,
+ LOG_LEVEL_ERROR,
+ LOG_LEVEL_WARNING,
+ LOG_LEVEL_NOTICE,
+ LOG_LEVEL_INFO,
+ LOG_LEVEL_DEBUG,
+ LOG_LEVEL_MAX = LOG_LEVEL_DEBUG
+};
+
+#define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
+
+#define HMI_ERROR(prefix, args,...) _HMI_LOG(LOG_LEVEL_ERROR, __FILENAME__, __FUNCTION__, __LINE__, prefix, args, ##__VA_ARGS__)
+#define HMI_WARNING(prefix, args,...) _HMI_LOG(LOG_LEVEL_WARNING, __FILENAME__, __FUNCTION__,__LINE__, prefix, args,##__VA_ARGS__)
+#define HMI_NOTICE(prefix, args,...) _HMI_LOG(LOG_LEVEL_NOTICE, __FILENAME__, __FUNCTION__,__LINE__, prefix, args,##__VA_ARGS__)
+#define HMI_INFO(prefix, args,...) _HMI_LOG(LOG_LEVEL_INFO, __FILENAME__, __FUNCTION__,__LINE__, prefix, args,##__VA_ARGS__)
+#define HMI_DEBUG(prefix, args,...) _HMI_LOG(LOG_LEVEL_DEBUG, __FILENAME__, __FUNCTION__,__LINE__, prefix, args,##__VA_ARGS__)
+
+static char ERROR_FLAG[6][20] = {"NONE", "ERROR", "WARNING", "NOTICE", "INFO", "DEBUG"};
+
+static void _HMI_LOG(enum LOG_LEVEL level, const char* file, const char* func, const int line, const char* prefix, const char* log, ...)
+{
+ const int log_level = (getenv("USE_HMI_DEBUG") == NULL)?LOG_LEVEL_ERROR:atoi(getenv("USE_HMI_DEBUG"));
+ if(log_level < level)
+ {
+ return;
+ }
+
+ char *message;
+ struct timespec tp;
+ unsigned int time;
+
+ clock_gettime(CLOCK_REALTIME, &tp);
+ time = (tp.tv_sec * 1000000L) + (tp.tv_nsec / 1000);
+
+ va_list args;
+ va_start(args, log);
+ if (log == NULL || vasprintf(&message, log, args) < 0)
+ message = NULL;
+ fprintf(stderr, "[%10.3f] [%s %s] [%s, %s(), Line:%d] >>> %s \n", time / 1000.0, prefix, ERROR_FLAG[level], file, func, line, message);
+ va_end(args);
+ free(message);
+}
+
+#endif //__HMI_DEBUG_H__
diff --git a/demo#3/common/libhomescreen/include/libhomescreen.hpp b/demo#3/common/libhomescreen/include/libhomescreen.hpp
new file mode 100644
index 0000000..f07e62f
--- /dev/null
+++ b/demo#3/common/libhomescreen/include/libhomescreen.hpp
@@ -0,0 +1,101 @@
+/*
+ * Copyright (c) 2017 TOYOTA MOTOR CORPORATION
+ *
+ * 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 LIBHOMESCREEN_H
+#define LIBHOMESCREEN_H
+#include <vector>
+#include <map>
+#include <string>
+#include <functional>
+#include <json-c/json.h>
+#include <systemd/sd-event.h>
+extern "C"
+{
+#include <afb/afb-wsj1.h>
+#include <afb/afb-ws-client.h>
+}
+
+class LibHomeScreen
+{
+public:
+ LibHomeScreen();
+ ~LibHomeScreen();
+
+ LibHomeScreen(const LibHomeScreen &) = delete;
+ LibHomeScreen &operator=(const LibHomeScreen &) = delete;
+
+ using handler_func = std::function<void(json_object*)>;
+
+ enum EventType {
+ Event_ShowWindow = 1,
+ Event_TapShortcut = 1,
+ Event_OnScreenMessage,
+ Event_OnScreenReply,
+ Event_AllocateRestriction,
+ Event_ReleaseRestriction
+ };
+
+ static const std::vector<std::string> api_list;
+ static const std::vector<std::string> event_list;
+
+ /* Method */
+ int init(const int port, const std::string& token);
+
+ int tapShortcut(const char* application_name);
+ int onScreenMessage(const char* display_message);
+ int onScreenReply(const char* reply_message);
+
+ void set_event_handler(enum EventType et, handler_func f);
+
+ void registerCallback(
+ void (*event_cb)(const std::string& event, struct json_object* event_contents),
+ void (*reply_cb)(struct json_object* reply_contents),
+ void (*hangup_cb)(void) = nullptr);
+
+ int call(const std::string& verb, struct json_object* arg);
+ int call(const char* verb, struct json_object* arg);
+ int subscribe(const std::string& event_name);
+ int unsubscribe(const std::string& event_name);
+ int allocateRestriction(const char* area);
+ int releaseRestriction(const char* area);
+ int showWindow(const char* id, json_object* json);
+
+private:
+ int initialize_websocket();
+
+ void (*onEvent)(const std::string& event, struct json_object* event_contents);
+ void (*onReply)(struct json_object* reply);
+ void (*onHangup)(void);
+
+ struct afb_wsj1* sp_websock;
+ struct afb_wsj1_itf minterface;
+ sd_event* mploop;
+ std::string muri;
+
+ int mport = 2000;
+ std::string mtoken = "hs";
+
+ std::map<EventType, handler_func> handlers;
+
+public:
+ /* Don't use/ Internal only */
+ void on_hangup(void *closure, struct afb_wsj1 *wsj);
+ void on_call(void *closure, const char *api, const char *verb, struct afb_wsj1_msg *msg);
+ void on_event(void *closure, const char *event, struct afb_wsj1_msg *msg);
+ void on_reply(void *closure, struct afb_wsj1_msg *msg);
+};
+
+#endif /* LIBHOMESCREEN_H */
diff --git a/demo#3/common/libhomescreen/libhomescreen.pc.in b/demo#3/common/libhomescreen/libhomescreen.pc.in
new file mode 100644
index 0000000..809abbd
--- /dev/null
+++ b/demo#3/common/libhomescreen/libhomescreen.pc.in
@@ -0,0 +1,12 @@
+includedir=@PROJECT_INCLUDEDIR@
+libdir=@PROJECT_LIBDIR@
+binding_install_dir=@binding_install_dir@
+
+Name: @PROJECT_PRETTY_NAME@
+Description: @PROJECT_DESCRIPTION@
+Version: @PROJECT_VERSION@
+URL: @PROJECT_URL@
+
+Requires: json-c afb-daemon
+Cflags: -I${includedir}
+Libs: -L${libdir} -lhomescreen
diff --git a/demo#3/common/libhomescreen/sample/simple-egl/CMakeLists.txt b/demo#3/common/libhomescreen/sample/simple-egl/CMakeLists.txt
new file mode 100644
index 0000000..57bdfbd
--- /dev/null
+++ b/demo#3/common/libhomescreen/sample/simple-egl/CMakeLists.txt
@@ -0,0 +1,70 @@
+#
+# Copyright (c) 2017 TOYOTA MOTOR CORPORATION
+#
+# 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.
+#
+
+project(simple-egl C CXX)
+
+cmake_minimum_required(VERSION 3.0)
+
+set(PROJECT_NAME "simple-egl")
+set(PROJECT_VERSION "1.0")
+set(PROJECT_PRETTY_NAME "SE")
+set(PROJECT_DESCRIPTION "Sample application for homescreen and windowmanager")
+set(PROJECT_URL "")
+set(CMAKE_CXX_FLAGS "-Wall -fpermissive")
+
+#source directory
+aux_source_directory(src DIR_SRCS)
+
+#head file path
+include_directories(include)
+
+#set extern libraries
+SET(LIBRARIES
+ libwindowmanager.so
+ libEGL.so
+ libGLESv2.so
+ libm.so
+ libwayland-egl.so
+ libwayland-client.so
+ libjson-c.so
+ libhomescreen.so
+ librt.so
+ libpthread.so
+)
+
+#add executable file
+add_executable(simple-egl ${DIR_SRCS})
+
+#add link library
+TARGET_LINK_LIBRARIES(simple-egl ${LIBRARIES})
+
+add_custom_command(TARGET simple-egl POST_BUILD
+ COMMAND cp -rf ${CMAKE_CURRENT_SOURCE_DIR}/package ${PROJECT_BINARY_DIR}
+ COMMAND mkdir -p ${PROJECT_BINARY_DIR}/package/root/bin
+ COMMAND cp -rf ${PROJECT_BINARY_DIR}/simple-egl ${PROJECT_BINARY_DIR}/package/root/bin)
+
+add_custom_target(widget DEPENDS ${PROJECT_BINARY_DIR}/package/root
+ COMMAND wgtpkg-pack -f -o ${PROJECT_BINARY_DIR}/package/${PROJECT_NAME}.wgt ${PROJECT_BINARY_DIR}/package/root)
+
+add_custom_target(hvac DEPENDS ${PROJECT_BINARY_DIR}/package/root
+ COMMAND mkdir -p ${PROJECT_BINARY_DIR}/package/hvac/bin
+ COMMAND cp -rf ${PROJECT_BINARY_DIR}/simple-egl ${PROJECT_BINARY_DIR}/package/hvac/bin/hvac
+ COMMAND wgtpkg-pack -f -o ${PROJECT_BINARY_DIR}/package/hvac.wgt ${PROJECT_BINARY_DIR}/package/hvac)
+
+add_custom_target(navi DEPENDS ${PROJECT_BINARY_DIR}/package/root
+ COMMAND mkdir -p ${PROJECT_BINARY_DIR}/package/navi/bin
+ COMMAND cp -rf ${PROJECT_BINARY_DIR}/simple-egl ${PROJECT_BINARY_DIR}/package/navi/bin/navi
+ COMMAND wgtpkg-pack -f -o ${PROJECT_BINARY_DIR}/package/navi.wgt ${PROJECT_BINARY_DIR}/package/navi)
diff --git a/demo#3/common/libhomescreen/sample/simple-egl/LICENSE.APL-2.0 b/demo#3/common/libhomescreen/sample/simple-egl/LICENSE.APL-2.0
new file mode 100644
index 0000000..b3201ab
--- /dev/null
+++ b/demo#3/common/libhomescreen/sample/simple-egl/LICENSE.APL-2.0
@@ -0,0 +1,204 @@
+
+
+ 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/demo#3/common/libhomescreen/sample/simple-egl/LICENSE.MIT b/demo#3/common/libhomescreen/sample/simple-egl/LICENSE.MIT
new file mode 100644
index 0000000..33f8bef
--- /dev/null
+++ b/demo#3/common/libhomescreen/sample/simple-egl/LICENSE.MIT
@@ -0,0 +1,23 @@
+
+MIT License
+
+Copyright (c) <year> <copyright holders>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
diff --git a/demo#3/common/libhomescreen/sample/simple-egl/README.md b/demo#3/common/libhomescreen/sample/simple-egl/README.md
new file mode 100644
index 0000000..42820e1
--- /dev/null
+++ b/demo#3/common/libhomescreen/sample/simple-egl/README.md
@@ -0,0 +1,27 @@
+Information
+====
+<br>This is a sample application for homescreen-2017 and windowmanager-2017.
+
+How to compile and install
+====
+<br>$ mkdir build
+<br>$ cd build
+<br>$ cmake ..
+<br>$ make
+<br>$ make widget
+
+<br>Copy package/simple-egl.wgt to rootfs.
+
+How to use
+====
+<br>afm-util install simple-egl.wgt
+<br>afm-util start simple-egl@0.1
+
+Depends
+====
+<br>homescreen-2017
+<br>agl-service-homescreen-2017
+<br>agl-service-windowmanger-2017
+<br>libhomescreen
+<br>libwindowmanager
+<br>wayland-ivi-extension
diff --git a/demo#3/common/libhomescreen/sample/simple-egl/include/hmi-debug.h b/demo#3/common/libhomescreen/sample/simple-egl/include/hmi-debug.h
new file mode 100644
index 0000000..28705f5
--- /dev/null
+++ b/demo#3/common/libhomescreen/sample/simple-egl/include/hmi-debug.h
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2017 TOYOTA MOTOR CORPORATION
+ *
+ * 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 __HMI_DEBUG_H__
+#define __HMI_DEBUG_H__
+
+#include <time.h>
+#include <stdio.h>
+#include <stdarg.h>
+#include <string.h>
+#include <stdlib.h>
+
+enum LOG_LEVEL{
+ LOG_LEVEL_NONE = 0,
+ LOG_LEVEL_ERROR,
+ LOG_LEVEL_WARNING,
+ LOG_LEVEL_NOTICE,
+ LOG_LEVEL_INFO,
+ LOG_LEVEL_DEBUG,
+ LOG_LEVEL_MAX = LOG_LEVEL_DEBUG
+};
+
+#define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
+
+#define HMI_ERROR(prefix, args,...) _HMI_LOG(LOG_LEVEL_ERROR, __FILENAME__, __FUNCTION__, __LINE__, prefix, args, ##__VA_ARGS__)
+#define HMI_WARNING(prefix, args,...) _HMI_LOG(LOG_LEVEL_WARNING, __FILENAME__, __FUNCTION__,__LINE__, prefix, args,##__VA_ARGS__)
+#define HMI_NOTICE(prefix, args,...) _HMI_LOG(LOG_LEVEL_NOTICE, __FILENAME__, __FUNCTION__,__LINE__, prefix, args,##__VA_ARGS__)
+#define HMI_INFO(prefix, args,...) _HMI_LOG(LOG_LEVEL_INFO, __FILENAME__, __FUNCTION__,__LINE__, prefix, args,##__VA_ARGS__)
+#define HMI_DEBUG(prefix, args,...) _HMI_LOG(LOG_LEVEL_DEBUG, __FILENAME__, __FUNCTION__,__LINE__, prefix, args,##__VA_ARGS__)
+
+static char ERROR_FLAG[6][20] = {"NONE", "ERROR", "WARNING", "NOTICE", "INFO", "DEBUG"};
+
+static void _HMI_LOG(enum LOG_LEVEL level, const char* file, const char* func, const int line, const char* prefix, const char* log, ...)
+{
+ const int log_level = (getenv("USE_HMI_DEBUG") == NULL)?LOG_LEVEL_ERROR:atoi(getenv("USE_HMI_DEBUG"));
+ if(log_level < level)
+ {
+ return;
+ }
+
+ char *message;
+ struct timespec tp;
+ unsigned int time;
+
+ clock_gettime(CLOCK_REALTIME, &tp);
+ time = (tp.tv_sec * 1000000L) + (tp.tv_nsec / 1000);
+
+ va_list args;
+ va_start(args, log);
+ if (log == NULL || vasprintf(&message, log, args) < 0)
+ message = NULL;
+ fprintf(stderr, "[%10.3f] [%s %s] [%s, %s(), Line:%d] >>> %s \n", time / 1000.0, prefix, ERROR_FLAG[level], file, func, line, message);
+ va_end(args);
+ free(message);
+}
+
+#endif //__HMI_DEBUG_H__
diff --git a/demo#3/common/libhomescreen/sample/simple-egl/include/platform.h b/demo#3/common/libhomescreen/sample/simple-egl/include/platform.h
new file mode 100644
index 0000000..8fd57b0
--- /dev/null
+++ b/demo#3/common/libhomescreen/sample/simple-egl/include/platform.h
@@ -0,0 +1,115 @@
+/*
+ * Copyright © 2015 Collabora, Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#ifndef WESTON_PLATFORM_H
+#define WESTON_PLATFORM_H
+
+#include <string.h>
+
+#include <wayland-egl.h>
+#include <EGL/egl.h>
+#include <EGL/eglext.h>
+
+#ifndef EGL_PLATFORM_WAYLAND_KHR
+#define EGL_PLATFORM_WAYLAND_KHR 0x31D8
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#ifndef EGL_EXT_platform_base
+typedef EGLDisplay (*PFNEGLGETPLATFORMDISPLAYEXTPROC) (EGLenum platform,
+ void *native_display,
+ const EGLint *attrib_list);
+typedef EGLSurface (*PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC) (EGLDisplay dpy,
+ EGLConfig config,
+ void *native_window,
+ const EGLint *attrib_list);
+#endif
+
+static inline void *
+weston_platform_get_egl_proc_address(const char *address)
+{
+ const char *extensions = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
+
+ if (extensions
+ && (strstr(extensions, "EGL_EXT_platform_wayland")
+ || strstr(extensions, "EGL_KHR_platform_wayland"))) {
+ return (void *) eglGetProcAddress(address);
+ }
+
+ return NULL;
+}
+
+static inline EGLDisplay
+weston_platform_get_egl_display(EGLenum platform, void *native_display,
+ const EGLint *attrib_list)
+{
+ static PFNEGLGETPLATFORMDISPLAYEXTPROC get_platform_display = NULL;
+
+ if (!get_platform_display) {
+ get_platform_display = (PFNEGLGETPLATFORMDISPLAYEXTPROC)
+ weston_platform_get_egl_proc_address(
+ "eglGetPlatformDisplayEXT");
+ }
+
+ if (get_platform_display)
+ return get_platform_display(platform,
+ native_display, attrib_list);
+
+ return eglGetDisplay((EGLNativeDisplayType) native_display);
+}
+
+static inline EGLSurface
+weston_platform_create_egl_surface(EGLDisplay dpy, EGLConfig config,
+ void *native_window,
+ const EGLint *attrib_list)
+{
+ static PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC
+ create_platform_window = NULL;
+
+ if (!create_platform_window) {
+ create_platform_window = (PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC)
+ weston_platform_get_egl_proc_address(
+ "eglCreatePlatformWindowSurfaceEXT");
+ }
+
+ if (create_platform_window)
+ return create_platform_window(dpy, config,
+ native_window,
+ attrib_list);
+
+ return eglCreateWindowSurface(dpy, config,
+ (EGLNativeWindowType) native_window,
+ attrib_list);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* WESTON_PLATFORM_H */
diff --git a/demo#3/common/libhomescreen/sample/simple-egl/package/hvac/config.xml b/demo#3/common/libhomescreen/sample/simple-egl/package/hvac/config.xml
new file mode 100644
index 0000000..d903f0e
--- /dev/null
+++ b/demo#3/common/libhomescreen/sample/simple-egl/package/hvac/config.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<widget xmlns="http://www.w3.org/ns/widgets" id="hvac" version="0.1">
+ <name>HVAC</name>
+ <icon src="icon.svg"/>
+ <content src="bin/hvac" type="application/vnd.agl.native"/>
+ <description>This is a demo application for simple-egl</description>
+ <author>TOYOA</author>
+ <license>APL 2.0 + MIT</license>
+ <feature name="urn:AGL:widget:required-api">
+ <param name="homescreen" value="ws" />
+ <param name="windowmanager" value="ws" />
+ </feature>
+ <feature name="urn:AGL:widget:required-permission">
+ <param name="urn:AGL:permission::public:no-htdocs" value="required" />
+ </feature>
+</widget>
diff --git a/demo#3/common/libhomescreen/sample/simple-egl/package/hvac/icon.svg b/demo#3/common/libhomescreen/sample/simple-egl/package/hvac/icon.svg
new file mode 100644
index 0000000..91661a7
--- /dev/null
+++ b/demo#3/common/libhomescreen/sample/simple-egl/package/hvac/icon.svg
@@ -0,0 +1,279 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Generator: Adobe Illustrator 21.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+
+<svg
+ xmlns:i="&amp;ns_ai;"
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ version="1.1"
+ x="0px"
+ y="0px"
+ viewBox="0 0 320 320"
+ style="enable-background:new 0 0 320 320;"
+ xml:space="preserve"
+ id="svg2"
+ inkscape:version="0.91 r13725"
+ sodipodi:docname="icon.svg"><metadata
+ id="metadata1292"><rdf:RDF><cc:Work
+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs
+ id="defs1290" /><sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="2560"
+ inkscape:window-height="1464"
+ id="namedview1288"
+ showgrid="false"
+ inkscape:zoom="0.7375"
+ inkscape:cx="-572.20339"
+ inkscape:cy="160"
+ inkscape:window-x="0"
+ inkscape:window-y="0"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="svg2" /><style
+ type="text/css"
+ id="style4">
+ .st0{display:none;}
+ .st1{display:inline;}
+ .st2{opacity:0.4;fill:url(#SVGID_1_);}
+ .st3{fill:url(#SVGID_2_);}
+ .st4{fill:#FFFFFF;}
+ .st5{font-family:'Roboto-Regular';}
+ .st6{font-size:25px;}
+ .st7{letter-spacing:6;}
+ .st8{fill:url(#SVGID_3_);}
+ .st9{fill:url(#SVGID_4_);}
+ .st10{fill:url(#SVGID_5_);}
+ .st11{fill:url(#SVGID_6_);}
+ .st12{fill:url(#SVGID_7_);}
+ .st13{fill:url(#SVGID_8_);}
+ .st14{fill:url(#SVGID_9_);}
+ .st15{fill:url(#SVGID_10_);}
+ .st16{fill:url(#SVGID_11_);}
+ .st17{fill:url(#SVGID_12_);}
+ .st18{fill:url(#SVGID_13_);}
+ .st19{fill:url(#SVGID_14_);}
+ .st20{fill:url(#SVGID_15_);}
+ .st21{fill:url(#SVGID_16_);}
+ .st22{fill:url(#SVGID_17_);}
+ .st23{fill:url(#SVGID_18_);}
+ .st24{opacity:0.29;}
+ .st25{fill:url(#SVGID_19_);}
+ .st26{fill:url(#SVGID_20_);}
+ .st27{fill:url(#SVGID_21_);}
+ .st28{fill:url(#SVGID_22_);}
+ .st29{fill:url(#SVGID_23_);}
+ .st30{fill:url(#SVGID_24_);}
+ .st31{fill:url(#SVGID_25_);}
+ .st32{fill:url(#SVGID_26_);}
+ .st33{fill:url(#SVGID_27_);}
+ .st34{fill:url(#SVGID_28_);}
+ .st35{fill:url(#SVGID_29_);}
+ .st36{fill:url(#SVGID_30_);}
+ .st37{fill:url(#SVGID_31_);}
+ .st38{fill:url(#SVGID_32_);}
+ .st39{fill:url(#SVGID_33_);}
+ .st40{fill:url(#SVGID_34_);}
+ .st41{fill:url(#SVGID_35_);}
+ .st42{fill:url(#SVGID_36_);}
+ .st43{opacity:0.4;fill:url(#SVGID_37_);}
+ .st44{fill:url(#SVGID_38_);}
+ .st45{fill:url(#SVGID_39_);}
+ .st46{fill:url(#SVGID_40_);}
+ .st47{fill:url(#SVGID_41_);}
+ .st48{fill:url(#SVGID_42_);}
+ .st49{fill:url(#SVGID_43_);}
+ .st50{fill:url(#SVGID_44_);}
+ .st51{display:inline;opacity:0.29;}
+ .st52{display:inline;fill:url(#SVGID_45_);}
+ .st53{display:inline;fill:url(#SVGID_46_);}
+ .st54{display:inline;fill:#FFFFFF;}
+ .st55{display:inline;fill:url(#SVGID_47_);}
+ .st56{display:inline;fill:url(#SVGID_48_);}
+ .st57{display:inline;fill:url(#SVGID_49_);}
+ .st58{display:inline;fill:url(#SVGID_50_);}
+ .st59{display:inline;fill:url(#SVGID_51_);}
+ .st60{display:inline;fill:url(#SVGID_52_);}
+ .st61{opacity:0.4;fill:url(#SVGID_53_);}
+ .st62{fill:url(#SVGID_54_);}
+ .st63{fill:url(#SVGID_55_);}
+ .st64{fill:url(#SVGID_56_);}
+ .st65{fill:url(#SVGID_57_);}
+ .st66{fill:url(#SVGID_58_);}
+ .st67{opacity:0.4;fill:url(#SVGID_59_);}
+ .st68{fill:url(#SVGID_60_);}
+ .st69{fill:url(#SVGID_61_);}
+ .st70{fill:url(#SVGID_62_);}
+ .st71{fill:url(#SVGID_63_);}
+ .st72{fill:url(#SVGID_64_);}
+ .st73{fill:url(#SVGID_65_);}
+ .st74{fill:url(#SVGID_66_);}
+ .st75{fill:url(#SVGID_67_);}
+ .st76{fill:url(#SVGID_68_);}
+ .st77{fill:url(#SVGID_69_);}
+ .st78{fill:url(#SVGID_70_);}
+ .st79{fill:url(#SVGID_71_);}
+ .st80{fill:url(#SVGID_72_);}
+ .st81{fill:url(#SVGID_73_);}
+ .st82{fill:url(#SVGID_74_);}
+ .st83{fill:url(#SVGID_75_);}
+ .st84{fill:url(#SVGID_76_);}
+ .st85{fill:url(#SVGID_77_);}
+ .st86{fill:url(#SVGID_78_);}
+ .st87{fill:url(#SVGID_79_);}
+ .st88{fill:url(#SVGID_80_);}
+ .st89{fill:url(#SVGID_81_);}
+ .st90{fill:url(#SVGID_82_);}
+ .st91{fill:url(#SVGID_83_);}
+ .st92{fill:url(#SVGID_84_);}
+ .st93{fill:url(#SVGID_85_);}
+ .st94{fill:url(#SVGID_86_);}
+ .st95{opacity:0.4;fill:url(#SVGID_87_);}
+ .st96{fill:url(#SVGID_88_);}
+ .st97{fill:url(#SVGID_89_);}
+ .st98{fill:url(#SVGID_90_);}
+ .st99{fill:url(#SVGID_91_);}
+ .st100{fill:url(#SVGID_92_);}
+ .st101{fill:url(#SVGID_93_);}
+ .st102{fill:url(#SVGID_94_);}
+ .st103{opacity:0.4;fill:url(#SVGID_95_);}
+ .st104{fill:url(#SVGID_96_);}
+ .st105{fill:url(#SVGID_97_);}
+ .st106{fill:url(#SVGID_98_);}
+ .st107{fill:url(#SVGID_99_);}
+ .st108{fill:url(#SVGID_100_);}
+ .st109{fill:url(#SVGID_101_);}
+ .st110{display:inline;fill:url(#SVGID_102_);}
+ .st111{display:inline;fill:url(#SVGID_103_);}
+ .st112{fill:url(#SVGID_104_);}
+ .st113{fill:url(#SVGID_105_);}
+ .st114{fill:url(#SVGID_106_);}
+ .st115{fill:url(#SVGID_107_);}
+ .st116{fill:url(#SVGID_108_);}
+ .st117{opacity:0.4;fill:url(#SVGID_109_);}
+ .st118{fill:url(#SVGID_110_);}
+ .st119{fill:url(#SVGID_111_);}
+ .st120{fill:url(#SVGID_112_);}
+ .st121{fill:url(#SVGID_113_);}
+ .st122{fill:url(#SVGID_114_);}
+ .st123{opacity:0.4;fill:url(#SVGID_115_);}
+ .st124{fill:url(#SVGID_116_);}
+ .st125{fill:url(#SVGID_117_);}
+ .st126{fill:url(#SVGID_118_);}
+ .st127{display:inline;fill:url(#SVGID_119_);}
+ .st128{display:inline;fill:url(#SVGID_120_);}
+ .st129{fill:url(#SVGID_121_);}
+ .st130{fill:url(#SVGID_122_);}
+</style><switch
+ id="switch6"><g
+ i:extraneous="self"
+ id="g8"><g
+ id="Multimedia_Inactive_copy"><circle
+ class="st24"
+ cx="159.7"
+ cy="133.4"
+ r="101.9"
+ id="circle884" /><linearGradient
+ id="SVGID_91_"
+ gradientUnits="userSpaceOnUse"
+ x1="115.9317"
+ y1="254.1836"
+ x2="256.3852"
+ y2="-133.5267"><stop
+ offset="0"
+ style="stop-color:#8BC53F"
+ id="stop887" /><stop
+ offset="2.015080e-02"
+ style="stop-color:#7CCB56;stop-opacity:0.9678"
+ id="stop889" /><stop
+ offset="6.089833e-02"
+ style="stop-color:#62D67D;stop-opacity:0.9028"
+ id="stop891" /><stop
+ offset="0.1057"
+ style="stop-color:#4BDFA0;stop-opacity:0.8312"
+ id="stop893" /><stop
+ offset="0.1543"
+ style="stop-color:#38E7BE;stop-opacity:0.7537"
+ id="stop895" /><stop
+ offset="0.2077"
+ style="stop-color:#28EED6;stop-opacity:0.6684"
+ id="stop897" /><stop
+ offset="0.2681"
+ style="stop-color:#1CF3E8;stop-opacity:0.572"
+ id="stop899" /><stop
+ offset="0.3394"
+ style="stop-color:#13F6F5;stop-opacity:0.4581"
+ id="stop901" /><stop
+ offset="0.4323"
+ style="stop-color:#0EF8FD;stop-opacity:0.3098"
+ id="stop903" /><stop
+ offset="0.6264"
+ style="stop-color:#0DF9FF;stop-opacity:0"
+ id="stop905" /></linearGradient><circle
+ class="st99"
+ cx="159.7"
+ cy="133.4"
+ r="101.9"
+ id="circle907" /><linearGradient
+ id="SVGID_92_"
+ gradientUnits="userSpaceOnUse"
+ x1="4.0481"
+ y1="287.9492"
+ x2="320.4859"
+ y2="-15.4029"
+ gradientTransform="matrix(1 5.464556e-03 -5.464556e-03 1 -2.0192 -3.0212)"><stop
+ offset="0"
+ style="stop-color:#59FF7F"
+ id="stop910" /><stop
+ offset="1"
+ style="stop-color:#6BFBFF"
+ id="stop912" /></linearGradient><path
+ class="st100"
+ d="M160,238.8c-0.2,0-0.4,0-0.6,0c-58-0.3-104.9-47.7-104.6-105.7C55.2,75.3,102.3,28.5,160,28.5 c0.2,0,0.4,0,0.6,0c58,0.3,104.9,47.7,104.6,105.7l0,0C264.8,192,217.7,238.8,160,238.8z M160,32.2 c-55.7,0-101.2,45.2-101.5,100.9c-0.3,55.9,45,101.7,100.9,102c0.2,0,0.4,0,0.6,0c55.7,0,101.2-45.2,101.5-100.9 c0.3-55.9-45-101.7-100.9-102C160.4,32.2,160.2,32.2,160,32.2z"
+ id="path914" /><g
+ id="g916"><text
+ transform="matrix(1 0 0 1 53.5841 284.7119)"
+ class="st4 st5 st6 st7"
+ id="text918">MULTIMEDIA</text>
+<linearGradient
+ id="SVGID_93_"
+ gradientUnits="userSpaceOnUse"
+ x1="140.5445"
+ y1="202.2363"
+ x2="186.8444"
+ y2="68.7049"><stop
+ offset="0"
+ style="stop-color:#59FF7F"
+ id="stop921" /><stop
+ offset="1"
+ style="stop-color:#6BFBFF"
+ id="stop923" /></linearGradient><path
+ class="st101"
+ d="M114.5,190.9c-6.4,0-12-2.6-14.8-7.5c-2.9-4.9-5.4-14.5,9.6-23.2c4.8-2.8,17.1-3.9,20.8-4l0.1,3.6 c-4.6,0.1-15.5,1.4-19.1,3.5c-9.4,5.4-12.1,11.5-8.3,18.3c3.8,6.6,14.6,7.6,24,2.2c6.6-3.8,10.6-10.5,10.7-17.9l-0.1-0.7V95.4 l71.9-14.2l0.1,71.3c0,6.7-3.3,16.4-12.5,21.8c-11.1,6.4-24.1,4.8-28.9-3.5c-2.9-4.9-5.4-14.5,9.6-23.2 c4.4-2.5,14.4-3.8,18.8-3.9l0.1,3.6c-4.2,0.1-13.5,1.4-17.1,3.5c-6.4,3.7-13.1,9.9-8.3,18.3c3.8,6.6,14.6,7.6,24,2.2 c7.9-4.5,10.7-12.8,10.7-18.5l-0.1-0.8V85.6l-64.7,12.7v66.8l0.1,0.7c0,8.7-4.7,16.6-12.5,21.1 C123.9,189.6,119,190.9,114.5,190.9z"
+ id="path925" /><linearGradient
+ id="SVGID_94_"
+ gradientUnits="userSpaceOnUse"
+ x1="145.3286"
+ y1="203.8951"
+ x2="191.6285"
+ y2="70.3637"><stop
+ offset="0"
+ style="stop-color:#59FF7F"
+ id="stop928" /><stop
+ offset="1"
+ style="stop-color:#6BFBFF"
+ id="stop930" /></linearGradient><polygon
+ class="st102"
+ points="155.6,123.3 154.8,119.8 195.5,110.2 196.3,113.7 "
+ id="polygon932" /></g></g></g></switch></svg> \ No newline at end of file
diff --git a/demo#3/common/libhomescreen/sample/simple-egl/package/navi/config.xml b/demo#3/common/libhomescreen/sample/simple-egl/package/navi/config.xml
new file mode 100644
index 0000000..33b5b67
--- /dev/null
+++ b/demo#3/common/libhomescreen/sample/simple-egl/package/navi/config.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<widget xmlns="http://www.w3.org/ns/widgets" id="navigation" version="0.1">
+ <name>Navigation</name>
+ <icon src="icon.svg"/>
+ <content src="bin/navi" type="application/vnd.agl.native"/>
+ <description>This is a demo application for simple-egl</description>
+ <author>TOYOA</author>
+ <license>APL 2.0 + MIT</license>
+ <feature name="urn:AGL:widget:required-api">
+ <param name="homescreen" value="ws" />
+ <param name="windowmanager" value="ws" />
+ </feature>
+ <feature name="urn:AGL:widget:required-permission">
+ <param name="urn:AGL:permission::public:no-htdocs" value="required" />
+ </feature>
+</widget>
diff --git a/demo#3/common/libhomescreen/sample/simple-egl/package/navi/icon.svg b/demo#3/common/libhomescreen/sample/simple-egl/package/navi/icon.svg
new file mode 100644
index 0000000..91661a7
--- /dev/null
+++ b/demo#3/common/libhomescreen/sample/simple-egl/package/navi/icon.svg
@@ -0,0 +1,279 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Generator: Adobe Illustrator 21.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+
+<svg
+ xmlns:i="&amp;ns_ai;"
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ version="1.1"
+ x="0px"
+ y="0px"
+ viewBox="0 0 320 320"
+ style="enable-background:new 0 0 320 320;"
+ xml:space="preserve"
+ id="svg2"
+ inkscape:version="0.91 r13725"
+ sodipodi:docname="icon.svg"><metadata
+ id="metadata1292"><rdf:RDF><cc:Work
+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs
+ id="defs1290" /><sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="2560"
+ inkscape:window-height="1464"
+ id="namedview1288"
+ showgrid="false"
+ inkscape:zoom="0.7375"
+ inkscape:cx="-572.20339"
+ inkscape:cy="160"
+ inkscape:window-x="0"
+ inkscape:window-y="0"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="svg2" /><style
+ type="text/css"
+ id="style4">
+ .st0{display:none;}
+ .st1{display:inline;}
+ .st2{opacity:0.4;fill:url(#SVGID_1_);}
+ .st3{fill:url(#SVGID_2_);}
+ .st4{fill:#FFFFFF;}
+ .st5{font-family:'Roboto-Regular';}
+ .st6{font-size:25px;}
+ .st7{letter-spacing:6;}
+ .st8{fill:url(#SVGID_3_);}
+ .st9{fill:url(#SVGID_4_);}
+ .st10{fill:url(#SVGID_5_);}
+ .st11{fill:url(#SVGID_6_);}
+ .st12{fill:url(#SVGID_7_);}
+ .st13{fill:url(#SVGID_8_);}
+ .st14{fill:url(#SVGID_9_);}
+ .st15{fill:url(#SVGID_10_);}
+ .st16{fill:url(#SVGID_11_);}
+ .st17{fill:url(#SVGID_12_);}
+ .st18{fill:url(#SVGID_13_);}
+ .st19{fill:url(#SVGID_14_);}
+ .st20{fill:url(#SVGID_15_);}
+ .st21{fill:url(#SVGID_16_);}
+ .st22{fill:url(#SVGID_17_);}
+ .st23{fill:url(#SVGID_18_);}
+ .st24{opacity:0.29;}
+ .st25{fill:url(#SVGID_19_);}
+ .st26{fill:url(#SVGID_20_);}
+ .st27{fill:url(#SVGID_21_);}
+ .st28{fill:url(#SVGID_22_);}
+ .st29{fill:url(#SVGID_23_);}
+ .st30{fill:url(#SVGID_24_);}
+ .st31{fill:url(#SVGID_25_);}
+ .st32{fill:url(#SVGID_26_);}
+ .st33{fill:url(#SVGID_27_);}
+ .st34{fill:url(#SVGID_28_);}
+ .st35{fill:url(#SVGID_29_);}
+ .st36{fill:url(#SVGID_30_);}
+ .st37{fill:url(#SVGID_31_);}
+ .st38{fill:url(#SVGID_32_);}
+ .st39{fill:url(#SVGID_33_);}
+ .st40{fill:url(#SVGID_34_);}
+ .st41{fill:url(#SVGID_35_);}
+ .st42{fill:url(#SVGID_36_);}
+ .st43{opacity:0.4;fill:url(#SVGID_37_);}
+ .st44{fill:url(#SVGID_38_);}
+ .st45{fill:url(#SVGID_39_);}
+ .st46{fill:url(#SVGID_40_);}
+ .st47{fill:url(#SVGID_41_);}
+ .st48{fill:url(#SVGID_42_);}
+ .st49{fill:url(#SVGID_43_);}
+ .st50{fill:url(#SVGID_44_);}
+ .st51{display:inline;opacity:0.29;}
+ .st52{display:inline;fill:url(#SVGID_45_);}
+ .st53{display:inline;fill:url(#SVGID_46_);}
+ .st54{display:inline;fill:#FFFFFF;}
+ .st55{display:inline;fill:url(#SVGID_47_);}
+ .st56{display:inline;fill:url(#SVGID_48_);}
+ .st57{display:inline;fill:url(#SVGID_49_);}
+ .st58{display:inline;fill:url(#SVGID_50_);}
+ .st59{display:inline;fill:url(#SVGID_51_);}
+ .st60{display:inline;fill:url(#SVGID_52_);}
+ .st61{opacity:0.4;fill:url(#SVGID_53_);}
+ .st62{fill:url(#SVGID_54_);}
+ .st63{fill:url(#SVGID_55_);}
+ .st64{fill:url(#SVGID_56_);}
+ .st65{fill:url(#SVGID_57_);}
+ .st66{fill:url(#SVGID_58_);}
+ .st67{opacity:0.4;fill:url(#SVGID_59_);}
+ .st68{fill:url(#SVGID_60_);}
+ .st69{fill:url(#SVGID_61_);}
+ .st70{fill:url(#SVGID_62_);}
+ .st71{fill:url(#SVGID_63_);}
+ .st72{fill:url(#SVGID_64_);}
+ .st73{fill:url(#SVGID_65_);}
+ .st74{fill:url(#SVGID_66_);}
+ .st75{fill:url(#SVGID_67_);}
+ .st76{fill:url(#SVGID_68_);}
+ .st77{fill:url(#SVGID_69_);}
+ .st78{fill:url(#SVGID_70_);}
+ .st79{fill:url(#SVGID_71_);}
+ .st80{fill:url(#SVGID_72_);}
+ .st81{fill:url(#SVGID_73_);}
+ .st82{fill:url(#SVGID_74_);}
+ .st83{fill:url(#SVGID_75_);}
+ .st84{fill:url(#SVGID_76_);}
+ .st85{fill:url(#SVGID_77_);}
+ .st86{fill:url(#SVGID_78_);}
+ .st87{fill:url(#SVGID_79_);}
+ .st88{fill:url(#SVGID_80_);}
+ .st89{fill:url(#SVGID_81_);}
+ .st90{fill:url(#SVGID_82_);}
+ .st91{fill:url(#SVGID_83_);}
+ .st92{fill:url(#SVGID_84_);}
+ .st93{fill:url(#SVGID_85_);}
+ .st94{fill:url(#SVGID_86_);}
+ .st95{opacity:0.4;fill:url(#SVGID_87_);}
+ .st96{fill:url(#SVGID_88_);}
+ .st97{fill:url(#SVGID_89_);}
+ .st98{fill:url(#SVGID_90_);}
+ .st99{fill:url(#SVGID_91_);}
+ .st100{fill:url(#SVGID_92_);}
+ .st101{fill:url(#SVGID_93_);}
+ .st102{fill:url(#SVGID_94_);}
+ .st103{opacity:0.4;fill:url(#SVGID_95_);}
+ .st104{fill:url(#SVGID_96_);}
+ .st105{fill:url(#SVGID_97_);}
+ .st106{fill:url(#SVGID_98_);}
+ .st107{fill:url(#SVGID_99_);}
+ .st108{fill:url(#SVGID_100_);}
+ .st109{fill:url(#SVGID_101_);}
+ .st110{display:inline;fill:url(#SVGID_102_);}
+ .st111{display:inline;fill:url(#SVGID_103_);}
+ .st112{fill:url(#SVGID_104_);}
+ .st113{fill:url(#SVGID_105_);}
+ .st114{fill:url(#SVGID_106_);}
+ .st115{fill:url(#SVGID_107_);}
+ .st116{fill:url(#SVGID_108_);}
+ .st117{opacity:0.4;fill:url(#SVGID_109_);}
+ .st118{fill:url(#SVGID_110_);}
+ .st119{fill:url(#SVGID_111_);}
+ .st120{fill:url(#SVGID_112_);}
+ .st121{fill:url(#SVGID_113_);}
+ .st122{fill:url(#SVGID_114_);}
+ .st123{opacity:0.4;fill:url(#SVGID_115_);}
+ .st124{fill:url(#SVGID_116_);}
+ .st125{fill:url(#SVGID_117_);}
+ .st126{fill:url(#SVGID_118_);}
+ .st127{display:inline;fill:url(#SVGID_119_);}
+ .st128{display:inline;fill:url(#SVGID_120_);}
+ .st129{fill:url(#SVGID_121_);}
+ .st130{fill:url(#SVGID_122_);}
+</style><switch
+ id="switch6"><g
+ i:extraneous="self"
+ id="g8"><g
+ id="Multimedia_Inactive_copy"><circle
+ class="st24"
+ cx="159.7"
+ cy="133.4"
+ r="101.9"
+ id="circle884" /><linearGradient
+ id="SVGID_91_"
+ gradientUnits="userSpaceOnUse"
+ x1="115.9317"
+ y1="254.1836"
+ x2="256.3852"
+ y2="-133.5267"><stop
+ offset="0"
+ style="stop-color:#8BC53F"
+ id="stop887" /><stop
+ offset="2.015080e-02"
+ style="stop-color:#7CCB56;stop-opacity:0.9678"
+ id="stop889" /><stop
+ offset="6.089833e-02"
+ style="stop-color:#62D67D;stop-opacity:0.9028"
+ id="stop891" /><stop
+ offset="0.1057"
+ style="stop-color:#4BDFA0;stop-opacity:0.8312"
+ id="stop893" /><stop
+ offset="0.1543"
+ style="stop-color:#38E7BE;stop-opacity:0.7537"
+ id="stop895" /><stop
+ offset="0.2077"
+ style="stop-color:#28EED6;stop-opacity:0.6684"
+ id="stop897" /><stop
+ offset="0.2681"
+ style="stop-color:#1CF3E8;stop-opacity:0.572"
+ id="stop899" /><stop
+ offset="0.3394"
+ style="stop-color:#13F6F5;stop-opacity:0.4581"
+ id="stop901" /><stop
+ offset="0.4323"
+ style="stop-color:#0EF8FD;stop-opacity:0.3098"
+ id="stop903" /><stop
+ offset="0.6264"
+ style="stop-color:#0DF9FF;stop-opacity:0"
+ id="stop905" /></linearGradient><circle
+ class="st99"
+ cx="159.7"
+ cy="133.4"
+ r="101.9"
+ id="circle907" /><linearGradient
+ id="SVGID_92_"
+ gradientUnits="userSpaceOnUse"
+ x1="4.0481"
+ y1="287.9492"
+ x2="320.4859"
+ y2="-15.4029"
+ gradientTransform="matrix(1 5.464556e-03 -5.464556e-03 1 -2.0192 -3.0212)"><stop
+ offset="0"
+ style="stop-color:#59FF7F"
+ id="stop910" /><stop
+ offset="1"
+ style="stop-color:#6BFBFF"
+ id="stop912" /></linearGradient><path
+ class="st100"
+ d="M160,238.8c-0.2,0-0.4,0-0.6,0c-58-0.3-104.9-47.7-104.6-105.7C55.2,75.3,102.3,28.5,160,28.5 c0.2,0,0.4,0,0.6,0c58,0.3,104.9,47.7,104.6,105.7l0,0C264.8,192,217.7,238.8,160,238.8z M160,32.2 c-55.7,0-101.2,45.2-101.5,100.9c-0.3,55.9,45,101.7,100.9,102c0.2,0,0.4,0,0.6,0c55.7,0,101.2-45.2,101.5-100.9 c0.3-55.9-45-101.7-100.9-102C160.4,32.2,160.2,32.2,160,32.2z"
+ id="path914" /><g
+ id="g916"><text
+ transform="matrix(1 0 0 1 53.5841 284.7119)"
+ class="st4 st5 st6 st7"
+ id="text918">MULTIMEDIA</text>
+<linearGradient
+ id="SVGID_93_"
+ gradientUnits="userSpaceOnUse"
+ x1="140.5445"
+ y1="202.2363"
+ x2="186.8444"
+ y2="68.7049"><stop
+ offset="0"
+ style="stop-color:#59FF7F"
+ id="stop921" /><stop
+ offset="1"
+ style="stop-color:#6BFBFF"
+ id="stop923" /></linearGradient><path
+ class="st101"
+ d="M114.5,190.9c-6.4,0-12-2.6-14.8-7.5c-2.9-4.9-5.4-14.5,9.6-23.2c4.8-2.8,17.1-3.9,20.8-4l0.1,3.6 c-4.6,0.1-15.5,1.4-19.1,3.5c-9.4,5.4-12.1,11.5-8.3,18.3c3.8,6.6,14.6,7.6,24,2.2c6.6-3.8,10.6-10.5,10.7-17.9l-0.1-0.7V95.4 l71.9-14.2l0.1,71.3c0,6.7-3.3,16.4-12.5,21.8c-11.1,6.4-24.1,4.8-28.9-3.5c-2.9-4.9-5.4-14.5,9.6-23.2 c4.4-2.5,14.4-3.8,18.8-3.9l0.1,3.6c-4.2,0.1-13.5,1.4-17.1,3.5c-6.4,3.7-13.1,9.9-8.3,18.3c3.8,6.6,14.6,7.6,24,2.2 c7.9-4.5,10.7-12.8,10.7-18.5l-0.1-0.8V85.6l-64.7,12.7v66.8l0.1,0.7c0,8.7-4.7,16.6-12.5,21.1 C123.9,189.6,119,190.9,114.5,190.9z"
+ id="path925" /><linearGradient
+ id="SVGID_94_"
+ gradientUnits="userSpaceOnUse"
+ x1="145.3286"
+ y1="203.8951"
+ x2="191.6285"
+ y2="70.3637"><stop
+ offset="0"
+ style="stop-color:#59FF7F"
+ id="stop928" /><stop
+ offset="1"
+ style="stop-color:#6BFBFF"
+ id="stop930" /></linearGradient><polygon
+ class="st102"
+ points="155.6,123.3 154.8,119.8 195.5,110.2 196.3,113.7 "
+ id="polygon932" /></g></g></g></switch></svg> \ No newline at end of file
diff --git a/demo#3/common/libhomescreen/sample/simple-egl/package/root/config.xml b/demo#3/common/libhomescreen/sample/simple-egl/package/root/config.xml
new file mode 100644
index 0000000..d6402ad
--- /dev/null
+++ b/demo#3/common/libhomescreen/sample/simple-egl/package/root/config.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<widget xmlns="http://www.w3.org/ns/widgets" id="simple-egl" version="0.1">
+ <name>SIMPLE-EGL</name>
+ <icon src="icon.svg"/>
+ <content src="bin/simple-egl" type="application/vnd.agl.native"/>
+ <description>This is a demo application for simple-egl</description>
+ <author>TOYOA</author>
+ <license>APL 2.0 + MIT</license>
+ <feature name="urn:AGL:widget:required-api">
+ <param name="homescreen" value="ws" />
+ <param name="windowmanager" value="ws" />
+ </feature>
+ <feature name="urn:AGL:widget:required-permission">
+ <param name="urn:AGL:permission::public:no-htdocs" value="required" />
+ </feature>
+</widget>
diff --git a/demo#3/common/libhomescreen/sample/simple-egl/package/root/icon.svg b/demo#3/common/libhomescreen/sample/simple-egl/package/root/icon.svg
new file mode 100644
index 0000000..91661a7
--- /dev/null
+++ b/demo#3/common/libhomescreen/sample/simple-egl/package/root/icon.svg
@@ -0,0 +1,279 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Generator: Adobe Illustrator 21.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+
+<svg
+ xmlns:i="&amp;ns_ai;"
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ version="1.1"
+ x="0px"
+ y="0px"
+ viewBox="0 0 320 320"
+ style="enable-background:new 0 0 320 320;"
+ xml:space="preserve"
+ id="svg2"
+ inkscape:version="0.91 r13725"
+ sodipodi:docname="icon.svg"><metadata
+ id="metadata1292"><rdf:RDF><cc:Work
+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs
+ id="defs1290" /><sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="2560"
+ inkscape:window-height="1464"
+ id="namedview1288"
+ showgrid="false"
+ inkscape:zoom="0.7375"
+ inkscape:cx="-572.20339"
+ inkscape:cy="160"
+ inkscape:window-x="0"
+ inkscape:window-y="0"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="svg2" /><style
+ type="text/css"
+ id="style4">
+ .st0{display:none;}
+ .st1{display:inline;}
+ .st2{opacity:0.4;fill:url(#SVGID_1_);}
+ .st3{fill:url(#SVGID_2_);}
+ .st4{fill:#FFFFFF;}
+ .st5{font-family:'Roboto-Regular';}
+ .st6{font-size:25px;}
+ .st7{letter-spacing:6;}
+ .st8{fill:url(#SVGID_3_);}
+ .st9{fill:url(#SVGID_4_);}
+ .st10{fill:url(#SVGID_5_);}
+ .st11{fill:url(#SVGID_6_);}
+ .st12{fill:url(#SVGID_7_);}
+ .st13{fill:url(#SVGID_8_);}
+ .st14{fill:url(#SVGID_9_);}
+ .st15{fill:url(#SVGID_10_);}
+ .st16{fill:url(#SVGID_11_);}
+ .st17{fill:url(#SVGID_12_);}
+ .st18{fill:url(#SVGID_13_);}
+ .st19{fill:url(#SVGID_14_);}
+ .st20{fill:url(#SVGID_15_);}
+ .st21{fill:url(#SVGID_16_);}
+ .st22{fill:url(#SVGID_17_);}
+ .st23{fill:url(#SVGID_18_);}
+ .st24{opacity:0.29;}
+ .st25{fill:url(#SVGID_19_);}
+ .st26{fill:url(#SVGID_20_);}
+ .st27{fill:url(#SVGID_21_);}
+ .st28{fill:url(#SVGID_22_);}
+ .st29{fill:url(#SVGID_23_);}
+ .st30{fill:url(#SVGID_24_);}
+ .st31{fill:url(#SVGID_25_);}
+ .st32{fill:url(#SVGID_26_);}
+ .st33{fill:url(#SVGID_27_);}
+ .st34{fill:url(#SVGID_28_);}
+ .st35{fill:url(#SVGID_29_);}
+ .st36{fill:url(#SVGID_30_);}
+ .st37{fill:url(#SVGID_31_);}
+ .st38{fill:url(#SVGID_32_);}
+ .st39{fill:url(#SVGID_33_);}
+ .st40{fill:url(#SVGID_34_);}
+ .st41{fill:url(#SVGID_35_);}
+ .st42{fill:url(#SVGID_36_);}
+ .st43{opacity:0.4;fill:url(#SVGID_37_);}
+ .st44{fill:url(#SVGID_38_);}
+ .st45{fill:url(#SVGID_39_);}
+ .st46{fill:url(#SVGID_40_);}
+ .st47{fill:url(#SVGID_41_);}
+ .st48{fill:url(#SVGID_42_);}
+ .st49{fill:url(#SVGID_43_);}
+ .st50{fill:url(#SVGID_44_);}
+ .st51{display:inline;opacity:0.29;}
+ .st52{display:inline;fill:url(#SVGID_45_);}
+ .st53{display:inline;fill:url(#SVGID_46_);}
+ .st54{display:inline;fill:#FFFFFF;}
+ .st55{display:inline;fill:url(#SVGID_47_);}
+ .st56{display:inline;fill:url(#SVGID_48_);}
+ .st57{display:inline;fill:url(#SVGID_49_);}
+ .st58{display:inline;fill:url(#SVGID_50_);}
+ .st59{display:inline;fill:url(#SVGID_51_);}
+ .st60{display:inline;fill:url(#SVGID_52_);}
+ .st61{opacity:0.4;fill:url(#SVGID_53_);}
+ .st62{fill:url(#SVGID_54_);}
+ .st63{fill:url(#SVGID_55_);}
+ .st64{fill:url(#SVGID_56_);}
+ .st65{fill:url(#SVGID_57_);}
+ .st66{fill:url(#SVGID_58_);}
+ .st67{opacity:0.4;fill:url(#SVGID_59_);}
+ .st68{fill:url(#SVGID_60_);}
+ .st69{fill:url(#SVGID_61_);}
+ .st70{fill:url(#SVGID_62_);}
+ .st71{fill:url(#SVGID_63_);}
+ .st72{fill:url(#SVGID_64_);}
+ .st73{fill:url(#SVGID_65_);}
+ .st74{fill:url(#SVGID_66_);}
+ .st75{fill:url(#SVGID_67_);}
+ .st76{fill:url(#SVGID_68_);}
+ .st77{fill:url(#SVGID_69_);}
+ .st78{fill:url(#SVGID_70_);}
+ .st79{fill:url(#SVGID_71_);}
+ .st80{fill:url(#SVGID_72_);}
+ .st81{fill:url(#SVGID_73_);}
+ .st82{fill:url(#SVGID_74_);}
+ .st83{fill:url(#SVGID_75_);}
+ .st84{fill:url(#SVGID_76_);}
+ .st85{fill:url(#SVGID_77_);}
+ .st86{fill:url(#SVGID_78_);}
+ .st87{fill:url(#SVGID_79_);}
+ .st88{fill:url(#SVGID_80_);}
+ .st89{fill:url(#SVGID_81_);}
+ .st90{fill:url(#SVGID_82_);}
+ .st91{fill:url(#SVGID_83_);}
+ .st92{fill:url(#SVGID_84_);}
+ .st93{fill:url(#SVGID_85_);}
+ .st94{fill:url(#SVGID_86_);}
+ .st95{opacity:0.4;fill:url(#SVGID_87_);}
+ .st96{fill:url(#SVGID_88_);}
+ .st97{fill:url(#SVGID_89_);}
+ .st98{fill:url(#SVGID_90_);}
+ .st99{fill:url(#SVGID_91_);}
+ .st100{fill:url(#SVGID_92_);}
+ .st101{fill:url(#SVGID_93_);}
+ .st102{fill:url(#SVGID_94_);}
+ .st103{opacity:0.4;fill:url(#SVGID_95_);}
+ .st104{fill:url(#SVGID_96_);}
+ .st105{fill:url(#SVGID_97_);}
+ .st106{fill:url(#SVGID_98_);}
+ .st107{fill:url(#SVGID_99_);}
+ .st108{fill:url(#SVGID_100_);}
+ .st109{fill:url(#SVGID_101_);}
+ .st110{display:inline;fill:url(#SVGID_102_);}
+ .st111{display:inline;fill:url(#SVGID_103_);}
+ .st112{fill:url(#SVGID_104_);}
+ .st113{fill:url(#SVGID_105_);}
+ .st114{fill:url(#SVGID_106_);}
+ .st115{fill:url(#SVGID_107_);}
+ .st116{fill:url(#SVGID_108_);}
+ .st117{opacity:0.4;fill:url(#SVGID_109_);}
+ .st118{fill:url(#SVGID_110_);}
+ .st119{fill:url(#SVGID_111_);}
+ .st120{fill:url(#SVGID_112_);}
+ .st121{fill:url(#SVGID_113_);}
+ .st122{fill:url(#SVGID_114_);}
+ .st123{opacity:0.4;fill:url(#SVGID_115_);}
+ .st124{fill:url(#SVGID_116_);}
+ .st125{fill:url(#SVGID_117_);}
+ .st126{fill:url(#SVGID_118_);}
+ .st127{display:inline;fill:url(#SVGID_119_);}
+ .st128{display:inline;fill:url(#SVGID_120_);}
+ .st129{fill:url(#SVGID_121_);}
+ .st130{fill:url(#SVGID_122_);}
+</style><switch
+ id="switch6"><g
+ i:extraneous="self"
+ id="g8"><g
+ id="Multimedia_Inactive_copy"><circle
+ class="st24"
+ cx="159.7"
+ cy="133.4"
+ r="101.9"
+ id="circle884" /><linearGradient
+ id="SVGID_91_"
+ gradientUnits="userSpaceOnUse"
+ x1="115.9317"
+ y1="254.1836"
+ x2="256.3852"
+ y2="-133.5267"><stop
+ offset="0"
+ style="stop-color:#8BC53F"
+ id="stop887" /><stop
+ offset="2.015080e-02"
+ style="stop-color:#7CCB56;stop-opacity:0.9678"
+ id="stop889" /><stop
+ offset="6.089833e-02"
+ style="stop-color:#62D67D;stop-opacity:0.9028"
+ id="stop891" /><stop
+ offset="0.1057"
+ style="stop-color:#4BDFA0;stop-opacity:0.8312"
+ id="stop893" /><stop
+ offset="0.1543"
+ style="stop-color:#38E7BE;stop-opacity:0.7537"
+ id="stop895" /><stop
+ offset="0.2077"
+ style="stop-color:#28EED6;stop-opacity:0.6684"
+ id="stop897" /><stop
+ offset="0.2681"
+ style="stop-color:#1CF3E8;stop-opacity:0.572"
+ id="stop899" /><stop
+ offset="0.3394"
+ style="stop-color:#13F6F5;stop-opacity:0.4581"
+ id="stop901" /><stop
+ offset="0.4323"
+ style="stop-color:#0EF8FD;stop-opacity:0.3098"
+ id="stop903" /><stop
+ offset="0.6264"
+ style="stop-color:#0DF9FF;stop-opacity:0"
+ id="stop905" /></linearGradient><circle
+ class="st99"
+ cx="159.7"
+ cy="133.4"
+ r="101.9"
+ id="circle907" /><linearGradient
+ id="SVGID_92_"
+ gradientUnits="userSpaceOnUse"
+ x1="4.0481"
+ y1="287.9492"
+ x2="320.4859"
+ y2="-15.4029"
+ gradientTransform="matrix(1 5.464556e-03 -5.464556e-03 1 -2.0192 -3.0212)"><stop
+ offset="0"
+ style="stop-color:#59FF7F"
+ id="stop910" /><stop
+ offset="1"
+ style="stop-color:#6BFBFF"
+ id="stop912" /></linearGradient><path
+ class="st100"
+ d="M160,238.8c-0.2,0-0.4,0-0.6,0c-58-0.3-104.9-47.7-104.6-105.7C55.2,75.3,102.3,28.5,160,28.5 c0.2,0,0.4,0,0.6,0c58,0.3,104.9,47.7,104.6,105.7l0,0C264.8,192,217.7,238.8,160,238.8z M160,32.2 c-55.7,0-101.2,45.2-101.5,100.9c-0.3,55.9,45,101.7,100.9,102c0.2,0,0.4,0,0.6,0c55.7,0,101.2-45.2,101.5-100.9 c0.3-55.9-45-101.7-100.9-102C160.4,32.2,160.2,32.2,160,32.2z"
+ id="path914" /><g
+ id="g916"><text
+ transform="matrix(1 0 0 1 53.5841 284.7119)"
+ class="st4 st5 st6 st7"
+ id="text918">MULTIMEDIA</text>
+<linearGradient
+ id="SVGID_93_"
+ gradientUnits="userSpaceOnUse"
+ x1="140.5445"
+ y1="202.2363"
+ x2="186.8444"
+ y2="68.7049"><stop
+ offset="0"
+ style="stop-color:#59FF7F"
+ id="stop921" /><stop
+ offset="1"
+ style="stop-color:#6BFBFF"
+ id="stop923" /></linearGradient><path
+ class="st101"
+ d="M114.5,190.9c-6.4,0-12-2.6-14.8-7.5c-2.9-4.9-5.4-14.5,9.6-23.2c4.8-2.8,17.1-3.9,20.8-4l0.1,3.6 c-4.6,0.1-15.5,1.4-19.1,3.5c-9.4,5.4-12.1,11.5-8.3,18.3c3.8,6.6,14.6,7.6,24,2.2c6.6-3.8,10.6-10.5,10.7-17.9l-0.1-0.7V95.4 l71.9-14.2l0.1,71.3c0,6.7-3.3,16.4-12.5,21.8c-11.1,6.4-24.1,4.8-28.9-3.5c-2.9-4.9-5.4-14.5,9.6-23.2 c4.4-2.5,14.4-3.8,18.8-3.9l0.1,3.6c-4.2,0.1-13.5,1.4-17.1,3.5c-6.4,3.7-13.1,9.9-8.3,18.3c3.8,6.6,14.6,7.6,24,2.2 c7.9-4.5,10.7-12.8,10.7-18.5l-0.1-0.8V85.6l-64.7,12.7v66.8l0.1,0.7c0,8.7-4.7,16.6-12.5,21.1 C123.9,189.6,119,190.9,114.5,190.9z"
+ id="path925" /><linearGradient
+ id="SVGID_94_"
+ gradientUnits="userSpaceOnUse"
+ x1="145.3286"
+ y1="203.8951"
+ x2="191.6285"
+ y2="70.3637"><stop
+ offset="0"
+ style="stop-color:#59FF7F"
+ id="stop928" /><stop
+ offset="1"
+ style="stop-color:#6BFBFF"
+ id="stop930" /></linearGradient><polygon
+ class="st102"
+ points="155.6,123.3 154.8,119.8 195.5,110.2 196.3,113.7 "
+ id="polygon932" /></g></g></g></switch></svg> \ No newline at end of file
diff --git a/demo#3/common/libhomescreen/sample/simple-egl/src/simple-egl.cpp b/demo#3/common/libhomescreen/sample/simple-egl/src/simple-egl.cpp
new file mode 100644
index 0000000..799729b
--- /dev/null
+++ b/demo#3/common/libhomescreen/sample/simple-egl/src/simple-egl.cpp
@@ -0,0 +1,681 @@
+/*
+ * Copyright (c) 2017 TOYOTA MOTOR CORPORATION
+ * Copyright © 2011 Benjamin Franzke
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#include <mutex>
+#include <chrono>
+
+#include <iostream>
+#include <string>
+#include <stdarg.h>
+#include <sys/types.h>
+#include <thread>
+#include <exception>
+#include <vector>
+#include <sstream>
+
+#include <assert.h>
+#include <signal.h>
+
+#include <wayland-client.h>
+#include <wayland-egl.h>
+
+#include <GLES2/gl2.h>
+#include <EGL/egl.h>
+#include <EGL/eglext.h>
+
+#include <unistd.h>
+#include <time.h>
+
+#include <libwindowmanager.h>
+#include <libhomescreen.hpp>
+
+#include <ilm/ivi-application-client-protocol.h>
+#include "hmi-debug.h"
+
+using namespace std;
+
+const char* log_prefix = "simple-egl";
+uint32_t g_id_ivisurf = 9009;
+long port = 1700;
+string token = string("wm");
+
+string app_name = string("Navigation");
+const char* main_role = "navigation";
+
+LibHomeScreen* hs;
+LibWindowmanager *wm;
+
+static const struct wl_interface *types[] = {
+ NULL,
+ NULL,
+ NULL,
+ &wl_surface_interface,
+ &ivi_surface_interface,
+};
+
+static const struct wl_message ivi_surface_requests[] = {
+ { "destroy", "", types + 0 },
+};
+
+static const struct wl_message ivi_surface_events[] = {
+ { "configure", "ii", types + 0 },
+};
+
+const struct wl_interface ivi_surface_interface = {
+ "ivi_surface", 1,
+ 1, ivi_surface_requests,
+ 1, ivi_surface_events,
+};
+
+static const struct wl_message ivi_application_requests[] = {
+ { "surface_create", "uon", types + 2 },
+};
+
+const struct wl_interface ivi_application_interface = {
+ "ivi_application", 1,
+ 1, ivi_application_requests,
+ 0, NULL,
+};
+
+#include "platform.h"
+
+#ifndef EGL_EXT_swap_buffers_with_damage
+#define EGL_EXT_swap_buffers_with_damage 1
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC)(EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
+#endif
+
+#ifndef EGL_EXT_buffer_age
+#define EGL_EXT_buffer_age 1
+#define EGL_BUFFER_AGE_EXT 0x313D
+#endif
+
+struct window;
+struct seat;
+
+struct display {
+ struct wl_display *display;
+ struct wl_registry *registry;
+ struct wl_compositor *compositor;
+ struct wl_seat *seat;
+ struct {
+ EGLDisplay dpy;
+ EGLContext ctx;
+ EGLConfig conf;
+ } egl;
+ struct window *window;
+ struct ivi_application *ivi_application;
+
+ PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC swap_buffers_with_damage;
+};
+
+struct geometry {
+ int width, height;
+};
+
+struct window {
+ struct display *display;
+ struct geometry geometry, window_size;
+ struct {
+ GLuint rotation_uniform;
+ GLuint pos;
+ GLuint col;
+ } gl;
+
+ uint32_t benchmark_time, frames;
+ struct wl_egl_window *native;
+ struct wl_surface *surface;
+ struct ivi_surface *ivi_surface;
+ EGLSurface egl_surface;
+ struct wl_callback *callback;
+ int fullscreen, opaque, buffer_size, frame_sync;
+};
+
+static const char *vert_shader_text =
+ "uniform mat4 rotation;\n"
+ "attribute vec4 pos;\n"
+ "attribute vec4 color;\n"
+ "varying vec4 v_color;\n"
+ "void main() {\n"
+ " gl_Position = rotation * pos;\n"
+ " v_color = color;\n"
+ "}\n";
+
+static const char *frag_shader_text =
+ "precision mediump float;\n"
+ "varying vec4 v_color;\n"
+ "void main() {\n"
+ " gl_FragColor = v_color;\n"
+ "}\n";
+
+static int running = 1;
+
+static void
+init_egl(struct display *display, struct window *window)
+{
+ static const EGLint context_attribs[] = {
+ EGL_CONTEXT_CLIENT_VERSION, 2,
+ EGL_NONE
+ };
+ const char *extensions;
+
+ EGLint config_attribs[] = {
+ EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
+ EGL_RED_SIZE, 1,
+ EGL_GREEN_SIZE, 1,
+ EGL_BLUE_SIZE, 1,
+ EGL_ALPHA_SIZE, 1,
+ EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
+ EGL_NONE
+ };
+
+ EGLint major, minor, n, count, i, size;
+ EGLConfig *configs;
+ EGLBoolean ret;
+
+ if (window->opaque || window->buffer_size == 16)
+ config_attribs[9] = 0;
+
+ display->egl.dpy = weston_platform_get_egl_display(EGL_PLATFORM_WAYLAND_KHR, display->display, NULL);
+ assert(display->egl.dpy);
+
+ ret = eglInitialize(display->egl.dpy, &major, &minor);
+ assert(ret == EGL_TRUE);
+ ret = eglBindAPI(EGL_OPENGL_ES_API);
+ assert(ret == EGL_TRUE);
+
+ if (!eglGetConfigs(display->egl.dpy, NULL, 0, &count) || count < 1)
+ assert(0);
+
+ configs = calloc(count, sizeof *configs);
+ assert(configs);
+
+ ret = eglChooseConfig(display->egl.dpy, config_attribs,
+ configs, count, &n);
+ assert(ret && n >= 1);
+
+ for (i = 0; i < n; i++) {
+ eglGetConfigAttrib(display->egl.dpy,
+ configs[i], EGL_BUFFER_SIZE, &size);
+ if (window->buffer_size == size) {
+ display->egl.conf = configs[i];
+ break;
+ }
+ }
+ free(configs);
+ if (display->egl.conf == NULL) {
+ HMI_ERROR(log_prefix,"did not find config with buffer size %d",
+ window->buffer_size);
+ exit(EXIT_FAILURE);
+ }
+
+ display->egl.ctx = eglCreateContext(display->egl.dpy,
+ display->egl.conf,
+ EGL_NO_CONTEXT, context_attribs);
+ assert(display->egl.ctx);
+
+ display->swap_buffers_with_damage = NULL;
+ extensions = eglQueryString(display->egl.dpy, EGL_EXTENSIONS);
+ if (extensions &&
+ strstr(extensions, "EGL_EXT_swap_buffers_with_damage") &&
+ strstr(extensions, "EGL_EXT_buffer_age"))
+ display->swap_buffers_with_damage =
+ (PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC)
+ eglGetProcAddress("eglSwapBuffersWithDamageEXT");
+
+ if (display->swap_buffers_with_damage)
+ HMI_DEBUG(log_prefix,"has EGL_EXT_buffer_age and EGL_EXT_swap_buffers_with_damage");
+
+}
+
+static void
+fini_egl(struct display *display)
+{
+ eglTerminate(display->egl.dpy);
+ eglReleaseThread();
+}
+
+static GLuint
+create_shader(struct window *window, const char *source, GLenum shader_type)
+{
+ GLuint shader;
+ GLint status;
+
+ shader = glCreateShader(shader_type);
+ assert(shader != 0);
+
+ glShaderSource(shader, 1, (const char **) &source, NULL);
+ glCompileShader(shader);
+
+ glGetShaderiv(shader, GL_COMPILE_STATUS, &status);
+ if (!status) {
+ char log[1000];
+ GLsizei len;
+ glGetShaderInfoLog(shader, 1000, &len, log);
+ HMI_ERROR(log_prefix,"Error: compiling %s: %*s",
+ shader_type == GL_VERTEX_SHADER ? "vertex" : "fragment",
+ len, log);
+ exit(1);
+ }
+
+ return shader;
+}
+
+static void
+init_gl(struct window *window)
+{
+ GLuint frag, vert;
+ GLuint program;
+ GLint status;
+
+ frag = create_shader(window, frag_shader_text, GL_FRAGMENT_SHADER);
+ vert = create_shader(window, vert_shader_text, GL_VERTEX_SHADER);
+
+ program = glCreateProgram();
+ glAttachShader(program, frag);
+ glAttachShader(program, vert);
+ glLinkProgram(program);
+
+ glGetProgramiv(program, GL_LINK_STATUS, &status);
+ if (!status) {
+ char log[1000];
+ GLsizei len;
+ glGetProgramInfoLog(program, 1000, &len, log);
+ HMI_ERROR(log_prefix,"Error: linking:%*s", len, log);
+ exit(1);
+ }
+
+ glUseProgram(program);
+
+ window->gl.pos = 0;
+ window->gl.col = 1;
+
+ glBindAttribLocation(program, window->gl.pos, "pos");
+ glBindAttribLocation(program, window->gl.col, "color");
+ glLinkProgram(program);
+
+ window->gl.rotation_uniform =
+ glGetUniformLocation(program, "rotation");
+}
+
+static void
+create_ivi_surface(struct window *window, struct display *display)
+{
+ uint32_t id_ivisurf = g_id_ivisurf;
+ window->ivi_surface =
+ ivi_application_surface_create(display->ivi_application,
+ id_ivisurf, window->surface);
+
+ if (window->ivi_surface == NULL) {
+ HMI_ERROR(log_prefix,"Failed to create ivi_client_surface");
+ abort();
+ }
+
+}
+
+static void
+create_surface(struct window *window)
+{
+ struct display *display = window->display;
+ EGLBoolean ret;
+
+ window->surface = wl_compositor_create_surface(display->compositor);
+
+ window->native =
+ wl_egl_window_create(window->surface,
+ window->geometry.width,
+ window->geometry.height);
+ window->egl_surface =
+ weston_platform_create_egl_surface(display->egl.dpy,
+ display->egl.conf,
+ window->native, NULL);
+
+
+ if (display->ivi_application ) {
+ create_ivi_surface(window, display);
+ } else {
+ assert(0);
+ }
+
+ ret = eglMakeCurrent(window->display->egl.dpy, window->egl_surface,
+ window->egl_surface, window->display->egl.ctx);
+ assert(ret == EGL_TRUE);
+
+ if (!window->frame_sync)
+ eglSwapInterval(display->egl.dpy, 0);
+
+}
+
+static void
+destroy_surface(struct window *window)
+{
+ /* Required, otherwise segfault in egl_dri2.c: dri2_make_current()
+ * on eglReleaseThread(). */
+ eglMakeCurrent(window->display->egl.dpy, EGL_NO_SURFACE, EGL_NO_SURFACE,
+ EGL_NO_CONTEXT);
+
+ eglDestroySurface(window->display->egl.dpy, window->egl_surface);
+ wl_egl_window_destroy(window->native);
+
+ if (window->display->ivi_application)
+ ivi_surface_destroy(window->ivi_surface);
+ wl_surface_destroy(window->surface);
+
+ if (window->callback)
+ wl_callback_destroy(window->callback);
+}
+
+static void
+redraw(void *data, struct wl_callback *callback, uint32_t time)
+{
+ struct window *window = data;
+ struct display *display = window->display;
+ static const GLfloat verts[3][2] = {
+ { -0.5, -0.5 },
+ { 0.5, -0.5 },
+ { 0, 0.5 }
+ };
+
+ static const GLfloat colors[3][3] = {
+ { 1, 0, 0 },
+ { 0, 1, 0 },
+ { 0, 0, 1 }
+ };
+
+ GLfloat angle;
+ GLfloat rotation[4][4] = {
+ { 1, 0, 0, 0 },
+ { 0, 1, 0, 0 },
+ { 0, 0, 1, 0 },
+ { 0, 0, 0, 1 }
+ };
+ static const uint32_t speed_div = 5, benchmark_interval = 5;
+ struct wl_region *region;
+ EGLint rect[4];
+ EGLint buffer_age = 0;
+ struct timeval tv;
+
+ assert(window->callback == callback);
+ window->callback = NULL;
+
+ if (callback)
+ wl_callback_destroy(callback);
+
+ gettimeofday(&tv, NULL);
+ time = tv.tv_sec * 1000 + tv.tv_usec / 1000;
+ if (window->frames == 0)
+ window->benchmark_time = time;
+
+ if (time - window->benchmark_time > (benchmark_interval * 1000)) {
+ HMI_DEBUG(log_prefix,"%d frames in %d seconds: %f fps",
+ window->frames,
+ benchmark_interval,
+ (float) window->frames / benchmark_interval);
+ window->benchmark_time = time;
+ window->frames = 0;
+ }
+
+ angle = (time / speed_div) % 360 * M_PI / 180.0;
+ rotation[0][0] = cos(angle);
+ rotation[0][2] = sin(angle);
+ rotation[2][0] = -sin(angle);
+ rotation[2][2] = cos(angle);
+
+ if (display->swap_buffers_with_damage)
+ eglQuerySurface(display->egl.dpy, window->egl_surface,
+ EGL_BUFFER_AGE_EXT, &buffer_age);
+
+ glViewport(0, 0, window->geometry.width, window->geometry.height);
+
+ glUniformMatrix4fv(window->gl.rotation_uniform, 1, GL_FALSE,
+ (GLfloat *) rotation);
+
+ glClearColor(0.0, 0.0, 0.0, 0.5);
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ glVertexAttribPointer(window->gl.pos, 2, GL_FLOAT, GL_FALSE, 0, verts);
+ glVertexAttribPointer(window->gl.col, 3, GL_FLOAT, GL_FALSE, 0, colors);
+ glEnableVertexAttribArray(window->gl.pos);
+ glEnableVertexAttribArray(window->gl.col);
+
+ glDrawArrays(GL_TRIANGLES, 0, 3);
+
+ glDisableVertexAttribArray(window->gl.pos);
+ glDisableVertexAttribArray(window->gl.col);
+
+ if (window->opaque || window->fullscreen) {
+ region = wl_compositor_create_region(window->display->compositor);
+ wl_region_add(region, 0, 0,
+ window->geometry.width,
+ window->geometry.height);
+ wl_surface_set_opaque_region(window->surface, region);
+ wl_region_destroy(region);
+ } else {
+ wl_surface_set_opaque_region(window->surface, NULL);
+ }
+
+ if (display->swap_buffers_with_damage && buffer_age > 0) {
+ rect[0] = window->geometry.width / 4 - 1;
+ rect[1] = window->geometry.height / 4 - 1;
+ rect[2] = window->geometry.width / 2 + 2;
+ rect[3] = window->geometry.height / 2 + 2;
+ display->swap_buffers_with_damage(display->egl.dpy,
+ window->egl_surface,
+ rect, 1);
+ } else {
+ eglSwapBuffers(display->egl.dpy, window->egl_surface);
+ }
+
+ window->frames++;
+}
+
+static void
+registry_handle_global(void *data, struct wl_registry *registry,
+ uint32_t name, const char *interface, uint32_t version)
+{
+ struct display *d = data;
+
+ if (strcmp(interface, "wl_compositor") == 0) {
+ d->compositor =
+ wl_registry_bind(registry, name,
+ &wl_compositor_interface, 1);
+ } else if (strcmp(interface, "ivi_application") == 0) {
+ d->ivi_application =
+ wl_registry_bind(registry, name,
+ &ivi_application_interface, 1);
+ }
+}
+
+static void
+registry_handle_global_remove(void *data, struct wl_registry *registry,
+ uint32_t name)
+{
+}
+
+static const struct wl_registry_listener registry_listener = {
+ registry_handle_global,
+ registry_handle_global_remove
+};
+
+static void
+signal_int(int signum)
+{
+ running = 0;
+}
+
+int
+init_wm(LibWindowmanager *wm, struct window *window)
+{
+ HMI_DEBUG(log_prefix,"called");
+
+ if (wm->init(port, token) != 0) {
+ HMI_ERROR(log_prefix,"wm init failed. ");
+ return -1;
+ }
+
+ g_id_ivisurf = wm->requestSurface(main_role);
+ if (g_id_ivisurf < 0) {
+ HMI_ERROR(log_prefix,"wm request surface failed ");
+ return -1;
+ }
+ HMI_DEBUG(log_prefix,"IVI_SURFACE_ID: %d ", g_id_ivisurf);
+
+ WMHandler wmh;
+ wmh.on_visible = [](const char* role, bool visible){
+ // Sample code if user uses visible event
+ HMI_DEBUG(log_prefix, "role: %s, visible: %s", role, visible ? "true" : "false");
+ };
+ wmh.on_sync_draw = [wm, window](const char* role, const char* area, Rect rect) {
+
+ HMI_DEBUG(log_prefix,"Surface %s got syncDraw! Area: %s. w:%d, h:%d", role, area, rect.width(), rect.height());
+
+ wl_egl_window_resize(window->native, rect.width(), rect.height(), 0, 0);
+ window->geometry.width = rect.width();
+ window->geometry.height = rect.height();
+
+ wm->endDraw(role);
+ };
+
+ wm->setEventHandler(wmh);
+
+ return 0;
+}
+
+int
+init_hs(LibHomeScreen* hs){
+ if(hs->init(port, token)!=0)
+ {
+ HMI_ERROR(log_prefix,"homescreen init failed. ");
+ return -1;
+ }
+
+ hs->set_event_handler(LibHomeScreen::Event_TapShortcut, [](json_object *object){
+ const char *application_name = json_object_get_string(
+ json_object_object_get(object, "application_name"));
+ HMI_DEBUG("simple-egl","Event_TapShortcut application_name = %s ", application_name);
+ if(strcmp(application_name, app_name.c_str()) == 0)
+ {
+ HMI_DEBUG("simple-egl","try to activesurface %s ", app_name.c_str());
+ wm->activateWindow(main_role);
+ }
+ });
+
+ return 0;
+}
+
+int
+main(int argc, char **argv)
+{
+ struct sigaction sigint;
+ struct window window = { 0 };
+ struct display display = { 0 };
+
+ window.display = &display;
+ display.window = &window;
+ window.geometry.width = 1080;
+ window.geometry.height = 1488;
+ window.window_size = window.geometry;
+ window.buffer_size = 32;
+ window.frame_sync = 1;
+
+ if(argc > 2){
+ port = strtol(argv[1], NULL, 10);
+ token = argv[2];
+ }
+
+ HMI_DEBUG(log_prefix,"main_role: %s, port: %d, token: %s. ", main_role, port, token.c_str());
+
+ display.display = wl_display_connect(NULL);
+ assert(display.display);
+
+ display.registry = wl_display_get_registry(display.display);
+ wl_registry_add_listener(display.registry,
+ &registry_listener, &display);
+
+ wl_display_roundtrip(display.display);
+
+ init_egl(&display, &window);
+
+ wm = new LibWindowmanager();
+ if(init_wm(wm, &window)!=0){
+ fini_egl(&display);
+ if (display.ivi_application)
+ ivi_application_destroy(display.ivi_application);
+ if (display.compositor)
+ wl_compositor_destroy(display.compositor);
+ wl_registry_destroy(display.registry);
+ wl_display_flush(display.display);
+ return -1;
+ }
+
+ hs = new LibHomeScreen();
+ if(init_hs(hs)!=0){
+ fini_egl(&display);
+ if (display.ivi_application)
+ ivi_application_destroy(display.ivi_application);
+ if (display.compositor)
+ wl_compositor_destroy(display.compositor);
+ wl_registry_destroy(display.registry);
+ wl_display_flush(display.display);
+ return -1;
+ }
+
+ create_surface(&window);
+ init_gl(&window);
+
+ //Ctrl+C
+ sigint.sa_handler = signal_int;
+ sigemptyset(&sigint.sa_mask);
+ sigint.sa_flags = SA_RESETHAND;
+ sigaction(SIGINT, &sigint, NULL);
+
+ eglSwapBuffers(window.display->egl.dpy, window.egl_surface);
+
+ wm->activateWindow(main_role);
+
+ /* The mainloop here is a little subtle. Redrawing will cause
+ * EGL to read events so we can just call
+ * wl_display_dispatch_pending() to handle any events that got
+ * queued up as a side effect. */
+ while (running) {
+ wl_display_dispatch_pending(display.display);
+ redraw(&window, NULL, 0);
+ }
+
+ HMI_DEBUG(log_prefix,"simple-egl exiting! ");
+
+ destroy_surface(&window);
+ fini_egl(&display);
+
+ if (display.ivi_application)
+ ivi_application_destroy(display.ivi_application);
+
+ if (display.compositor)
+ wl_compositor_destroy(display.compositor);
+
+ wl_registry_destroy(display.registry);
+ wl_display_flush(display.display);
+ wl_display_disconnect(display.display);
+
+ return 0;
+}
diff --git a/demo#3/common/libhomescreen/sample/template/LICENSE.APL-2.0 b/demo#3/common/libhomescreen/sample/template/LICENSE.APL-2.0
new file mode 100644
index 0000000..b3201ab
--- /dev/null
+++ b/demo#3/common/libhomescreen/sample/template/LICENSE.APL-2.0
@@ -0,0 +1,204 @@
+
+
+ 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/demo#3/common/libhomescreen/sample/template/README.md b/demo#3/common/libhomescreen/sample/template/README.md
new file mode 100644
index 0000000..4eeae4e
--- /dev/null
+++ b/demo#3/common/libhomescreen/sample/template/README.md
@@ -0,0 +1,25 @@
+==========
+ Overview
+==========
+<br>This is the templete that is useful for implementation of Qt application
+<br>by using HomeScreen, WindowManager and SoundManager.
+
+
+===========
+ Structure
+===========
+<br> - main.cpp
+<br> The templete for implementation main function for Qt application.
+
+<br> - wmhandler.cpp
+<br> - wmhandler.h
+<br> These file is implemented "slot"
+<br> that is needed by Qt application that uses WindowManager.
+<br> These file should be modified according to Qt application.
+
+<br> - smhandler.cpp
+<br> - smhandler.h
+<br> These file is implemented "signal" and "slot"
+<br> that is needed by Qt application that uses SoundManager.
+<br> These file should be modified according to Qt application.
+
diff --git a/demo#3/common/libhomescreen/sample/template/main.cpp b/demo#3/common/libhomescreen/sample/template/main.cpp
new file mode 100644
index 0000000..831df41
--- /dev/null
+++ b/demo#3/common/libhomescreen/sample/template/main.cpp
@@ -0,0 +1,225 @@
+/*
+ * Copyright (c) 2017 TOYOTA MOTOR CORPORATION
+ *
+ * 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 <QtCore/QDebug>
+#include <QtCore/QCommandLineParser>
+#include <QtCore/QUrlQuery>
+#include <QtCore/QSettings>
+#include <QtGui/QGuiApplication>
+#include <QtQml/QQmlApplicationEngine>
+#include <QtQml/QQmlContext>
+#include <QtQuickControls2/QQuickStyle>
+#include <QQuickWindow>
+
+#include <libhomescreen/libhomescreen.hpp>
+#include "wmhandler.h"
+#include "smhandler.h"
+
+
+static LibHomeScreen* hs;
+static LibWindowmanager* wm;
+static LibSMWrapper* smw;
+static WmHandler* wmh;
+
+static std::string myname = std::string("Templete");
+
+
+static void onRep(struct json_object* reply_contents);
+static void onEv(const std::string& event, struct json_object* event_contents);
+
+
+int main(int argc, char *argv[])
+{
+ QGuiApplication app(argc, argv);
+ QQmlApplicationEngine engine;
+ QQmlContext* context = engine.rootContext();
+ QObject* root;
+ QQuickWindow* window;
+
+ QQuickStyle::setStyle("AGL");
+
+ /*
+ * Set argument and option
+ */
+ QCommandLineParser parser;
+ parser.addPositionalArgument("port", app.translate("main", "port for binding"));
+ parser.addPositionalArgument("secret", app.translate("main", "secret for binding"));
+ parser.addHelpOption();
+ parser.addVersionOption();
+ parser.process(app);
+ QStringList positionalArguments = parser.positionalArguments();
+
+ if (positionalArguments.length() == 2) {
+ /*
+ * Get argument
+ */
+ int port = positionalArguments.takeFirst().toInt();
+ QString secret = positionalArguments.takeFirst();
+ std::string token = secret.toStdString();
+
+
+ /*
+ * Get instance
+ */
+ hs = new LibHomeScreen();
+ wm = new LibWindowmanager();
+ smw = new LibSMWrapper(port, secret);
+ wmh = new WmHandler();
+
+
+ /*
+ * Set WindowManager
+ */
+ // Initialize
+ if(wm->init(port, token.c_str()) != 0){
+ exit(EXIT_FAILURE);
+ }
+
+ // Application should call requestSurface at first
+ json_object *obj = json_object_new_object();
+ json_object_object_add(obj, wm->kKeyDrawingName, json_object_new_string(app_name.c_str()));
+ if (wm->requestSurface(obj) != 0) {
+ exit(EXIT_FAILURE);
+ }
+
+ // Set event handlers for each event
+ wm->set_event_handler(LibWindowmanager::Event_Active, [wm](json_object *object) {
+ const char *label = json_object_get_string(
+ json_object_object_get(object, wm->kKeyDrawingName));
+ fprintf(stderr, "Surface %s got activated!\n", label);
+ });
+ wm->set_event_handler(LibWindowmanager::Event_Inactive, [wm](json_object *object) {
+ const char *label = json_object_get_string(
+ json_object_object_get(object, wm->kKeyDrawingName));
+ fprintf(stderr, "Surface %s got deactivated!\n", label);
+ });
+ wm->set_event_handler(LibWindowmanager::Event_Visible, [wm](json_object *object) {
+ const char *label = json_object_get_string(
+ json_object_object_get(object, wm->kKeyDrawingName));
+ fprintf(stderr, "Surface %s got visible!\n", label);
+ });
+ wm->set_event_handler(LibWindowmanager::Event_Invisible, [wm](json_object *object) {
+ const char *label = json_object_get_string(
+ json_object_object_get(object, wm->kKeyDrawingName));
+ fprintf(stderr, "Surface %s got invisible!\n", label);
+ });
+ wm->set_event_handler(LibWindowmanager::Event_SyncDraw, [wm](json_object *object) {
+ const char *label = json_object_get_string(
+ json_object_object_get(object, wm->kKeyDrawingName));
+ const char *area = json_object_get_string(
+ json_object_object_get(object, wm->kKeyDrawingArea));
+ fprintf(stderr, "Surface %s got syncDraw!\n", label);
+ // Application should call LibWindowmanager::endDraw() in SyncDraw handler
+ json_object *obj = json_object_new_object();
+ json_object_object_add(obj, wm->kKeyDrawingName, json_object_new_string(app_name.c_str()));
+ wm->endDraw(obj);
+ });
+ wm->set_event_handler(LibWindowmanager::Event_FlushDraw, [wm](json_object *object) {
+ const char *label = json_object_get_string(
+ json_object_object_get(object, wm->kKeyDrawingName));
+ fprintf(stderr, "Surface %s got flushDraw!\n", label);
+ });
+
+ // Initialize WmHandler
+ wmh->init(wm, myname.c_str());
+
+
+ /*
+ * Set HomeScreen
+ */
+ // Initialize
+ hs->init(port, token.c_str());
+
+ // Set event handler
+ hs->set_event_handler(LibHomeScreen::Event_TapShortcut, [wm](json_object *object) {
+ const char *appname = json_object_get_string(
+ json_object_object_get(object, "application_name"));
+ if(myname == appname) {
+ qDebug("Surface %s got tapShortcut\n", appname);
+ // Application should call LibWindowmanager::endDraw() in TapShortcut handler
+ json_object *obj = json_object_new_object();
+ json_object_object_add(obj, wm->kKeyDrawingName, json_object_new_string(app_name.c_str()));
+ json_object_object_add(obj, wm->kKeyDrawingArea, json_object_new_string("normal.full"));
+ wm->activateSurface(obj);
+ }
+ });
+
+ /*
+ * Set SoundManager
+ */
+ smw->wrapper_registerCallback(onEv, onRep);
+ smw->subscribe(QString("newMainConnection"));
+ smw->subscribe(QString("mainConnectionStateChanged"));
+ smw->subscribe(QString("removedMainConnection"));
+ smw->subscribe(QString("asyncSetSourceState"));
+ smw->subscribe(QString("asyncConnect"));
+
+ // Set context property for SoundManager
+ context->setContextProperty("smw", smw);
+
+
+ /*
+ * Load qml
+ */
+ engine.load(QUrl(QStringLiteral("qrc:/QmlForThisApp.qml")));
+
+
+ /*
+ * Set slot for WindowManager and SoundManager
+ */
+ root = engine.rootObjects().first();
+ window = qobject_cast<QQuickWindow *>(root);
+
+ // Set slot for calling LibWindowmanager::activateSurface() when loading qml have completed
+ QObject::connect(window, SIGNAL(frameSwapped()),
+ wmh, SLOT(slotActivateSurface()));
+
+ // Set slot for SoundManager
+ QObject::connect(smw, SIGNAL(smEvent(QVariant, QVariant)),
+ root, SLOT(slotEvent(QVariant, QVariant)));
+ QObject::connect(smw, SIGNAL(smReply(QVariant)),
+ root, SLOT(slotReply(QVariant)));
+ }
+
+ return app.exec();
+}
+
+static void onRep(struct json_object* reply_contents)
+{
+ qDebug("%s is called", __FUNCTION__);
+ QString str = QString(json_object_get_string(reply_contents));
+ QJsonParseError error;
+ QJsonDocument jdoc = QJsonDocument::fromJson(str.toUtf8(), &error);
+ QJsonObject jobj = jdoc.object();
+
+ smw->emit_reply(jobj);
+ json_object_put(reply_contents);
+}
+
+static void onEv(const std::string& event, struct json_object* event_contents)
+{
+ qDebug("%s is called", __FUNCTION__);
+ const QString event_name = QString(event.c_str());
+ QString str = QString(json_object_get_string(event_contents));
+ QJsonParseError error;
+ QJsonDocument jdoc = QJsonDocument::fromJson(str.toUtf8(), &error);
+ const QJsonObject jobj = jdoc.object();
+ smw->emit_event(event_name, jobj);
+
+ json_object_put(event_contents);
+}
+
diff --git a/demo#3/common/libhomescreen/sample/template/smhandler.cpp b/demo#3/common/libhomescreen/sample/template/smhandler.cpp
new file mode 100644
index 0000000..54b94d8
--- /dev/null
+++ b/demo#3/common/libhomescreen/sample/template/smhandler.cpp
@@ -0,0 +1,157 @@
+/*
+ * Copyright (c) 2017 TOYOTA MOTOR CORPORATION
+ *
+ * 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 "libsmwrapper.h"
+using namespace std;
+
+static int create_json_object(const QJsonObject& obj, struct json_object* jobj);
+static bool put_val_to_jobj(const char* key, const QJsonValue& val, struct json_object* jobj);
+static bool put_array_to_jobj(const char* key, const QJsonArray& qarray, struct json_object* jobj);
+
+LibSMWrapper::LibSMWrapper(QObject *parent) :
+ QObject(parent)
+{
+ /* This is not enabled */
+ //libsm = new LibSoundmanager();
+}
+
+LibSMWrapper::LibSMWrapper(const int port, const QString& token, QObject *parent) :
+ QObject(parent)
+{
+ libsm = new LibSoundmanager(port, token.toStdString());
+}
+
+LibSMWrapper::~LibSMWrapper()
+{
+ delete libsm;
+}
+
+int LibSMWrapper::call(const QString &verb, const QString &arg)
+{
+ // translate QJsonObject to struct json_object
+ struct json_object* jobj = json_object_new_object();
+ QJsonDocument jsonDoc = QJsonDocument::fromJson(arg.toUtf8());
+ const QJsonObject jsonObj = jsonDoc.object();
+ int ret = create_json_object(jsonObj, jobj);
+ if(ret < 0)
+ {
+ return -1;
+ }
+ return libsm->call(verb.toStdString().c_str(), jobj);
+}
+
+static int create_json_object(const QJsonObject& obj, struct json_object* jobj)
+{
+ try{
+ for(auto itr = obj.begin(); itr != obj.end();++itr)
+ {
+ string key = itr.key().toStdString();
+ //const char* key = itr.key().toStdString().c_str(); // Do not code like this. string is removed if size is over 16!!
+
+ bool ret = put_val_to_jobj(key.c_str(), itr.value(),jobj);
+ if(!ret){
+ /*This is not implemented*/
+ qDebug("JsonArray can't parse for now");
+ return -1;
+ // ToDo
+ // For now, array may not be inputted for soundmanager
+ // But use case absolutely exists
+ /*QJsonArray qarray = itr.value().toArray();
+ ret = put_array_to_jobj(key, qarray, jobj);*/
+ }
+ }
+ }
+ catch(...){
+ qDebug("Json parse error occured");
+ return -1;
+ }
+ return 0;
+}
+
+static bool put_val_to_jobj(const char* key, const QJsonValue& val, struct json_object* jobj)
+{
+ if(val.isArray()){
+ return false; // Array can't input
+ }
+ if(val.isString()){
+ string value = val.toString().toStdString();
+ json_object_object_add(jobj, key, json_object_new_string(value.c_str()));
+ }
+ else{
+ const int value = val.toInt();
+ json_object_object_add(jobj, key, json_object_new_int(value));
+ }
+ return true;
+}
+
+static bool put_array_to_jobj(const char* key, const QJsonArray& qarray, struct json_object* jobj)
+{
+ // ToDo Fix this !!
+/* struct json_object* jarray = json_object_new_array();
+
+ bool ret;
+ for(auto jitr = qarray.begin(); jitr != qarray.end(); ++jitr){
+ struct json_object* tmp = json_object_new_object();
+ ret = put_val_to_jobj(key,jitr,tmp);
+ if(!ret)
+ {
+ put_array_to_jobj(key,jitr,tmp);
+ }
+ json_object_array_add(jarray, tmp);
+ }
+ json_object_object_add(jobj, key, jarray);
+ return true;*/
+}
+
+void LibSMWrapper::wrapper_registerCallback(
+ void (*event_func)(const string& event, struct json_object* event_contents),
+ void (*reply_func)(struct json_object* reply_contents))
+{
+ libsm->register_callback(event_func, reply_func);
+}
+
+void LibSMWrapper::subscribe(const QString event_name)
+{
+ std::string str = event_name.toStdString();
+ libsm->subscribe(str);
+}
+
+void LibSMWrapper::unsubscribe(const QString event_name)
+{
+ std::string str = event_name.toStdString();
+ libsm->unsubscribe(str);
+}
+
+void LibSMWrapper::run_eventloop()
+{
+ libsm->run_eventloop();
+}
+
+void LibSMWrapper::print(const QString &str)
+{
+ qDebug("%s is called", str.toStdString().c_str());
+}
+
+void LibSMWrapper::emit_event(const QString &event, const QJsonObject &msg)
+{
+ qDebug("emit smEvent signal @%s", __FUNCTION__);
+ emit smEvent(event, msg);
+}
+void LibSMWrapper::emit_reply(const QJsonObject &msg)
+{
+ qDebug("emit smReply signal @%s", __FUNCTION__);
+ emit smReply(msg);
+} \ No newline at end of file
diff --git a/demo#3/common/libhomescreen/sample/template/smhandler.h b/demo#3/common/libhomescreen/sample/template/smhandler.h
new file mode 100644
index 0000000..3954a29
--- /dev/null
+++ b/demo#3/common/libhomescreen/sample/template/smhandler.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2017 TOYOTA MOTOR CORPORATION
+ *
+ * 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 SIGNALER_H
+#define SIGNALER_H
+
+ #include <QObject>
+ #include <QVariant>
+ #include <QJsonDocument>
+ #include <QtCore/QJsonObject>
+ #include <libsoundmanager/libsoundmanager.hpp>
+ #include <QString>
+ #include <string>
+
+
+class LibSMWrapper : public QObject
+{
+ Q_OBJECT
+public: // method
+ explicit LibSMWrapper(QObject *parent = nullptr);
+ LibSMWrapper(const int port, const QString& token, QObject *parent = nullptr);
+ ~LibSMWrapper();
+
+ void wrapper_registerCallback(
+ void (*event_func)(const std::string& event, struct json_object* event_contents),
+ void (*reply_func)(struct json_object* reply_contents)
+ );
+ void subscribe(const QString event_name);
+ void unsubscribe(const QString event_name);
+ void run_eventloop();
+
+ void emit_event(const QString &event, const QJsonObject &msg);
+ void emit_reply(const QJsonObject &msg);
+public slots:
+ int call(const QString &verb, const QString &arg);
+ void print(const QString &str);
+signals:
+ void smEvent(const QVariant &event, const QVariant &msg);
+ void smReply(const QVariant &msg);
+
+private:
+ LibSoundmanager* libsm;
+};
+
+
+#endif /*SIGNALER_H*/ \ No newline at end of file
diff --git a/demo#3/common/libhomescreen/sample/template/wmhandler.cpp b/demo#3/common/libhomescreen/sample/template/wmhandler.cpp
new file mode 100644
index 0000000..9972104
--- /dev/null
+++ b/demo#3/common/libhomescreen/sample/template/wmhandler.cpp
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2017 TOYOTA MOTOR CORPORATION
+ *
+ * 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 "wmhandler.h"
+#include <unistd.h>
+
+
+void WmHandler::init(LibWindowmanager *p_wm, std::string applabel)
+{
+ mp_wm = p_wm;
+ m_applabel = applabel;
+}
+
+void WmHandler::slotActivateSurface() {
+ json_object *obj = json_object_new_object();
+ json_object_object_add(obj, wm->kKeyDrawingName, json_object_new_string(m_applabel.c_str()));
+ json_object_object_add(obj, wm->kKeyDrawingArea, json_object_new_string("normal.full"));
+ mp_wm->activateSurface(obj);
+}
+
+WmHandler::WmHandler(QObject *parent)
+ :QObject(parent)
+{
+}
+
+WmHandler::~WmHandler() { }
diff --git a/demo#3/common/libhomescreen/sample/template/wmhandler.h b/demo#3/common/libhomescreen/sample/template/wmhandler.h
new file mode 100644
index 0000000..5442d8e
--- /dev/null
+++ b/demo#3/common/libhomescreen/sample/template/wmhandler.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2017 TOYOTA MOTOR CORPORATION
+ *
+ * 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 WMHANDLER_H
+#define WMHANDLER_H
+#include <QObject>
+#include <QUrl>
+#include <QVariant>
+#include <string>
+#include <vector>
+#include <functional>
+#include <libwindowmanager.h>
+
+class WmHandler : public QObject {
+Q_OBJECT
+public:
+ explicit WmHandler(QObject *parent = nullptr);
+ ~WmHandler();
+
+ WmHandler(const WmHandler &) = delete;
+ WmHandler &operator=(const WmHandler &) = delete;
+
+public:
+ static WmHandler &instance();
+ void init(LibWindowmanager *p_wm, std::string applabel);
+
+public slots:
+ void slotActivateSurface();
+
+private:
+ LibWindowmanager* mp_wm;
+ std::string m_applabel;
+};
+#endif // WMHANDLER_H
diff --git a/demo#3/common/libhomescreen/src/CMakeLists.txt b/demo#3/common/libhomescreen/src/CMakeLists.txt
new file mode 100644
index 0000000..babf49d
--- /dev/null
+++ b/demo#3/common/libhomescreen/src/CMakeLists.txt
@@ -0,0 +1,48 @@
+#
+# Copyright (c) 2017 TOYOTA MOTOR CORPORATION
+#
+# 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.
+#
+
+
+cmake_minimum_required(VERSION 3.0)
+
+set(TARGET_LIBHOMESCREEN homescreen)
+add_definitions("-std=c++11")
+
+pkg_check_modules(libhomescreen_depends json-c libafbwsc libsystemd)
+set(libhomescreen_sources libhomescreen.cpp)
+
+include_directories(${LIBHOMESCREEN_INCLUDE_DIR})
+link_libraries(-Wl,--as-needed -Wl,--gc-sections -Wl,--no-undefined)
+
+add_library(${TARGET_LIBHOMESCREEN} SHARED ${libhomescreen_sources})
+target_compile_options(${TARGET_LIBHOMESCREEN} PUBLIC ${libhomescreen_depends_CFLAGS})
+
+if(DEFINED DEBUGMODE)
+ target_compile_options(${TARGET_LIBHOMESCREEN} PRIVATE -g -O0)
+else(DEFINED DEBUGMODE)
+ target_compile_options(${TARGET_LIBHOMESCREEN} PRIVATE -g -O2)
+endif(DEFINED DEBUGMODE)
+
+include_directories(${TARGET_LIBHOMESCREEN} ${libhomescreen_depends_INCLUDE_DIRS})
+target_link_libraries(${TARGET_LIBHOMESCREEN} afbwsc -lpthread ${link_libraries} ${libhomescreen_depends_LIBRARIES})
+set_target_properties(${TARGET_LIBHOMESCREEN}
+ PROPERTIES
+ VERSION 0.1
+)
+
+if(DEFINED CMAKE_INSTALL_LIBDIR)
+ INSTALL(TARGETS ${TARGET_LIBHOMESCREEN}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+endif(DEFINED CMAKE_INSTALL_LIBDIR)
diff --git a/demo#3/common/libhomescreen/src/libhomescreen.cpp b/demo#3/common/libhomescreen/src/libhomescreen.cpp
new file mode 100644
index 0000000..9689863
--- /dev/null
+++ b/demo#3/common/libhomescreen/src/libhomescreen.cpp
@@ -0,0 +1,643 @@
+/*
+ * Copyright (c) 2017 TOYOTA MOTOR CORPORATION
+ *
+ * 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 <stdarg.h>
+#include <sys/socket.h>
+#include <iostream>
+#include <algorithm>
+#include <errno.h>
+#include <cassert>
+#include <cctype>
+#include <cerrno>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+
+#include <libhomescreen.hpp>
+#include "hmi-debug.h"
+
+using namespace std;
+
+static bool has_verb(const string& verb);
+static const char API[] = "homescreen";
+
+const std::vector<std::string> LibHomeScreen::api_list {
+ std::string("ping"), // debug do not use
+// std::string("tap_shortcut"), // HomeScreen Application only
+ std::string("on_screen_message"),
+ std::string("on_screen_reply"),
+ std::string("subscribe"),
+ std::string("unsubscribe"),
+ std::string("showWindow"),
+ std::string("allocateRestriction"),
+ std::string("releaseRestriction")
+};
+
+const std::vector<std::string> LibHomeScreen::event_list {
+// std::string("tap_shortcut"),
+ std::string("showWindow"),
+ std::string("on_screen_message"),
+ std::string("on_screen_reply"),
+ std::string("allocateRestriction"),
+ std::string("releaseRestriction"),
+ std::string("none")
+};
+
+
+/**
+ * websocket
+ */
+
+static void _on_hangup_static(void *closure, struct afb_wsj1 *wsj)
+{
+ static_cast<LibHomeScreen*>(closure)->on_hangup(NULL,wsj);
+}
+
+static void _on_call_static(void *closure, const char *api, const char *verb, struct afb_wsj1_msg *msg)
+{
+ /* LibHomeScreen is not called from other process */
+}
+
+static void _on_event_static(void* closure, const char* event, struct afb_wsj1_msg *msg)
+{
+ static_cast<LibHomeScreen*>(closure)->on_event(NULL,event,msg);
+}
+
+static void _on_reply_static(void *closure, struct afb_wsj1_msg *msg)
+{
+ static_cast<LibHomeScreen*>(closure)->on_reply(NULL,msg);
+}
+
+
+/**
+ * constructor
+ */
+LibHomeScreen::LibHomeScreen()
+{
+}
+
+/**
+ * destructor
+ */
+LibHomeScreen::~LibHomeScreen()
+{
+ if(mploop)
+ {
+ sd_event_unref(mploop);
+ }
+ if(sp_websock != NULL)
+ {
+ afb_wsj1_unref(sp_websock);
+ }
+}
+
+/**
+ * This function is initializer
+ *
+ * #### Parameters
+ * - port [in] : This argument should be specified to the port number to be used for websocket
+ * - token [in] : This argument should be specified to the token to be used for websocket
+ *
+ * #### Return
+ * Nothing
+ *
+ * #### Note
+ * Use this constructor
+ *
+ */
+int LibHomeScreen::init(const int port, const string& token)
+{
+ int ret = 0;
+ if(port > 0 && token.size() > 0)
+ {
+ mport = port;
+ mtoken = token;
+ }
+ else
+ {
+ HMI_ERROR("libhomescreen","port and token should be > 0, Initial port and token uses.");
+ }
+
+ ret = initialize_websocket();
+ if(ret != 0 )
+ {
+ HMI_ERROR("libhomescreen","Failed to initialize websocket");
+ }
+ else{
+ HMI_DEBUG("libhomescreen","Initialized");
+ }
+
+ return ret;
+}
+
+/**
+ * This function register callback function for reply/event message from home screen
+ *
+ * #### Parameters
+ * - event_cb [in] : This argument should be specified to the callback for subscribed event
+ * - reply_cb [in] : This argument should be specified to the reply callback for call function
+ *
+ * #### Return
+ * Nothing
+ *
+ * #### Note
+ * Event callback is invoked by home screen for event you subscribed.
+ * If you would like to get event, please call subscribe function before/after this function
+ */
+void LibHomeScreen::registerCallback(
+ void (*event_cb)(const std::string& event, struct json_object* event_contents),
+ void (*reply_cb)(struct json_object* reply_contents),
+ void (*hangup_cb)(void))
+{
+ onEvent = event_cb;
+ onReply = reply_cb;
+ onHangup = hangup_cb;
+}
+
+int LibHomeScreen::initialize_websocket()
+{
+ mploop = NULL;
+ onEvent = nullptr;
+ onReply = nullptr;
+ int ret = sd_event_default(&mploop);
+ if(ret < 0)
+ {
+ HMI_ERROR("libhomescreen","Failed to create event loop");
+ goto END;
+ }
+
+ /* Initialize interface from websocket */
+ minterface.on_hangup = _on_hangup_static;
+ minterface.on_call = _on_call_static;
+ minterface.on_event = _on_event_static;
+ muri += "ws://localhost:" + to_string(mport) + "/api?token=" + mtoken; /*To be modified*/
+ sp_websock = afb_ws_client_connect_wsj1(mploop, muri.c_str(), &minterface, this);
+ if(sp_websock == NULL)
+ {
+ HMI_ERROR("libhomescreen","Failed to create websocket connection");
+ goto END;
+ }
+
+ /* creates the evsrc */
+ //ret = sd_event_add_io(mploop,&mevent_src, sp_websock->fd, EPOLLIN, event_callback, NULL);
+
+ return 0;
+END:
+ if(mploop)
+ {
+ sd_event_unref(mploop);
+ }
+ return -1;
+}
+
+/**
+ * Sending ShortCut Icon tapped event
+ *
+ * When HomeScreen shortcut area is tapped, sending a event
+ *
+ * #### Parameters
+ * - application_name [in] : Tapped application name (label)
+ *
+ * #### Return
+ * - Returns 0 on success or -1 in case of error.
+ */
+int LibHomeScreen::tapShortcut(const char* application_name)
+{
+ if(!sp_websock)
+ {
+ return -1;
+ }
+
+ struct json_object* obj = json_object_new_object();
+ struct json_object* val = json_object_new_string("normal");
+ json_object_object_add(obj, "area", val);
+
+ return showWindow(application_name, obj);
+}
+
+/**
+ * Sending onScreen message event
+ *
+ * Sending OnScreen message event to HomeScreen from applications
+ *
+ * #### Parameters
+ * - display_message [in] : message for display
+ *
+ * #### Return
+ * - Returns 0 on success or -1 in case of error.
+ */
+int LibHomeScreen::onScreenMessage(const char* display_message)
+{
+ if(!sp_websock)
+ {
+ return -1;
+ }
+
+ struct json_object* j_obj = json_object_new_object();
+ struct json_object* val = json_object_new_string(display_message);
+ json_object_object_add(j_obj, "display_message", val);
+ return this->call("on_screen_message", j_obj);
+}
+
+/**
+ * Sending onScreen reply event
+ *
+ * Sending OnScreen reply event to applications from HomeScreen
+ *
+ * #### Parameters
+ * - reply_message [in] : message for reply
+ *
+ * #### Return
+ * - Returns 0 on success or -1 in case of error.
+ */
+int LibHomeScreen::onScreenReply(const char* reply_message)
+{
+ if(!sp_websock)
+ {
+ return -1;
+ }
+
+ struct json_object* j_obj = json_object_new_object();
+ struct json_object* val = json_object_new_string(reply_message);
+ json_object_object_add(j_obj, "reply_message", val);
+ return this->call("on_screen_reply", j_obj);
+}
+
+/**
+ * Setting Event Handler
+ *
+ * Setting event handler for Homescreen
+ *
+ * #### Parameters
+ * - et [in] : event name
+ * - f [in] : event handler
+ *
+ * #### Return
+ * Nothing
+ *
+ * #### Note
+ * Don't release json_object by json_object_put in handler_func.
+ * The resource is released by libafbwsc library.
+ */
+void LibHomeScreen::set_event_handler(enum EventType et, handler_func f)
+{
+ if (et >= 1 && et <= 5) {
+ switch (et) {
+/* case Event_TapShortcut:
+ this->subscribe(LibHomeScreen::event_list[0]);
+ break;
+*/
+ case Event_ShowWindow:
+ this->subscribe(LibHomeScreen::event_list[0]);
+ break;
+ case Event_OnScreenMessage:
+ this->subscribe(LibHomeScreen::event_list[1]);
+ break;
+ case Event_OnScreenReply:
+ this->subscribe(LibHomeScreen::event_list[2]);
+ break;
+ case Event_AllocateRestriction:
+ this->subscribe(LibHomeScreen::event_list[3]);
+ break;
+ case Event_ReleaseRestriction:
+ this->subscribe(LibHomeScreen::event_list[4]);
+ break;
+ }
+
+ this->handlers[et] = std::move(f);
+ }
+}
+
+/**
+ * This function calls the API of HomeScreen via WebSocket
+ *
+ * #### Parameters
+ * - verb [in] : This argument should be specified to the API name (e.g. "tap_shortcut")
+ * - arg [in] : This argument should be specified to the argument of API. And this argument expects JSON object
+ *
+ * #### Return
+ * - Returns 0 on success or -1 in case of error.
+ *
+ * #### Note
+ * To call HomeScreen's APIs, the application should set its function name, arguments to JSON format.
+ *
+ */
+int LibHomeScreen::call(const string& verb, struct json_object* arg)
+{
+ int ret;
+ if(!sp_websock)
+ {
+ return -1;
+ }
+ if (!has_verb(verb))
+ {
+ HMI_ERROR("libhomescreen","verb doesn't exit");
+ return -1;
+ }
+ ret = afb_wsj1_call_j(sp_websock, API, verb.c_str(), arg, _on_reply_static, this);
+ if (ret < 0) {
+ HMI_ERROR("libhomescreen","Failed to call verb:%s",verb.c_str());
+ }
+ return ret;
+}
+
+/**
+ * This function calls the API of HomeScreen via WebSocket
+ * This function is overload function of "call"
+ *
+ * #### Parameters
+ * - verb [in] : This argument should be specified to the API name (e.g. "tap_shortcut")
+ * - arg [in] : This argument should be specified to the argument of API. And this argument expects JSON object
+ *
+ * #### Return
+ * - Returns 0 on success or -1 in case of error.
+ *
+ * #### Note
+ * To call HomeScreen's APIs, the application should set its function name, arguments to JSON format.
+ *
+ */
+int LibHomeScreen::call(const char* verb, struct json_object* arg)
+{
+ int ret;
+ if(!sp_websock)
+ {
+ return -1;
+ }
+ if (!has_verb(string(verb)))
+ {
+ HMI_ERROR("libhomescreen","verb doesn't exit");
+ return -1;
+ }
+ ret = afb_wsj1_call_j(sp_websock, API, verb, arg, _on_reply_static, this);
+ if (ret < 0) {
+ HMI_ERROR("libhomescreen","Failed to call verb:%s",verb);
+ }
+ return ret;
+}
+
+/**
+ * Register callback function for each event
+ *
+ * #### Parameters
+ * - event_name [in] : This argument should be specified to the event name
+ *
+ * #### Return
+ * - Returns 0 on success or -1 in case of error.
+ *
+ * #### Note
+ * This function enables to get an event to your callback function.
+ *
+ */
+int LibHomeScreen::subscribe(const string& event_name)
+{
+ if(!sp_websock)
+ {
+ return -1;
+ }
+ struct json_object* j_obj = json_object_new_object();
+ json_object_object_add(j_obj, "event", json_object_new_string(event_name.c_str()));
+
+ int ret = afb_wsj1_call_j(sp_websock, API, "subscribe", j_obj, _on_reply_static, this);
+ if (ret < 0) {
+ HMI_ERROR("libhomescreen","Failed to call verb");
+ }
+ return ret;
+}
+
+/**
+ * Unregister callback function for each event
+ *
+ * #### Parameters
+ * - event_name [in] : This argument should be specified to the event name
+ *
+ * #### Return
+ * - Returns 0 on success or -1 in case of error.
+ *
+ * #### Note
+ * This function disables to get an event to your callback function.
+ *
+ */
+int LibHomeScreen::unsubscribe(const string& event_name)
+{
+ if(!sp_websock)
+ {
+ return -1;
+ }
+ struct json_object* j_obj = json_object_new_object();
+ json_object_object_add(j_obj, "event", json_object_new_string(event_name.c_str()));
+
+ int ret = afb_wsj1_call_j(sp_websock, API, "unsubscribe", j_obj, _on_reply_static, this);
+ if (ret < 0) {
+ HMI_ERROR("libhomescreen","Failed to call verb");
+ }
+ return ret;
+}
+
+/**
+ * Sending show window event
+ *
+ * Call HomeScreen Service's showWindow verb to request display id's screen.
+ *
+ * #### Parameters
+ * - id [in] : This argument should be specified to the application's id.
+ * - json [in] : This argument should be specified to the json parameters.
+ *
+ * #### Return
+ * - Returns 0 on success or -1 in case of error.
+ *
+ */
+int LibHomeScreen::showWindow(const char* application_name, json_object* json)
+{
+ if(!sp_websock)
+ {
+ return -1;
+ }
+
+ struct json_object* j_obj = json_object_new_object();
+ struct json_object* val = json_object_new_string(application_name);
+ json_object_object_add(j_obj, "application_name", val);
+ // j_json = json;
+ if (json == nullptr) {
+ struct json_object* j_json = json_object_new_object();
+ struct json_object* value = json_object_new_string("normal");
+ json_object_object_add(j_json, "area", value);
+ json_object_object_add(j_obj, "parameter", j_json);
+ }
+ else {
+ json_object_object_add(j_obj, "parameter", json);
+ }
+
+
+ return this->call("showWindow", j_obj);
+}
+
+/**
+ * Sending allocate restriction event
+ *
+ * Call HomeScreen Service's requestRestriction verb to request restriction screen.
+ *
+ * #### Parameters
+ * - area [in] : restriction display area id.
+ *
+ * #### Return
+ * - Returns 0 on success or -1 in case of error.
+ *
+ */
+int LibHomeScreen::allocateRestriction(const char* area)
+{
+ if(!sp_websock)
+ {
+ return -1;
+ }
+
+ struct json_object* j_obj = json_object_new_object();
+ struct json_object* a_obj = json_object_new_object();
+
+ struct json_object* val = json_object_new_string(area);
+
+ json_object_object_add(j_obj, "area", val);
+
+ json_object_object_add(a_obj, "args", j_obj);
+
+ return this->call("allocateRestriction", a_obj);
+}
+
+/**
+ * Sending release restriction event
+ *
+ * Call HomeScreen Service's releaseRestriction verb to release restriction screen.
+ *
+ * #### Parameters
+ * - area [in] : restriction display area id.
+ *
+ * #### Return
+ * - Returns 0 on success or -1 in case of error.
+ *
+ */
+int LibHomeScreen::releaseRestriction(const char* area)
+{
+ if(!sp_websock)
+ {
+ return -1;
+ }
+
+ struct json_object* j_obj = json_object_new_object();
+ struct json_object* a_obj = json_object_new_object();
+
+ struct json_object* val = json_object_new_string(area);
+
+ json_object_object_add(j_obj, "area", val);
+
+ json_object_object_add(a_obj, "args", j_obj);
+
+ return this->call("releaseRestriction", a_obj);
+}
+
+
+/************* Callback Function *************/
+
+void LibHomeScreen::on_hangup(void *closure, struct afb_wsj1 *wsj)
+{
+ HMI_DEBUG("libhomescreen","called");
+ if(onHangup != nullptr)
+ {
+ onHangup();
+ }
+}
+
+void LibHomeScreen::on_call(void *closure, const char *api, const char *verb, struct afb_wsj1_msg *msg)
+{
+}
+
+/*
+* event is like "homescreen/tap_shortcut"
+* msg is like {"event":"homescreen\/tap_shortcut","data":{"application_name":"hoge"},"jtype":"afb-event"}
+* so you can get
+ event name : struct json_object obj = json_object_object_get(msg,"event")
+*/
+void LibHomeScreen::on_event(void *closure, const char *event, struct afb_wsj1_msg *msg)
+{
+ HMI_DEBUG("libhomescreen","event: (%s) msg: (%s).", event, afb_wsj1_msg_object_s(msg));
+
+ if (strstr(event, API) == NULL) {
+ return;
+ }
+
+ struct json_object* ev_contents = afb_wsj1_msg_object_j(msg);
+ struct json_object *json_data;
+ if(!json_object_object_get_ex(ev_contents, "data", &json_data)) {
+ HMI_ERROR("libhomescreen", "got ev_contents error.");
+ return;
+ }
+
+ if(onEvent != nullptr)
+ {
+ const string ev(event);
+ onEvent(ev, ev_contents);
+ }
+
+ const char* event_type = nullptr;
+ struct json_object *json_event_type;
+ if(json_object_object_get_ex(json_data, "type", &json_event_type)) {
+ event_type = json_object_get_string(json_event_type);
+ }
+ else {
+ HMI_WARNING("libhomescreen","event_type is null.");
+ return;
+ }
+
+ if (strcasecmp(event_type, LibHomeScreen::event_list[0].c_str()) == 0) {
+ auto i = this->handlers.find(Event_TapShortcut);
+ if ( i != this->handlers.end() ) {
+ i->second(json_data);
+ }
+ }
+ else if (strcasecmp(event_type, LibHomeScreen::event_list[1].c_str()) == 0) {
+ auto i = this->handlers.find(Event_OnScreenMessage);
+ if ( i != this->handlers.end() ) {
+ i->second(json_data);
+ }
+ }
+ else if (strcasecmp(event_type, LibHomeScreen::event_list[2].c_str()) == 0) {
+ auto i = this->handlers.find(Event_OnScreenReply);
+ if ( i != this->handlers.end() ) {
+ i->second(json_data);
+ }
+ }
+}
+
+/**
+ * msg is like ({"response":{"verb":"subscribe","error":0},"jtype":"afb-reply","request":{"status":"success","info":"homescreen binder subscribe event name [on_screen_message]"}})
+ * msg is like ({"response":{"verb":"tap_shortcut","error":0},"jtype":"afb-reply","request":{"status":"success","info":"afb_event_push event [tap_shortcut]"}})
+ */
+void LibHomeScreen::on_reply(void *closure, struct afb_wsj1_msg *msg)
+{
+ HMI_DEBUG("libhomescreen","msg: (%s)", afb_wsj1_msg_object_s(msg));
+ if(onReply != nullptr)
+ {
+ struct json_object* reply = afb_wsj1_msg_object_j(msg);
+ onReply(reply);
+ }
+}
+
+static bool has_verb(const string& verb)
+{
+ HMI_DEBUG("libhomescreen","verb is %s", verb.c_str());
+ if(find(LibHomeScreen::api_list.begin(), LibHomeScreen::api_list.end(), verb) != LibHomeScreen::api_list.end())
+ return true;
+ else
+ return false;
+}