ADD: added a command server with simple order handling
This commit is contained in:
@@ -153,7 +153,6 @@ namespace Entities
|
||||
}else {
|
||||
|
||||
LOG_S(INFO)<< "Wait for MomentApp";
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(5000));
|
||||
}
|
||||
|
||||
|
||||
@@ -195,17 +194,24 @@ namespace Entities
|
||||
|
||||
void Entity::handleExternalComms(std::string msg)
|
||||
{
|
||||
LOG_S(INFO)<<msg;
|
||||
// LOG_S(INFO)<<msg;
|
||||
auto MoveOrder = Orders::MoveOrder::unpack(msg);
|
||||
|
||||
if (MoveOrder != nullptr)
|
||||
{
|
||||
if(MoveOrder->Speed.isValid()) this->setSpeed(MoveOrder->Speed.getValue());
|
||||
if(MoveOrder->Course.isValid()) this->setCourse(MoveOrder->Course.getValue());
|
||||
if(MoveOrder->getPosition().isValid())
|
||||
{
|
||||
LOG_S(INFO)<<"New Position received";
|
||||
|
||||
this->setPosition(MoveOrder->getPosition());
|
||||
}
|
||||
// CommandCommsServer_->sendMessage("Hello Client");
|
||||
}
|
||||
|
||||
LOG_S(INFO)<<this->CommandCommsServer_->countClients();
|
||||
CommandCommsServer_->sendMessage("Hello Client");
|
||||
|
||||
CommandCommsServer_->sendMessage(this->OwnShipTrack->buildMessage().serialize());
|
||||
|
||||
}
|
||||
|
||||
@@ -218,7 +224,7 @@ namespace Entities
|
||||
while (!stopMainLoop)
|
||||
{
|
||||
handleMovement();
|
||||
|
||||
childWorker();
|
||||
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(500));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user