Hotwheels-Cluster 1.2
Creation of Cluster APP for SEA:ME project.
 
Loading...
Searching...
No Matches
CarManager.cpp
Go to the documentation of this file.
1
18
19#include "CarManager.hpp"
20#include "ui_CarManager.h"
21#include <QDebug>
22
29CarManager::CarManager(int argc, char **argv, QWidget *parent)
30 : QMainWindow(parent)
31 , ui(new Ui::CarManager)
33 , m_canBusManager(new CanBusManager("/dev/spidev0.0"))
34 , m_controlsManager(new ControlsManager(argc, argv))
35 , m_displayManager(nullptr)
37 , m_mileageManager(new MileageManager("/home/hotweels/app_data/mileage.json"))
38{
39 ui->setupUi(this);
41}
42
44{
45 delete m_displayManager;
46 delete m_controlsManager;
47 delete m_canBusManager;
48 delete m_dataManager;
49 delete m_mileageManager;
50 delete m_systemManager;
51 delete ui;
52}
53
68
74 // No additional logic for now; ready for future extensions
75}
76
91
110
117 if (ui) {
119
120 // Connect DataManager signals to DisplayManager slots
123
126
129
132
135
138
141
144
147
150
153
154 // Connect DisplayManager toggle signals to DataManager slots
157
160
163 }
164}
165
172{
173 if (m_systemManager) {
174 m_systemManager->initialize();
175 // Connect SystemManager signals to DataManager slots
176 connect(m_systemManager,
180
181 connect(m_systemManager,
185
186 connect(m_systemManager,
190
191 // Connect SystemManager's battery signal to DataManager's battery slot
192 connect(m_systemManager,
196
197 connect(m_systemManager,
201 }
202}
203
210 if (m_mileageManager) {
211 m_mileageManager->initialize();
212
213 // Connect CanBusManager signals to MileageManager slots
216
217 // Connect MileageManager signals to DataManager slots
220 }
221}
Definition of the CarManager class.
Class that manages the CAN bus communication. QObject.
void rpmUpdated(int newRpm)
Signal emitted when the RPM is updated.
void speedUpdated(float newSpeed)
Signal emitted when the speed is updated.
void initializeSystemManager()
Initialize the SystemManager.
void initializeCanBusManager()
Initialize the CanBusManager.
void initializeDisplayManager()
Initialize the DisplayManager.
MileageManager * m_mileageManager
Pointer to the MileageManager instance.
Ui::CarManager * ui
Pointer to the user interface for the car manager.
void initializeMileageManager()
Initialize the MileageManager.
void initializeDataManager()
Initialize the DataManager.
void initializeControlsManager()
Initialize the ControlsManager.
ControlsManager * m_controlsManager
Pointer to the ControlsManager instance.
void initializeComponents()
Initialize the components of the CarManager.
DisplayManager * m_displayManager
Pointer to the DisplayManager instance.
SystemManager * m_systemManager
Pointer to the SystemManager instance.
CanBusManager * m_canBusManager
Pointer to the CanBusManager instance.
DataManager * m_dataManager
Pointer to the DataManager instance.
CarManager(int argc, char **argv, QWidget *parent=nullptr)
Construct a new CarManager object.
The ControlsManager class.
void directionChanged(CarDirection newDirection)
void drivingModeUpdated(DrivingMode newMode)
Update the driving mode of the vehicle.
void steeringChanged(int newAngle)
Class that manages the data received from the car's systems. QObject.
void handleTimeData(const QString &currentDate, const QString &currentTime, const QString &currentDay)
Handle Time data.
void batteryPercentageUpdated(float batteryPercentage)
void toggleClusterMetrics()
Toggle the cluster metrics.
void handleIpAddressData(const QString &ipAddress)
Handle IP Address data.
void engineDataProcessed(CarDirection processedDirection, int processedAngle)
void mileageUpdated(double mileage)
void ipAddressUpdated(const QString &ipAddress)
void drivingModeUpdated(DrivingMode newMode)
void canDataProcessed(float processedSpeed, int processedRpm)
void toggleDrivingMode()
Toggle the driving mode.
void handleTemperatureData(const QString &temperature)
Handle Temperature data.
void toggleClusterTheme()
Toggle the cluster theme.
void handleSteeringData(int rawAngle)
Handle Steering data.
void handleRpmData(int rawRpm)
Handle CAN data.
void handleSpeedData(float rawSpeed)
Handle Speed data.
void handleMileageUpdate(double mileage)
Handle Engine data.
void handleWifiData(const QString &status, const QString &wifiName)
Handle WiFi data.
void systemTimeUpdated(const QString &currentDate, const QString &currentTime, const QString &currentDay)
void handleBatteryPercentage(float batteryPercentage)
Handle Battery Percentage data.
void clusterThemeUpdated(ClusterTheme newTheme)
void clusterMetricsUpdated(ClusterMetrics newMetrics)
void systemTemperatureUpdated(const QString &temperature)
void systemWifiUpdated(const QString &status, const QString &wifiName)
void handleDirectionData(CarDirection rawDirection)
Handle Direction data.
Class that manages the display of the car manager. QObject.
void updateTemperature(const QString &temperature)
Updates the temperature on the display.
void updateDrivingMode(DrivingMode newMode)
Updates the driving mode on the display.
void updateClusterTheme(ClusterTheme newTheme)
Updates the cluster theme on the display.
void updateIpAddress(const QString &ipAddress)
Updates the IP address on the display.
void clusterMetricsToggled()
Signal emitted when the cluster metrics are toggled.
void clusterThemeToggled()
Signal emitted when the cluster theme is toggled.
void drivingModeToggled()
Signal emitted when the driving mode is toggled.
void updateSystemTime(const QString &currentDate, const QString &currentTime, const QString &currentDay)
Updates the system time on the display.
void updateBatteryPercentage(float batteryPercentage)
Updates the battery percentage on the display.
void updateCanBusData(float speed, int rpm)
Updates the CAN bus data on the display.
void updateClusterMetrics(ClusterMetrics newMetrics)
Updates the cluster metrics on the display.
void updateEngineData(CarDirection direction, int steeringAngle)
Updates the engine data on the display.
void updateMileage(double mileage)
Updates the mileage on the display.
void updateWifiStatus(const QString &status, const QString &wifiName)
Updates the WiFi status on the display.
Class that manages the mileage of a vehicle. QObject.
void mileageUpdated(double mileage)
void onSpeedUpdated(float speed)
Handles the speed updated signal.
Class that manages the system time, status, and battery. QObject.
void ipAddressUpdated(const QString &ipAddress)
void batteryPercentageUpdated(float batteryPercentage)
void wifiStatusUpdated(const QString &status, const QString &wifiName)
void timeUpdated(const QString &currentDate, const QString &currentTime, const QString &currentDay)
void temperatureUpdated(const QString &temperature)
Namespace containing the user interface for the car manager.