diff options
author | fukubayashi.akio <fukubayashi.akio@genetec.co.jp> | 2019-06-03 17:59:13 +0900 |
---|---|---|
committer | fukubayashi.akio <fukubayashi.akio@genetec.co.jp> | 2019-06-03 17:59:13 +0900 |
commit | 98006b6538c5be44350746ec3756f004a5c68af8 (patch) | |
tree | f76ed8991d3837678c00722a23b779c4e2dcb67b /client | |
parent | b6644e5cffa84e40d62e38f4ee0c14e64e0faf48 (diff) |
Add boot sequence and multi ecu transfer
Signed-off-by: fukubayashi.akio <fukubayashi.akio@genetec.co.jp>
Diffstat (limited to 'client')
-rw-r--r-- | client/README | 39 | ||||
-rw-r--r-- | client/communication.cpp | 86 | ||||
-rw-r--r-- | client/communication.h | 64 | ||||
-rw-r--r-- | client/extra/WindowManagerSampleApp.qml | 47 | ||||
-rw-r--r-- | client/extra/WindowManagerSampleApp.qml.sample2 | 52 | ||||
-rw-r--r-- | client/main.cpp | 99 | ||||
-rw-r--r-- | client/main.cpp.sample2 | 92 | ||||
-rw-r--r-- | client/qlibwindowmanager.cpp | 56 | ||||
-rw-r--r-- | client/qlibwindowmanager.h | 69 | ||||
-rw-r--r-- | client/qmlWindowManagerSampleApp.pro | 20 | ||||
-rw-r--r-- | client/sample.qrc | 5 |
11 files changed, 0 insertions, 629 deletions
diff --git a/client/README b/client/README deleted file mode 100644 index 95ab875..0000000 --- a/client/README +++ /dev/null @@ -1,39 +0,0 @@ -= Example Application for TMC AGL WindowManager Client Lib -This is a example QML application that uses clients of the TMC WindowManager. - -== Dependencies -* Qt5 + QtQuick (QML) with ivi-shell support - -== Build instructions -Inside of an SDK environment run: - ----------------- -qmake -make ----------------- - -* The binary should be installed somewhere in $PATH - -== Usage -Run this application like follows: - ----------------- -qmlWindowManagerSampleApp $width $height $appLabel $colorName ----------------- - -.Note -**************** -Depending on your environment you will need to set the following -environment variable to instruct Qt to use the ivi-shell integration: -`QT_WAYLAND_SHELL_INTEGRATION=ivi-shell` -**************** - -Starts the application with a surface the size $width x $height -the Surface will request the label "$appLabel" and set its surface -color "$colorName" e.g. red. - -Note, that although the application sets an initial window size, the -window manager will send events to the application that instruct it to -set the proper, requested size for the layout. - -// vim:set tw=72 ft=asciidoc: diff --git a/client/communication.cpp b/client/communication.cpp deleted file mode 100644 index 1acfdca..0000000 --- a/client/communication.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2017 TOYOTA MOTOR CORPORATION - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "communication.h" - -#include <QGuiApplication> -#include <QDebug> - -communication::communication(QObject *parent) : QObject(parent) -{ - this->quit = false; -} - -communication::~communication() -{ -} - -void communication::setWidth(const unsigned int &w) -{ - this->width = w; - emit widthChanged(); -} - -void communication::setHeight(const unsigned int &h) -{ - this->height = h; - emit heightChanged(); -} - -void communication::setColor(const QString &c) -{ - this->color = c; - emit colorChanged(); -} - -void communication::setAppName(const QString &a) -{ - this->appName = a; - emit appNameChanged(); -} - -void communication::setQuit(const bool &q) -{ - this->quit = q; - emit quitChanged(); - if(q) - exit(EXIT_SUCCESS); -} - -unsigned int communication::getWidth() const -{ - return this->width; -} - -unsigned int communication::getHeight() const -{ - return this->height; -} - -QString communication::getColor() const -{ - return this->color; -} - -QString communication::getAppName() const -{ - return this->appName; -} - -bool communication::getQuit() const -{ - return this->quit; -} diff --git a/client/communication.h b/client/communication.h deleted file mode 100644 index fd3072f..0000000 --- a/client/communication.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2017 TOYOTA MOTOR CORPORATION - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef COMMUNICATION_H -#define COMMUNICATION_H - -#include <QObject> - -class communication : public QObject -{ - Q_OBJECT - - Q_PROPERTY(unsigned int width WRITE setWidth READ getWidth NOTIFY widthChanged) - Q_PROPERTY(unsigned int height WRITE setHeight READ getHeight NOTIFY heightChanged) - Q_PROPERTY(QString color READ getColor WRITE setColor NOTIFY colorChanged) - Q_PROPERTY(QString appName READ getAppName WRITE setAppName NOTIFY appNameChanged) - Q_PROPERTY(bool quit READ getQuit WRITE setQuit NOTIFY quitChanged) - -public: - explicit communication(QObject *parent = 0); - virtual ~communication(); - -public slots: - void setWidth(const unsigned int &); - void setHeight(const unsigned int &); - void setColor(const QString&); - void setAppName(const QString&); - void setQuit(const bool&); - - unsigned int getWidth() const; - unsigned int getHeight() const; - QString getColor() const; - QString getAppName() const; - bool getQuit() const; - -signals: - void widthChanged(); - void heightChanged(); - void colorChanged(); - void appNameChanged(); - void quitChanged(); - -private: - unsigned int width; - unsigned int height; - QString color; - QString appName; - bool quit; -}; - -#endif // COMMUNICATION_H diff --git a/client/extra/WindowManagerSampleApp.qml b/client/extra/WindowManagerSampleApp.qml deleted file mode 100644 index 0945af9..0000000 --- a/client/extra/WindowManagerSampleApp.qml +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2017 TOYOTA MOTOR CORPORATION - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import QtQuick 2.2 -import QtQuick.Window 2.1 -import QtQuick.Layouts 1.1 - -Window { - id: screen - width: COMM.width - height: COMM.height - color: COMM.color - flags: Qt.FramelessWindowHint - title: COMM.appName - opacity: 0.99 - visible: true - - Timer { - id: quitTimer - interval: 2000 - repeat: false - triggeredOnStart: false - onTriggered: COMM.quit = true - } - - Text { - id: textArea - color: "black" - font.bold: true - font.pointSize: 90 - anchors.centerIn: parent - text: COMM.appName - } -} diff --git a/client/extra/WindowManagerSampleApp.qml.sample2 b/client/extra/WindowManagerSampleApp.qml.sample2 deleted file mode 100644 index 1ffc071..0000000 --- a/client/extra/WindowManagerSampleApp.qml.sample2 +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2017 TOYOTA MOTOR CORPORATION - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import QtQuick 2.2 -import QtQuick.Window 2.1 -import QtQuick.Layouts 1.1 - -Window { - id: screen - width: COMM.width - height: COMM.height - color: COMM.color - flags: Qt.FramelessWindowHint - title: COMM.appName - opacity: 0.99 - visible: true - signal created - - Timer { - id: quitTimer - interval: 2000 - repeat: false - triggeredOnStart: false - onTriggered: COMM.quit = true - } - - Text { - id: textArea - color: "black" - font.bold: true - font.pointSize: 90 - anchors.centerIn: parent - text: COMM.appName - } - onFrameSwapped: { - created() - } - -} diff --git a/client/main.cpp b/client/main.cpp deleted file mode 100644 index 3dc2e42..0000000 --- a/client/main.cpp +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (c) 2017 TOYOTA MOTOR CORPORATION - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -#include <QDebug> -#include <QDir> -#include <QGuiApplication> -#include <QQmlApplicationEngine> -#include <QQmlContext> -#include <QQuickView> -#include <QQuickWindow> -#include "communication.h" - -#include "qlibwindowmanager.h" - -int main(int argc, char *argv[]) { - QGuiApplication app(argc, argv); - - qDebug() << QCoreApplication::arguments(); - - if (QCoreApplication::arguments().count() < 5) { - qWarning() << "Wrong parameters specified for the application. " - "Please restart with correct parameters:" - "width, height, name, color [port] [token]:\n\n" - "/usr/bin/WindowManagerSampleApp/" - "qmlWindowManagerSampleApp width height name color\n"; - exit(EXIT_FAILURE); - } - - QString label = QCoreApplication::arguments().at(3); - - QLibWindowmanager* qwm = new QLibWindowmanager(); - - QString token = "wm"; - int port = 1700; - if(QCoreApplication::arguments().count() == 7){ - bool ok; - port = QCoreApplication::arguments().at(5).toInt(&ok); - if(ok == false){ - port = 1700; - } - else{ - token = QCoreApplication::arguments().at(6); - } - } - const char* ctoken = token.toLatin1().data(); - if (qwm->init(port, ctoken) != 0) { - exit(EXIT_FAILURE); - } - - if (qwm->requestSurface( - QCoreApplication::arguments().at(3).toLatin1().data()) != 0) { - exit(EXIT_FAILURE); - } - - qwm->set_event_handler(QLibWindowmanager::Event_SyncDraw, [qwm](char const *label) { - fprintf(stderr, "Surface %s got syncDraw!\n", label); - qwm->endDraw(label); - }); - qwm->set_event_handler(QLibWindowmanager::Event_Active, [](char const *label) { - fprintf(stderr, "Surface %s got activated!\n", label); - }); - qwm->set_event_handler(QLibWindowmanager::Event_Visible, [](char const *label) { - fprintf(stderr, "Surface %s got visible!\n", label); - }); - qwm->set_event_handler(QLibWindowmanager::Event_FlushDraw, [](char const *label) { - fprintf(stderr, "Surface %s got flushDraw!\n", label); - }); - - communication comm; - comm.setWidth(QCoreApplication::arguments().at(1).toUInt()); - comm.setHeight(QCoreApplication::arguments().at(2).toUInt()); - comm.setAppName(label); - comm.setColor(QCoreApplication::arguments().at(4)); - - QQmlApplicationEngine engine; - engine.rootContext()->setContextProperty("COMM", &comm); - - engine.load( - QUrl(QStringLiteral("qrc:/extra/WindowManagerSampleApp.qml"))); - QObject *root = engine.rootObjects().first(); - QQuickWindow *window = qobject_cast<QQuickWindow *>(root); - QObject::connect(root, SIGNAL(frameSwapped()), qwm, SLOT(slotActivateSurface())); - - return app.exec(); -} diff --git a/client/main.cpp.sample2 b/client/main.cpp.sample2 deleted file mode 100644 index 5d9cc44..0000000 --- a/client/main.cpp.sample2 +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2017 TOYOTA MOTOR CORPORATION - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -#include <QDebug> -#include <QDir> -#include <QGuiApplication> -#include <QQmlApplicationEngine> -#include <QQmlContext> -#include <QQuickView> -#include <QQuickWindow> -#include "communication.h" - -#include "qlibwindowmanager.h" - -int main(int argc, char *argv[]) { - QGuiApplication app(argc, argv); - - qDebug() << QCoreApplication::arguments(); - - if (QCoreApplication::arguments().count() < 5) { - qWarning() << "Wrong parameters specified for the application. " - "Please restart with correct parameters:" - "width, height, name, color [port] [token]:\n\n" - "/usr/bin/WindowManagerSampleApp/" - "qmlWindowManagerSampleApp width height name color\n"; - exit(EXIT_FAILURE); - } - - QString label = QCoreApplication::arguments().at(3); - - QLibWindowmanager* qwm = new QLibWindowmanager(); - - QString token = "wm"; - int port = 1700; - if(QCoreApplication::arguments().count() == 7){ - bool ok; - port = QCoreApplication::arguments().at(5).toInt(&ok); - if(ok == false){ - port = 1700; - } - else{ - token = QCoreApplication::arguments().at(6); - } - } - const char* ctoken = token.toLatin1().data(); - if (qwm->init(port, ctoken) != 0) { - exit(EXIT_FAILURE); - } - - if (qwm->requestSurface( - QCoreApplication::arguments().at(3).toLatin1().data()) != 0) { - exit(EXIT_FAILURE); - } - - qwm->set_event_handler(QLibWindowmanager::Event_SyncDraw, [qwm](char const *label) { - //qwm->endDraw(label); - fprintf(stderr, "Surface %s got syncDraw!\n", label); - }); - qwm->set_event_handler(QLibWindowmanager::Event_Active, [](char const *label) { - fprintf(stderr, "Surface %s got activated!\n", label); - }); - - communication comm; - comm.setWidth(QCoreApplication::arguments().at(1).toUInt()); - comm.setHeight(QCoreApplication::arguments().at(2).toUInt()); - comm.setAppName(label); - comm.setColor(QCoreApplication::arguments().at(4)); - - QQmlApplicationEngine engine; - engine.rootContext()->setContextProperty("COMM", &comm); - - engine.load( - QUrl(QStringLiteral("qrc:/extra/WindowManagerSampleApp.qml"))); - QObject *root = engine.rootObjects().first(); - QObject::connect(root, SIGNAL(created()), qwm, SLOT(slotActivateSurface())); - - return app.exec(); -} diff --git a/client/qlibwindowmanager.cpp b/client/qlibwindowmanager.cpp deleted file mode 100644 index e69f0ac..0000000 --- a/client/qlibwindowmanager.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2017 TOYOTA MOTOR CORPORATION - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "qlibwindowmanager.h" -#include <unistd.h> - -int QLibWindowmanager::init(int port, char const *token) { - return this->wm->init(port, token); -} - -int QLibWindowmanager::requestSurface(const char *label) { - applabel = label; - return this->wm->requestSurface(label); -} - -int QLibWindowmanager::activateSurface(const char *label) { - return this->wm->activateSurface(label); -} - -int QLibWindowmanager::deactivateSurface(const char *label) { - return this->wm->deactivateSurface(label); -} - -int QLibWindowmanager::endDraw(const char *label) { return this->wm->endDraw(label); } - -void QLibWindowmanager::set_event_handler(enum QEventType et, - std::function<void(char const *label)> f) { - LibWindowmanager::EventType wet = (LibWindowmanager::EventType)et; - return this->wm->set_event_handler(wet, std::move(f)); -} - -void QLibWindowmanager::slotActivateSurface(){ - qDebug("%s",__FUNCTION__); - this->activateSurface(applabel.c_str()); -} - -QLibWindowmanager::QLibWindowmanager(QObject *parent) - :QObject(parent) -{ - wm = new LibWindowmanager(); -} - -QLibWindowmanager::~QLibWindowmanager() { } diff --git a/client/qlibwindowmanager.h b/client/qlibwindowmanager.h deleted file mode 100644 index ed86a65..0000000 --- a/client/qlibwindowmanager.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2017 TOYOTA MOTOR CORPORATION - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef QLIBWINDOWMANAGER_H -#define QLIBWINDOWMANAGER_H -#include <libwindowmanager.h> -#include <functional> - #include <QObject> - #include <QUrl> - #include <QVariant> - #include <string> - #include <vector> - -class QLibWindowmanager : public QObject{ -Q_OBJECT -public: - explicit QLibWindowmanager(QObject *parent = nullptr); - ~QLibWindowmanager(); - - QLibWindowmanager(const QLibWindowmanager &) = delete; - QLibWindowmanager &operator=(const QLibWindowmanager &) = delete; - -public: - using handler_fun = std::function<void(const char *)>; - - enum QEventType { - Event_Active = 1, - Event_Inactive, - - Event_Visible, - Event_Invisible, - - Event_SyncDraw, - Event_FlushDraw, - }; - - static QLibWindowmanager &instance(); - - int init(int port, char const *token); - - // WM API - int requestSurface(const char *label); - int activateSurface(const char *label); - int deactivateSurface(const char *label); - int endDraw(const char *label); - void set_event_handler(enum QEventType et, handler_fun f); - -public slots: - void slotActivateSurface(); - -private: - LibWindowmanager* wm; - std::string applabel; - std::vector<int> surfaceIDs; -}; -#endif // LIBWINDOWMANAGER_H diff --git a/client/qmlWindowManagerSampleApp.pro b/client/qmlWindowManagerSampleApp.pro deleted file mode 100644 index 3064d57..0000000 --- a/client/qmlWindowManagerSampleApp.pro +++ /dev/null @@ -1,20 +0,0 @@ -TEMPLATE = app -QT += qml quick -CONFIG += c++11 - -HEADERS += communication.h qlibwindowmanager.h - -SOURCES += main.cpp \ - communication.cpp qlibwindowmanager.cpp -RESOURCES += sample.qrc - -INCLUDEPATH += $$[QT_SYSROOT]/usr/include/afb - -LIBS += -lwindowmanager -#LIBS += -lsystemd -LIBS += -lafbwsc -#LIBS += -ljson-c - -target.path = /usr/bin/WindowManagerSampleApp - -INSTALLS += target diff --git a/client/sample.qrc b/client/sample.qrc deleted file mode 100644 index be79eb6..0000000 --- a/client/sample.qrc +++ /dev/null @@ -1,5 +0,0 @@ -<RCC> - <qresource prefix="/"> - <file>extra/WindowManagerSampleApp.qml</file> - </qresource> -</RCC> |