diff --git a/.gitignore b/.gitignore
index a9f2f76..68500d1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -72,4 +72,3 @@ build*
# --------
*.dll
*.exe
-
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..60304e9
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,7 @@
+[submodule "deps/qtmqtt"]
+ path = deps/qtmqtt
+ url = https://github.com/qt/qtmqtt
+ ignore = dirty
+[submodule "deps/protobuf"]
+ path = deps/protobuf
+ url = https://github.com/protocolbuffers/protobuf
diff --git a/NERODevelopment/CMakeLists.txt b/NERODevelopment/CMakeLists.txt
index 2d22d70..9b1908a 100644
--- a/NERODevelopment/CMakeLists.txt
+++ b/NERODevelopment/CMakeLists.txt
@@ -1,42 +1,46 @@
cmake_minimum_required(VERSION 3.21.1)
-option(LINK_INSIGHT "Link Qt Insight Tracker library" ON)
-option(BUILD_QDS_COMPONENTS "Build design studio components" ON)
-
project(NEROApp LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
+# Find Qt6 first before version checks
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick Network Mqtt Protobuf)
-if (Qt6_VERSION VERSION_GREATER_EQUAL 6.5)
- qt_standard_project_setup()
-endif()
+qt_standard_project_setup(REQUIRES 6.8)
+# Consolidate all sources in one place
set(PROJECT_SOURCES
+ # Headers - Constants
src/constants/fault_statuses.h
+ # Headers - Controllers
src/controllers/chargingcontroller.h
src/controllers/homecontroller.h
src/controllers/offviewcontroller.h
src/controllers/efficiencycontroller.h
src/controllers/headercontroller.h
- src/controllers/offviewcontroller.h
src/controllers/buttoncontroller.h
src/controllers/navigationcontroller.h
src/controllers/flappybirdcontroller.h
+ src/controllers/speedcontroller.h
+ src/controllers/snakecontroller.h
+ src/controllers/tankcontroller.h
+ # Headers - Models
src/models/mock_model.h
src/models/model.h
src/models/raspberry_model.h
src/models/mqtt_client.h
+ # Headers - Debug Mode
src/modes/debug_mode/debug_utils.h
+ # Headers - Utils
src/utils/data_type_names.h
src/utils/server_data.h
src/utils/attributestatus.h
src/utils/descriptioninfo.h
+ # Implementation - Controllers
src/controllers/efficiencycontroller.cpp
src/controllers/chargingcontroller.cpp
src/controllers/homecontroller.cpp
@@ -45,46 +49,43 @@ set(PROJECT_SOURCES
src/controllers/buttoncontroller.cpp
src/controllers/navigationcontroller.cpp
src/controllers/flappybirdcontroller.cpp
+ src/controllers/speedcontroller.cpp
+ src/controllers/snakecontroller.cpp
+ src/controllers/tankcontroller.cpp
+
+ # Implementation - Models
src/models/mock_model.cpp
src/models/model.cpp
src/models/raspberry_model.cpp
src/models/mqtt_client.cpp
+ # Implementation - Debug Mode
src/modes/debug_mode/debug_utils.cpp
+ # Implementation - Utils
src/utils/server_data.cpp
src/utils/descriptioninfo.cpp
+ # Main
src/main.cpp
- src/controllers/speedcontroller.h
- src/controllers/speedcontroller.cpp
-)
-
-find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick Network Mqtt Protobuf)
-
-qt_add_executable(NEROApp ${PROJECT_SOURCES}
- src/controllers/snakecontroller.h
- src/controllers/snakecontroller.cpp
- src/controllers/tankcontroller.cpp
- src/controllers/tankcontroller.h)
-
-qt_add_resources(NEROApp "configuration"
- PREFIX "/"
- FILES
- qtquickcontrols2.conf
+ # rss
+ application.qrc
)
+set(CMAKE_AUTORCC ON)
+set(CMAKE_AUTOMOC ON)
+# Create executable with all sources consolidated
+qt_add_executable(NEROApp ${PROJECT_SOURCES})
+# Add protobuf
qt_add_protobuf(NEROApp
PROTO_FILES
src/proto/serverdata/serverdata.proto
)
-target_include_directories(${PROJECT_NAME} PUBLIC include)
-include_directories("src/**")
-
+# Link libraries
target_link_libraries(NEROApp PRIVATE
Qt6::Core
Qt6::Gui
@@ -95,21 +96,17 @@ target_link_libraries(NEROApp PRIVATE
Qt6::Protobuf
)
-if (BUILD_QDS_COMPONENTS)
- include(${CMAKE_CURRENT_SOURCE_DIR}/qmlcomponents)
-endif()
+set(CMAKE_OBJECT_PATH_MAX 500)
+# include the qml config
include(${CMAKE_CURRENT_SOURCE_DIR}/qmlmodules)
+include(${CMAKE_CURRENT_SOURCE_DIR}/qmlcomponents)
+include(${CMAKE_CURRENT_SOURCE_DIR}/insight)
-if (LINK_INSIGHT)
- include(${CMAKE_CURRENT_SOURCE_DIR}/insight)
-endif ()
-
+# Installation
include(GNUInstallDirs)
install(TARGETS NEROApp
BUNDLE DESTINATION .
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
-
-
diff --git a/NERODevelopment/NERO.qmlproject.qtds b/NERODevelopment/NERO.qmlproject.qtds
new file mode 100644
index 0000000..4388ba6
--- /dev/null
+++ b/NERODevelopment/NERO.qmlproject.qtds
@@ -0,0 +1,116 @@
+
+
+
+
+
+ EnvironmentId
+ {dc75e71e-c532-40d3-9c38-160afa0018ea}
+
+
+ ProjectExplorer.Project.ActiveTarget
+ 0
+
+
+ ProjectExplorer.Project.EditorSettings
+
+ true
+ false
+ true
+
+ Cpp
+
+ CppGlobal
+
+
+
+ QmlJS
+
+ QmlJSGlobal
+
+
+ 2
+ UTF-8
+ false
+ 4
+ false
+ 0
+ 80
+ true
+ true
+ 1
+ 0
+ false
+ true
+ false
+ 2
+ true
+ true
+ 0
+ 8
+ true
+ false
+ 1
+ true
+ true
+ true
+ *.md, *.MD, Makefile
+ false
+ true
+ true
+
+
+
+ ProjectExplorer.Project.Target.0
+
+ Desktop
+ Desktop Qt 6.8.2
+ Desktop Qt 6.8.2
+ {63f87550-2541-4163-9631-08b7fea781da}
+ -1
+ 0
+ 0
+ 0
+
+
+ 0
+ Deploy
+ Deploy
+ ProjectExplorer.BuildSteps.Deploy
+
+ 1
+
+ false
+ ProjectExplorer.DefaultDeployConfiguration
+
+ 1
+
+
+ 0
+
+ false
+ QML Runtime
+ QmlProjectManager.QmlRunConfiguration.Qml
+
+ false
+ en
+ CurrentFile
+ true
+ true
+ true
+
+ 1
+
+
+
+ ProjectExplorer.Project.TargetCount
+ 1
+
+
+ ProjectExplorer.Project.Updater.FileVersion
+ 22
+
+
+ Version
+ 22
+
+
diff --git a/NERODevelopment/application.qrc b/NERODevelopment/application.qrc
new file mode 100644
index 0000000..f3b3d91
--- /dev/null
+++ b/NERODevelopment/application.qrc
@@ -0,0 +1,5 @@
+
+
+ qtquickcontrols2.conf
+
+
\ No newline at end of file
diff --git a/NERODevelopment/content/DescriptionModal.qml b/NERODevelopment/content/DescriptionModal.qml
index 0acb32e..bb27f70 100644
--- a/NERODevelopment/content/DescriptionModal.qml
+++ b/NERODevelopment/content/DescriptionModal.qml
@@ -30,7 +30,7 @@ Rectangle {
Image {
id: modalImage
anchors.fill: parent // This makes the image fill the rectangle
- source: "qrc:/content/images/neroLogo.png" // Set the image source here
+ source: "/qt/qml/content/images/neroLogo.png" // Set the image source here
fillMode: Image.PreserveAspectCrop
layer.enabled: true
diff --git a/NERODevelopment/content/FlappyBird.qml b/NERODevelopment/content/FlappyBird.qml
index 83427ee..786bf5a 100644
--- a/NERODevelopment/content/FlappyBird.qml
+++ b/NERODevelopment/content/FlappyBird.qml
@@ -18,9 +18,9 @@ Item {
property int xWall1: 200
property int xWall2: 400
property int xWall3: 600
- property string pipeSrc: "qrc:/content/images/pipe.png"
- property string backgroundSrc: "qrc:/content/images/bg.png"
- property string birdSrc: "qrc:/content/images/flappy-bird.png"
+ property string pipeSrc: "/qt/qml/content/images/pipe.png"
+ property string backgroundSrc: "/qt/qml/content/images/bg.png"
+ property string birdSrc: "/qt/qml/content/images/flappy-bird.png"
property bool gameOver: true
property int score: 0
property bool jump: false
@@ -32,9 +32,9 @@ Item {
property double speed: 3
property int frameRate: 25
property bool didJump: flappyBirdController.didJump
- property string birdFrame1: "qrc:/content/images/yellowbird-downflap.png"
- property string birdFrame2: "qrc:/content/images/yellowbird-midflap.png"
- property string birdFrame3: "qrc:/content/images/yellowbird-upflap.png"
+ property string birdFrame1: "/qt/qml/content/images/yellowbird-downflap.png"
+ property string birdFrame2: "/qt/qml/content/images/yellowbird-midflap.png"
+ property string birdFrame3: "/qt/qml/content/images/yellowbird-upflap.png"
property int currentBirdFrame: 0
property bool startFalling: false
diff --git a/NERODevelopment/content/HomeIcon.qml b/NERODevelopment/content/HomeIcon.qml
index 2753074..9fb152a 100644
--- a/NERODevelopment/content/HomeIcon.qml
+++ b/NERODevelopment/content/HomeIcon.qml
@@ -8,7 +8,7 @@ Rectangle {
property bool highlighted: false
property string text: "Off"
- property string source: "qrc:/content/images/zzz.png"
+ property string source: "/qt/qml/content/images/zzz.png"
ColumnLayout {
id: imageContainer
diff --git a/NERODevelopment/content/MicrophoneComponent.qml b/NERODevelopment/content/MicrophoneComponent.qml
index 186f9f8..477ce40 100644
--- a/NERODevelopment/content/MicrophoneComponent.qml
+++ b/NERODevelopment/content/MicrophoneComponent.qml
@@ -31,7 +31,7 @@ Item {
height: parent.height
width: parent.width
visible: isTalking
- source: "qrc:/content/images/microphone.svg"
+ source: "/qt/qml/content/images/microphone.svg"
fillMode: Image.PreserveAspectFit
}
diff --git a/NERODevelopment/content/NavigationController.qml b/NERODevelopment/content/NavigationController.qml
index 9200551..e0082db 100644
--- a/NERODevelopment/content/NavigationController.qml
+++ b/NERODevelopment/content/NavigationController.qml
@@ -100,7 +100,7 @@ Item {
width: navigation.boxSize
highlighted: selectedPageIndex === pitDrivePageIndex
text: "PIT - DRIVE"
- source: "qrc:/content/images/flag.png"
+ source: "/qt/qml/content/images/flag.png"
}
HomeIcon {
@@ -108,7 +108,7 @@ Item {
width: navigation.boxSize
highlighted: selectedPageIndex === pitReversePageIndex
text: "PIT - REVERSE"
- source: "qrc:/content/images/reverse.png"
+ source: "/qt/qml/content/images/reverse.png"
}
HomeIcon {
@@ -116,7 +116,7 @@ Item {
width: navigation.boxSize
highlighted: selectedPageIndex === speedPageIndex
text: "PERFORMANCE"
- source: "qrc:/content/images/hare.png"
+ source: "/qt/qml/content/images/hare.png"
}
HomeIcon {
@@ -124,7 +124,7 @@ Item {
width: navigation.boxSize
highlighted: selectedPageIndex === efficiencyPageIndex
text: "EFFICIENCY"
- source: "qrc:/content/images/turtle.png"
+ source: "/qt/qml/content/images/turtle.png"
}
}
@@ -139,7 +139,7 @@ Item {
width: navigation.boxSize
highlighted: selectedPageIndex === gamePageIndex
text: "GAMES"
- source: "qrc:/content/images/game.png"
+ source: "/qt/qml/content/images/game.png"
visible: !gamePageOpen
}
@@ -165,7 +165,7 @@ Item {
width: navigation.boxSize
highlighted: selectedPageIndex === exitPageIndex
text: "EXIT"
- source: "qrc:/content/images/exit.png"
+ source: "/qt/qml/content/images/exit.png"
}
}
}
diff --git a/NERODevelopment/content/OffScreen2.qml b/NERODevelopment/content/OffScreen2.qml
index 745d6a0..f07b3ad 100644
--- a/NERODevelopment/content/OffScreen2.qml
+++ b/NERODevelopment/content/OffScreen2.qml
@@ -508,7 +508,7 @@ Rectangle {
anchors.right: cpBrbInterlocksTsmsContainer.left
anchors.rightMargin: parent.width / 30
anchors.leftMargin: parent.width / 30
- source: "qrc:/content/images/neroLogo.png"
+ source: "/qt/qml/content/images/neroLogo.png"
fillMode: Image.PreserveAspectFit
}
diff --git a/NERODevelopment/imports/NERO/CMakeLists.txt b/NERODevelopment/imports/NERO/CMakeLists.txt
index 117e94d..f655f1d 100644
--- a/NERODevelopment/imports/NERO/CMakeLists.txt
+++ b/NERODevelopment/imports/NERO/CMakeLists.txt
@@ -15,4 +15,6 @@ qt6_add_qml_module(NERO
DirectoryFontLoader.qml
EventListModel.qml
EventListSimulator.qml
+ DEPENDENCIES
+ QtQuick
)
diff --git a/NERODevelopment/src/controllers/buttoncontroller.h b/NERODevelopment/src/controllers/buttoncontroller.h
index 57d134d..8546213 100644
--- a/NERODevelopment/src/controllers/buttoncontroller.h
+++ b/NERODevelopment/src/controllers/buttoncontroller.h
@@ -1,7 +1,7 @@
#ifndef BUTTONCONTROLLER_H
#define BUTTONCONTROLLER_H
-#include "src/models/model.h"
+#include "../models/model.h"
#include
class ButtonController : public QObject {
diff --git a/NERODevelopment/src/controllers/navigationcontroller.h b/NERODevelopment/src/controllers/navigationcontroller.h
index e8e2e60..661e74c 100644
--- a/NERODevelopment/src/controllers/navigationcontroller.h
+++ b/NERODevelopment/src/controllers/navigationcontroller.h
@@ -1,8 +1,8 @@
#ifndef NAVIGATIONCONTROLLER_H
#define NAVIGATIONCONTROLLER_H
-#include "src/controllers/buttoncontroller.h"
-#include "src/models/model.h"
+#include "../controllers/buttoncontroller.h"
+#include "../models/model.h"
#include
class NavigationController : public ButtonController {
diff --git a/NERODevelopment/src/controllers/offviewcontroller.h b/NERODevelopment/src/controllers/offviewcontroller.h
index ca8c6e3..e48c4f8 100644
--- a/NERODevelopment/src/controllers/offviewcontroller.h
+++ b/NERODevelopment/src/controllers/offviewcontroller.h
@@ -89,38 +89,38 @@ public slots:
DescriptionInfo("GLVMS",
"The master switch that allows for 24 volt to power low "
"voltage system.",
- "qrc:/content/images/glv.jpg"),
+ "qrc://qt/qml/content/images/glv.jpg"),
DescriptionInfo("Side BRBs",
"Emergency shutdown switches to fully and immediately "
"power down low voltage and tractive.",
- "qrc:/content/images/sidebrb.jpg"),
+ "qrc://qt/qml/content/images/sidebrb.jpg"),
DescriptionInfo("BMS",
"The battery management system to monitor state and "
"faults of accumulator.",
- "qrc:/content/images/imd.jpg"),
+ "qrc://qt/qml/content/images/imd.jpg"),
DescriptionInfo(
"IMD", "Monitors isolation between the high and low voltage systems.",
- "qrc:/content/images/imd.jpg"),
+ "qrc://qt/qml/content/images/imd.jpg"),
DescriptionInfo(
"CAN", "Monitors the status of intercomputer communication system.",
- "qrc:/content/images/imd.jpg"),
+ "qrc://qt/qml/content/images/imd.jpg"),
DescriptionInfo("BSPD",
"Brake System Plausibility Device which detects "
"inconsistencies in the brake sensor.",
- "qrc:/content/images/bspd.jpg"),
+ "qrc://qt/qml/content/images/bspd.jpg"),
DescriptionInfo("BOTS",
"Brake over travel switch which detects if we have lost "
"pressure in the brakes.",
- "qrc:/content/images/bots.jpg"),
+ "qrc://qt/qml/content/images/bots.jpg"),
DescriptionInfo("INERTIA", "Measures if there is a crash.",
- "qrc:/content/images/inertia.jpg"),
+ "qrc://qt/qml/content/images/inertia.jpg"),
DescriptionInfo("Pit BRB", "Driver tractive shutdown button.",
- "qrc:/content/images/cockpitBrb.jpg"),
+ "qrc://qt/qml/content/images/cockpitBrb.jpg"),
DescriptionInfo("INTERLOCKS",
"Detects if all high voltage connections are made.",
- "qrc:/content/images/interlocks.jpg"),
+ "qrc://qt/qml/content/images/interlocks.jpg"),
DescriptionInfo("TSMS", "Toggles tractive system.",
- "qrc:/content/images/tsms.jpg"),
+ "qrc://qt/qml/content/images/tsms.jpg"),
};
};
diff --git a/NERODevelopment/src/main.cpp b/NERODevelopment/src/main.cpp
index a3286b0..5338c62 100644
--- a/NERODevelopment/src/main.cpp
+++ b/NERODevelopment/src/main.cpp
@@ -10,10 +10,12 @@
#include "controllers/offviewcontroller.h"
#include "controllers/snakecontroller.h"
#include "controllers/speedcontroller.h"
+#ifndef _WIN32
+#include "models/raspberry_model.h"
+#endif
#include "import_qml_components_plugins.h"
#include "import_qml_plugins.h"
-#include "src/models/mock_model.h"
-#include "src/models/raspberry_model.h"
+#include "models/mock_model.h"
#include
#include
#include
@@ -31,7 +33,9 @@ int main(int argc, char *argv[]) {
Model *model;
if (osName == "raspberrypi-sta") {
- model = new RaspberryModel;
+#ifndef _WIN32
+ model = new RaspberryModel;
+#endif
model->connectToMQTT();
} else {
model = new MockModel;
@@ -50,15 +54,6 @@ int main(int argc, char *argv[]) {
EfficiencyController efficencyController(model);
SpeedController speedController(model);
- const QUrl url(u"qrc:Main/main.qml"_qs);
- QObject::connect(
- &engine, &QQmlApplicationEngine::objectCreated, &app,
- [url](QObject *obj, const QUrl &objUrl) {
- if (!obj && url == objUrl)
- QCoreApplication::exit(-1);
- },
- Qt::QueuedConnection);
-
engine.rootContext()->setContextProperty("homeController", &homeController);
engine.rootContext()->setContextProperty("headerController",
&headerController);
@@ -73,16 +68,10 @@ int main(int argc, char *argv[]) {
&efficencyController);
engine.rootContext()->setContextProperty("speedController", &speedController);
- engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
-
- engine.addImportPath(QCoreApplication::applicationDirPath() + "/qml");
- engine.addImportPath(":/");
-
- engine.load(url);
-
- if (engine.rootObjects().isEmpty()) {
- return -1;
- }
+ QObject::connect(&engine, &QQmlApplicationEngine::objectCreationFailed,
+ &app, []() { QCoreApplication::exit(-1); },
+ Qt::QueuedConnection);
+ engine.loadFromModule("content", "App");
return app.exec();
}
diff --git a/NERODevelopment/src/models/mqtt_client.h b/NERODevelopment/src/models/mqtt_client.h
index 3892266..8e28bae 100644
--- a/NERODevelopment/src/models/mqtt_client.h
+++ b/NERODevelopment/src/models/mqtt_client.h
@@ -5,7 +5,6 @@
#include
#include
#include
-#include
/**
* @brief The MqttClient class, wraps the native QMqtt client to functions we
diff --git a/deps/protobuf b/deps/protobuf
new file mode 160000
index 0000000..1449d47
--- /dev/null
+++ b/deps/protobuf
@@ -0,0 +1 @@
+Subproject commit 1449d4760bed71e6ec532742277ae6ec584bf4d4
diff --git a/deps/qtmqtt b/deps/qtmqtt
new file mode 160000
index 0000000..6a876cb
--- /dev/null
+++ b/deps/qtmqtt
@@ -0,0 +1 @@
+Subproject commit 6a876cb32162873a9183ea847bcaef57ef4dfd01