working websocket
This commit is contained in:
parent
381dcfa102
commit
58f7c65875
@ -42,7 +42,7 @@ add_definitions(-DBOOST_ALL_DYN_LINK)
|
||||
find_package(Boost REQUIRED COMPONENTS system log OPTIONAL_COMPONENTS unit_test_framework)
|
||||
|
||||
find_package(libusb-1.0 REQUIRED)
|
||||
find_package(Qt5 COMPONENTS Multimedia MultimediaWidgets Bluetooth Qml Quick QuickWidgets REQUIRED)
|
||||
find_package(Qt5 COMPONENTS Multimedia MultimediaWidgets Bluetooth Qml Quick QuickWidgets WebSockets REQUIRED)
|
||||
find_package(Protobuf REQUIRED)
|
||||
find_package(OpenSSL REQUIRED)
|
||||
find_package(rtaudio REQUIRED)
|
||||
@ -125,4 +125,4 @@ set(CPACK_INSTALL_TYPE_FULL_DISPLAY_NAME "Everything")
|
||||
set(CPACK_COMPONENT_LIBRARIES_INSTALL_TYPES Developer Full)
|
||||
set(CPACK_COMPONENT_HEADERS_INSTALL_TYPES Developer Full)
|
||||
set(CPACK_COMPONENT_APPLICATIONS_INSTALL_TYPES Full)
|
||||
INCLUDE(CPack)
|
||||
INCLUDE(CPack)
|
||||
|
@ -18,6 +18,7 @@ target_include_directories(autoapp PRIVATE
|
||||
)
|
||||
|
||||
target_link_libraries(autoapp
|
||||
Qt5::WebSockets
|
||||
openauto
|
||||
)
|
||||
|
||||
|
@ -19,6 +19,10 @@
|
||||
#include <QApplication>
|
||||
#include <QtWebSockets/QWebSocket>
|
||||
#include <QDebug>
|
||||
#include <QTimer>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QJsonParseError>
|
||||
|
||||
#include "autoapp/UI/MainWindow.hpp"
|
||||
#include "ui_mainwindow.h"
|
||||
@ -91,7 +95,13 @@ void autoapp::ui::MainWindow::handleIncomingMessage(const QString &message)
|
||||
{
|
||||
qDebug() << "[Handler] Processing message:" << message;
|
||||
|
||||
QJsonParseError error;
|
||||
QJsonDocument doc = QJsonDocument::fromJson(message.toUtf8(), &error);
|
||||
if (error.error != QJsonParseError::NoError) {
|
||||
qDebug() << "JSON parse error:" << error.errorString();
|
||||
return;
|
||||
}
|
||||
|
||||
QJsonObject rootObj = doc.object();
|
||||
if (rootObj.contains("bluetooth")) {
|
||||
ui_->stackedWidget->setCurrentIndex(0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user