diff options
author | Bocklage, Jens <Jens_Bocklage@mentor.com> | 2017-01-18 15:28:22 +0100 |
---|---|---|
committer | Bocklage, Jens <Jens_Bocklage@mentor.com> | 2017-01-18 15:28:22 +0100 |
commit | 4b9e093c2b20cae1d3ea3c7ff462a48781ba9a30 (patch) | |
tree | e22f2f5c157eda97732ac95fda94f646ea4eec21 | |
parent | e77744c9465c927d526fbbf9adca9f6e2b221b1b (diff) |
Initial source commit
Taken from https://gerrit.automotivelinux.org/gerrit/p/staging/HomeScreen.git
Signed-off-by: Bocklage, Jens <Jens_Bocklage@mentor.com>
-rw-r--r-- | README.md | 39 | ||||
-rw-r--r-- | inputeventmanager.pro | 22 | ||||
-rw-r--r-- | inputeventmanager/.gitignore | 125 | ||||
-rw-r--r-- | inputeventmanager/LICENSE | 54 | ||||
-rw-r--r-- | inputeventmanager/README.md | 11 | ||||
-rw-r--r-- | inputeventmanager/conf/InputEventManager.service | 15 | ||||
-rw-r--r-- | inputeventmanager/inputeventmanager.pro | 29 | ||||
-rw-r--r-- | inputeventmanager/src/inputeventmanager.cpp | 64 | ||||
-rw-r--r-- | inputeventmanager/src/inputeventmanager.h | 46 | ||||
-rw-r--r-- | inputeventmanager/src/main.cpp | 51 | ||||
-rw-r--r-- | interfaces/LICENSE | 54 | ||||
-rw-r--r-- | interfaces/README.md | 11 | ||||
-rw-r--r-- | interfaces/homescreen.xml | 106 | ||||
-rw-r--r-- | interfaces/include/homescreen.hpp | 23 | ||||
-rw-r--r-- | interfaces/include/inputevent.hpp | 30 | ||||
-rw-r--r-- | interfaces/inputevent.xml | 22 | ||||
-rw-r--r-- | interfaces/interfaces.pri | 18 | ||||
-rw-r--r-- | interfaces/interfaces.pro | 52 | ||||
-rw-r--r-- | test/commandlinetests.txt | 22 |
19 files changed, 794 insertions, 0 deletions
diff --git a/README.md b/README.md new file mode 100644 index 0000000..c4dc063 --- /dev/null +++ b/README.md @@ -0,0 +1,39 @@ +This project contains: + +InputEventManager: AGL Input event manager + +AGL repo for source code: +https://gerrit.automotivelinux.org/gerrit/gitweb?p=staging%2FHomeScreen.git + +AGL repo for bitbake recipe: +https://gerrit.automotivelinux.org/gerrit/gitweb?p=AGL/meta-agl-demo.git;a=blob;f=recipes-demo-hmi/homescreen/homescreen_git.bb + + + + +Quickstart: + +Instructions for building InputEventManager app +----------------------------------------------- + +The InputEventManager app is part of the +packagegroup-agl-demo-platform +packagegroup. + +This also includes the following apps: +- HomeScreen +- HomeScreenAppFrameworkBinderAGL +- SampleAppTimeDate +- SampleHomeScreenInterfaceApp +- WindowManager + +And the library +- libhomescreen + + +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 + +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 diff --git a/inputeventmanager.pro b/inputeventmanager.pro new file mode 100644 index 0000000..75e443a --- /dev/null +++ b/inputeventmanager.pro @@ -0,0 +1,22 @@ +# Copyright (C) 2016, 2017 Mentor Graphics Development (Deutschland) GmbH +# +# 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. + +TEMPLATE = subdirs + +load(configure) + +SUBDIRS = interfaces \ + inputeventmanager + +inputeventmanager.depends = interfaces diff --git a/inputeventmanager/.gitignore b/inputeventmanager/.gitignore new file mode 100644 index 0000000..051f2d5 --- /dev/null +++ b/inputeventmanager/.gitignore @@ -0,0 +1,125 @@ +# manually added: +.DS_Store + +# Created by https://www.gitignore.io/api/linux,qt,c,c++ + +### Linux ### +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + + +### Qt ### +# C++ objects and libs + +*.slo +*.lo +*.o +*.a +*.la +*.lai +*.so +*.dll +*.dylib + +# Qt-es + +/.qmake.cache +/.qmake.stash +*.pro.user +*.pro.user.* +*.qbs.user +*.qbs.user.* +*.moc +moc_*.cpp +qrc_*.cpp +ui_*.h +Makefile* +*build-* + +# QtCreator + +*.autosave + +# QtCtreator Qml +*.qmlproject.user +*.qmlproject.user.* + +# QtCtreator CMake +CMakeLists.txt.user + + + +### C ### +# Object files +*.o +*.ko +*.obj +*.elf + +# Precompiled Headers +*.gch +*.pch + +# Libraries +*.lib +*.a +*.la +*.lo + +# Shared objects (inc. Windows DLLs) +*.dll +*.so +*.so.* +*.dylib + +# Executables +*.exe +*.out +*.app +*.i*86 +*.x86_64 +*.hex + +# Debug files +*.dSYM/ + + +### C++ ### +# Compiled Object files +*.slo +*.lo +*.o +*.obj + +# Precompiled Headers +*.gch +*.pch + +# Compiled Dynamic libraries +*.so +*.dylib +*.dll + +# Fortran module files +*.mod + +# Compiled Static libraries +*.lai +*.la +*.a +*.lib + +# Executables +*.exe +*.out +*.app + + diff --git a/inputeventmanager/LICENSE b/inputeventmanager/LICENSE new file mode 100644 index 0000000..31c692a --- /dev/null +++ b/inputeventmanager/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/inputeventmanager/README.md b/inputeventmanager/README.md new file mode 100644 index 0000000..fd2ad8c --- /dev/null +++ b/inputeventmanager/README.md @@ -0,0 +1,11 @@ +AGL InputEventManager Sample App + + +Build with QtCreator 3.0.1 + +AGL repo for source code: +https://gerrit.automotivelinux.org/gerrit/#/admin/projects/staging/HomeScreen + +AGL repo for bitbake recipe: +https://gerrit.automotivelinux.org/gerrit/#/admin/projects/AGL/meta-agl-demo/recipes-demo-hmi/HomeScreen/HomeScreen_?.bb + diff --git a/inputeventmanager/conf/InputEventManager.service b/inputeventmanager/conf/InputEventManager.service new file mode 100644 index 0000000..007ecad --- /dev/null +++ b/inputeventmanager/conf/InputEventManager.service @@ -0,0 +1,15 @@ +[Unit] +Description=AGL Input Event Manager +Requires=dbus.service +After=dbus.service + +[Service] +User=root +Type=dbus +BusName=org.agl.inputeventmanager +ExecStart=/usr/AGL/homescreen/InputEventManager +Restart=on-failure +RestartSec=5 + +[Install] +WantedBy=default.target diff --git a/inputeventmanager/inputeventmanager.pro b/inputeventmanager/inputeventmanager.pro new file mode 100644 index 0000000..fd54636 --- /dev/null +++ b/inputeventmanager/inputeventmanager.pro @@ -0,0 +1,29 @@ +# Copyright (C) 2016, 2017 Mentor Graphics Development (Deutschland) GmbH +# +# 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. + +TEMPLATE = app +TARGET = InputEventManager +QT = core dbus + +include(../interfaces/interfaces.pri) + +SOURCES += src/main.cpp \ + src/inputeventmanager.cpp + +HEADERS += \ + src/inputeventmanager.h + + +OTHER_FILES += \ + README.md diff --git a/inputeventmanager/src/inputeventmanager.cpp b/inputeventmanager/src/inputeventmanager.cpp new file mode 100644 index 0000000..c8d8d94 --- /dev/null +++ b/inputeventmanager/src/inputeventmanager.cpp @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2016, 2017 Mentor Graphics Development (Deutschland) GmbH + * + * 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 "inputeventmanager.h" +#include "include/inputevent.hpp" + + +InputEventManager::InputEventManager(QObject *parent) : + QObject(parent), + mp_inputEventAdaptor(0), + mp_dBusHomeScreenProxy(0) +{ + qDebug("D-Bus: register as org.agl.inputeventmanager"); + + // publish app framework interface + mp_inputEventAdaptor = new InputeventAdaptor((QObject*)this); + QDBusConnection dbus = QDBusConnection::sessionBus(); + dbus.registerObject("/InputEvent", this); + dbus.registerService("org.agl.inputeventmanager"); + + + qDebug("D-Bus: connect to org.agl.homescreen /HomeScreen"); + mp_dBusHomeScreenProxy = new org::agl::homescreen("org.agl.homescreen", + "/HomeScreen", + QDBusConnection::sessionBus(), + 0); +} + +InputEventManager::~InputEventManager() +{ + delete mp_dBusHomeScreenProxy; + delete mp_inputEventAdaptor; +} + +void InputEventManager::hardKeyPressed(int key) +{ + switch (key) + { + case InputEvent::HARDKEY_NAV: + mp_dBusHomeScreenProxy->hardKeyPressed(key); + qDebug("hardKeyPressed NAV key pressed!"); + break; + case InputEvent::HARDKEY_MEDIA: + mp_dBusHomeScreenProxy->hardKeyPressed(key); + qDebug("hardKeyPressed MEDIA key pressed!"); + break; + default: + qDebug("hardKeyPressed %d", key); + break; + } +} diff --git a/inputeventmanager/src/inputeventmanager.h b/inputeventmanager/src/inputeventmanager.h new file mode 100644 index 0000000..f6b8ad5 --- /dev/null +++ b/inputeventmanager/src/inputeventmanager.h @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2016, 2017 Mentor Graphics Development (Deutschland) GmbH + * + * 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 INPUTEVENTMANAGER_H +#define INPUTEVENTMANAGER_H + +#include "inputevent_adaptor.h" +#include <include/homescreen.hpp> +#include "homescreen_proxy.h" + + +class InputEventManager : public QObject +{ + Q_OBJECT +public: + explicit InputEventManager(QObject *parent = 0); + ~InputEventManager(); +private: + InputeventAdaptor *mp_inputEventAdaptor; + org::agl::homescreen *mp_dBusHomeScreenProxy; + + //from inputevent_adapter.h +public Q_SLOTS: // METHODS + void hardKeyPressed(int key); + +public: + + +public slots: + +}; + +#endif // INPUTEVENTMANAGER_H diff --git a/inputeventmanager/src/main.cpp b/inputeventmanager/src/main.cpp new file mode 100644 index 0000000..f710cb4 --- /dev/null +++ b/inputeventmanager/src/main.cpp @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2016, 2017 Mentor Graphics Development (Deutschland) GmbH + * + * 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 <QCoreApplication> +#include <QCommandLineParser> +#include "inputeventmanager.h" + +void noOutput(QtMsgType, const QMessageLogContext &, const QString &) +{ +} + +int main(int argc, char *argv[]) +{ + QCoreApplication a(argc, argv); + + QCoreApplication::setOrganizationDomain("LinuxFoundation"); + QCoreApplication::setOrganizationName("AutomotiveGradeLinux"); + QCoreApplication::setApplicationName("InputEventManager"); + QCoreApplication::setApplicationVersion("0.7.0"); + + QCommandLineParser parser; + parser.setApplicationDescription("AGL InputEventManager - see wwww... for more details"); + parser.addHelpOption(); + parser.addVersionOption(); + QCommandLineOption quietOption(QStringList() << "q" << "quiet", + QCoreApplication::translate("main", "Be quiet. No outputs.")); + parser.addOption(quietOption); + parser.process(a); + + if (parser.isSet(quietOption)) + { + qInstallMessageHandler(noOutput); + } + + InputEventManager *inputEventManager = new InputEventManager(); + + return a.exec(); +} diff --git a/interfaces/LICENSE b/interfaces/LICENSE new file mode 100644 index 0000000..31c692a --- /dev/null +++ b/interfaces/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/interfaces/README.md b/interfaces/README.md new file mode 100644 index 0000000..15dfaa9 --- /dev/null +++ b/interfaces/README.md @@ -0,0 +1,11 @@ +AGL Home Screen reference implementation +This lib provides the needed D-Bus interfaces + +Build with QtCreator 3.0.1 + +AGL repo for source code: +https://gerrit.automotivelinux.org/gerrit/#/admin/projects/staging/HomeScreen + +AGL repo for bitbake recipe: +https://gerrit.automotivelinux.org/gerrit/#/admin/projects/AGL/meta-agl-demo/recipes-demo-hmi/HomeScreen/HomeScreen_?.bb + diff --git a/interfaces/homescreen.xml b/interfaces/homescreen.xml new file mode 100644 index 0000000..378ff54 --- /dev/null +++ b/interfaces/homescreen.xml @@ -0,0 +1,106 @@ +<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"> +<!-- Copyright (C) 2016, 2017 Mentor Graphics Development (Deutschland) GmbH + + 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. --> +<node> +<!-- + org.agl.homescreen: + @short_description: A generic interface for the HomeScreen app. + + This interface is a collection of methods from different functional areas to control the HomeScreen app. +--> + <interface name="org.agl.homescreen"> + <!-- + hardKeyPressed: + @key: The key that was pressed using the inputevent.hpp InputEvent::HardKey type. + + This is used to inject hard keys into the HomeScreen app. + --> + <method name="hardKeyPressed"> + <arg name="key" type="i" direction="in"/> + </method> + <!-- + getSurfaceStatus: + @surfaceId: The given surface. + @status: The status can be unknown (-1), visible (0), invisible (1) + + A surface can have three states. It can be visible, then it is shown on the screen. + It can be invisible, then it is not shown on the screen. Or the state is unknown. + --> + <method name="getSurfaceStatus"> + <arg name="surfaceId" type="i" direction="in"/> + <arg name="status" type="i" direction="out"/> + </method> + <!-- + requestSurfaceIdToFullScreen: + @surfaceId: The surface that request to be shown fullscreen. + + This allows an application to set a surface to full screen. + --> + <method name="requestSurfaceIdToFullScreen"> + <arg name="surfaceId" type="i" direction="in"/> + </method> + <!-- + getAllSurfacesOfProcess: + @pid: The PID of the process. + @surfaceIds: A list of surfaces that were created by the process. + + The surface IDs can for example be used to assign them to a layout render area. + --> + <method name="getAllSurfacesOfProcess"> + <arg name="pid" type="i" direction="in"/> + <arg name="surfaceIds" type="ai" direction="out"/> + <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QList<int>"/> + </method> + <!-- + renderAppToAreaAllowed: + @appCategory: The application category that is requested. Use enum AppCategory for this! + @layoutArea: The layout area where the application shall be rendered. Find the layoutArea ids in the layout definition! + @allowed: Returns true, if the application is allowed to be rendered in the area + + This function can be used to request, if it is allowed to render an application of a specific category + in a layout area. The idea is to decide from an application point of view to allocate recources or not. + Example: an application will decide to render video based on this call. This call will not change anything, it is only a request. + --> + <method name="renderAppToAreaAllowed"> + <arg name="appCategory" type="i" direction="in"/> + <arg name="layoutArea" type="i" direction="in"/> + <arg name="allowed" type="b" direction="out"/> + </method> + <!-- + renderSurfaceToArea: + @surfaceId: The surface that is requested. + @layoutArea: The layout area where the surface shall be rendered. Find the layoutArea ids in the layout definition! + + This is a special case. In the normal use case, one layout area is always filled completely + with the first surface, that the process creates (more precise: the surface with the lowest id). + By using this function, an app can request to position a different surface in the layout area. + --> + <method name="renderSurfaceToArea"> + <arg name="surfaceId" type="i" direction="in"/> + <arg name="layoutArea" type="i" direction="in"/> + </method> + <!-- + surfaceVisibilityChanged: + @surfaceId: The surface that changed. + @visible: True, if the surface is visible. + + This is emitted when the visible property of the surfaces changes. + --> + <signal name="surfaceVisibilityChanged"> + <arg name="surfaceId" type="i"/> + <arg name="visible" type="b"/> + </signal> + </interface> +</node> + diff --git a/interfaces/include/homescreen.hpp b/interfaces/include/homescreen.hpp new file mode 100644 index 0000000..728962b --- /dev/null +++ b/interfaces/include/homescreen.hpp @@ -0,0 +1,23 @@ +/* + * Copyright (C) 2016, 2017 Mentor Graphics Development (Deutschland) GmbH + * + * 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 HOMESCREEN_H +#define HOMESCREEN_H + +#include "inputevent.hpp" + +#endif // HOMESCREEN_H + diff --git a/interfaces/include/inputevent.hpp b/interfaces/include/inputevent.hpp new file mode 100644 index 0000000..8c6bf58 --- /dev/null +++ b/interfaces/include/inputevent.hpp @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2016, 2017 Mentor Graphics Development (Deutschland) GmbH + * + * 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 INPUTEVENT_H +#define INPUTEVENT_H + +namespace InputEvent { + typedef enum HardKey + { + HARDKEY_UNDEFINED, + HARDKEY_NAV, + HARDKEY_MEDIA + } eHardKey; +} + +#endif // INPUTEVENT_H + diff --git a/interfaces/inputevent.xml b/interfaces/inputevent.xml new file mode 100644 index 0000000..74c698e --- /dev/null +++ b/interfaces/inputevent.xml @@ -0,0 +1,22 @@ +<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"> +<!-- Copyright (C) 2016, 2017 Mentor Graphics Development (Deutschland) GmbH + + 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. --> +<node> + <interface name="org.agl.inputevent"> + <method name="hardKeyPressed"> + <arg name="key" type="i" direction="in"/> + </method> + </interface> +</node> + diff --git a/interfaces/interfaces.pri b/interfaces/interfaces.pri new file mode 100644 index 0000000..07b9e6a --- /dev/null +++ b/interfaces/interfaces.pri @@ -0,0 +1,18 @@ +# Copyright (C) 2016 The Qt Company Ltd. +# Copyright (C) 2016, 2017 Mentor Graphics Development (Deutschland) GmbH +# +# 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. + +INCLUDEPATH += $$PWD $$OUT_PWD/../interfaces/ + +LIBS += -L$$OUT_PWD/../interfaces/ -linterfaces diff --git a/interfaces/interfaces.pro b/interfaces/interfaces.pro new file mode 100644 index 0000000..88ce2b2 --- /dev/null +++ b/interfaces/interfaces.pro @@ -0,0 +1,52 @@ +# Copyright (C) 2016, 2017 Mentor Graphics Development (Deutschland) GmbH +# +# 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. + +TEMPLATE = lib +TARGET = interfaces +QT = dbus +CONFIG += staticlib + +XMLSOURCES = \ + homescreen.xml \ + inputevent.xml + +gen_adaptor_cpp.input = XMLSOURCES +gen_adaptor_cpp.commands = \ + qdbusxml2cpp -i include/${QMAKE_FILE_IN_BASE}.hpp -m -a ${QMAKE_FILE_IN_BASE}_adaptor ${QMAKE_FILE_IN}; \ + moc $$OUT_PWD/${QMAKE_FILE_IN_BASE}_adaptor.h -o $$OUT_PWD/${QMAKE_FILE_IN_BASE}_adaptor.moc +gen_adaptor_cpp.output = ${QMAKE_FILE_IN_BASE}_adaptor.cpp +gen_adaptor_cpp.variable_out = SOURCES +gen_adaptor_cpp.clean = ${QMAKE_FILE_IN_BASE}_adaptor.cpp + +gen_proxy_cpp.input = XMLSOURCES +gen_proxy_cpp.commands = \ + qdbusxml2cpp -i include/${QMAKE_FILE_IN_BASE}.hpp -m -p ${QMAKE_FILE_IN_BASE}_proxy ${QMAKE_FILE_IN}; \ + moc $$OUT_PWD/${QMAKE_FILE_IN_BASE}_proxy.h -o $$OUT_PWD/${QMAKE_FILE_IN_BASE}_proxy.moc +gen_proxy_cpp.output = ${QMAKE_FILE_IN_BASE}_proxy.cpp +gen_proxy_cpp.variable_out = SOURCES +gen_proxy_cpp.clean = ${QMAKE_FILE_IN_BASE}_proxy.cpp + +gen_adaptor_h.input = XMLSOURCES +gen_adaptor_h.commands = @echo Fake making the header for ${QMAKE_FILE_IN} +gen_adaptor_h.depends = ${QMAKE_FILE_IN_BASE}_adaptor.cpp +gen_adaptor_h.output = ${QMAKE_FILE_IN_BASE}_adaptor.h +gen_adaptor_h.clean = ${QMAKE_FILE_IN_BASE}_adaptor.h + +gen_proxy_h.input = XMLSOURCES +gen_proxy_h.commands = @echo Fake making the header for ${QMAKE_FILE_IN} +gen_proxy_h.depends = ${QMAKE_FILE_IN_BASE}_proxy.cpp +gen_proxy_h.output = ${QMAKE_FILE_IN_BASE}_proxy.h +gen_proxy_h.clean = ${QMAKE_FILE_IN_BASE}_proxy.h + +QMAKE_EXTRA_COMPILERS += gen_adaptor_cpp gen_proxy_cpp gen_adaptor_h gen_proxy_h diff --git a/test/commandlinetests.txt b/test/commandlinetests.txt new file mode 100644 index 0000000..bf0f136 --- /dev/null +++ b/test/commandlinetests.txt @@ -0,0 +1,22 @@ +Command line tests + +Precondition for all test is, that the D-Bus session is launched: +$export `dbus-launch` + +--------------------------------------------------------------------------------------------------------------------- +Interface: +org.agl.inputevent + +Method: + <method name="hardKeyPressed"> + <arg name="key" type="i" direction="in"/> + </method> + +Preconditions: +- HomeScreen app is running +- InputEventManager app is running + +Test: +$dbus-send --session --type=method_call --print-reply --dest=org.agl.inputeventmanager /InputEvent org.agl.inputevent.hardKeyPressed int32:0 + + |