ADD: added smal prototype
This commit is contained in:
@@ -104,11 +104,13 @@ namespace Entities
|
|||||||
{
|
{
|
||||||
|
|
||||||
LOG_S(INFO)<< "TODO: starting the movement app from here";
|
LOG_S(INFO)<< "TODO: starting the movement app from here";
|
||||||
|
|
||||||
if (MovemtServer_->countClients() > 0 )
|
if (MovemtServer_->countClients() > 0 )
|
||||||
{
|
{
|
||||||
auto msg = MovemtServer_->getLatestMessage();
|
std::string msg = MovemtServer_->getLatestMessage();
|
||||||
if (*msg.get() == "Hello Server")
|
if (msg == "Hello Server")
|
||||||
{
|
{
|
||||||
|
MovementWorkerStarted = true;
|
||||||
MovemtServer_->sendMessage(OwnShipTrack->buildMessage().serialize());
|
MovemtServer_->sendMessage(OwnShipTrack->buildMessage().serialize());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -122,16 +124,27 @@ namespace Entities
|
|||||||
void Entity::MainLoop()
|
void Entity::MainLoop()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
LOG_S(INFO)<< "main loop started";
|
||||||
while (!stopMainLoop)
|
while (!stopMainLoop)
|
||||||
{
|
{
|
||||||
if (!MovementWorkerStarted)
|
if (!MovementWorkerStarted)
|
||||||
{
|
{
|
||||||
startMovementWorker();
|
startMovementWorker();
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
std::string msg = MovemtServer_->getLatestMessage();
|
||||||
|
auto newTrack = SimCore::SimTrack::unpack(msg);
|
||||||
|
if (newTrack != nullptr)
|
||||||
|
{
|
||||||
|
OwnShipTrack->setPosition(newTrack->getPosition());
|
||||||
|
LOG_S(INFO)<< "new POS: LAT: "<< OwnShipTrack->getPosition().getGeodesicPos()(SimCore::LATITUDE) << " LON: " << OwnShipTrack->getPosition().getGeodesicPos()(SimCore::LONGITUDE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
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