ADD: added a command server with simple order handling
This commit is contained in:
@@ -70,8 +70,7 @@ namespace Entities {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
virtual void specificPhysicsCalculations(std::chrono::milliseconds::rep duration) = 0;
|
virtual void childWorker() = 0;
|
||||||
virtual void specificReloadCharacteristicts() = 0;
|
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
@@ -153,7 +153,6 @@ namespace Entities
|
|||||||
}else {
|
}else {
|
||||||
|
|
||||||
LOG_S(INFO)<< "Wait for MomentApp";
|
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)
|
void Entity::handleExternalComms(std::string msg)
|
||||||
{
|
{
|
||||||
LOG_S(INFO)<<msg;
|
// LOG_S(INFO)<<msg;
|
||||||
auto MoveOrder = Orders::MoveOrder::unpack(msg);
|
auto MoveOrder = Orders::MoveOrder::unpack(msg);
|
||||||
|
|
||||||
if (MoveOrder != nullptr)
|
if (MoveOrder != nullptr)
|
||||||
{
|
{
|
||||||
if(MoveOrder->Speed.isValid()) this->setSpeed(MoveOrder->Speed.getValue());
|
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)
|
while (!stopMainLoop)
|
||||||
{
|
{
|
||||||
handleMovement();
|
handleMovement();
|
||||||
|
childWorker();
|
||||||
|
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(500));
|
std::this_thread::sleep_for(std::chrono::milliseconds(500));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user