From 2b7ca7a6eeb79e03507abb7a16b0503591d2b064 Mon Sep 17 00:00:00 2001 From: Scott Murray Date: Thu, 4 Nov 2021 14:35:55 -0400 Subject: Initial rework to run without the app framework Changes: - Remove application framework build scripts, and update the application qmake file to just build a "homescreen" binary and support installing it to /usr/bin. - Remove voice API related code. Some of the associated QML and images for the UI have been retained in case equivalent functionality is re-added in the future. - Remove or stub out various app framework API access for the homescreen and launcher bindings, and comment out usage of the Qt wrappers from libqtappfw (e.g. Bluetooth). The aim is to provide a replacement library or libraries for the latter that provide the same functionality. - Remove the old homescreen API documentation and do an initial update of the build instructions in README.md. Bug-AGL: SPEC-4121 Signed-off-by: Scott Murray Change-Id: Iab979c8e1341f2da0384f88f163a977b03664600 --- README.md | 23 +-- autobuild/agl/autobuild | 110 ------------ autobuild/linux/autobuild | 110 ------------ homescreen.pro | 5 +- homescreen/docs/api-services-book.yml | 12 -- homescreen/docs/homescreen-book.yml | 12 -- homescreen/docs/homescreen_api.md | 186 --------------------- homescreen/docs/index.md | 31 ---- .../docs/pictures/api_getAllSurfacesOfProcess.png | Bin 10485 -> 0 bytes .../docs/pictures/api_getSurfaceStatus_1.png | Bin 10168 -> 0 bytes .../docs/pictures/api_getSurfaceStatus_2.png | Bin 9794 -> 0 bytes .../docs/pictures/api_getSurfaceStatus_3.png | Bin 19030 -> 0 bytes homescreen/docs/pictures/api_hardKeyPressed.png | Bin 9241 -> 0 bytes .../docs/pictures/api_renderSurfaceToArea.png | Bin 9060 -> 0 bytes .../pictures/api_renderSurfaceToAreaAllowed.png | Bin 14910 -> 0 bytes .../pictures/api_requestSurfaceIdToFullScreen.png | Bin 10056 -> 0 bytes .../docs/pictures/api_surfaceVisibilityChanged.png | Bin 8882 -> 0 bytes homescreen/docs/pictures/dashboard.png | Bin 359145 -> 0 bytes homescreen/docs/pictures/full/dashboard.png | Bin 1055839 -> 0 bytes .../docs/pictures/full/homescreen_applauncher.png | Bin 1090490 -> 0 bytes homescreen/docs/pictures/full/hvac.png | Bin 921864 -> 0 bytes homescreen/docs/pictures/full/phone.png | Bin 936048 -> 0 bytes homescreen/docs/pictures/full/settings.png | Bin 863641 -> 0 bytes .../docs/pictures/homescreen_applauncher.png | Bin 399084 -> 0 bytes homescreen/docs/pictures/hvac.png | Bin 338097 -> 0 bytes homescreen/docs/pictures/phone.png | Bin 336318 -> 0 bytes homescreen/docs/pictures/settings.png | Bin 300437 -> 0 bytes homescreen/homescreen.pro | 38 ++--- homescreen/qml/MediaAreaBlank.qml | 18 +- homescreen/qml/StatusArea.qml | 8 +- homescreen/qml/TopArea.qml | 3 +- homescreen/qml/qml.qrc | 1 - homescreen/src/aglsocketwrapper.cpp | 90 ---------- homescreen/src/aglsocketwrapper.h | 35 ---- homescreen/src/chromecontroller.cpp | 164 ------------------ homescreen/src/chromecontroller.h | 46 ----- homescreen/src/homescreenhandler.cpp | 15 +- homescreen/src/homescreenhandler.h | 9 +- homescreen/src/main.cpp | 50 ++---- homescreen/src/mastervolume.cpp | 17 +- homescreen/src/mastervolume.h | 7 +- homescreen/src/statusbarmodel.cpp | 16 +- homescreen/src/statusbarmodel.h | 2 +- package/config.xml | 22 --- 44 files changed, 92 insertions(+), 938 deletions(-) delete mode 100755 autobuild/agl/autobuild delete mode 100755 autobuild/linux/autobuild delete mode 100644 homescreen/docs/api-services-book.yml delete mode 100644 homescreen/docs/homescreen-book.yml delete mode 100644 homescreen/docs/homescreen_api.md delete mode 100644 homescreen/docs/index.md delete mode 100644 homescreen/docs/pictures/api_getAllSurfacesOfProcess.png delete mode 100644 homescreen/docs/pictures/api_getSurfaceStatus_1.png delete mode 100644 homescreen/docs/pictures/api_getSurfaceStatus_2.png delete mode 100644 homescreen/docs/pictures/api_getSurfaceStatus_3.png delete mode 100644 homescreen/docs/pictures/api_hardKeyPressed.png delete mode 100644 homescreen/docs/pictures/api_renderSurfaceToArea.png delete mode 100644 homescreen/docs/pictures/api_renderSurfaceToAreaAllowed.png delete mode 100644 homescreen/docs/pictures/api_requestSurfaceIdToFullScreen.png delete mode 100644 homescreen/docs/pictures/api_surfaceVisibilityChanged.png delete mode 100644 homescreen/docs/pictures/dashboard.png delete mode 100644 homescreen/docs/pictures/full/dashboard.png delete mode 100644 homescreen/docs/pictures/full/homescreen_applauncher.png delete mode 100644 homescreen/docs/pictures/full/hvac.png delete mode 100644 homescreen/docs/pictures/full/phone.png delete mode 100644 homescreen/docs/pictures/full/settings.png delete mode 100644 homescreen/docs/pictures/homescreen_applauncher.png delete mode 100644 homescreen/docs/pictures/hvac.png delete mode 100644 homescreen/docs/pictures/phone.png delete mode 100644 homescreen/docs/pictures/settings.png delete mode 100644 homescreen/src/aglsocketwrapper.cpp delete mode 100644 homescreen/src/aglsocketwrapper.h delete mode 100644 homescreen/src/chromecontroller.cpp delete mode 100644 homescreen/src/chromecontroller.h delete mode 100644 package/config.xml diff --git a/README.md b/README.md index 2c04a91..4732347 100644 --- a/README.md +++ b/README.md @@ -7,9 +7,8 @@ HomeScreen: AGL Home Screen reference implementation ``` $ mkdir WORK $ cd WORK -$ repo init -b dab -m dab_4.0.0_xml -u https://gerrit.automotivelinux.org/gerrit/AGL/AGL-repo +$ repo init -b master -u https://gerrit.automotivelinux.org/gerrit/AGL/AGL-repo $ repo sync -$ git clone git clone https://gerrit.automotivelinux.org/gerrit/staging/meta-hmi-framework ``` @@ -21,26 +20,16 @@ Then you can get the following recipe. **Bitbake** ``` -$ source meta-agl/scripts/aglsetup.sh -m m3ulcb agl-demo agl-devel agl-appfw-smack agl-hmi-framework +$ source meta-agl/scripts/aglsetup.sh -m m3ulcb agl-demo agl-devel $ bitbake homescreen ``` -Instructions for building HomeScreen app +Instructions for building Home Screen app ---------------------------------------- -The HomeScreen app is part of the -packagegroup-agl-demo-platform +The Home Screen app is part of the packagegroup-agl-demo-platform packagegroup. -This also includes the following apps: -- WindowManager -- HomeScreen Binder - -And the library -- libhomescreen -- libwindowmanager - - To build all the above, follow the instrucions on the AGL documentation website: http://docs.automotivelinux.org/docs/getting_started/en/dev/reference/source-code.html#features-supported-by-aglsetup @@ -49,10 +38,10 @@ Please activate the "agl-demo" feature when running the aglsetup script: http://docs.automotivelinux.org/docs/getting_started/en/dev/reference/source-code.html#features-supported-by-aglsetup -Launch HomeScreen App: +Launch Home Screen App: Usage: ``` -afm-util start homescreen +systemctl start homescreen ``` diff --git a/autobuild/agl/autobuild b/autobuild/agl/autobuild deleted file mode 100755 index bbbc13e..0000000 --- a/autobuild/agl/autobuild +++ /dev/null @@ -1,110 +0,0 @@ -#!/usr/bin/make -f -# Copyright (C) 2015 - 2018 "IoT.bzh" -# Copyright (C) 2020 Konsulko Group -# Author "Romain Forlot" -# -# 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. - -THISFILE := $(lastword $(MAKEFILE_LIST)) -ROOT_DIR := $(abspath $(dir $(THISFILE))/../..) - -# Build directories -# Note that the debug directory is defined in relation to the release -# directory (BUILD_DIR), this needs to be kept in mind if over-riding -# it and building that widget types, the specific widget type variable -# (e.g. BUILD_DIR_DEBUG) may also need to be specified to yield the -# desired output hierarchy. -BUILD_DIR = $(ROOT_DIR)/build -BUILD_DIR_DEBUG = $(abspath $(BUILD_DIR)/../build-debug) - -# Output directory variable for use in pattern rules. -# This is intended for internal use only, hence the explicit override -# definition. -override OUTPUT_DIR = $(BUILD_DIR) - -# Final install directory for widgets -DEST = $(OUTPUT_DIR) - -# Default build type for release builds -BUILD_TYPE = release - -.PHONY: all help update install distclean -.PHONY: clean clean-release clean-debug clean-all -.PHONY: configure configure-release configure-debug -.PHONY: build build-release build-debug build-all -.PHONY: package package-release package-debug package-all - -help: - @echo "List of targets available:" - @echo "" - @echo "- all" - @echo "- help" - @echo "- clean" - @echo "- distclean" - @echo "- configure" - @echo "- build: compilation, link and prepare files for package into a widget" - @echo "- package: output a widget file '*.wgt'" - @echo "- install: install in $(DEST) directory" - @echo "" - @echo "Usage: ./autobuild/agl/autobuild package DEST=${HOME}/opt" - @echo "Don't use your build dir as DEST as wgt file is generated at this location" - -all: package-all - -# Target specific variable over-rides so static pattern rules can be -# used for the various type-specific targets. - -configure-debug build-debug package-debug clean-debug: OUTPUT_DIR = $(BUILD_DIR_DEBUG) -configure-debug build-debug package-debug: BUILD_TYPE = debug - -clean-release clean-debug: - @if [ -d $(OUTPUT_DIR) ]; then \ - $(MAKE) -C $(OUTPUT_DIR) $(CLEAN_ARGS) clean; \ - else \ - echo Nothing to clean; \ - fi - -clean: clean-release - -clean-all: clean-release clean-debug - -distclean: clean-all - -configure-release configure-debug: - @mkdir -p $(OUTPUT_DIR) - @if [ ! -f $(OUTPUT_DIR)/Makefile ]; then \ - (cd $(OUTPUT_DIR) && qmake CONFIG+=$(BUILD_TYPE) $(CONFIGURE_ARGS) $(ROOT_DIR)); \ - fi - -configure: configure-release - -build-release build-debug: build-%: configure-% - @$(MAKE) -C $(OUTPUT_DIR) $(BUILD_ARGS) all - -build: build-release - -build-all: build-release build-debug - -package-release package-debug: package-%: build-% - @cp $(OUTPUT_DIR)/package/*.wgt $(OUTPUT_DIR)/ - @if [ "$(abspath $(DEST))" != "$(abspath $(OUTPUT_DIR))" ]; then \ - mkdir -p $(DEST) && cp $(OUTPUT_DIR)/*.wgt $(DEST); \ - fi - - -package: package-release - -package-all: package-release package-debug - -install: build - @$(MAKE) -C $(BUILD_DIR) $(INSTALL_ARGS) install diff --git a/autobuild/linux/autobuild b/autobuild/linux/autobuild deleted file mode 100755 index bbbc13e..0000000 --- a/autobuild/linux/autobuild +++ /dev/null @@ -1,110 +0,0 @@ -#!/usr/bin/make -f -# Copyright (C) 2015 - 2018 "IoT.bzh" -# Copyright (C) 2020 Konsulko Group -# Author "Romain Forlot" -# -# 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. - -THISFILE := $(lastword $(MAKEFILE_LIST)) -ROOT_DIR := $(abspath $(dir $(THISFILE))/../..) - -# Build directories -# Note that the debug directory is defined in relation to the release -# directory (BUILD_DIR), this needs to be kept in mind if over-riding -# it and building that widget types, the specific widget type variable -# (e.g. BUILD_DIR_DEBUG) may also need to be specified to yield the -# desired output hierarchy. -BUILD_DIR = $(ROOT_DIR)/build -BUILD_DIR_DEBUG = $(abspath $(BUILD_DIR)/../build-debug) - -# Output directory variable for use in pattern rules. -# This is intended for internal use only, hence the explicit override -# definition. -override OUTPUT_DIR = $(BUILD_DIR) - -# Final install directory for widgets -DEST = $(OUTPUT_DIR) - -# Default build type for release builds -BUILD_TYPE = release - -.PHONY: all help update install distclean -.PHONY: clean clean-release clean-debug clean-all -.PHONY: configure configure-release configure-debug -.PHONY: build build-release build-debug build-all -.PHONY: package package-release package-debug package-all - -help: - @echo "List of targets available:" - @echo "" - @echo "- all" - @echo "- help" - @echo "- clean" - @echo "- distclean" - @echo "- configure" - @echo "- build: compilation, link and prepare files for package into a widget" - @echo "- package: output a widget file '*.wgt'" - @echo "- install: install in $(DEST) directory" - @echo "" - @echo "Usage: ./autobuild/agl/autobuild package DEST=${HOME}/opt" - @echo "Don't use your build dir as DEST as wgt file is generated at this location" - -all: package-all - -# Target specific variable over-rides so static pattern rules can be -# used for the various type-specific targets. - -configure-debug build-debug package-debug clean-debug: OUTPUT_DIR = $(BUILD_DIR_DEBUG) -configure-debug build-debug package-debug: BUILD_TYPE = debug - -clean-release clean-debug: - @if [ -d $(OUTPUT_DIR) ]; then \ - $(MAKE) -C $(OUTPUT_DIR) $(CLEAN_ARGS) clean; \ - else \ - echo Nothing to clean; \ - fi - -clean: clean-release - -clean-all: clean-release clean-debug - -distclean: clean-all - -configure-release configure-debug: - @mkdir -p $(OUTPUT_DIR) - @if [ ! -f $(OUTPUT_DIR)/Makefile ]; then \ - (cd $(OUTPUT_DIR) && qmake CONFIG+=$(BUILD_TYPE) $(CONFIGURE_ARGS) $(ROOT_DIR)); \ - fi - -configure: configure-release - -build-release build-debug: build-%: configure-% - @$(MAKE) -C $(OUTPUT_DIR) $(BUILD_ARGS) all - -build: build-release - -build-all: build-release build-debug - -package-release package-debug: package-%: build-% - @cp $(OUTPUT_DIR)/package/*.wgt $(OUTPUT_DIR)/ - @if [ "$(abspath $(DEST))" != "$(abspath $(OUTPUT_DIR))" ]; then \ - mkdir -p $(DEST) && cp $(OUTPUT_DIR)/*.wgt $(DEST); \ - fi - - -package: package-release - -package-all: package-release package-debug - -install: build - @$(MAKE) -C $(BUILD_DIR) $(INSTALL_ARGS) install diff --git a/homescreen.pro b/homescreen.pro index 4f29853..bf0d4bb 100644 --- a/homescreen.pro +++ b/homescreen.pro @@ -17,7 +17,4 @@ TEMPLATE = subdirs load(configure) SUBDIRS = \ - homescreen \ - package - -package.depends += homescreen + homescreen diff --git a/homescreen/docs/api-services-book.yml b/homescreen/docs/api-services-book.yml deleted file mode 100644 index 5a0d43a..0000000 --- a/homescreen/docs/api-services-book.yml +++ /dev/null @@ -1,12 +0,0 @@ -type: books -books: -- - id: homescreen - title: HomeScreen (old) - description: Homescreen documentation - keywords: - author: "TOYOTA MOTOR CORPORATION" - version: master - chapters: - - url: homescreen_api.md - name: HomeScreen API \ No newline at end of file diff --git a/homescreen/docs/homescreen-book.yml b/homescreen/docs/homescreen-book.yml deleted file mode 100644 index acc740d..0000000 --- a/homescreen/docs/homescreen-book.yml +++ /dev/null @@ -1,12 +0,0 @@ -type: books -books: -- - id: homescreen - title: HomeScreen - description: HomeScreen documentation - keywords: - author: - version: master - chapters: - - url: index.md - name: Overview diff --git a/homescreen/docs/homescreen_api.md b/homescreen/docs/homescreen_api.md deleted file mode 100644 index 8f7b8f4..0000000 --- a/homescreen/docs/homescreen_api.md +++ /dev/null @@ -1,186 +0,0 @@ -# HomeScreen API -The HomeScreen app provides an own interface for some special use cases concerning the surfaces and user inputs. - -The interface is implemented as D-Bus interface. -This is the introspection, describing the interface: - -``` - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -``` - -These interface will change during further development, so check back frequently. - -## User Input Events API calls - -### hardKeyPressed - -Use hardKeyPressed to inject hard key press events into the HomeScreen app. -This Interface call can be used by applications like the InputEventManager to inject hard keys into the HomeScreen application. - -#### Example - -if someone presses the Hard Key “NAV” on the target, this key may be injected using this interface to make the HomeScreen launch the navigation application. -Right now, only a few keys are defined (in inputevent.hpp): - -``` -namespace InputEvent { - typedef enum HardKey - { - HARDKEY_UNDEFINED, - HARDKEY_NAV, - HARDKEY_MEDIA - } eHardKey; -} -``` - -This will change in the future. - -![hardKeyPressed](pictures/api_hardKeyPressed.png) - -A “normal” application would not need to call this API. - -## Surface control API calls - -The normal use case when starting an application is: -The user presses a hard key or uses the app launcher to start an app. The app is then started and is shown full screen. -The org.agl.homescreen API provides some methods to get information about some status and some methods to show surfaces on the screen. - -### getSurfaceStatus - -A surface can be visible or invisible (please do not confuse “visible” and “visibility”). This function allows to request the current status. - -``` - - - - -``` - -Right now an application has to pull this information. -This is not optimal and will change in the future. There are two options: - - - The homescreen API will provide a signal that is emitted every time the visible status of surfaces changes. This would be way more efficient, because it would save time and avoid a re-occurring API call. __UPDATE:__ There is a D-Bus signal implemented in this API - - For Qt, there is already a patch available that provides this information as a base class property. See https://codereview.qt-project.org/#/c/176211/ This would be optimal for Qt widget applications. But not useful for other languages, e.g. Java. __UPDATE:__ This patch got reverted in AGL! - -#### Current implementation - -![getSurfaceStatus](pictures/api_getSurfaceStatus_1.png) - -#### Option 1 - -![getSurfaceStatus](pictures/api_getSurfaceStatus_2.png) - -#### Option 2 - -![getSurfaceStatus](pictures/api_getSurfaceStatus_3.png) - -### requestSurfaceIdToFullScreen - -This function will set the given surface to full screen. - -``` - - - -``` - -It will hide all other surfaces. - -![requestSurfaceIdToFullScreen](pictures/api_requestSurfaceIdToFullScreen.png) - -### getAllSurfacesOfProcess - -This returns all surfaces that are created by the given process ID. - -``` - - - - - -``` - -A process can create more than one surface. By default, the surface with the lowest surface ID is shown on the screen. If an application wants to know all surfaces that were created by an application, this method will provide them. - -![getAllSurfacesOfProcess](pictures/api_getAllSurfacesOfProcess.png) - -### renderSurfaceToAreaAllowed - -Before calling renderSurfaceToArea, an application can request, if it is allowed to render the surface to this area. This makes sense for an application that would begin to allocate resources to render. But if it is not allowed to render the surface, the application could avoid allocating the resources. - -``` - - - - - -``` - -The call will not affect the current setup, it will only request if it is allowed or not. - -![renderSurfaceToAreaAllowed](pictures/api_renderSurfaceToAreaAllowed.png) - -### renderSurfaceToArea - -By default, the HomeScreen application decides, where to render an applications surface. The concept of Layouts defines this. This API call can override the default behavior. An app can request to render a surface in a specific Layout Area. - -``` - - - - -``` - -The surface that was previously rendered in this Layout are will be hidden. - -![renderSurfaceToArea](pictures/api_renderSurfaceToArea.png) - -The homescreen interface functionality is not fully implemented, but the API is available. For example using the libhomescreen.so. - -### surfaceVisibilityChanged - -Whenever the visibility property of a surface changes, this signal is emitted. - -``` - - - - -``` - -Visibility here means visible. The name of the signal is from the Weston surface property “visibility”. -See here for reference: https://github.com/ntanibata/wayland-ivi-extension/blob/master/ivi-layermanagement-api/ilmCommon/include/ilm_types.h - -![surfaceVisibilityChanged](pictures/api_surfaceVisibilityChanged.png) diff --git a/homescreen/docs/index.md b/homescreen/docs/index.md deleted file mode 100644 index 4322255..0000000 --- a/homescreen/docs/index.md +++ /dev/null @@ -1,31 +0,0 @@ -# Welcome to your AGL system! -When booting up an AGL system, the first thing that your eyes will spot is this: - -![AGL HomeScreen Application Launcher](pictures/homescreen_applauncher.png) - -**The AGL HomeScreen!** - -Intended to be used with touch presses, the reference HMI provides access to all pre-installed AGL demo applications as well as in the future access to user installed apps. The list of demo apps contains some automotive applications like HVAC-control, Navigation or Dashboard, as well as some infotainment apps. Radio, Multimedia, Phone... -This applications are already available and were presented at CES 2017. - -## Here are some screenshots of the pre-installed demo applications: - -## HVAC - -![AGL HVAC](pictures/hvac.png) - -## Phone - -![AGL Phone](pictures/phone.png) - -## Dashboard - -![AGL Dashboard](pictures/dashboard.png) - -## Settings - -![AGL Settings](pictures/settings.png) - -#### Note: -* All current demos (including HomeScreen) are optimized for landscape full HD resolution (1080x1920). - diff --git a/homescreen/docs/pictures/api_getAllSurfacesOfProcess.png b/homescreen/docs/pictures/api_getAllSurfacesOfProcess.png deleted file mode 100644 index 5c862d7..0000000 Binary files a/homescreen/docs/pictures/api_getAllSurfacesOfProcess.png and /dev/null differ diff --git a/homescreen/docs/pictures/api_getSurfaceStatus_1.png b/homescreen/docs/pictures/api_getSurfaceStatus_1.png deleted file mode 100644 index 1e18fcf..0000000 Binary files a/homescreen/docs/pictures/api_getSurfaceStatus_1.png and /dev/null differ diff --git a/homescreen/docs/pictures/api_getSurfaceStatus_2.png b/homescreen/docs/pictures/api_getSurfaceStatus_2.png deleted file mode 100644 index e66d708..0000000 Binary files a/homescreen/docs/pictures/api_getSurfaceStatus_2.png and /dev/null differ diff --git a/homescreen/docs/pictures/api_getSurfaceStatus_3.png b/homescreen/docs/pictures/api_getSurfaceStatus_3.png deleted file mode 100644 index 50a3b10..0000000 Binary files a/homescreen/docs/pictures/api_getSurfaceStatus_3.png and /dev/null differ diff --git a/homescreen/docs/pictures/api_hardKeyPressed.png b/homescreen/docs/pictures/api_hardKeyPressed.png deleted file mode 100644 index a8a3660..0000000 Binary files a/homescreen/docs/pictures/api_hardKeyPressed.png and /dev/null differ diff --git a/homescreen/docs/pictures/api_renderSurfaceToArea.png b/homescreen/docs/pictures/api_renderSurfaceToArea.png deleted file mode 100644 index a61fc2f..0000000 Binary files a/homescreen/docs/pictures/api_renderSurfaceToArea.png and /dev/null differ diff --git a/homescreen/docs/pictures/api_renderSurfaceToAreaAllowed.png b/homescreen/docs/pictures/api_renderSurfaceToAreaAllowed.png deleted file mode 100644 index 35dbbcf..0000000 Binary files a/homescreen/docs/pictures/api_renderSurfaceToAreaAllowed.png and /dev/null differ diff --git a/homescreen/docs/pictures/api_requestSurfaceIdToFullScreen.png b/homescreen/docs/pictures/api_requestSurfaceIdToFullScreen.png deleted file mode 100644 index 6d2f712..0000000 Binary files a/homescreen/docs/pictures/api_requestSurfaceIdToFullScreen.png and /dev/null differ diff --git a/homescreen/docs/pictures/api_surfaceVisibilityChanged.png b/homescreen/docs/pictures/api_surfaceVisibilityChanged.png deleted file mode 100644 index f519757..0000000 Binary files a/homescreen/docs/pictures/api_surfaceVisibilityChanged.png and /dev/null differ diff --git a/homescreen/docs/pictures/dashboard.png b/homescreen/docs/pictures/dashboard.png deleted file mode 100644 index 527386d..0000000 Binary files a/homescreen/docs/pictures/dashboard.png and /dev/null differ diff --git a/homescreen/docs/pictures/full/dashboard.png b/homescreen/docs/pictures/full/dashboard.png deleted file mode 100644 index e947734..0000000 Binary files a/homescreen/docs/pictures/full/dashboard.png and /dev/null differ diff --git a/homescreen/docs/pictures/full/homescreen_applauncher.png b/homescreen/docs/pictures/full/homescreen_applauncher.png deleted file mode 100644 index b61884a..0000000 Binary files a/homescreen/docs/pictures/full/homescreen_applauncher.png and /dev/null differ diff --git a/homescreen/docs/pictures/full/hvac.png b/homescreen/docs/pictures/full/hvac.png deleted file mode 100644 index 7e0399a..0000000 Binary files a/homescreen/docs/pictures/full/hvac.png and /dev/null differ diff --git a/homescreen/docs/pictures/full/phone.png b/homescreen/docs/pictures/full/phone.png deleted file mode 100644 index f4cc547..0000000 Binary files a/homescreen/docs/pictures/full/phone.png and /dev/null differ diff --git a/homescreen/docs/pictures/full/settings.png b/homescreen/docs/pictures/full/settings.png deleted file mode 100644 index a115ef4..0000000 Binary files a/homescreen/docs/pictures/full/settings.png and /dev/null differ diff --git a/homescreen/docs/pictures/homescreen_applauncher.png b/homescreen/docs/pictures/homescreen_applauncher.png deleted file mode 100644 index e168668..0000000 Binary files a/homescreen/docs/pictures/homescreen_applauncher.png and /dev/null differ diff --git a/homescreen/docs/pictures/hvac.png b/homescreen/docs/pictures/hvac.png deleted file mode 100644 index f9a6030..0000000 Binary files a/homescreen/docs/pictures/hvac.png and /dev/null differ diff --git a/homescreen/docs/pictures/phone.png b/homescreen/docs/pictures/phone.png deleted file mode 100644 index e087594..0000000 Binary files a/homescreen/docs/pictures/phone.png and /dev/null differ diff --git a/homescreen/docs/pictures/settings.png b/homescreen/docs/pictures/settings.png deleted file mode 100644 index c92d835..0000000 Binary files a/homescreen/docs/pictures/settings.png and /dev/null differ diff --git a/homescreen/homescreen.pro b/homescreen/homescreen.pro index 7e65d56..0bf98fb 100644 --- a/homescreen/homescreen.pro +++ b/homescreen/homescreen.pro @@ -14,39 +14,29 @@ # limitations under the License. TEMPLATE = app -TARGET = HomeScreen -QT = qml quick websockets gui-private +TARGET = homescreen +QT = qml quick gui-private CONFIG += c++11 link_pkgconfig wayland-scanner -DESTDIR = $${OUT_PWD}/../package/root/bin -PKGCONFIG += qtappfw-weather qtappfw-network qtappfw-bt afb-helpers-qt wayland-client json-c - -LIBS += -lhomescreen - -CONFIG(release, debug|release) { - QMAKE_POST_LINK = $(STRIP) --strip-unneeded $(TARGET) -} +PKGCONFIG += wayland-client SOURCES += \ src/main.cpp \ + src/shell.cpp \ src/statusbarmodel.cpp \ src/statusbarserver.cpp \ src/applicationlauncher.cpp \ src/mastervolume.cpp \ - src/homescreenhandler.cpp \ - src/shell.cpp \ - src/aglsocketwrapper.cpp \ - src/chromecontroller.cpp + src/homescreenhandler.cpp HEADERS += \ + src/shell.h \ + src/constants.h \ src/statusbarmodel.h \ src/statusbarserver.h \ src/applicationlauncher.h \ src/mastervolume.h \ - src/homescreenhandler.h \ - src/shell.h \ - src/aglsocketwrapper.h \ - src/chromecontroller.h \ - src/constants.h + src/homescreenhandler.h + OTHER_FILES += \ README.md @@ -58,9 +48,13 @@ RESOURCES += \ qml/images/Shortcut/shortcut.qrc \ qml/images/Status/status.qrc \ qml/images/images.qrc \ - qml/qml.qrc \ - qml/images/SpeechChrome/speechchrome.qrc - + qml/qml.qrc AGL_SHELL_PATH = $$system(pkg-config --variable=pkgdatadir agl-compositor-0.0.19-protocols) WAYLANDCLIENTSOURCES += $$AGL_SHELL_PATH/agl-shell.xml + +target.path = $${PREFIX}/usr/bin +target.files += $${OUT_PWD}/$${TARGET} +target.CONFIG = no_check_exist executable + +INSTALLS += target diff --git a/homescreen/qml/MediaAreaBlank.qml b/homescreen/qml/MediaAreaBlank.qml index c971f6e..7a9e8af 100644 --- a/homescreen/qml/MediaAreaBlank.qml +++ b/homescreen/qml/MediaAreaBlank.qml @@ -19,7 +19,9 @@ import QtQuick 2.2 import QtQuick.Layouts 1.1 import QtQuick.Controls 2.0 import AGL.Demo.Controls 1.0 +/* import MasterVolume 1.0 +*/ Image { anchors.fill: parent @@ -55,20 +57,18 @@ Image { PropertyChanges { target: master_volume; opacity: 1.0 } PropertyChanges { target: slider; enabled: true } PropertyChanges { target: logo_image; opacity: 0.0 } - PropertyChanges { target: speech_chrome; visible: false } }, State { when: !displayVolume; PropertyChanges { target: master_volume; opacity: 0.0 } PropertyChanges { target: slider; enabled: false } PropertyChanges { target: logo_image; opacity: 1.0 } - PropertyChanges { target: speech_chrome; visible: speech_chrome.agentPresent } } ] transitions: Transition { NumberAnimation { property: "opacity"; duration: 500} } - +/* MasterVolume { id: mv objectName: "mv" @@ -77,7 +77,7 @@ Image { mv.open(bindingAddress); } } - +*/ Item { id: master_volume anchors.fill: parent @@ -108,8 +108,10 @@ Image { to: 100 stepSize: 1 snapMode: Slider.SnapOnRelease +/* onValueChanged: mv.volume = value Component.onCompleted: value = mv.volume +*/ onPressedChanged: { if (pressed) {volume_timer.stop()} else {volume_timer.restart()} @@ -122,12 +124,4 @@ Image { } } } - - SpeechChrome { - id: speech_chrome - anchors.left: parent.left - anchors.right: parent.right - anchors.bottom: parent.bottom - height: parent.height - } } diff --git a/homescreen/qml/StatusArea.qml b/homescreen/qml/StatusArea.qml index 4a8fbc0..87b27ad 100644 --- a/homescreen/qml/StatusArea.qml +++ b/homescreen/qml/StatusArea.qml @@ -30,7 +30,7 @@ Item { interval: 100; running: true; repeat: true; onTriggered: root.now = new Date } - +/* Connections { target: weather @@ -54,7 +54,7 @@ Item { temperature_item.text = temperature.split(".")[0] + '°F' } } - +*/ RowLayout { anchors.fill: parent spacing: 0 @@ -126,6 +126,7 @@ Item { fillMode: Image.PreserveAspectFit property string deviceName: "none" property bool connStatus: false +/* Connections { target: bluetooth @@ -133,7 +134,9 @@ Item { bt_icon.connStatus = state } } +*/ } +/* Repeater { model: StatusBarModel { objectName: "statusBar" } delegate: Image { @@ -143,6 +146,7 @@ Item { fillMode: Image.PreserveAspectFit } } +*/ } } } diff --git a/homescreen/qml/TopArea.qml b/homescreen/qml/TopArea.qml index 19bed91..3b0b25a 100644 --- a/homescreen/qml/TopArea.qml +++ b/homescreen/qml/TopArea.qml @@ -41,7 +41,7 @@ Image { Layout.preferredWidth: 291 } } - +/* Timer { id: launching interval: 500 @@ -56,4 +56,5 @@ Image { indeterminate: visible visible: launcher.launching && !launching.running } +*/ } diff --git a/homescreen/qml/qml.qrc b/homescreen/qml/qml.qrc index 7a0be7c..319e1da 100644 --- a/homescreen/qml/qml.qrc +++ b/homescreen/qml/qml.qrc @@ -6,7 +6,6 @@ MediaAreaRadio.qml ShortcutArea.qml ShortcutIcon.qml - SpeechChrome.qml StatusArea.qml TopArea.qml IconItem.qml diff --git a/homescreen/src/aglsocketwrapper.cpp b/homescreen/src/aglsocketwrapper.cpp deleted file mode 100644 index 8352660..0000000 --- a/homescreen/src/aglsocketwrapper.cpp +++ /dev/null @@ -1,90 +0,0 @@ -#include "aglsocketwrapper.h" -#include "constants.h" - -#include -#include -#include -#include -#include - -#include - -namespace { -enum MessageTypes { - Call = 2, - Success = 3, - Error = 4, - Event = 5 -}; -} - -AglSocketWrapper::AglSocketWrapper(QObject *parent) : - QObject(parent) - , m_socket(new QWebSocket(QString(), QWebSocketProtocol::VersionLatest, this)) -{ - connect(m_socket, &QWebSocket::connected, this, &AglSocketWrapper::connected); - connect(m_socket, &QWebSocket::disconnected, this, &AglSocketWrapper::disconnected); - connect(m_socket, QOverload::of(&QWebSocket::error), - [](QAbstractSocket::SocketError error) -> void { - qWarning() << "AglSocketWrapper internal socket error" << error; - }); - connect(m_socket, &QWebSocket::textMessageReceived, - this, [this](const QString &msg) -> void { - const QJsonDocument doc = QJsonDocument::fromJson(msg.toUtf8()); - if (doc.isArray()) { - const QJsonArray msgArray = doc.array(); - if (msgArray.count() >= 3) { - const int msgType = msgArray.at(0).toInt(); - switch (msgType) { - case Success: - case Error: { - auto callbackIt = m_callbacks.find( msgArray.at(1).toString()); - if (callbackIt != m_callbacks.constEnd()) { - (*callbackIt)(msgType == Success, msgArray.at(2)); - m_callbacks.erase(callbackIt); - } - } - break; - case Event: { - const QJsonObject eventObj = msgArray.at(2).toObject(); - emit eventReceived(msgArray.at(1).toString(), eventObj.value(vshl::DATA_TAG)); - } - break; - default: - break; - } - return; - } - } - qWarning() << "Unsupported message format:" << msg; - }); -} - -void AglSocketWrapper::open(const QUrl &url) -{ - m_socket->open(url); -} - -void AglSocketWrapper::close() -{ - m_socket->close(); -} - -void AglSocketWrapper::apiCall(const QString &api, const QString &verb, const QJsonValue &args, - AglSocketWrapper::ApiCallback callback) -{ - const QString id = QUuid::createUuid().toString(); - if (callback) - m_callbacks.insert(id, callback); - - QJsonArray callData; - callData.append(Call); - callData.append(id); - callData.append(api + QLatin1String("/") + verb); - callData.append(args); - - const QString msg = QLatin1String(QJsonDocument(callData).toJson(QJsonDocument::Compact)); - m_socket->sendTextMessage(msg); - - qDebug() << Q_FUNC_INFO << "Data sent:" << msg; -} diff --git a/homescreen/src/aglsocketwrapper.h b/homescreen/src/aglsocketwrapper.h deleted file mode 100644 index 4807cd5..0000000 --- a/homescreen/src/aglsocketwrapper.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef AGLSOCKETWRAPPER_H -#define AGLSOCKETWRAPPER_H - -#include -#include -#include -#include - -#include - -class QWebSocket; -class AglSocketWrapper : public QObject -{ - Q_OBJECT -public: - explicit AglSocketWrapper(QObject *parent = nullptr); - - void open(const QUrl &url); - void close(); - - using ApiCallback = std::function; - void apiCall(const QString &api, const QString &verb, const QJsonValue &args = QJsonValue(), - ApiCallback callback = nullptr); - -signals: - void connected(); - void disconnected(); - void eventReceived(const QString &eventName, const QJsonValue &data); - -private: - QWebSocket *m_socket; - QMap m_callbacks; -}; - -#endif // AGLSOCKETWRAPPER_H diff --git a/homescreen/src/chromecontroller.cpp b/homescreen/src/chromecontroller.cpp deleted file mode 100644 index e944b2d..0000000 --- a/homescreen/src/chromecontroller.cpp +++ /dev/null @@ -1,164 +0,0 @@ -#include "chromecontroller.h" -#include "aglsocketwrapper.h" -#include "constants.h" - -#include -#include -#include - -ChromeController::ChromeController(const QUrl &bindingUrl, QObject *parent) : - QObject(parent) - , m_aglSocket(new AglSocketWrapper(this)) -{ - //Alexa voice agent subscription---------------------------------------------------------------- - { - connect(m_aglSocket, &AglSocketWrapper::connected, - this, [this]() -> void { - m_aglSocket->apiCall(vshl::API, vshl::VOICE_AGENT_ENUMERATION_VERB, QJsonValue(), - [this](bool result, const QJsonValue &data) -> void { - qDebug() << (vshl::API + QLatin1String(":") + vshl::VOICE_AGENT_ENUMERATION_VERB) - << "result: " << result << " val: " << data; - if (!result) { - qWarning() << "Failed to enumerate voice agents"; - return; - } - - QJsonObject dataObj = data.toObject(); - auto objIt = dataObj.find(vshl::RESPONSE_TAG); - if (objIt == dataObj.constEnd()) { - qWarning() << "Voice agent enumeration response tag missing." - << dataObj; - return; - } - - // Get default voice agent - dataObj = objIt.value().toObject(); - QJsonObject responseObj = dataObj; - objIt = dataObj.find(vshl::DEFAULT_TAG); - if (objIt == dataObj.constEnd()) { - qWarning() << "Voice agent enumeration default agent tag missing." - << dataObj; - return; - } - QString agentId = objIt.value().toString(); - if (agentId.isEmpty()) { - qWarning() << "Default voice agent not found"; - return; - } - qDebug() << (vshl::API + QLatin1String(":") + vshl::VOICE_AGENT_ENUMERATION_VERB) << "default: " << agentId; - - objIt = dataObj.find(vshl::AGENTS_TAG); - if (objIt == dataObj.constEnd()) { - qWarning() << "Voice agent enumeration agents tag missing." - << dataObj; - return; - } - - // Sanity check that the default agent is actually listed - bool agentFound = false; - const QJsonArray agents = objIt.value().toArray(); - for (const QJsonValue &agent : agents) { - const QJsonObject agentObj = agent.toObject(); - auto agentIt = agentObj.find(vshl::ID_TAG); - if (agentIt == agentObj.constEnd()) - continue; - if (agentId.compare(agentIt.value().toString()) == 0) { - agentFound = true; - auto nameIt = agentObj.find(vshl::NAME_TAG); - if (nameIt != agentObj.constEnd()) { - m_voiceAgentName = nameIt.value().toString(); - emit agentNameChanged(); - } - break; - } - } - if (!agentFound) { - qWarning() << "Default voice agent configuration not found"; - return; - } - m_agentPresent = true; - emit agentPresentChanged(); - - //Voice agent subscription------------------------------------------------------ - { - m_voiceAgentId = agentId; - const QJsonObject args { - { vshl::VOICE_AGENT_ID_ARG, agentId }, - { vshl::VOICE_AGENT_EVENTS_ARG, vshl::VOICE_AGENT_EVENTS_ARRAY } - }; - m_aglSocket->apiCall(vshl::API, vshl::SUBSCRIBE_VERB, args, - [](bool result, const QJsonValue &data) -> void { - qDebug() << (vshl::API + QLatin1String(":") + vshl::SUBSCRIBE_VERB) - << "result: " << result << " val: " << data; - }); - } - //------------------------------------------------------------------------------ - }); - }); - } - //----------------------------------------------------------------------------------------------< - - //Socket connection management------------------------------------------------------------------ - { - auto connectToBinding = [bindingUrl, this]() -> void { - m_aglSocket->open(bindingUrl); - qDebug() << "Connecting to:" << bindingUrl; - }; - connect(m_aglSocket, &AglSocketWrapper::disconnected, this, [connectToBinding]() -> void { - QTimer::singleShot(2500, connectToBinding); - }); - connectToBinding(); - } - //---------------------------------------------------------------------------------------------- - - //Speech chrome state change event handling----------------------------------------------------- - { - connect(m_aglSocket, &AglSocketWrapper::eventReceived, - this, [this](const QString &eventName, const QJsonValue &data) -> void { - if (eventName.compare(vshl::VOICE_DIALOG_STATE_EVENT + m_voiceAgentId) == 0) { - const QJsonObject dataObj = data.toObject(); - auto objIt = dataObj.find(vshl::STATE_TAG); - if (objIt == dataObj.constEnd()) { - qWarning() << "Voice dialog state event state missing."; - return; - } - const QString stateStr = objIt.value().toString(); - if (stateStr.compare(vshl::VOICE_DIALOG_IDLE) == 0) { - setChromeState(Idle); - } else if (stateStr.compare(vshl::VOICE_DIALOG_LISTENING) == 0) { - setChromeState(Listening); - } else if (stateStr.compare(vshl::VOICE_DIALOG_THINKING) == 0) { - setChromeState(Thinking); - } else if (stateStr.compare(vshl::VOICE_DIALOG_SPEAKING) == 0) { - setChromeState(Speaking); - } else if (stateStr.compare(vshl::VOICE_DIALOG_MICROPHONEOFF) == 0) { - setChromeState(MicrophoneOff); - } - } - }); - } - //---------------------------------------------------------------------------------------------- -} - -void ChromeController::pushToTalk() -{ - m_aglSocket->apiCall(vshl::API, vshl::TAP_TO_TALK_VERB, QJsonValue(), - [](bool result, const QJsonValue &data) -> void { - qDebug() << (vshl::API + QLatin1String(":") + vshl::TAP_TO_TALK_VERB) - << "result: " << result << " val: " << data; - }); -} - -void ChromeController::setChromeState(ChromeController::ChromeState state) -{ - const char* ChromeStateNames[MicrophoneOff + 1] = { "Idle", "Listening", "Thinking", "Speaking", "MicrophoneOff" }; - - if (m_chromeState != state) { - m_chromeState = state; - emit chromeStateChanged(); - if(state <= MicrophoneOff) - qDebug() << "new state = " << ChromeStateNames[state]; - else - qDebug() << "new state = " << state; - } -} diff --git a/homescreen/src/chromecontroller.h b/homescreen/src/chromecontroller.h deleted file mode 100644 index 047ddd9..0000000 --- a/homescreen/src/chromecontroller.h +++ /dev/null @@ -1,46 +0,0 @@ -#pragma once - -#include -#include - -class AglSocketWrapper; -class ChromeController : public QObject -{ - Q_OBJECT - - Q_PROPERTY(bool agentPresent READ agentPresent NOTIFY agentPresentChanged) - Q_PROPERTY(QString agentName READ agentName NOTIFY agentNameChanged) - Q_PROPERTY(int chromeState READ chromeState NOTIFY chromeStateChanged) - -public: - enum ChromeState { - Idle = 0, - Listening, - Thinking, - Speaking, - MicrophoneOff - }; - Q_ENUM(ChromeState) - - explicit ChromeController(const QUrl &bindingUrl, QObject *parent = nullptr); - bool agentPresent() const { return m_agentPresent; } - int chromeState() const { return m_chromeState; } - QString agentName() const { return m_voiceAgentName; } - -public slots: - void pushToTalk(); - -signals: - void agentPresentChanged(); - void agentNameChanged(); - void chromeStateChanged(); - -private: - void setChromeState(ChromeState state); - - AglSocketWrapper *m_aglSocket; - QString m_voiceAgentId = ""; - QString m_voiceAgentName = ""; - bool m_agentPresent = false; - ChromeState m_chromeState = Idle; -}; diff --git a/homescreen/src/homescreenhandler.cpp b/homescreen/src/homescreenhandler.cpp index e31f122..836ed47 100644 --- a/homescreen/src/homescreenhandler.cpp +++ b/homescreen/src/homescreenhandler.cpp @@ -33,19 +33,22 @@ HomescreenHandler::HomescreenHandler(Shell *_aglShell, ApplicationLauncher *laun HomescreenHandler::~HomescreenHandler() { +#if 0 if (mp_hs != NULL) { delete mp_hs; } +#endif } -void HomescreenHandler::init(int port, const char *token) +void HomescreenHandler::init(void) { +#if 0 mp_hs = new LibHomeScreen(); mp_hs->init(port, token); - +#endif myThis = this; - +#if 0 mp_hs->registerCallback(nullptr, HomescreenHandler::onRep_static); mp_hs->set_event_handler(LibHomeScreen::Event_OnScreenMessage, [this](json_object *object){ @@ -83,6 +86,7 @@ void HomescreenHandler::init(int port, const char *token) emit showInformation(QString(QLatin1String(info))); }); +#endif } static struct wl_output * @@ -95,7 +99,7 @@ getWlOutput(QPlatformNativeInterface *native, QScreen *screen) void HomescreenHandler::tapShortcut(QString application_id) { HMI_DEBUG("HomeScreen","tapShortcut %s", application_id.toStdString().c_str()); - +#if 0 struct json_object* j_json = json_object_new_object(); struct json_object* value; @@ -117,8 +121,10 @@ void HomescreenHandler::tapShortcut(QString application_id) if (mp_launcher) { mp_launcher->setCurrent(application_id); } +#endif } +#if 0 void HomescreenHandler::onRep_static(struct json_object* reply_contents) { static_cast(HomescreenHandler::myThis)->onRep(reply_contents); @@ -148,3 +154,4 @@ void HomescreenHandler::onEv(const string& event, struct json_object* event_cont HMI_DEBUG("HomeScreen","display_message = %s", display_message); } } +#endif diff --git a/homescreen/src/homescreenhandler.h b/homescreen/src/homescreenhandler.h index 790c4fd..6dbf31b 100644 --- a/homescreen/src/homescreenhandler.h +++ b/homescreen/src/homescreenhandler.h @@ -19,7 +19,6 @@ #include -#include #include "applicationlauncher.h" #include "shell.h" @@ -34,22 +33,24 @@ public: explicit HomescreenHandler(Shell *aglShell, ApplicationLauncher *launcher = 0, QObject *parent = 0); ~HomescreenHandler(); - void init(int port, const char* token); + void init(void); Q_INVOKABLE void tapShortcut(QString application_id); +#if 0 void onRep(struct json_object* reply_contents); void onEv(const string& event, struct json_object* event_contents); - +#endif static void* myThis; +#if 0 static void onRep_static(struct json_object* reply_contents); static void onEv_static(const string& event, struct json_object* event_contents); +#endif signals: void showNotification(QString application_id, QString icon_path, QString text); void showInformation(QString info); private: - LibHomeScreen *mp_hs; ApplicationLauncher *mp_launcher; Shell *aglShell; }; diff --git a/homescreen/src/main.cpp b/homescreen/src/main.cpp index 376644f..75ed97c 100644 --- a/homescreen/src/main.cpp +++ b/homescreen/src/main.cpp @@ -26,14 +26,15 @@ #include #include +#if 0 #include #include +#endif #include "applicationlauncher.h" #include "statusbarmodel.h" #include "mastervolume.h" #include "homescreenhandler.h" #include "hmi-debug.h" -#include "chromecontroller.h" #include #include @@ -137,8 +138,9 @@ find_screen(const char *screen_name) static void load_agl_shell_app(QPlatformNativeInterface *native, QQmlApplicationEngine *engine, - struct agl_shell *agl_shell, QUrl &bindingAddress, - const char *screen_name, bool is_demo) + struct agl_shell *agl_shell, + const char *screen_name, + bool is_demo) { struct wl_surface *bg, *top, *bottom; struct wl_output *output; @@ -182,12 +184,11 @@ load_agl_shell_app(QPlatformNativeInterface *native, "first screen " << qApp->screens().first()->name(); output = getWlOutput(native, screen); - /* engine.rootObjects() works only if we had a load() */ StatusBarModel *statusBar = qobj_top->findChild("statusBar"); if (statusBar) { qDebug() << "got statusBar objectname, doing init()"; - statusBar->init(bindingAddress, engine->rootContext()); + statusBar->init(engine->rootContext()); } agl_shell_set_panel(agl_shell, top, output, AGL_SHELL_EDGE_TOP); @@ -225,25 +226,6 @@ int main(int argc, char *argv[]) /* we need to have an app_id */ a.setDesktopFileName("homescreen"); - QCommandLineParser parser; - parser.addPositionalArgument("port", a.translate("main", "port for binding")); - parser.addPositionalArgument("secret", a.translate("main", "secret for binding")); - parser.addHelpOption(); - parser.addVersionOption(); - parser.process(a); - QStringList positionalArguments = parser.positionalArguments(); - - int port = 1700; - QString token = "wm"; - QString graphic_role = "homescreen"; // defined in layers.json in Window Manager - - if (positionalArguments.length() == 2) { - port = positionalArguments.takeFirst().toInt(); - token = positionalArguments.takeFirst(); - } - - HMI_DEBUG("HomeScreen","port = %d, token = %s", port, token.toStdString().c_str()); - agl_shell = register_agl_shell(native); if (!agl_shell) { fprintf(stderr, "agl_shell extension is not advertised. " @@ -257,40 +239,28 @@ int main(int argc, char *argv[]) // import C++ class to QML qmlRegisterType("HomeScreen", 1, 0, "StatusBarModel"); qmlRegisterType("MasterVolume", 1, 0, "MasterVolume"); - qmlRegisterUncreatableType("SpeechChrome", 1, 0, "SpeechChromeController", - QLatin1String("SpeechChromeController is uncreatable.")); ApplicationLauncher *launcher = new ApplicationLauncher(); launcher->setCurrent(QStringLiteral("launcher")); HomescreenHandler* homescreenHandler = new HomescreenHandler(aglShell, launcher); - homescreenHandler->init(port, token.toStdString().c_str()); - - QUrl bindingAddress; - bindingAddress.setScheme(QStringLiteral("ws")); - bindingAddress.setHost(QStringLiteral("localhost")); - bindingAddress.setPort(port); - bindingAddress.setPath(QStringLiteral("/api")); - - QUrlQuery query; - query.addQueryItem(QStringLiteral("token"), token); - bindingAddress.setQuery(query); + homescreenHandler->init(); QQmlApplicationEngine engine; QQmlContext *context = engine.rootContext(); - context->setContextProperty("bindingAddress", bindingAddress); context->setContextProperty("homescreenHandler", homescreenHandler); context->setContextProperty("launcher", launcher); +#if 0 context->setContextProperty("weather", new Weather(bindingAddress)); context->setContextProperty("bluetooth", new Bluetooth(bindingAddress, context)); - context->setContextProperty("speechChromeController", new ChromeController(bindingAddress, &engine)); +#endif // we add it here even if we don't use it context->setContextProperty("shell", aglShell); /* instead of loading main.qml we load one-by-one each of the QMLs, * divided now between several surfaces: panels, background. */ - load_agl_shell_app(native, &engine, agl_shell, bindingAddress, screen_name, is_demo_val); + load_agl_shell_app(native, &engine, agl_shell, screen_name, is_demo_val); return a.exec(); } diff --git a/homescreen/src/mastervolume.cpp b/homescreen/src/mastervolume.cpp index 43beaef..de8d75d 100644 --- a/homescreen/src/mastervolume.cpp +++ b/homescreen/src/mastervolume.cpp @@ -15,7 +15,6 @@ */ #include "mastervolume.h" -#include #include #include @@ -25,17 +24,19 @@ MasterVolume::MasterVolume(QObject* parent) : QObject(parent) , m_volume{50} { +#if 0 connect(&m_client, SIGNAL(connected()), this, SLOT(onClientConnected())); connect(&m_client, SIGNAL(disconnected()), this, SLOT(onClientDisconnected())); connect(&m_client, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(onClientError(QAbstractSocket::SocketError))); connect(&m_client, SIGNAL(eventReceived(QString, const QJsonValue&)), this, SLOT(onClientEventReceived(QString, const QJsonValue&))); +#endif } +#if 0 void MasterVolume::open(const QUrl& url) { - m_url = url; - TryOpen(); } +#endif qint32 MasterVolume::getVolume() const { @@ -47,16 +48,21 @@ void MasterVolume::setVolume(qint32 volume) if (m_volume != volume) { m_volume = volume; +#if 0 QJsonObject arg; arg.insert("control", MASTER_CONTROL); double v = (double) volume / 100.0; arg.insert("value", v); m_client.call("audiomixer", "volume", arg); +#endif } } +#if 0 + void MasterVolume::onClientConnected() { + QJsonObject arg; arg.insert("control", MASTER_CONTROL); m_client.call("audiomixer", "volume", arg, [this](bool r, const QJsonValue& v) { @@ -107,7 +113,4 @@ void MasterVolume::onClientEventReceived(QString name, const QJsonValue& data) } } -void MasterVolume::TryOpen() -{ - m_client.open(m_url); -} +#endif diff --git a/homescreen/src/mastervolume.h b/homescreen/src/mastervolume.h index 6ae0aad..04ce3b5 100644 --- a/homescreen/src/mastervolume.h +++ b/homescreen/src/mastervolume.h @@ -16,7 +16,6 @@ #include #include -#include "../qafbwebsocketclient.h" class MasterVolume : public QObject @@ -25,24 +24,24 @@ class MasterVolume Q_PROPERTY (uint32_t volume READ getVolume WRITE setVolume NOTIFY VolumeChanged) private: - QAfbWebsocketClient m_client; - QUrl m_url; qint32 m_volume; public: MasterVolume(QObject* parent = nullptr); ~MasterVolume() = default; - Q_INVOKABLE void open(const QUrl& url); + //Q_INVOKABLE void open(const QUrl& url); Q_INVOKABLE qint32 getVolume() const; Q_INVOKABLE void setVolume(qint32 val); private slots: +#if 0 void onClientConnected(); void onClientDisconnected(); void onClientError(QAbstractSocket::SocketError se); void onClientEventReceived(QString name, const QJsonValue& data); void TryOpen(); +#endif signals: void VolumeChanged(); diff --git a/homescreen/src/statusbarmodel.cpp b/homescreen/src/statusbarmodel.cpp index 1e8be6f..8b46cd1 100644 --- a/homescreen/src/statusbarmodel.cpp +++ b/homescreen/src/statusbarmodel.cpp @@ -17,7 +17,9 @@ #include "statusbarmodel.h" #include "statusbarserver.h" +#if 0 #include "network.h" +#endif class StatusBarModel::Private { @@ -29,8 +31,10 @@ private: public: StatusBarServer server; QString iconList[StatusBarServer::SupportedCount]; +#if 0 Network *network; WifiAdapter *wifi_a; +#endif }; StatusBarModel::Private::Private(StatusBarModel *parent) @@ -58,8 +62,9 @@ StatusBarModel::~StatusBarModel() delete d; } -void StatusBarModel::init(QUrl &url, QQmlContext *context) +void StatusBarModel::init(QQmlContext *context) { +#if 0 d->network = new Network(url, context); context->setContextProperty("network", d->network); d->wifi_a = static_cast(d->network->findAdapter("wifi")); @@ -73,10 +78,12 @@ void StatusBarModel::init(QUrl &url, QQmlContext *context) this, &StatusBarModel::onWifiStrengthChanged); setWifiStatus(d->wifi_a->wifiConnected(), d->wifi_a->wifiEnabled(), d->wifi_a->wifiStrength()); +#endif } void StatusBarModel::setWifiStatus(bool connected, bool enabled, int strength) { +#if 0 if (enabled && connected) if (strength < 30) d->server.setStatusIcon(0, QStringLiteral("qrc:/images/Status/HMI_Status_Wifi_1Bar-01.png")); @@ -88,22 +95,29 @@ void StatusBarModel::setWifiStatus(bool connected, bool enabled, int strength) d->server.setStatusIcon(0, QStringLiteral("qrc:/images/Status/HMI_Status_Wifi_Full-01.png")); else d->server.setStatusIcon(0, QStringLiteral("qrc:/images/Status/HMI_Status_Wifi_NoBars-01.png")); +#endif } void StatusBarModel::onWifiConnectedChanged(bool connected) { +#if 0 setWifiStatus(connected, d->wifi_a->wifiEnabled(), d->wifi_a->wifiStrength()); +#endif } void StatusBarModel::onWifiEnabledChanged(bool enabled) { +#if 0 setWifiStatus(d->wifi_a->wifiConnected(), enabled, d->wifi_a->wifiStrength()); +#endif } void StatusBarModel::onWifiStrengthChanged(int strength) { +#if 0 qInfo() << "Strength changed: " << strength; setWifiStatus(d->wifi_a->wifiConnected(), d->wifi_a->wifiEnabled(), strength); +#endif } int StatusBarModel::rowCount(const QModelIndex &parent) const diff --git a/homescreen/src/statusbarmodel.h b/homescreen/src/statusbarmodel.h index 4e31f19..39d02db 100644 --- a/homescreen/src/statusbarmodel.h +++ b/homescreen/src/statusbarmodel.h @@ -27,7 +27,7 @@ public: explicit StatusBarModel(QObject *parent = NULL); ~StatusBarModel(); - void init(QUrl &url, QQmlContext *context); + void init(QQmlContext *context); int rowCount(const QModelIndex &parent = QModelIndex()) const override; QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; diff --git a/package/config.xml b/package/config.xml deleted file mode 100644 index 0586a12..0000000 --- a/package/config.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - homescreen - - - This is a demo application for homescreen - TOYOTA - APL 2.0 - - - - - - - - - - - - - - -- cgit 1.2.3-korg