diff options
Diffstat (limited to 'homescreen/src')
-rw-r--r-- | homescreen/src/aglsocketwrapper.cpp | 90 | ||||
-rw-r--r-- | homescreen/src/aglsocketwrapper.h | 35 | ||||
-rw-r--r-- | homescreen/src/chromecontroller.cpp | 164 | ||||
-rw-r--r-- | homescreen/src/chromecontroller.h | 46 | ||||
-rw-r--r-- | homescreen/src/homescreenhandler.cpp | 15 | ||||
-rw-r--r-- | homescreen/src/homescreenhandler.h | 9 | ||||
-rw-r--r-- | homescreen/src/main.cpp | 50 | ||||
-rw-r--r-- | homescreen/src/mastervolume.cpp | 17 | ||||
-rw-r--r-- | homescreen/src/mastervolume.h | 7 | ||||
-rw-r--r-- | homescreen/src/statusbarmodel.cpp | 16 | ||||
-rw-r--r-- | homescreen/src/statusbarmodel.h | 2 |
11 files changed, 55 insertions, 396 deletions
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 <QWebSocket> -#include <QUuid> -#include <QJsonArray> -#include <QJsonObject> -#include <QJsonDocument> - -#include <QDebug> - -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<QAbstractSocket::SocketError>::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 <QUrl> -#include <QMap> -#include <QObject> -#include <QJsonValue> - -#include <functional> - -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(bool, const QJsonValue&)>; - 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<QString, ApiCallback> 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 <QTimer> -#include <QDebug> -#include <QJsonDocument> - -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 <QObject> -#include <QUrl> - -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*>(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 <QObject> -#include <libhomescreen.hpp> #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 <QQuickWindow> #include <QTimer> +#if 0 #include <weather.h> #include <bluetooth.h> +#endif #include "applicationlauncher.h" #include "statusbarmodel.h" #include "mastervolume.h" #include "homescreenhandler.h" #include "hmi-debug.h" -#include "chromecontroller.h" #include <qpa/qplatformnativeinterface.h> #include <wayland-client.h> @@ -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<StatusBarModel *>("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<StatusBarModel>("HomeScreen", 1, 0, "StatusBarModel"); qmlRegisterType<MasterVolume>("MasterVolume", 1, 0, "MasterVolume"); - qmlRegisterUncreatableType<ChromeController>("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 <QJsonObject> #include <QTimer> #include <QtDebug> @@ -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 <QtCore/QObject> #include <QQmlEngine> -#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<WifiAdapter*>(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; |