mirror of
https://github.com/modelec/TCPSocketServer.git
synced 2026-03-23 16:10:41 +01:00
send back the message
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user