60 throw std::runtime_error(
"Invalid proxy, failed to cast.");
65 std::lock_guard<std::mutex> lock(
mtx);
74 std::this_thread::sleep_for(std::chrono::milliseconds(100));
79 }
catch (
const Ice::Exception& e) {
80 std::cerr <<
"Ice Exception: " << e.what() << std::endl;
95 std::unique_lock<std::mutex> lock(
mtx);
101 carData->setJoystickValue(value);
102 }
catch (
const Ice::Exception& e) {
103 std::cerr <<
"Error setting joystick value: " << e.what() << std::endl;
106 std::cerr <<
"Joystick proxy is not valid!" << std::endl;
121 std::unique_lock<std::mutex> lock(
mtx);
127 bool state =
carData->getJoystickValue();
129 }
catch (
const Ice::Exception& e) {
130 std::cerr <<
"Error getting joystick value: " << e.what() << std::endl;
134 std::cerr <<
"Joystick proxy is not valid!" << std::endl;
147 std::lock_guard<std::mutex> lock(
mtx);
File containing the ClientThread class.
Ice::CommunicatorPtr communicator
void setJoystickValue(bool value)
Set the joystick value on the server.
std::condition_variable cv
void setRunning(bool value)
Sets the running flag of the client thread.
ClientThread(QObject *parent=nullptr)
Construct a new Client Thread:: Client Thread object.
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.
bool getJoystickValue()
Get the joystick value from the server.