send back the message

This commit is contained in:
ackimixs
2024-04-16 19:53:52 +02:00
parent 71b164a89b
commit ffa26836e9

View File

@@ -244,6 +244,8 @@ void TCPServer::handleMessage(const std::string& message, int clientSocket)
else if (tokens[0] == "arduino" && tokens[2] == "set state") {
if (TCPUtils::startWith(tokens[3], "0")) {
this->isRobotMoving++;
std::string temp = message;
this->broadcastMessage(temp, clientSocket);
}
}
std::cout << "Received: " << message << std::endl;
@@ -453,7 +455,6 @@ void TCPServer::startGame() {
usleep(500'000);
// ReSharper disable once CppDFAUnreachableCode
usleep(500'000);
this->broadcastMessage("strat;servo_moteur;baisser bras;1\n");
@@ -531,6 +532,8 @@ void TCPServer::startGame() {
pinceState[1] = NONE;
usleep(1'000'000);
this->broadcastMessage("strat;arduino;speed;150\n");
toSend = "strat;arduino;go;" + std::to_string(static_cast<int>(this->endRobotPose.pos.x)) + "," + std::to_string(static_cast<int>(this->endRobotPose.pos.y)) + "\n";
this->broadcastMessage(toSend);
isRobotMoving = 0;