Adds immediate migration results in progress
This commit is contained in:
2102 files changed
+17482
-15071
No files matched your search
+22
-22
@@ -44,7 +44,7 @@ DataManager::DataManager(std::shared_ptr<DdsHandler> ddsHandler)
|
||||
m_tabDtc = TrainingAreaBase::Interface::Dtc::create(m_ddsHandler->dds());
|
||||
if (m_tabDtc == nullptr)
|
||||
{
|
||||
ERROR_LOG() << "Could not create DTC TrainingAreaBase";
|
||||
ERROR_LOG(m_logger) << "Could not create DTC TrainingAreaBase";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ DataManager::~DataManager()
|
||||
|
||||
void DataManager::onConnected()
|
||||
{
|
||||
DEBUG_LOG() << "SCM websocket port connected";
|
||||
DEBUG_LOG(m_logger) << "SCM websocket port connected";
|
||||
|
||||
connect(m_scmWebSocket, &QWebSocket::textMessageReceived, this, &DataManager::onTextMessageFromScm);
|
||||
|
||||
@@ -81,26 +81,26 @@ void DataManager::onTimerTimeout()
|
||||
|
||||
void DataManager::onTextMessageFromScm(const QString &message)
|
||||
{
|
||||
DEBUG_LOG() << "onTextMessageFromScm from scm: " << message;
|
||||
DEBUG_LOG(m_logger) << "onTextMessageFromScm from scm: " << message;
|
||||
const QJsonDocument doc = QJsonDocument::fromJson(message.toUtf8());
|
||||
const QJsonArray exercises = doc.object().value(DATA()).toArray();
|
||||
for (const QJsonValue &valEx : exercises)
|
||||
{
|
||||
const QJsonObject &exercise = valEx.toObject();
|
||||
const int exerciseId = exercise.value(EXERCISE_ID()).toInt();
|
||||
DEBUG_LOG() << "textMessageFromScm from scm - exerciseId " << exerciseId;
|
||||
DEBUG_LOG(m_logger) << "textMessageFromScm from scm - exerciseId " << exerciseId;
|
||||
|
||||
const QJsonArray services = exercise.value(SERVICES()).toArray();
|
||||
for (const QJsonValue &valSvc : services)
|
||||
{
|
||||
const QJsonObject &service = valSvc.toObject();
|
||||
const QString svcName = service.value(NAME_ABBREVATION()).toString().toUpper();
|
||||
DEBUG_LOG() << "textMessageFromScm from scm - svcName " << svcName;
|
||||
DEBUG_LOG(m_logger) << "textMessageFromScm from scm - svcName " << svcName;
|
||||
|
||||
if (svcName != QStringLiteral("TAB"))
|
||||
continue;
|
||||
|
||||
DEBUG_LOG() << "service TAB ";
|
||||
DEBUG_LOG(m_logger) << "service TAB ";
|
||||
|
||||
const QJsonArray ports = service.value(PORTS()).toArray();
|
||||
for (const QJsonValue &valPort : ports)
|
||||
@@ -110,7 +110,7 @@ void DataManager::onTextMessageFromScm(const QString &message)
|
||||
if (typeId == Core::PortType::WebSocketServer)
|
||||
{
|
||||
int tabPort = port.value(NUMBER()).toInt();
|
||||
DEBUG_LOG() << "connect to TAB - port: " << tabPort;
|
||||
DEBUG_LOG(m_logger) << "connect to TAB - port: " << tabPort;
|
||||
connectToTabWebSocket(tabPort, exerciseId);
|
||||
}
|
||||
}
|
||||
@@ -120,7 +120,7 @@ void DataManager::onTextMessageFromScm(const QString &message)
|
||||
|
||||
void DataManager::onConnectedTab()
|
||||
{
|
||||
DEBUG_LOG() << "TAB connected";
|
||||
DEBUG_LOG(m_logger) << "TAB connected";
|
||||
}
|
||||
|
||||
void DataManager::connectToTabWebSocket(int port, int exerciseId)
|
||||
@@ -131,7 +131,7 @@ void DataManager::connectToTabWebSocket(int port, int exerciseId)
|
||||
// Websocket connection already exists?
|
||||
if (tabData.port == port)
|
||||
{
|
||||
INFO_LOG() << "Connection to port " << port << " already exists.";
|
||||
INFO_LOG(m_logger) << "Connection to port " << port << " already exists.";
|
||||
return;
|
||||
}
|
||||
else
|
||||
@@ -142,7 +142,7 @@ void DataManager::connectToTabWebSocket(int port, int exerciseId)
|
||||
}
|
||||
}
|
||||
|
||||
INFO_LOG() << "New connection: exercise: " << exerciseId << ", port: " << port;
|
||||
INFO_LOG(m_logger) << "New connection: exercise: " << exerciseId << ", port: " << port;
|
||||
|
||||
const QUrl url(QStringLiteral("ws://%1:%2").arg(NGL::Connections::hostName(NGL::Connections::eConnection::SCM_WEBSOCKET)).arg(port));
|
||||
|
||||
@@ -152,7 +152,7 @@ void DataManager::connectToTabWebSocket(int port, int exerciseId)
|
||||
connect(webSocketTab, &QWebSocket::disconnected, this, &DataManager::closedTab);
|
||||
connect(webSocketTab, &QWebSocket::textMessageReceived, this, &DataManager::onTextMessageFromTab);
|
||||
|
||||
DEBUG_LOG() << "Trying to connect to TAB at " << url.toString();
|
||||
DEBUG_LOG(m_logger) << "Trying to connect to TAB at " << url.toString();
|
||||
webSocketTab->open(url);
|
||||
|
||||
TabData data;
|
||||
@@ -168,7 +168,7 @@ void DataManager::onClientDisconnect(Messages::MessageTransmitter *transmitter)
|
||||
{
|
||||
if (ed.transmitter == transmitter)
|
||||
{
|
||||
DEBUG_LOG() << "removed dead transmitter";
|
||||
DEBUG_LOG(m_logger) << "removed dead transmitter";
|
||||
ed.transmitter = nullptr;
|
||||
}
|
||||
}
|
||||
@@ -176,13 +176,13 @@ void DataManager::onClientDisconnect(Messages::MessageTransmitter *transmitter)
|
||||
|
||||
void DataManager::onTextMessageFromTab(const QString &message)
|
||||
{
|
||||
INFO_LOG() << "onTextMessageFromTab : " << message;
|
||||
INFO_LOG(m_logger) << "onTextMessageFromTab : " << message;
|
||||
const QJsonDocument doc = QJsonDocument::fromJson(message.toUtf8());
|
||||
|
||||
if (doc.object().value(TYPE()) != BITE_DATA() && doc.object().value(TYPE()) != POSITION_DATA())
|
||||
return;
|
||||
|
||||
INFO_LOG() << "TYPE: " << doc.object().value(TYPE()).toString();
|
||||
INFO_LOG(m_logger) << "TYPE: " << doc.object().value(TYPE()).toString();
|
||||
|
||||
QJsonObject data = doc.object().value(DATA()).toObject();
|
||||
|
||||
@@ -190,7 +190,7 @@ void DataManager::onTextMessageFromTab(const QString &message)
|
||||
|
||||
int equipNo = data.value(EQUIP_NO()).toInt();
|
||||
|
||||
INFO_LOG() << "equipNo: " << equipNo;
|
||||
INFO_LOG(m_logger) << "equipNo: " << equipNo;
|
||||
if (equipNo <= 0)
|
||||
return;
|
||||
|
||||
@@ -200,7 +200,7 @@ void DataManager::onTextMessageFromTab(const QString &message)
|
||||
if (doc.object().value(TYPE()) == POSITION_DATA())
|
||||
{
|
||||
m_equipDataMap[equipNo].lastPositionUpdate = data.value(LAST_POSITION_UPDATE()).toDouble();
|
||||
INFO_LOG() << "lastPosUpdate: " << m_equipDataMap[equipNo].lastPositionUpdate;
|
||||
INFO_LOG(m_logger) << "lastPosUpdate: " << m_equipDataMap[equipNo].lastPositionUpdate;
|
||||
}
|
||||
|
||||
if (m_equipDataMap[equipNo].boxId >= 0)
|
||||
@@ -209,7 +209,7 @@ void DataManager::onTextMessageFromTab(const QString &message)
|
||||
|
||||
if (transmitter == nullptr)
|
||||
{
|
||||
ERROR_LOG() << "transmitter for eqId " << equipNo << " no longer available";
|
||||
ERROR_LOG(m_logger) << "transmitter for eqId " << equipNo << " no longer available";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -218,7 +218,7 @@ void DataManager::onTextMessageFromTab(const QString &message)
|
||||
biteData.insert(BOX(), boxId);
|
||||
biteData.insert(LAST_POSITION_UPDATE(), m_equipDataMap[equipNo].lastPositionUpdate);
|
||||
transmitter->addMessage(Messages::BiteDataMessage(biteData, m_equipDataMap[equipNo].uuid));
|
||||
INFO_LOG() << "Send Message with boxId: " << boxId << ", equipNo: " << equipNo;
|
||||
INFO_LOG(m_logger) << "Send Message with boxId: " << boxId << ", equipNo: " << equipNo;
|
||||
if (boxId == 0)
|
||||
boxId = -1; // only single request
|
||||
}
|
||||
@@ -226,7 +226,7 @@ void DataManager::onTextMessageFromTab(const QString &message)
|
||||
|
||||
void DataManager::setEquipNoBoxId(int equipNo, int boxId, Messages::MessageTransmitter *transmitter, const QString &uuid)
|
||||
{
|
||||
INFO_LOG() << "equipNo: " << equipNo << ", boxId = " << boxId;
|
||||
INFO_LOG(m_logger) << "equipNo: " << equipNo << ", boxId = " << boxId;
|
||||
|
||||
// erase abonnement, no further biteData telegrams
|
||||
if (equipNo == 0)
|
||||
@@ -259,7 +259,7 @@ void DataManager::setEquipNoBoxId(int equipNo, int boxId, Messages::MessageTrans
|
||||
data.insert(BOX(), boxId);
|
||||
data.insert(LAST_POSITION_UPDATE(), equipData.lastPositionUpdate);
|
||||
transmitter->addMessage(Messages::BiteDataMessage(data, equipData.uuid));
|
||||
INFO_LOG() << "Send Message with boxId: " << boxId << ", equipNo: " << equipNo;
|
||||
INFO_LOG(m_logger) << "Send Message with boxId: " << boxId << ", equipNo: " << equipNo;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -273,7 +273,7 @@ void DataManager::setEquipNoBoxId(int equipNo, int boxId, Messages::MessageTrans
|
||||
equipData.biteMessage = data;
|
||||
|
||||
transmitter->addMessage(Messages::BiteDataMessage(data, equipData.uuid));
|
||||
INFO_LOG() << "Send Message with boxId: " << boxId << ", equipNo: " << equipNo << ", lastUpdate 0";
|
||||
INFO_LOG(m_logger) << "Send Message with boxId: " << boxId << ", equipNo: " << equipNo << ", lastUpdate 0";
|
||||
|
||||
// send bite request
|
||||
QJsonObject biteData;
|
||||
@@ -283,7 +283,7 @@ void DataManager::setEquipNoBoxId(int equipNo, int boxId, Messages::MessageTrans
|
||||
biteData.insert(UUID_(), QUuid::createUuid().toString());
|
||||
|
||||
QString message = QString::fromStdString(QJsonDocument(biteData).toJson(QJsonDocument::Compact).toStdString());
|
||||
INFO_LOG() << "message: " << message;
|
||||
INFO_LOG(m_logger) << "message: " << message;
|
||||
for (TabData dataTab : m_tabWebSocketMap)
|
||||
dataTab.websocket->sendTextMessage(message);
|
||||
|
||||
|
||||
Reference in new issue
Block a user