Hotwheels-Cluster 1.2
Creation of Cluster APP for SEA:ME project.
 
Loading...
Searching...
No Matches
ClientThread.hpp
Go to the documentation of this file.
1
15
16#ifndef CLIENT_THREAD_HPP
17#define CLIENT_THREAD_HPP
18
19#include <Ice/Ice.h>
20#include "Joystick.h" // Generated by slice2cpp
21#include <iostream>
22#include <thread>
23#include <mutex>
24#include <condition_variable>
25#include <QObject>
26
31class ClientThread : public QObject
32{
33 Q_OBJECT
34
35private:
36 Ice::CommunicatorPtr communicator;
37 Ice::ObjectPrx base;
38 Data::CarDataPrx carData; // Proxy to communicate with the server
39 std::thread clientThread;
40 bool running = true;
41 bool connected = false; // Flag to check if the client is connected
42 std::mutex mtx; // Mutex for synchronization
43 std::condition_variable cv; // Condition variable for synchronization
44
45public:
46 explicit ClientThread(QObject *parent = nullptr);
47
49
50 void runClient(int argc, char *argv[]);
51
52 void setJoystickValue(bool value);
53 bool getJoystickValue();
54
55 void setRunning(bool value);
56};
57
58#endif
Ice::CommunicatorPtr communicator
void setJoystickValue(bool value)
Set the joystick value on the server.
std::condition_variable cv
Ice::ObjectPrx base
void setRunning(bool value)
Sets the running flag of the client thread.
ClientThread(QObject *parent=nullptr)
Construct a new Client Thread:: Client Thread object.
Data::CarDataPrx carData
void runClient(int argc, char *argv[])
Run the client by initializing the Ice communicator and connecting to the server.
~ClientThread()
Destructor for the ClientThread class.
std::mutex mtx
bool getJoystickValue()
Get the joystick value from the server.
std::thread clientThread
::IceInternal::ProxyHandle< ::IceProxy::Data::CarData > CarDataPrx
Definition Joystick.h:293