Hotwheels-Cluster 1.2
Creation of Cluster APP for SEA:ME project.
 
Loading...
Searching...
No Matches
ControlsManager.cpp
Go to the documentation of this file.
1
22
23#include "ControlsManager.hpp"
24#include <QDebug>
25
26#define SHM_NAME "/joystick_enable"
27
33ControlsManager::ControlsManager(int argc, char **argv, QObject *parent)
34 : QObject(parent), m_clientObject(nullptr),
35 m_clientThread(nullptr) {
36
37 // **Client Middleware Interface Thread**
38 m_clientObject = new ClientThread();
39 m_clientThread = QThread::create([this, argc, argv]() {
40 m_clientObject->runClient(argc, argv);
41 });
42 m_clientThread->start();
43}
44
51{
52 if (m_clientThread) {
53 m_clientObject->setRunning(false);
54 m_clientThread->quit();
55 m_clientThread->wait();
56 delete m_clientThread;
57 }
58 delete m_clientObject;
59}
60
68 if (newMode == DrivingMode::Automatic) {
69 m_clientObject->setJoystickValue(false);
70 }
71 else {
72 m_clientObject->setJoystickValue(true);
73 }
74}
DrivingMode
Enum class for the driving mode.
Definition enums.hpp:24
Class for the client thread.
~ControlsManager()
Destructor for the ControlsManager class.
ControlsManager(int argc, char **argv, QObject *parent=nullptr)
Constructs a ControlsManager object.
void drivingModeUpdated(DrivingMode newMode)
Update the driving mode of the vehicle.
ClientThread * m_clientObject