diff --git a/plugins/channelrx/demodinmarsat/inmarsatdemodgui.cpp b/plugins/channelrx/demodinmarsat/inmarsatdemodgui.cpp index ce058e737..c73da9ec0 100644 --- a/plugins/channelrx/demodinmarsat/inmarsatdemodgui.cpp +++ b/plugins/channelrx/demodinmarsat/inmarsatdemodgui.cpp @@ -115,7 +115,7 @@ QRegularExpression MultipartMessage::m_re(QStringLiteral("(\\d+)-(\\d+)(.(\\d+)) void MultipartMessage::parseMessage() { - if (getParts() == getTotalParts()) + if (getComplete()) { QString message = getMessage(); m_messageCoordinates.clear(); @@ -209,13 +209,14 @@ void InmarsatDemodGUI::resizeTable() ui->packets->setItem(row, PACKET_COL_DATE, new QTableWidgetItem("Frid Apr 15 2016-")); ui->packets->setItem(row, PACKET_COL_TIME, new QTableWidgetItem("10:17:00")); ui->packets->setItem(row, PACKET_COL_SAT, new QTableWidgetItem("Atlantic Ocean")); + ui->packets->setItem(row, PACKET_COL_MES, new QTableWidgetItem("123456789-")); ui->packets->setItem(row, PACKET_COL_LES, new QTableWidgetItem("123456-15-")); - ui->packets->setItem(row, PACKET_COL_MSG_ID, new QTableWidgetItem("80555301-")); ui->packets->setItem(row, PACKET_COL_TYPE, new QTableWidgetItem("Multiframe Packet Start-")); ui->packets->setItem(row, PACKET_COL_FRAME_NO, new QTableWidgetItem("123456")); ui->packets->setItem(row, PACKET_COL_LCN, new QTableWidgetItem("888")); ui->packets->setItem(row, PACKET_COL_ULF, new QTableWidgetItem("15,888.888")); ui->packets->setItem(row, PACKET_COL_DLF, new QTableWidgetItem("15,888.888")); + ui->packets->setItem(row, PACKET_COL_MSG_ID, new QTableWidgetItem("80555301-")); ui->packets->setItem(row, PACKET_COL_PRIORITY, new QTableWidgetItem("Urgency")); ui->packets->setItem(row, PACKET_COL_ADDRESS, new QTableWidgetItem("90S 180W 1000 nm")); ui->packets->setItem(row, PACKET_COL_MESSAGE, new QTableWidgetItem("ABCEDGHIJKLMNOPQRSTUVWXYZ")); @@ -233,7 +234,7 @@ void InmarsatDemodGUI::resizeTable() ui->messages->setItem(row, MESSAGE_COL_PRIORITY, new QTableWidgetItem("Urgency-")); ui->messages->setItem(row, MESSAGE_COL_ADDRESS, new QTableWidgetItem("90S 180W 1000 nm")); ui->messages->setItem(row, MESSAGE_COL_MESSAGE, new QTableWidgetItem("ABCEDGHIJKLMNOPQRSTUVWXYZ")); - ui->messages->setItem(row, MESSAGE_COL_PARTS, new QTableWidgetItem("8/88")); + ui->messages->setItem(row, MESSAGE_COL_PARTS, new QTableWidgetItem("88/88+")); ui->messages->resizeColumnsToContents(); ui->messages->removeRow(row); } @@ -445,10 +446,10 @@ const QStringList MultipartMessage::m_navAreaFlags = { "russia" }; -QString MultipartMessage::decodeAddress(QString messageType, QString addressHex, float *latitude, float *longitude, QList *coordinates, QIcon **icon) +QString MultipartMessage::decodeAddress(QString serviceCode, QString addressHex, float *latitude, float *longitude, QList *coordinates, QIcon **icon) { bool ok; - int messageTypeNum = messageType.toInt(&ok); + int messageTypeNum = serviceCode.toInt(&ok); if (ok) { @@ -697,7 +698,10 @@ void InmarsatDemodGUI::updateMessageTable(MultipartMessage *message) addressItem->setIcon(*icon); } messageItem->setText(message->getMessage()); - QString parts = QString("%1 / %2").arg(message->getParts()).arg(message->getTotalParts()); + QString parts = QString("%1 / %2%3") + .arg(message->getParts()) + .arg(message->getTotalParts()) + .arg(message->getComplete() ? "" : "+"); partsItem->setData(Qt::DisplayRole, parts); filterRow(ui->messages, row, -1, MESSAGE_COL_MESSAGE); @@ -711,6 +715,21 @@ void InmarsatDemodGUI::updateMessageTable(MultipartMessage *message) } } +void InmarsatDemodGUI::decodeAppend(QString& decode, const QString& title, const std::string& variable, inmarsatc::frameParser::FrameParser::frameParser_result& frame) +{ + decode = decode.append("" + title + " " + QString::fromStdString(frame.decoding_result.packetVars[variable])); +} + +void InmarsatDemodGUI::decodeAppendFreqMHz(QString& decode, const QString& title, const std::string& variable, inmarsatc::frameParser::FrameParser::frameParser_result& frame) +{ + decode = decode.append("" + title + " " + formatFreqMHz(frame.decoding_result.packetVars[variable])); +} + +void InmarsatDemodGUI::decodeAppendHTML(QString& decode, const QString& title, const std::string& variable, inmarsatc::frameParser::FrameParser::frameParser_result& frame) +{ + decode = decode.append("" + title + " " + toHTML(frame.decoding_result.packetVars[variable])); +} + // Add row to table void InmarsatDemodGUI::packetReceived(const QByteArray& bytes, QDateTime dateTime) { @@ -735,6 +754,7 @@ void InmarsatDemodGUI::packetReceived(const QByteArray& bytes, QDateTime dateTim QTableWidgetItem *dateItem = new QTableWidgetItem(); QTableWidgetItem *timeItem = new QTableWidgetItem(); QTableWidgetItem *satItem = new QTableWidgetItem(); + QTableWidgetItem *mesItem = new QTableWidgetItem(); QTableWidgetItem *lesItem = new QTableWidgetItem(); QTableWidgetItem *msgIdItem = new QTableWidgetItem(); QTableWidgetItem *typeItem = new QTableWidgetItem(); @@ -751,6 +771,7 @@ void InmarsatDemodGUI::packetReceived(const QByteArray& bytes, QDateTime dateTim ui->packets->setItem(row, PACKET_COL_DATE, dateItem); ui->packets->setItem(row, PACKET_COL_TIME, timeItem); ui->packets->setItem(row, PACKET_COL_SAT, satItem); + ui->packets->setItem(row, PACKET_COL_MES, mesItem); ui->packets->setItem(row, PACKET_COL_LES, lesItem); ui->packets->setItem(row, PACKET_COL_MSG_ID, msgIdItem); ui->packets->setItem(row, PACKET_COL_TYPE, typeItem); @@ -772,32 +793,29 @@ void InmarsatDemodGUI::packetReceived(const QByteArray& bytes, QDateTime dateTim frameNoItem->setText(QString::number(frame.decoding_result.frameNumber)); satItem->setText(QString::fromStdString(frame.decoding_result.packetVars["satName"])); + mesItem->setText(QString::fromStdString(frame.decoding_result.packetVars["mesId"])); QString lesName = QString::fromStdString(frame.decoding_result.packetVars["lesName"]); if (!lesName.isEmpty()) { lesItem->setText(lesName); - } else{ - lesItem->setText(QString::fromStdString(frame.decoding_result.packetVars["les"])); - } - QString msgId = QString::fromStdString(frame.decoding_result.packetVars["mesId"]); - if (!msgId.isEmpty()) { - msgIdItem->setText(msgId); } else { - msgIdItem->setText(QString::fromStdString(frame.decoding_result.packetVars["messageId"])); + lesItem->setText(QString::fromStdString(frame.decoding_result.packetVars["les"])); } lcnItem->setText(QString::fromStdString(frame.decoding_result.packetVars["logicalChannelNo"])); ulfItem->setText(formatFreqMHz(frame.decoding_result.packetVars["uplinkChannelMhz"])); dlfItem->setText(formatFreqMHz(frame.decoding_result.packetVars["downlinkChannelMhz"])); + msgIdItem->setText(QString::fromStdString(frame.decoding_result.packetVars["messageId"])); priorityItem->setText(QString::fromStdString(frame.decoding_result.packetVars["priorityText"])); QIcon *icon = nullptr; - addressItem->setText(MultipartMessage::decodeAddress( + QString address = MultipartMessage::decodeAddress( QString::fromStdString(frame.decoding_result.packetVars["messageType"]), QString::fromStdString(frame.decoding_result.packetVars["addressHex"]), nullptr, nullptr, nullptr, &icon - )); + ); + addressItem->setText(address); if (icon) { addressItem->setIcon(*icon); } @@ -805,182 +823,212 @@ void InmarsatDemodGUI::packetReceived(const QByteArray& bytes, QDateTime dateTim QString message; QString decode; - switch(frame.decoding_result.packetDescriptor) - { - case 0x27: - decode = decode.append("Msg Id " + QString::fromStdString(frame.decoding_result.packetVars["mesId"])); - decode = decode.append("Sat " + QString::fromStdString(frame.decoding_result.packetVars["satName"])); - decode = decode.append("LES " + QString::fromStdString(frame.decoding_result.packetVars["lesName"])); - decode = decode.append("LCN " + QString::fromStdString(frame.decoding_result.packetVars["logicalChannelNo"])); - break; - - case 0x2A: - decode = decode.append("Msg Id " + QString::fromStdString(frame.decoding_result.packetVars["mesId"])); - decode = decode.append("Sat " + QString::fromStdString(frame.decoding_result.packetVars["satName"])); - decode = decode.append("LES " + QString::fromStdString(frame.decoding_result.packetVars["lesName"])); - decode = decode.append("LCN " + QString::fromStdString(frame.decoding_result.packetVars["logicalChannelNo"])); - break; - - case 0x08: - decode = decode.append("Msg Id " + QString::fromStdString(frame.decoding_result.packetVars["mesId"])); - decode = decode.append("Sat " + QString::fromStdString(frame.decoding_result.packetVars["satName"])); - decode = decode.append("LCN " + QString::fromStdString(frame.decoding_result.packetVars["logicalChannelNo"])); - decode = decode.append("ULF " + formatFreqMHz(frame.decoding_result.packetVars["uplinkChannelMhz"])); - break; - - case 0x6C: - { - decode = decode.append("ULF" + formatFreqMHz(frame.decoding_result.packetVars["uplinkChannelMhz"])); - decode = decode.append("Services"); - - std::string services = frame.decoding_result.packetVars["services"]; - for (int k = 0; k < (int)services.length(); k++) - { - if (services[k] != '\n') { - decode = decode.append(services[k]); - } else { - decode = decode.append("
"); - } - } - decode = decode.append("Tdm slots"); - std::string tdmSlots = frame.decoding_result.packetVars["tdmSlots"]; - for (int k = 0; k < (int)tdmSlots.length(); k++) - { - if (tdmSlots[k] != '\n') { - decode = decode.append(tdmSlots[k]); - } else { - decode = decode.append("
"); - } - } + quint8 type; + if (((frame.decoding_result.packetDescriptor >> 7) & 1) == 0) { + type = frame.decoding_result.packetDescriptor >> 4; + } else { + type = frame.decoding_result.packetDescriptor & 0x3f; } - break; - case 0x7D: + switch(type) { - decode = decode.append("Network Version " + QString::fromStdString(frame.decoding_result.packetVars["networkVersion"])); - decode = decode.append("Sat " + QString::fromStdString(frame.decoding_result.packetVars["satName"])); - decode = decode.append("LES " + QString::fromStdString(frame.decoding_result.packetVars["lesName"])); - decode = decode.append("Signalling Channel " + QString::fromStdString(frame.decoding_result.packetVars["signallingChannel"])); - decode = decode.append("Count " + QString::fromStdString(frame.decoding_result.packetVars["count"])); - decode = decode.append("Channel Type Name " + QString::fromStdString(frame.decoding_result.packetVars["channelTypeName"])); - decode = decode.append("Local " + QString::fromStdString(frame.decoding_result.packetVars["local"])); - decode = decode.append("Random Interval " + QString::fromStdString(frame.decoding_result.packetVars["randomInterval"])); - - decode = decode.append("Status"); - std::string status = frame.decoding_result.packetVars["status"]; - for (int k = 0; k < (int)status.length(); k++) - { - if (status[k] != '\n') { - decode = decode.append(status[k]); - } else { - decode = decode.append("
"); - } - } - decode = decode.append("Services"); - std::string services = frame.decoding_result.packetVars["services"]; - for (int k = 0; k < (int)services.length(); k++) - { - if (services[k] != '\n') { - decode = decode.append(services[k]); - } else { - decode = decode.append("
"); - } - } - } - break; - - case 0x81: - decode = decode.append("Msg Id " + QString::fromStdString(frame.decoding_result.packetVars["mesId"])); - decode = decode.append("Sat " + QString::fromStdString(frame.decoding_result.packetVars["satName"])); - decode = decode.append("LES " + QString::fromStdString(frame.decoding_result.packetVars["lesName"])); - decode = decode.append("LCN " + QString::fromStdString(frame.decoding_result.packetVars["logicalChannelNo"])); - decode = decode.append("DLF " + formatFreqMHz(frame.decoding_result.packetVars["downlinkChannelMhz"])); - decode = decode.append("Presentation " + QString::fromStdString(frame.decoding_result.packetVars["presentation"])); + case 0x00: // Acknowledgement Request + decodeAppend(decode, "Packet", "packetDescriptorText", frame); + decodeAppend(decode, "Sat", "satName", frame); + decodeAppend(decode, "LES", "lesName", frame); + decodeAppend(decode, "LCN", "logicalChannelNo", frame); + decodeAppendFreqMHz(decode, "ULF", "uplinkChannelMhz", frame); break; - case 0x83: - decode = decode.append("Msg Id " + QString::fromStdString(frame.decoding_result.packetVars["mesId"])); - decode = decode.append("Sat " + QString::fromStdString(frame.decoding_result.packetVars["satName"])); - decode = decode.append("LES " + QString::fromStdString(frame.decoding_result.packetVars["lesName"])); - decode = decode.append("Status Bits " + QString::fromStdString(frame.decoding_result.packetVars["status_bits"])); - decode = decode.append("LCN " + QString::fromStdString(frame.decoding_result.packetVars["logicalChannelNo"])); - decode = decode.append("Frame Length " + QString::fromStdString(frame.decoding_result.packetVars["frameLength"])); - decode = decode.append("Duration " + QString::fromStdString(frame.decoding_result.packetVars["duration"])); - decode = decode.append("DLF " + formatFreqMHz(frame.decoding_result.packetVars["downlinkChannelMhz"])); - decode = decode.append("ULF " + formatFreqMHz(frame.decoding_result.packetVars["uplinkChannelMhz"])); - decode = decode.append("Frame Offset " + QString::fromStdString(frame.decoding_result.packetVars["frameOffset"])); - decode = decode.append("Packet Descriptor 1 " + QString::fromStdString(frame.decoding_result.packetVars["packetDescriptor1"])); + case 0x01: // Announcement + decodeAppend(decode, "Packet", "packetDescriptorText", frame); + decodeAppend(decode, "Sat", "satName", frame); + decodeAppend(decode, "MES", "mesId", frame); + decodeAppend(decode, "LES", "lesName", frame); + decodeAppendFreqMHz(decode, "DLF", "downlinkChannelMhz", frame); + decodeAppend(decode, "Service", "serviceText", frame); + decodeAppend(decode, "Direction", "directionText", frame); + decodeAppend(decode, "Priority", "priorityText", frame); + decodeAppend(decode, "LCN", "logicalChannelNo", frame); + decodeAppend(decode, "Message Reference Number", "messageReferenceNumber", frame); + decodeAppend(decode, "Sub-address", "subAddress", frame); + decodeAppend(decode, "Presentation", "presentationText", frame); + decodeAppend(decode, "Packets", "packets", frame); + decodeAppend(decode, "Last Count", "lastCount", frame); break; - case 0x92: - decode = decode.append("Login Ack Length" + QString::fromStdString(frame.decoding_result.packetVars["loginAckLength"])); - decode = decode.append("DLF" + formatFreqMHz(frame.decoding_result.packetVars["downlinkChannelMhz"])); - decode = decode.append("LES" + QString::fromStdString(frame.decoding_result.packetVars["les"])); - decode = decode.append("Station Start Hex" + QString::fromStdString(frame.decoding_result.packetVars["stationStartHex"])); + case 0x02: // Clear + decodeAppend(decode, "Packet", "packetDescriptorText", frame); + decodeAppend(decode, "Sat", "satName", frame); + decodeAppend(decode, "MES", "mesId", frame); + decodeAppend(decode, "LES", "lesName", frame); + decodeAppend(decode, "LCN", "logicalChannelNo", frame); + break; + + case 0x03: // Logical Channel Assignment + decodeAppend(decode, "Packet", "packetDescriptorText", frame); + decodeAppend(decode, "Sat", "satName", frame); + decodeAppend(decode, "MES", "mesId", frame); + decodeAppend(decode, "LES", "lesName", frame); + decodeAppend(decode, "Status Bits", "status_bits", frame); + decodeAppend(decode, "LCN", "logicalChannelNo", frame); + decodeAppend(decode, "Frame Length", "frameLength", frame); + decodeAppend(decode, "Duration", "duration", frame); + decodeAppendFreqMHz(decode, "DLF", "downlinkChannelMhz", frame); + decodeAppendFreqMHz(decode, "ULF", "uplinkChannelMhz", frame); + decodeAppend(decode, "Frame Offset", "frameOffset", frame); + decodeAppend(decode, "Packet Descriptor 1", "packetDescriptor1", frame); + break; + + case 0x06: // Signalling Channel Descriptor + decodeAppend(decode, "Packet", "packetDescriptorText", frame); + decodeAppendFreqMHz(decode, "ULF", "uplinkChannelMhz", frame); + decodeAppendHTML(decode, "Services", "services", frame); + decodeAppendHTML(decode, "TDM slots", "tdmSlots", frame); + break; + + case 0x07: // Bulletin Board + decodeAppend(decode, "Packet", "packetDescriptorText", frame); + decodeAppend(decode, "Network Version", "networkVersion", frame); + decodeAppend(decode, "Sat", "satName", frame); + decodeAppend(decode, "LES", "lesName", frame); + decodeAppend(decode, "Signalling Channel", "signallingChannel", frame); + decodeAppend(decode, "Count", "count", frame); + decodeAppend(decode, "Channel Type Name", "channelTypeName", frame); + decodeAppend(decode, "Local", "local", frame); + decodeAppend(decode, "Random Interval", "randomInterval", frame); + decodeAppendHTML(decode, "Status", "status", frame); + decodeAppendHTML(decode, "Services", "services", frame); + break; + + case 0x12: // Login Ack + decodeAppend(decode, "Packet", "packetDescriptorText", frame); + decodeAppend(decode, "MES", "mesId", frame); + decodeAppendFreqMHz(decode, "DLF", "downlinkChannelMhz", frame); + if (frame.decoding_result.packetVars.find("networkVesrion") != frame.decoding_result.packetVars.end()) { + decodeAppend(decode, "Network Version", "networkVersion", frame); + } if (frame.decoding_result.packetVars.find("stationCount") != frame.decoding_result.packetVars.end()) { - decode = decode.append("Station Count" + QString::fromStdString(frame.decoding_result.packetVars["stationCnt"])); - decode = decode.append("Stations"); - std::string stations = frame.decoding_result.packetVars["stations"]; - for (int k = 0; k < (int)stations.length(); k++) - { - if (stations[k] != '\n') { - decode = decode.append(stations[k]); - } else { - decode = decode.append("
"); - } - } + decodeAppend(decode, "Station Count", "stationCount", frame); + decodeAppendHTML(decode, "Stations", "stations", frame); } break; - case 0xA3: - decode = decode.append("Msg Id " + QString::fromStdString(frame.decoding_result.packetVars["mesId"])); - decode = decode.append("Sat " + QString::fromStdString(frame.decoding_result.packetVars["satName"])); - decode = decode.append("LES " + QString::fromStdString(frame.decoding_result.packetVars["lesName"])); - - if (frame.decoding_result.packetVars.find("shortMessage") != frame.decoding_result.packetVars.end()) - { - std::string shortMessage = frame.decoding_result.packetVars["shortMessage"]; - for (int k = 0; k < (int)shortMessage.length(); k++) - { - char chr = shortMessage[k] & 0x7F; - if ((chr < 0x20 && chr != '\n' && chr != '\r')) { - message = message.append("(" + QString::number(chr) + ")"); - } else if(chr != '\n' && chr != '\r') { - message = message.append(chr); - } - } - decode = decode.append("Payload" + message); - } + case 0x13: // Logout Ack + decodeAppend(decode, "Packet", "packetDescriptorText", frame); + decodeAppend(decode, "MES", "mesId", frame); break; - case 0xA8: - decode = decode.append("Msg Id " + QString::fromStdString(frame.decoding_result.packetVars["mesId"])); - decode = decode.append("Sat " + QString::fromStdString(frame.decoding_result.packetVars["satName"])); - decode = decode.append("LES " + QString::fromStdString(frame.decoding_result.packetVars["lesName"])); - if (frame.decoding_result.packetVars.find("shortMessage") != frame.decoding_result.packetVars.end()) - { - std::string shortMessage = frame.decoding_result.packetVars["shortMessage"]; - for (int k = 0; k < (int)shortMessage.length(); k++) - { - char chr = shortMessage[k] & 0x7F; - if ((chr < 0x20 && chr != '\n' && chr != '\r')) { - message = message.append("(" + QString::number(chr) + ")"); - } else if(chr != '\n' && chr != '\r') { - message = message.append(chr); - } - } - decode = decode.append("Payload" + message); - } - break; - - case 0xAA: + case 0x22: // Group Poll { - decode = decode.append("Sat " + QString::fromStdString(frame.decoding_result.packetVars["satName"])); - decode = decode.append("LES " + QString::fromStdString(frame.decoding_result.packetVars["lesName"])); - decode = decode.append("LCN " + QString::fromStdString(frame.decoding_result.packetVars["logicalChannelNo"])); - decode = decode.append("Packet No " + QString::fromStdString(frame.decoding_result.packetVars["packetNo"])); + decodeAppend(decode, "Packet", "packetDescriptorText", frame); + decodeAppend(decode, "Sat", "satName", frame); + decodeAppend(decode, "Data Network ID", "dataNetworkId", frame); + decodeAppend(decode, "LES", "lesName", frame); + decodeAppend(decode, "LES TDM", "lesTDM", frame); + decodeAppend(decode, "Randomizing Inverval", "randomizingInterval", frame); + decodeAppend(decode, "Sub-address", "subAddress", frame); + decodeAppend(decode, "Response", "responseText", frame); + decodeAppend(decode, "Command", "commandText", frame); + decodeAppend(decode, "Sequence No", "sequenceNo", frame); + qint8 command = QString::fromStdString(frame.decoding_result.packetVars["command"]).toInt(); + if (command == 0x4) + { + decodeAppend(decode, "Start Frame", "startFrame", frame); + decodeAppend(decode, "Interval", "interval", frame); + } + else if (command == 0x8) + { + decodeAppend(decode, "MEM Id", "memId", frame); + } + else if (command == 0xa) + { + decodeAppend(decode, "Member Number", "memberNumber", frame); + } + if (frame.decoding_result.packetVars.find("shortMessage") != frame.decoding_result.packetVars.end()) + { + std::string shortMessage = frame.decoding_result.packetVars["shortMessage"]; + for (int k = 0; k < (int)shortMessage.length(); k++) + { + char chr = shortMessage[k] & 0x7F; + if ((chr < 0x20 && chr != '\n' && chr != '\r')) { + message = message.append("(" + QString::number(chr) + ")"); + } else { + message = message.append(chr); + } + } + decode = decode.append("Text" + message); + } + QString textHex = QString::fromStdString(frame.decoding_result.packetVars["text"]); + if (!textHex.isEmpty()) { + decode = decode.append("Text (hex)" + textHex); + } + break; + } + case 0x23: // Individual Poll + { + decodeAppend(decode, "Packet", "packetDescriptorText", frame); + decodeAppend(decode, "Sat", "satName", frame); + decodeAppend(decode, "MES", "mesId", frame); + decodeAppend(decode, "LES", "lesName", frame); + decodeAppend(decode, "Sub-address", "subAddress", frame); + decodeAppend(decode, "Data Network ID", "dataNetworkId", frame); + decodeAppend(decode, "Response", "responseText", frame); + decodeAppend(decode, "Command", "commandText", frame); + decodeAppend(decode, "Sequence No", "sequenceNo", frame); + qint8 command = QString::fromStdString(frame.decoding_result.packetVars["command"]).toInt(); + if (command == 0x4) + { + decodeAppend(decode, "Start Frame", "startFrame", frame); + decodeAppend(decode, "Interval", "interval", frame); + } + else if (command == 0x8) + { + decodeAppend(decode, "MEM Id", "memId", frame); + } + else if (command == 0xa) + { + decodeAppend(decode, "Member Number", "memberNumber", frame); + } + if (frame.decoding_result.packetVars.find("shortMessage") != frame.decoding_result.packetVars.end()) + { + std::string shortMessage = frame.decoding_result.packetVars["shortMessage"]; + for (int k = 0; k < (int)shortMessage.length(); k++) + { + char chr = shortMessage[k] & 0x7F; + if ((chr < 0x20 && chr != '\n' && chr != '\r')) { + message = message.append("(" + QString::number(chr) + ")"); + } else { + message = message.append(chr); + } + } + decode = decode.append("Text" + message); + } + QString textHex = QString::fromStdString(frame.decoding_result.packetVars["text"]); + if (!textHex.isEmpty()) { + decode = decode.append("Text (hex)" + textHex); + } + break; + } + + case 0x28: // Confirmation + decodeAppend(decode, "Packet", "packetDescriptorText", frame); + decodeAppend(decode, "Sat", "satName", frame); + decodeAppend(decode, "MES", "mesId", frame); + decodeAppend(decode, "LES", "lesName", frame); + decodeAppend(decode, "Message Reference Number", "messageReferenceNumber", frame); + decodeAppendHTML(decode, "Message Status", "messageStatusDescriptors", frame); + break; + + case 0x2A: // Message + { + decodeAppend(decode, "Packet", "packetDescriptorText", frame); + decodeAppend(decode, "Sat", "satName", frame); + decodeAppend(decode, "LES", "lesName", frame); + decodeAppend(decode, "LCN", "logicalChannelNo", frame); + decodeAppend(decode, "Packet No", "packetNo", frame); //bool isBinary = frame.decoding_result.payload.presentation == PACKETDECODER_PRESENTATION_BINARY; if (frame.decoding_result.payload.presentation == PACKETDECODER_PRESENTATION_IA5) { @@ -989,7 +1037,7 @@ void InmarsatDemodGUI::packetReceived(const QByteArray& bytes, QDateTime dateTim char chr = frame.decoding_result.payload.data8Bit[i] & 0x7F; if ((chr < 0x20 && chr != '\n' && chr != '\r')) { message = message.append("(" + QString::number((uint16_t)chr, 16) + ")"); - } else if(chr != '\n' && chr != '\r') { + } else { message = message.append(chr); } } @@ -1010,36 +1058,30 @@ void InmarsatDemodGUI::packetReceived(const QByteArray& bytes, QDateTime dateTim decode = decode.append("Payload" + message); break; - case 0xAB: - { - decode = decode.append("LES List Length" + QString::fromStdString(frame.decoding_result.packetVars["lesListLength"])); - decode = decode.append("Station Start Hex" + QString::fromStdString(frame.decoding_result.packetVars["stationStartHex"])); - decode = decode.append("Station Count" + QString::fromStdString(frame.decoding_result.packetVars["stationCount"])); + case 0x2B: // Network Update + decodeAppend(decode, "Packet", "packetDescriptorText", frame); + decodeAppend(decode, "LES List Length", "lesListLength", frame); + decodeAppend(decode, "Station Start Hex", "stationStartHex", frame); + decodeAppend(decode, "Station Count", "stationCount", frame); + decodeAppendHTML(decode, "Stations", "stations", frame); + break; - decode = decode.append("Stations"); - std::string stations = frame.decoding_result.packetVars["stations"]; - for (int k = 0; k < (int)stations.length(); k++) - { - if (stations[k] != '\n') { - decode = decode.append(stations[k]); - } else { - decode = decode.append("
"); - } - } - } - break; - - case 0xB1: + case 0x30: // EGC (Single Header) + case 0x31: // EGC (First of Double Header) + case 0x32: // EGC (Second of Double Header) { - decode = decode.append("Msg Type" + QString::fromStdString(frame.decoding_result.packetVars["messageType"])); - decode = decode.append("Service Code & Address Name" + QString::fromStdString(frame.decoding_result.packetVars["serviceCodeAndAddressName"])); - decode = decode.append("Continuation" + QString::fromStdString(frame.decoding_result.packetVars["continuation"])); - decode = decode.append("Priority" + QString::fromStdString(frame.decoding_result.packetVars["priorityText"])); - decode = decode.append("Repetition" + QString::fromStdString(frame.decoding_result.packetVars["rep"])); - decode = decode.append("Msg Id" + QString::fromStdString(frame.decoding_result.packetVars["messageId"])); - decode = decode.append("Packet No" + QString::fromStdString(frame.decoding_result.packetVars["packetNo"])); - decode = decode.append("isNewPayload" + QString::fromStdString(frame.decoding_result.packetVars["isNewPayl"])); - decode = decode.append("Address" + QString::fromStdString(frame.decoding_result.packetVars["addrHex"])); + decodeAppend(decode, "Packet", "packetDescriptorText", frame); + decodeAppend(decode, "Service Code", "serviceCodeAndAddressName", frame); + decodeAppend(decode, "Continuation", "continuation", frame); + decodeAppend(decode, "Priority", "priorityText", frame); + decodeAppend(decode, "Repetition Number", "repetition", frame); + decodeAppend(decode, "Message Sequence Number", "messageId", frame); + decodeAppend(decode, "Packet Sequence Number", "packetNo", frame); + decodeAppend(decode, "Presentation", "presentationText", frame); + decodeAppend(decode, "Sat", "satName", frame); + decodeAppend(decode, "LES", "lesName", frame); + decode = decode.append("Address" + address); + decodeAppend(decode, "Checksum", "egcChecksum", frame); bool isBinary = frame.decoding_result.payload.presentation == PACKETDECODER_PRESENTATION_BINARY; if (!isBinary) @@ -1048,7 +1090,7 @@ void InmarsatDemodGUI::packetReceived(const QByteArray& bytes, QDateTime dateTim char chr = frame.decoding_result.payload.data8Bit[k] & 0x7F; if ((chr < 0x20 && chr != '\n' && chr != '\r')) { message = message.append("(" + QString::number((uint16_t)chr, 16) + ")"); - } else /*if (chr != '\n' && chr != '\r')*/ { + } else { message = message.append(chr); } } @@ -1061,46 +1103,21 @@ void InmarsatDemodGUI::packetReceived(const QByteArray& bytes, QDateTime dateTim message = message.append(QString::number(data, 16) + " "); } } - decode = decode.append("Payload" + message); + decode = decode.append("Message" + message); } break; - case 0xB2: + case 0x2c: // Request Status { - decode = decode.append("Msg Type" + QString::fromStdString(frame.decoding_result.packetVars["messageType"])); - decode = decode.append("Service Code & Address Name" + QString::fromStdString(frame.decoding_result.packetVars["serviceCodeAndAddressName"])); - decode = decode.append("Continuation" + QString::fromStdString(frame.decoding_result.packetVars["continuation"])); - decode = decode.append("Priority" + QString::fromStdString(frame.decoding_result.packetVars["priorityText"])); - decode = decode.append("Repetition" + QString::fromStdString(frame.decoding_result.packetVars["rep"])); - decode = decode.append("Msg Id" + QString::fromStdString(frame.decoding_result.packetVars["messageId"])); - decode = decode.append("Packet No" + QString::fromStdString(frame.decoding_result.packetVars["packetNo"])); - decode = decode.append("isNewPayload" + QString::fromStdString(frame.decoding_result.packetVars["isNewPayl"])); - decode = decode.append("Address" + QString::fromStdString(frame.decoding_result.packetVars["addrHex"])); - - bool isBinary = frame.decoding_result.payload.presentation == PACKETDECODER_PRESENTATION_BINARY; - if (!isBinary) - { - for (int k = 0; k < (int)frame.decoding_result.payload.data8Bit.size(); k++) - { - char chr = frame.decoding_result.payload.data8Bit[k] & 0x7F; - if ((chr < 0x20 && chr != '\n' && chr != '\r')) { - message = message.append("(" + QString::number((uint16_t)chr, 16) + ")"); - } else /*if (chr != '\n' && chr != '\r')*/ { - message = message.append(chr); - } - } - } - else - { - for (int i = 0; i < (int)frame.decoding_result.payload.data8Bit.size(); i++) - { - uint8_t data = frame.decoding_result.payload.data8Bit[i]; - message = message.append(QString::number(data, 16) + " "); - } - } - decode = decode.append("Payload" + message); + decodeAppend(decode, "Packet", "packetDescriptorText", frame); + decodeAppend(decode, "Sat", "satName", frame); + decodeAppend(decode, "MES", "mesId", frame); + decodeAppend(decode, "LES", "lesName", frame); + QString flag = QString::fromStdString(frame.decoding_result.packetVars["rejected"]) == "0" ? "Pending" : "Rejected"; + decode = decode.append("Pending / Reject Flag " + flag); + decodeAppend(decode, "Status Code", "statusCodeText", frame); + break; } - break; } @@ -1137,6 +1154,7 @@ void InmarsatDemodGUI::packetReceived(const QByteArray& bytes, QDateTime dateTim MessagePart part; part.m_part = frame.decoding_result.packetDescriptor == 0xb1 ? 1 : 2; part.m_packet = QString::fromStdString(frame.decoding_result.packetVars["packetNo"]).toInt(); + part.m_continuation = QString::fromStdString(frame.decoding_result.packetVars["continuation"]) == "1"; part.m_text = message; multipartMessage->addPart(part); updateMessageTable(multipartMessage); @@ -1152,6 +1170,17 @@ void InmarsatDemodGUI::packetReceived(const QByteArray& bytes, QDateTime dateTim } } +QString InmarsatDemodGUI::toHTML(const std::string& string) const +{ + return toHTML(QString::fromStdString(string)); +} + +QString InmarsatDemodGUI::toHTML(const QString& string) const +{ + QString s = string; + return s.replace("\n", "
"); +} + void InmarsatDemodGUI::sendAreaToMapFeature(const QString& name, const QString& text, float latitude, float longitude, const QList& coordinates) { // Send to Map feature diff --git a/plugins/channelrx/demodinmarsat/inmarsatdemodgui.h b/plugins/channelrx/demodinmarsat/inmarsatdemodgui.h index 2a509e57a..9197bfa6b 100644 --- a/plugins/channelrx/demodinmarsat/inmarsatdemodgui.h +++ b/plugins/channelrx/demodinmarsat/inmarsatdemodgui.h @@ -55,6 +55,7 @@ class InmarsatDemodGUI; struct MessagePart { int m_part; int m_packet; + bool m_continuation; QString m_text; }; @@ -68,6 +69,7 @@ public: int getParts() const { return m_parts.size(); } int getTotalParts() const { return m_parts[m_parts.size()-1].m_packet * 2; } QDateTime getDateTime() const { return m_dateTime; } + bool getComplete() const { return getParts() == getTotalParts() && !m_parts[m_parts.size()-1].m_continuation; } int getId() const { return m_id; } QString getService() const { return m_service; } QString getPriority() const { return m_priority; } @@ -183,6 +185,12 @@ private: void filterRow(QTableWidget *table, int row, int typeCol, int messageCol); void filter(); + void decodeAppend(QString& decode, const QString& title, const std::string& variable, inmarsatc::frameParser::FrameParser::frameParser_result& frame); + void decodeAppendFreqMHz(QString& decode, const QString& title, const std::string& variable, inmarsatc::frameParser::FrameParser::frameParser_result& frame); + void decodeAppendHTML(QString& decode, const QString& title, const std::string& variable, inmarsatc::frameParser::FrameParser::frameParser_result& frame); + QString toHTML(const std::string& string) const; + QString toHTML(const QString& string) const; + enum MessageCol { MESSAGE_COL_DATE, MESSAGE_COL_TIME, @@ -198,13 +206,14 @@ private: PACKET_COL_DATE, PACKET_COL_TIME, PACKET_COL_SAT, + PACKET_COL_MES, PACKET_COL_LES, - PACKET_COL_MSG_ID, PACKET_COL_TYPE, PACKET_COL_FRAME_NO, PACKET_COL_LCN, PACKET_COL_ULF, PACKET_COL_DLF, + PACKET_COL_MSG_ID, PACKET_COL_PRIORITY, PACKET_COL_ADDRESS, PACKET_COL_MESSAGE, diff --git a/plugins/channelrx/demodinmarsat/inmarsatdemodgui.ui b/plugins/channelrx/demodinmarsat/inmarsatdemodgui.ui index 48457ef1d..4a3b90aee 100644 --- a/plugins/channelrx/demodinmarsat/inmarsatdemodgui.ui +++ b/plugins/channelrx/demodinmarsat/inmarsatdemodgui.ui @@ -854,7 +854,15 @@ Sat - Satellite + Satellite region + + + + + MES + + + Mobile Earth Station @@ -865,14 +873,6 @@ Land Earth Station - - - MsgId - - - Message ID - - Type @@ -913,6 +913,14 @@ Downlink frequency + + + MsgId + + + Message ID + + Priority @@ -989,41 +997,65 @@ Date + + Date last part of message was received + Time + + Time last part of message was received + ID + + Message ID + Service + + Service Code + Priority + + Priority + Address + + Address + Parts + + How many parts have been received / Total expected parts + Message + + Message text + diff --git a/plugins/channelrx/demodinmarsat/inmarsatdemodsettings.h b/plugins/channelrx/demodinmarsat/inmarsatdemodsettings.h index 94c2ff5c3..0d8b306a1 100644 --- a/plugins/channelrx/demodinmarsat/inmarsatdemodsettings.h +++ b/plugins/channelrx/demodinmarsat/inmarsatdemodsettings.h @@ -29,7 +29,7 @@ class Serializable; // Number of columns in the table #define INMARSATDEMOD_MESSAGES_COLUMNS 8 -#define INMARSATDEMOD_PACKETS_COLUMNS 15 +#define INMARSATDEMOD_PACKETS_COLUMNS 16 struct InmarsatDemodSettings {