ADD: added functionality to show the position in a simtrack of a connected ship

This commit is contained in:
Henry Winkel
2023-08-10 17:18:10 +02:00
parent 5739585b90
commit bbf4be8108
4 changed files with 125 additions and 28 deletions

View File

@@ -1,3 +1,4 @@
#include "Orders/MoveOrder.hpp"
#include <cstdlib>
#include <iostream>
#include <csignal>
@@ -32,26 +33,37 @@ int main()
sigIntHandler.sa_flags = 0;
sigaction(SIGINT, &sigIntHandler, NULL);
ushort port = 3500;
// SimControl::SimControl sc("127.0.0.1",5557);
const char* CommandPortChar = "31371";
if (std::getenv("COMMAND_PORT") != nullptr) {
CommandPortChar = std::getenv("COMMAND_PORT");
}
ushort commandPort_ = (unsigned short)strtol(CommandPortChar,NULL,0);
DirectCommunication::DirectCommunicationClient client(port,"127.0.0.1");
const char *ServerAddress = nullptr;
ServerAddress = std::getenv("SERVER_IP");
if (ServerAddress == nullptr) {
ServerAddress = "127.0.0.1";
}
LOG_S(INFO)<<ServerAddress;
ushort port = 8000;
SimControl::SimControl sc(commandPort_);
client.sendMessage("Hello Server");
while (running) {
std::this_thread::sleep_for(std::chrono::milliseconds(500));
client.sendMessage("Hello Server");
std::string MessageString = client.getLatestMessage();
LOG_S(INFO)<<MessageString;
std::this_thread::sleep_for(std::chrono::milliseconds(500));
std::this_thread::sleep_for(std::chrono::milliseconds(100));
}
std::this_thread::sleep_for(std::chrono::milliseconds(2000));
sc.stop();
LOG_S(INFO)<<"end app";
std::exit(0);
return 0;
std::exit(0);
}