Adds immediate migration results in progress
This commit is contained in:
2102 files changed
+17482
-15071
No files matched your search
+17
-18
@@ -21,11 +21,10 @@ namespace WirelessLocationSystem
|
||||
|
||||
const char *exerciseIdProperty = "exerciseId";
|
||||
|
||||
WebSocketHandler::WebSocketHandler(QObject *parent)
|
||||
: QObject(parent)
|
||||
WebSocketHandler::WebSocketHandler(QObject *parent) : QObject(parent)
|
||||
, m_webSocketServer(new QWebSocketServer(QStringLiteral("WLS"), QWebSocketServer::NonSecureMode, this))
|
||||
, m_basePoint(LtsCoordTrans::UtmCoordinate::fromMgrs(Settings::wlsMgrsBasePoint()))
|
||||
{}
|
||||
, m_basePoint(LtsCoordTrans::UtmCoordinate::fromMgrs(Settings::wlsMgrsBasePoint())),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {}
|
||||
|
||||
WebSocketHandler::~WebSocketHandler()
|
||||
{}
|
||||
@@ -37,7 +36,7 @@ bool WebSocketHandler::init(std::shared_ptr<WlsHandler> wlsHandler,
|
||||
{
|
||||
if (!m_webSocketServer->listen(QHostAddress::Any, listenPort))
|
||||
{
|
||||
WARNING_LOG() << "Can not listen on port " << listenPort << " - aborting" << m_webSocketServer->errorString();
|
||||
WARNING_LOG(m_logger) << "Can not listen on port " << listenPort << " - aborting" << m_webSocketServer->errorString();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -58,7 +57,7 @@ void WebSocketHandler::onNewConnection()
|
||||
if (ws == nullptr)
|
||||
return;
|
||||
|
||||
DEBUG_LOG() << "New websocket connection from " << ws->peerAddress().toString() << ":" << ws->peerPort();
|
||||
DEBUG_LOG(m_logger) << "New websocket connection from " << ws->peerAddress().toString() << ":" << ws->peerPort();
|
||||
|
||||
connect(ws, &QWebSocket::textMessageReceived,
|
||||
this, &WebSocketHandler::onTextMessageReceived);
|
||||
@@ -68,14 +67,14 @@ void WebSocketHandler::onNewConnection()
|
||||
connect(this, &WebSocketHandler::signalBroadcastMessage,
|
||||
ws, [this, ws](const QString &msg, int exerciseId)
|
||||
{
|
||||
DEBUG_LOG() << "broadcast: exercise property is valid? " << ws->property(exerciseIdProperty).isValid() << " for " << ws->peerPort();
|
||||
DEBUG_LOG(m_logger) << "broadcast: exercise property is valid? " << ws->property(exerciseIdProperty).isValid() << " for " << ws->peerPort();
|
||||
|
||||
bool exerciseIdAvailable = false;
|
||||
int wsExerciseId = ws->property(exerciseIdProperty).toInt(&exerciseIdAvailable);
|
||||
|
||||
if (exerciseIdAvailable && wsExerciseId != exerciseId)
|
||||
{
|
||||
DEBUG_LOG() << "broadcast: websocket has " << wsExerciseId << ", but " << exerciseId << " was requested";
|
||||
DEBUG_LOG(m_logger) << "broadcast: websocket has " << wsExerciseId << ", but " << exerciseId << " was requested";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -102,7 +101,7 @@ void WebSocketHandler::sendTelegramInternal(const TrainingAreaBase::TetraIcd::Tr
|
||||
|
||||
|
||||
const QString jsonStr(QString::fromUtf8(QJsonDocument(obj).toJson(QJsonDocument::Compact)));
|
||||
DEBUG_LOG() << "jsonStr: " << jsonStr;
|
||||
DEBUG_LOG(m_logger) << "jsonStr: " << jsonStr;
|
||||
|
||||
emit signalBroadcastMessage(jsonStr, exerciseId);
|
||||
}
|
||||
@@ -139,7 +138,7 @@ void WebSocketHandler::onTextMessageReceived(const QString &baJson)
|
||||
{
|
||||
using namespace TrainingAreaBase::TetraIcd;
|
||||
|
||||
TRACE_LOG() << "WebSocketHandler::onTextMessageReceived: " << baJson;
|
||||
TRACE_LOG(m_logger) << "WebSocketHandler::onTextMessageReceived: " << baJson;
|
||||
QWebSocket *ws = qobject_cast<QWebSocket*>(sender());
|
||||
|
||||
if (ws == nullptr)
|
||||
@@ -153,7 +152,7 @@ void WebSocketHandler::onTextMessageReceived(const QString &baJson)
|
||||
|
||||
if (err.error != QJsonParseError::NoError)
|
||||
{
|
||||
ERROR_LOG() << "received invalid json from websocket at " << err.offset << ": " << err.errorString();
|
||||
ERROR_LOG(m_logger) << "received invalid json from websocket at " << err.offset << ": " << err.errorString();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -172,7 +171,7 @@ void WebSocketHandler::onTextMessageReceived(const QString &baJson)
|
||||
const QJsonValue typeId(obj.value(QStringLiteral("typeId")));
|
||||
if (!typeId.isDouble())
|
||||
{
|
||||
ERROR_LOG() << "Can not read type id: " << baJson;
|
||||
ERROR_LOG(m_logger) << "Can not read type id: " << baJson;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -191,7 +190,7 @@ void WebSocketHandler::onTextMessageReceived(const QString &baJson)
|
||||
{
|
||||
int exerciseId = ExerciseStateData::fromJson(data).exerciseId;
|
||||
ws->setProperty(exerciseIdProperty, exerciseId);
|
||||
DEBUG_LOG() << "set exercise id " << exerciseId << " for ws with peer port " << ws->peerPort();
|
||||
DEBUG_LOG(m_logger) << "set exercise id " << exerciseId << " for ws with peer port " << ws->peerPort();
|
||||
sendParticipantConnectionStates(exerciseId);
|
||||
break;
|
||||
}
|
||||
@@ -202,14 +201,14 @@ void WebSocketHandler::onTextMessageReceived(const QString &baJson)
|
||||
m_participantHandler->handleWlsBinarySfmData(WlsBinarySfmData::fromJson(data));
|
||||
break;
|
||||
default:
|
||||
WARNING_LOG() << "Handler for telegram Id " << typeId.toInt()
|
||||
WARNING_LOG(m_logger) << "Handler for telegram Id " << typeId.toInt()
|
||||
<< " not yet implemented (" << baJson << ")";
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch (const std::exception &e)
|
||||
{
|
||||
WARNING_LOG() << "Could not parse json: " << e.what() << " (" << baJson << ")";
|
||||
WARNING_LOG(m_logger) << "Could not parse json: " << e.what() << " (" << baJson << ")";
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -271,16 +270,16 @@ void WebSocketHandler::setPosition(T &tele, const WlsParticipant *participant)
|
||||
|
||||
void WebSocketHandler::sendPosition(const WlsParticipant *participant)
|
||||
{
|
||||
INFO_LOG() << "sendPosition equipmentNumber=" << participant->equipmentNumber();
|
||||
INFO_LOG(m_logger) << "sendPosition equipmentNumber=" << participant->equipmentNumber();
|
||||
if (!participant || !participant->positionIsValid() || participant->equipmentNumber() == 0)
|
||||
{
|
||||
INFO_LOG() << "not send - participant is not yet fully initialized";
|
||||
INFO_LOG(m_logger) << "not send - participant is not yet fully initialized";
|
||||
return;
|
||||
}
|
||||
|
||||
if (participant->isGpsMode())
|
||||
{
|
||||
INFO_LOG() << "not send - participant is in gps mode";
|
||||
INFO_LOG(m_logger) << "not send - participant is in gps mode";
|
||||
return;
|
||||
}
|
||||
TrainingAreaBase::TetraIcd::PositionReport posValue;
|
||||
|
||||
Reference in new issue
Block a user