diff options
author | 2016-08-05 19:42:52 +0200 | |
---|---|---|
committer | 2016-08-05 19:42:52 +0200 | |
commit | 0a468d9b5ae7b3e5ba106facf17698d89b1ce200 (patch) | |
tree | 4b4b2a336802816522ef7bafd8d49cb6d6a6e67f /interfaces | |
parent | 3478f65b39560b333ba189e7d86e2c2cebfc9c7a (diff) |
Using the Tizen application manager to receive information about installed apps and to launch apps.v0.2.0
This acts as a template for other app framework adoptions.
Using the weston ivi shell to control surfaces.
Using the input event manager to dispatch hard key inputs.
This is a bigger update, so I increased the version number from 0.1.1 to 0.2.0.
Some parts are under development.
I created the components "WindowsManager" and "InputEventManager" because they are not defined in AGL right now.
As soon as they are defined, we should switch to them.
Find more information on the official wiki page:
https://wiki.automotivelinux.org/homescreen
Signed-off-by: Bocklage, Jens <Jens_Bocklage@mentor.com>
Diffstat (limited to 'interfaces')
-rw-r--r-- | interfaces/appframework.xml | 26 | ||||
-rw-r--r-- | interfaces/homescreen.xml | 22 | ||||
-rw-r--r-- | interfaces/include/appframework.hpp | 54 | ||||
-rw-r--r-- | interfaces/include/daynightmode.hpp (renamed from interfaces/daynightmode.h) | 0 | ||||
-rw-r--r-- | interfaces/include/homescreen.hpp | 23 | ||||
-rw-r--r-- | interfaces/include/inputevent.hpp | 29 | ||||
-rw-r--r-- | interfaces/include/popup.hpp (renamed from interfaces/popup.h) | 0 | ||||
-rw-r--r-- | interfaces/include/statusbar.hpp | 22 | ||||
-rw-r--r-- | interfaces/inputevent.xml | 22 | ||||
-rw-r--r-- | interfaces/interfaces.pro | 16 | ||||
-rw-r--r-- | interfaces/src/appframework.cpp | 55 |
11 files changed, 265 insertions, 4 deletions
diff --git a/interfaces/appframework.xml b/interfaces/appframework.xml new file mode 100644 index 0000000..1324386 --- /dev/null +++ b/interfaces/appframework.xml @@ -0,0 +1,26 @@ +<!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 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.appframework"> + <method name="getAvailableAppNames"> + <arg name="names" type="as" direction="out"/> + </method> + <method name="launchApp"> + <arg name="name" type="s" direction="in"/> + <arg name="pid" type="i" direction="out"/> + </method> + </interface> +</node> + diff --git a/interfaces/homescreen.xml b/interfaces/homescreen.xml new file mode 100644 index 0000000..55f4305 --- /dev/null +++ b/interfaces/homescreen.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 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.homescreen"> + <method name="hardKeyPressed"> + <arg name="key" type="i" direction="in"/> <!-- using the inputevent.hpp InputEvent::HardKey type --> + </method> + </interface> +</node> + diff --git a/interfaces/include/appframework.hpp b/interfaces/include/appframework.hpp new file mode 100644 index 0000000..d95cd9d --- /dev/null +++ b/interfaces/include/appframework.hpp @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2016 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 APPFRAMEWORK_HPP +#define APPFRAMEWORK_HPP + +#include <QObject> +#include <QtDBus> +#include <QString> + +class AppInfo : public QObject +{ + Q_OBJECT +public: + explicit AppInfo(QObject *parent = 0); + AppInfo(const AppInfo &other); + AppInfo& operator=(const AppInfo &other); + ~AppInfo(); + + //register Message with the Qt type system + static void registerMetaType(); + + friend QDBusArgument &operator<<(QDBusArgument &argument, const AppInfo &appInfo); + friend const QDBusArgument &operator>>(const QDBusArgument &argument, AppInfo &appInfo); + + void setName(const QString name) {this->name = name;} + QString getName() const {return name;} + void setIconPath(const QString iconPath) {this->iconPath = iconPath;} + QString getIconPath() const {return iconPath;} + void setDescription(const QString description) {this->description = description;} + QString getDescription() const {return description;} + +private: + QString name; + QString iconPath; + QString description; +}; + +Q_DECLARE_METATYPE(AppInfo) + +#endif // APPFRAMEWORK_HPP diff --git a/interfaces/daynightmode.h b/interfaces/include/daynightmode.hpp index 4081212..4081212 100644 --- a/interfaces/daynightmode.h +++ b/interfaces/include/daynightmode.hpp diff --git a/interfaces/include/homescreen.hpp b/interfaces/include/homescreen.hpp new file mode 100644 index 0000000..bef3695 --- /dev/null +++ b/interfaces/include/homescreen.hpp @@ -0,0 +1,23 @@ +/* + * Copyright (C) 2016 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..28418f6 --- /dev/null +++ b/interfaces/include/inputevent.hpp @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2016 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 + } eHardKey; +} + +#endif // INPUTEVENT_H + diff --git a/interfaces/popup.h b/interfaces/include/popup.hpp index 1b92333..1b92333 100644 --- a/interfaces/popup.h +++ b/interfaces/include/popup.hpp diff --git a/interfaces/include/statusbar.hpp b/interfaces/include/statusbar.hpp new file mode 100644 index 0000000..d7fcc0c --- /dev/null +++ b/interfaces/include/statusbar.hpp @@ -0,0 +1,22 @@ +/* + * Copyright (C) 2016 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 STATUSBAR_H +#define STATUSBAR_H + + + +#endif // STATUSBAR_H diff --git a/interfaces/inputevent.xml b/interfaces/inputevent.xml new file mode 100644 index 0000000..813139b --- /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 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.pro b/interfaces/interfaces.pro index c2b8cc0..75b4412 100644 --- a/interfaces/interfaces.pro +++ b/interfaces/interfaces.pro @@ -12,21 +12,29 @@ # See the License for the specific language governing permissions and # limitations under the License. -QT += core gui dbus +QT += core dbus +QT -= gui + greaterThan(QT_MAJOR_VERSION, 4): QT += widgets TEMPLATE = lib CONFIG += staticlib TARGET = interfaces +HEADERS += include/appframework.hpp +SOURCES += src/appframework.cpp + XMLSOURCES = \ + appframework.xml \ daynightmode.xml \ + homescreen.xml \ + inputevent.xml \ popup.xml \ statusbar.xml gen_adapter_cpp.input = XMLSOURCES gen_adapter_cpp.commands = \ - qdbusxml2cpp -m -a ${QMAKE_FILE_IN_BASE}_adapter ${QMAKE_FILE_IN}; \ + qdbusxml2cpp -i include/${QMAKE_FILE_IN_BASE}.hpp -m -a ${QMAKE_FILE_IN_BASE}_adapter ${QMAKE_FILE_IN}; \ moc $$OUT_PWD/${QMAKE_FILE_IN_BASE}_adapter.h -o $$OUT_PWD/${QMAKE_FILE_IN_BASE}_adapter.moc gen_adapter_cpp.output = ${QMAKE_FILE_IN_BASE}_adapter.cpp gen_adapter_cpp.variable_out = SOURCES @@ -34,7 +42,7 @@ gen_adapter_cpp.clean = ${QMAKE_FILE_IN_BASE}_adapter.cpp gen_proxy_cpp.input = XMLSOURCES gen_proxy_cpp.commands = \ - qdbusxml2cpp -m -p ${QMAKE_FILE_IN_BASE}_proxy ${QMAKE_FILE_IN}; \ + 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 @@ -43,7 +51,7 @@ gen_proxy_cpp.clean = ${QMAKE_FILE_IN_BASE}_proxy.cpp gen_adapter_h.input = XMLSOURCES gen_adapter_h.commands = @echo Fake making the header for ${QMAKE_FILE_IN} gen_adapter_h.depends = ${QMAKE_FILE_IN_BASE}_adapter.cpp -en_adapter_h.output = ${QMAKE_FILE_IN_BASE}_adapter.h +gen_adapter_h.output = ${QMAKE_FILE_IN_BASE}_adapter.h gen_adapter_h.clean = ${QMAKE_FILE_IN_BASE}_adapter.h gen_proxy_h.input = XMLSOURCES diff --git a/interfaces/src/appframework.cpp b/interfaces/src/appframework.cpp new file mode 100644 index 0000000..3a5ebda --- /dev/null +++ b/interfaces/src/appframework.cpp @@ -0,0 +1,55 @@ +#include "include/appframework.hpp" + +AppInfo::AppInfo(QObject *parent) : + QObject(parent) +{ +} + +AppInfo::AppInfo(const AppInfo &other) : + QObject(other.parent()), + name(other.getName()), + iconPath(other.getIconPath()), + description(other.getDescription()) +{ +} + +AppInfo& AppInfo::operator=(const AppInfo &other) +{ + setParent(other.parent()); + name = other.getName(); + iconPath = other.getIconPath(); + description = other.getDescription(); + + return *this; +} + +AppInfo::~AppInfo() +{ +} + +void AppInfo::registerMetaType() +{ + qRegisterMetaType<AppInfo>("AppInfo"); + qDBusRegisterMetaType<AppInfo>(); +} + + +// Marshall the MyStructure data into a D-Bus argument +QDBusArgument &operator<<(QDBusArgument &argument, const AppInfo &appInfo) +{ + argument.beginStructure(); + argument << appInfo.name << appInfo.iconPath << appInfo.description; + argument.endStructure(); + qDebug("appInfo.name:<< %s", appInfo.name.toStdString().c_str()); + return argument; +} + +// Retrieve the MyStructure data from the D-Bus argument +const QDBusArgument &operator>>(const QDBusArgument &argument, AppInfo &appInfo) +{ + argument.beginStructure(); + argument >> appInfo.name >> appInfo.iconPath >> appInfo.description; + argument.endStructure(); + qDebug("appInfo.name:>> %s", appInfo.name.toStdString().c_str()); + return argument; +} |