diff --git a/CMakeLists.txt b/CMakeLists.txt index da2af6b..1f5e143 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) \ No newline at end of file +INCLUDE(CPack) diff --git a/autoapp/CMakeLists.txt b/autoapp/CMakeLists.txt index 67946c8..020c018 100644 --- a/autoapp/CMakeLists.txt +++ b/autoapp/CMakeLists.txt @@ -18,6 +18,7 @@ target_include_directories(autoapp PRIVATE ) target_link_libraries(autoapp + Qt5::WebSockets openauto ) diff --git a/autoapp/UI/MainWindow.cpp b/autoapp/UI/MainWindow.cpp index a35fea8..26d13bd 100644 --- a/autoapp/UI/MainWindow.cpp +++ b/autoapp/UI/MainWindow.cpp @@ -19,6 +19,10 @@ #include #include #include +#include +#include +#include +#include #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);