mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-10-31 15:07:12 -04:00
ChirpChat demod: use messages for the decoder
This commit is contained in:
parent
ba075bcf66
commit
c21223771a
@ -47,8 +47,6 @@
|
||||
#include "chirpchatdemod.h"
|
||||
|
||||
MESSAGE_CLASS_DEFINITION(ChirpChatDemod::MsgConfigureChirpChatDemod, Message)
|
||||
MESSAGE_CLASS_DEFINITION(ChirpChatDemod::MsgReportDecodeBytes, Message)
|
||||
MESSAGE_CLASS_DEFINITION(ChirpChatDemod::MsgReportDecodeString, Message)
|
||||
|
||||
const char* const ChirpChatDemod::m_channelIdURI = "sdrangel.channel.chirpchatdemod";
|
||||
const char* const ChirpChatDemod::m_channelId = "ChirpChatDemod";
|
||||
@ -90,6 +88,7 @@ ChirpChatDemod::ChirpChatDemod(DeviceAPI* deviceAPI) :
|
||||
&ChirpChatDemod::handleIndexInDeviceSetChanged
|
||||
);
|
||||
|
||||
m_decoder.setOutputMessageQueue(getInputMessageQueue());
|
||||
start();
|
||||
}
|
||||
|
||||
@ -136,7 +135,7 @@ void ChirpChatDemod::start()
|
||||
m_thread = new QThread(this);
|
||||
m_basebandSink = new ChirpChatDemodBaseband();
|
||||
m_basebandSink->setSpectrumSink(&m_spectrumVis);
|
||||
m_basebandSink->setDecoderMessageQueue(getInputMessageQueue()); // Decoder held on the main thread
|
||||
m_basebandSink->setDecoderMessageQueue(m_decoder.getInputMessageQueue()); // Decoder held on the main thread
|
||||
m_basebandSink->moveToThread(m_thread);
|
||||
|
||||
QObject::connect(m_thread, &QThread::finished, m_basebandSink, &QObject::deleteLater);
|
||||
@ -180,29 +179,28 @@ bool ChirpChatDemod::handleMessage(const Message& cmd)
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (ChirpChatDemodMsg::MsgDecodeSymbols::match(cmd))
|
||||
else if (ChirpChatDemodMsg::MsgReportDecodeBytes::match(cmd))
|
||||
{
|
||||
qDebug() << "ChirpChatDemod::handleMessage: MsgDecodeSymbols";
|
||||
ChirpChatDemodMsg::MsgDecodeSymbols& msg = (ChirpChatDemodMsg::MsgDecodeSymbols&) cmd;
|
||||
qDebug() << "ChirpChatDemod::handleMessage: MsgReportDecodeBytes";
|
||||
ChirpChatDemodMsg::MsgReportDecodeBytes& msg = (ChirpChatDemodMsg::MsgReportDecodeBytes&) cmd;
|
||||
m_lastMsgSignalDb = msg.getSingalDb();
|
||||
m_lastMsgNoiseDb = msg.getNoiseDb();
|
||||
m_lastMsgSyncWord = msg.getSyncWord();
|
||||
m_lastMsgTimestamp = msg.getMsgTimestamp();
|
||||
|
||||
if (m_settings.m_codingScheme == ChirpChatDemodSettings::CodingLoRa)
|
||||
{
|
||||
m_decoder.decodeSymbols(msg.getSymbols(), m_lastMsgBytes);
|
||||
QDateTime dt = QDateTime::currentDateTime();
|
||||
m_lastMsgTimestamp = dt.toString(Qt::ISODateWithMs);
|
||||
m_lastMsgPacketLength = m_decoder.getPacketLength();
|
||||
m_lastMsgNbParityBits = m_decoder.getNbParityBits();
|
||||
m_lastMsgHasCRC = m_decoder.getHasCRC();
|
||||
m_lastMsgNbSymbols = m_decoder.getNbSymbols();
|
||||
m_lastMsgNbCodewords = m_decoder.getNbCodewords();
|
||||
m_lastMsgEarlyEOM = m_decoder.getEarlyEOM();
|
||||
m_lastMsgHeaderCRC = m_decoder.getHeaderCRCStatus();
|
||||
m_lastMsgHeaderParityStatus = m_decoder.getHeaderParityStatus();
|
||||
m_lastMsgPayloadCRC = m_decoder.getPayloadCRCStatus();
|
||||
m_lastMsgPayloadParityStatus = m_decoder.getPayloadParityStatus();
|
||||
m_lastMsgBytes = msg.getBytes();
|
||||
m_lastMsgPacketLength = msg.getPacketSize();
|
||||
m_lastMsgNbParityBits = msg.getNbParityBits();
|
||||
m_lastMsgHasCRC = msg.getHasCRC();
|
||||
m_lastMsgNbSymbols = msg.getNbSymbols();
|
||||
m_lastMsgNbCodewords = msg.getNbCodewords();
|
||||
m_lastMsgEarlyEOM = msg.getEarlyEOM();
|
||||
m_lastMsgHeaderCRC = msg.getHeaderCRCStatus();
|
||||
m_lastMsgHeaderParityStatus = msg.getHeaderParityStatus();
|
||||
m_lastMsgPayloadCRC = msg.getPayloadCRCStatus();
|
||||
m_lastMsgPayloadParityStatus = msg.getPayloadParityStatus();
|
||||
|
||||
QByteArray bytesCopy(m_lastMsgBytes);
|
||||
bytesCopy.truncate(m_lastMsgPacketLength);
|
||||
@ -215,23 +213,8 @@ bool ChirpChatDemod::handleMessage(const Message& cmd)
|
||||
m_udpSink.writeUnbuffered(bytes, m_lastMsgPacketLength);
|
||||
}
|
||||
|
||||
if (getMessageQueueToGUI())
|
||||
{
|
||||
MsgReportDecodeBytes *msgToGUI = MsgReportDecodeBytes::create(m_lastMsgBytes);
|
||||
msgToGUI->setSyncWord(m_lastMsgSyncWord);
|
||||
msgToGUI->setSignalDb(m_lastMsgSignalDb);
|
||||
msgToGUI->setNoiseDb(m_lastMsgNoiseDb);
|
||||
msgToGUI->setPacketSize(m_lastMsgPacketLength);
|
||||
msgToGUI->setNbParityBits(m_lastMsgNbParityBits);
|
||||
msgToGUI->setHasCRC(m_lastMsgHasCRC);
|
||||
msgToGUI->setNbSymbols(m_lastMsgNbSymbols);
|
||||
msgToGUI->setNbCodewords(m_lastMsgNbCodewords);
|
||||
msgToGUI->setEarlyEOM(m_lastMsgEarlyEOM);
|
||||
msgToGUI->setHeaderParityStatus(m_lastMsgHeaderParityStatus);
|
||||
msgToGUI->setHeaderCRCStatus(m_lastMsgHeaderCRC);
|
||||
msgToGUI->setPayloadParityStatus(m_lastMsgPayloadParityStatus);
|
||||
msgToGUI->setPayloadCRCStatus(m_lastMsgPayloadCRC);
|
||||
getMessageQueueToGUI()->push(msgToGUI);
|
||||
if (getMessageQueueToGUI()) {
|
||||
getMessageQueueToGUI()->push(new ChirpChatDemodMsg::MsgReportDecodeBytes(msg)); // make a copy
|
||||
}
|
||||
|
||||
// Is this an APRS packet?
|
||||
@ -289,11 +272,18 @@ bool ChirpChatDemod::handleMessage(const Message& cmd)
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (ChirpChatDemodMsg::MsgReportDecodeString::match(cmd))
|
||||
{
|
||||
m_decoder.decodeSymbols(msg.getSymbols(), m_lastMsgString);
|
||||
QDateTime dt = QDateTime::currentDateTime();
|
||||
m_lastMsgTimestamp = dt.toString(Qt::ISODateWithMs);
|
||||
qDebug() << "ChirpChatDemod::handleMessage: MsgReportDecodeString";
|
||||
ChirpChatDemodMsg::MsgReportDecodeString& msg = (ChirpChatDemodMsg::MsgReportDecodeString&) cmd;
|
||||
m_lastMsgSignalDb = msg.getSingalDb();
|
||||
m_lastMsgNoiseDb = msg.getNoiseDb();
|
||||
m_lastMsgSyncWord = msg.getSyncWord();
|
||||
m_lastMsgTimestamp = msg.getMsgTimestamp();
|
||||
m_lastMsgString = msg.getString();
|
||||
|
||||
if (m_settings.m_sendViaUDP)
|
||||
{
|
||||
@ -302,14 +292,8 @@ bool ChirpChatDemod::handleMessage(const Message& cmd)
|
||||
m_udpSink.writeUnbuffered(bytes, byteArray.size());
|
||||
}
|
||||
|
||||
if (getMessageQueueToGUI())
|
||||
{
|
||||
MsgReportDecodeString *msgToGUI = MsgReportDecodeString::create(m_lastMsgString);
|
||||
msgToGUI->setSyncWord(m_lastMsgSyncWord);
|
||||
msgToGUI->setSignalDb(m_lastMsgSignalDb);
|
||||
msgToGUI->setNoiseDb(m_lastMsgNoiseDb);
|
||||
getMessageQueueToGUI()->push(msgToGUI);
|
||||
}
|
||||
if (getMessageQueueToGUI()) {
|
||||
getMessageQueueToGUI()->push(new ChirpChatDemodMsg::MsgReportDecodeString(msg)); // make a copy
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -68,141 +68,6 @@ public:
|
||||
{ }
|
||||
};
|
||||
|
||||
class MsgReportDecodeBytes : public Message {
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
|
||||
public:
|
||||
const QByteArray& getBytes() const { return m_bytes; }
|
||||
unsigned int getSyncWord() const { return m_syncWord; }
|
||||
float getSingalDb() const { return m_signalDb; }
|
||||
float getNoiseDb() const { return m_noiseDb; }
|
||||
unsigned int getPacketSize() const { return m_packetSize; }
|
||||
unsigned int getNbParityBits() const { return m_nbParityBits; }
|
||||
unsigned int getNbSymbols() const { return m_nbSymbols; }
|
||||
unsigned int getNbCodewords() const { return m_nbCodewords; }
|
||||
bool getHasCRC() const { return m_hasCRC; }
|
||||
bool getEarlyEOM() const { return m_earlyEOM; }
|
||||
int getHeaderParityStatus() const { return m_headerParityStatus; }
|
||||
bool getHeaderCRCStatus() const { return m_headerCRCStatus; }
|
||||
int getPayloadParityStatus() const { return m_payloadParityStatus; }
|
||||
bool getPayloadCRCStatus() const { return m_payloadCRCStatus; }
|
||||
|
||||
static MsgReportDecodeBytes* create(const QByteArray& bytes) {
|
||||
return new MsgReportDecodeBytes(bytes);
|
||||
}
|
||||
void setSyncWord(unsigned int syncWord) {
|
||||
m_syncWord = syncWord;
|
||||
}
|
||||
void setSignalDb(float db) {
|
||||
m_signalDb = db;
|
||||
}
|
||||
void setNoiseDb(float db) {
|
||||
m_noiseDb = db;
|
||||
}
|
||||
void setPacketSize(unsigned int packetSize) {
|
||||
m_packetSize = packetSize;
|
||||
}
|
||||
void setNbParityBits(unsigned int nbParityBits) {
|
||||
m_nbParityBits = nbParityBits;
|
||||
}
|
||||
void setNbSymbols(unsigned int nbSymbols) {
|
||||
m_nbSymbols = nbSymbols;
|
||||
}
|
||||
void setNbCodewords(unsigned int nbCodewords) {
|
||||
m_nbCodewords = nbCodewords;
|
||||
}
|
||||
void setHasCRC(bool hasCRC) {
|
||||
m_hasCRC = hasCRC;
|
||||
}
|
||||
void setEarlyEOM(bool earlyEOM) {
|
||||
m_earlyEOM = earlyEOM;
|
||||
}
|
||||
void setHeaderParityStatus(int headerParityStatus) {
|
||||
m_headerParityStatus = headerParityStatus;
|
||||
}
|
||||
void setHeaderCRCStatus(bool headerCRCStatus) {
|
||||
m_headerCRCStatus = headerCRCStatus;
|
||||
}
|
||||
void setPayloadParityStatus(int payloadParityStatus) {
|
||||
m_payloadParityStatus = payloadParityStatus;
|
||||
}
|
||||
void setPayloadCRCStatus(bool payloadCRCStatus) {
|
||||
m_payloadCRCStatus = payloadCRCStatus;
|
||||
}
|
||||
|
||||
private:
|
||||
QByteArray m_bytes;
|
||||
unsigned int m_syncWord;
|
||||
float m_signalDb;
|
||||
float m_noiseDb;
|
||||
unsigned int m_packetSize;
|
||||
unsigned int m_nbParityBits;
|
||||
unsigned int m_nbSymbols;
|
||||
unsigned int m_nbCodewords;
|
||||
bool m_hasCRC;
|
||||
bool m_earlyEOM;
|
||||
int m_headerParityStatus;
|
||||
bool m_headerCRCStatus;
|
||||
int m_payloadParityStatus;
|
||||
bool m_payloadCRCStatus;
|
||||
|
||||
MsgReportDecodeBytes(const QByteArray& bytes) :
|
||||
Message(),
|
||||
m_bytes(bytes),
|
||||
m_syncWord(0),
|
||||
m_signalDb(0.0),
|
||||
m_noiseDb(0.0),
|
||||
m_packetSize(0),
|
||||
m_nbParityBits(0),
|
||||
m_nbSymbols(0),
|
||||
m_nbCodewords(0),
|
||||
m_hasCRC(false),
|
||||
m_earlyEOM(false),
|
||||
m_headerParityStatus(false),
|
||||
m_headerCRCStatus(false),
|
||||
m_payloadParityStatus(false),
|
||||
m_payloadCRCStatus(false)
|
||||
{ }
|
||||
};
|
||||
|
||||
class MsgReportDecodeString : public Message {
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
|
||||
public:
|
||||
const QString& getString() const { return m_str; }
|
||||
unsigned int getSyncWord() const { return m_syncWord; }
|
||||
float getSingalDb() const { return m_signalDb; }
|
||||
float getNoiseDb() const { return m_noiseDb; }
|
||||
|
||||
static MsgReportDecodeString* create(const QString& str)
|
||||
{
|
||||
return new MsgReportDecodeString(str);
|
||||
}
|
||||
void setSyncWord(unsigned int syncWord) {
|
||||
m_syncWord = syncWord;
|
||||
}
|
||||
void setSignalDb(float db) {
|
||||
m_signalDb = db;
|
||||
}
|
||||
void setNoiseDb(float db) {
|
||||
m_noiseDb = db;
|
||||
}
|
||||
|
||||
private:
|
||||
QString m_str;
|
||||
unsigned int m_syncWord;
|
||||
float m_signalDb;
|
||||
float m_noiseDb;
|
||||
|
||||
MsgReportDecodeString(const QString& str) :
|
||||
Message(),
|
||||
m_str(str),
|
||||
m_syncWord(0),
|
||||
m_signalDb(0.0),
|
||||
m_noiseDb(0.0)
|
||||
{ }
|
||||
};
|
||||
|
||||
ChirpChatDemod(DeviceAPI* deviceAPI);
|
||||
virtual ~ChirpChatDemod();
|
||||
virtual void destroy() { delete this; }
|
||||
|
@ -15,18 +15,24 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <QTime>
|
||||
|
||||
#include "chirpchatdemoddecoder.h"
|
||||
#include "chirpchatdemoddecodertty.h"
|
||||
#include "chirpchatdemoddecoderascii.h"
|
||||
#include "chirpchatdemoddecoderlora.h"
|
||||
#include "chirpchatdemodmsg.h"
|
||||
|
||||
ChirpChatDemodDecoder::ChirpChatDemodDecoder() :
|
||||
m_codingScheme(ChirpChatDemodSettings::CodingTTY),
|
||||
m_nbSymbolBits(5),
|
||||
m_nbParityBits(1),
|
||||
m_hasCRC(true),
|
||||
m_hasHeader(true)
|
||||
{}
|
||||
m_hasHeader(true),
|
||||
m_outputMessageQueue(nullptr)
|
||||
{
|
||||
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()));
|
||||
}
|
||||
|
||||
ChirpChatDemodDecoder::~ChirpChatDemodDecoder()
|
||||
{}
|
||||
@ -99,3 +105,78 @@ void ChirpChatDemodDecoder::decodeSymbols(const std::vector<unsigned short>& sym
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bool ChirpChatDemodDecoder::handleMessage(const Message& cmd)
|
||||
{
|
||||
if (ChirpChatDemodMsg::MsgDecodeSymbols::match(cmd))
|
||||
{
|
||||
qDebug("ChirpChatDemodDecoder::handleMessage: MsgDecodeSymbols");
|
||||
ChirpChatDemodMsg::MsgDecodeSymbols& msg = (ChirpChatDemodMsg::MsgDecodeSymbols&) cmd;
|
||||
float msgSignalDb = msg.getSingalDb();
|
||||
float msgNoiseDb = msg.getNoiseDb();
|
||||
unsigned int msgSyncWord = msg.getSyncWord();
|
||||
QDateTime dt = QDateTime::currentDateTime();
|
||||
QString msgTimestamp = dt.toString(Qt::ISODateWithMs);
|
||||
|
||||
if (m_codingScheme == ChirpChatDemodSettings::CodingLoRa)
|
||||
{
|
||||
QByteArray msgBytes;
|
||||
decodeSymbols(msg.getSymbols(), msgBytes);
|
||||
|
||||
if (m_outputMessageQueue)
|
||||
{
|
||||
ChirpChatDemodMsg::MsgReportDecodeBytes *outputMsg = ChirpChatDemodMsg::MsgReportDecodeBytes::create(msgBytes);
|
||||
outputMsg->setSyncWord(msgSyncWord);
|
||||
outputMsg->setSignalDb(msgSignalDb);
|
||||
outputMsg->setNoiseDb(msgNoiseDb);
|
||||
outputMsg->setMsgTimestamp(msgTimestamp);
|
||||
outputMsg->setPacketSize(getPacketLength());
|
||||
outputMsg->setNbParityBits(getNbParityBits());
|
||||
outputMsg->setHasCRC(getHasCRC());
|
||||
outputMsg->setNbSymbols(getNbSymbols());
|
||||
outputMsg->setNbCodewords(getNbCodewords());
|
||||
outputMsg->setEarlyEOM(getEarlyEOM());
|
||||
outputMsg->setHeaderParityStatus(getHeaderParityStatus());
|
||||
outputMsg->setHeaderCRCStatus(getHeaderCRCStatus());
|
||||
outputMsg->setPayloadParityStatus(getPayloadParityStatus());
|
||||
outputMsg->setPayloadCRCStatus(getPayloadCRCStatus());
|
||||
m_outputMessageQueue->push(outputMsg);
|
||||
}
|
||||
}
|
||||
else if (m_codingScheme == ChirpChatDemodSettings::CodingFT)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
QString msgString;
|
||||
decodeSymbols(msg.getSymbols(), msgString);
|
||||
|
||||
if (m_outputMessageQueue)
|
||||
{
|
||||
ChirpChatDemodMsg::MsgReportDecodeString *outputMsg = ChirpChatDemodMsg::MsgReportDecodeString::create(msgString);
|
||||
outputMsg->setSyncWord(msgSyncWord);
|
||||
outputMsg->setSignalDb(msgSignalDb);
|
||||
outputMsg->setNoiseDb(msgNoiseDb);
|
||||
outputMsg->setMsgTimestamp(msgTimestamp);
|
||||
m_outputMessageQueue->push(outputMsg);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void ChirpChatDemodDecoder::handleInputMessages()
|
||||
{
|
||||
Message* message;
|
||||
|
||||
while ((message = m_inputMessageQueue.pop()) != nullptr)
|
||||
{
|
||||
if (handleMessage(*message)) {
|
||||
delete message;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21,10 +21,15 @@
|
||||
#define INCLUDE_CHIRPCHATDEMODDECODER_H
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include "util/messagequeue.h"
|
||||
#include "chirpchatdemodsettings.h"
|
||||
|
||||
class ChirpChatDemodDecoder
|
||||
class ChirpChatDemodDecoder : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ChirpChatDemodDecoder();
|
||||
~ChirpChatDemodDecoder();
|
||||
@ -47,8 +52,12 @@ public:
|
||||
bool getHeaderCRCStatus() const { return m_headerCRCStatus; }
|
||||
int getPayloadParityStatus() const { return m_payloadParityStatus; }
|
||||
bool getPayloadCRCStatus() const { return m_payloadCRCStatus; }
|
||||
MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; }
|
||||
void setOutputMessageQueue(MessageQueue *messageQueue) { m_outputMessageQueue = messageQueue; }
|
||||
|
||||
private:
|
||||
bool handleMessage(const Message& cmd);
|
||||
|
||||
ChirpChatDemodSettings::CodingScheme m_codingScheme;
|
||||
unsigned int m_spreadFactor;
|
||||
unsigned int m_deBits;
|
||||
@ -65,6 +74,11 @@ private:
|
||||
bool m_headerCRCStatus;
|
||||
int m_payloadParityStatus;
|
||||
bool m_payloadCRCStatus;
|
||||
MessageQueue m_inputMessageQueue;
|
||||
MessageQueue *m_outputMessageQueue;
|
||||
|
||||
private slots:
|
||||
void handleInputMessages();
|
||||
};
|
||||
|
||||
#endif // INCLUDE_CHIRPCHATDEMODDECODER_H
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include "maincore.h"
|
||||
|
||||
#include "chirpchatdemod.h"
|
||||
#include "chirpchatdemodmsg.h"
|
||||
#include "chirpchatdemodgui.h"
|
||||
|
||||
ChirpChatDemodGUI* ChirpChatDemodGUI::create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel)
|
||||
@ -103,7 +104,7 @@ bool ChirpChatDemodGUI::handleMessage(const Message& message)
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (ChirpChatDemod::MsgReportDecodeBytes::match(message))
|
||||
else if (ChirpChatDemodMsg::MsgReportDecodeBytes::match(message))
|
||||
{
|
||||
if (m_settings.m_codingScheme == ChirpChatDemodSettings::CodingLoRa) {
|
||||
showLoRaMessage(message);
|
||||
@ -111,7 +112,7 @@ bool ChirpChatDemodGUI::handleMessage(const Message& message)
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (ChirpChatDemod::MsgReportDecodeString::match(message))
|
||||
else if (ChirpChatDemodMsg::MsgReportDecodeString::match(message))
|
||||
{
|
||||
if ((m_settings.m_codingScheme == ChirpChatDemodSettings::CodingASCII)
|
||||
|| (m_settings.m_codingScheme == ChirpChatDemodSettings::CodingTTY)) {
|
||||
@ -607,7 +608,7 @@ void ChirpChatDemodGUI::setBandwidths()
|
||||
|
||||
void ChirpChatDemodGUI::showLoRaMessage(const Message& message)
|
||||
{
|
||||
const ChirpChatDemod::MsgReportDecodeBytes& msg = (ChirpChatDemod::MsgReportDecodeBytes&) message;
|
||||
const ChirpChatDemodMsg::MsgReportDecodeBytes& msg = (ChirpChatDemodMsg::MsgReportDecodeBytes&) message;
|
||||
QByteArray bytes = msg.getBytes();
|
||||
QString syncWordStr((tr("%1").arg(msg.getSyncWord(), 2, 16, QChar('0'))));
|
||||
|
||||
@ -677,7 +678,7 @@ void ChirpChatDemodGUI::showLoRaMessage(const Message& message)
|
||||
|
||||
void ChirpChatDemodGUI::showTextMessage(const Message& message)
|
||||
{
|
||||
const ChirpChatDemod::MsgReportDecodeString& msg = (ChirpChatDemod::MsgReportDecodeString&) message;
|
||||
const ChirpChatDemodMsg::MsgReportDecodeString& msg = (ChirpChatDemodMsg::MsgReportDecodeString&) message;
|
||||
|
||||
QDateTime dt = QDateTime::currentDateTime();
|
||||
QString dateStr = dt.toString("HH:mm:ss");
|
||||
|
@ -20,3 +20,6 @@
|
||||
#include "chirpchatdemodmsg.h"
|
||||
|
||||
MESSAGE_CLASS_DEFINITION(ChirpChatDemodMsg::MsgDecodeSymbols, Message)
|
||||
MESSAGE_CLASS_DEFINITION(ChirpChatDemodMsg::MsgReportDecodeBytes, Message)
|
||||
MESSAGE_CLASS_DEFINITION(ChirpChatDemodMsg::MsgReportDecodeString, Message)
|
||||
MESSAGE_CLASS_DEFINITION(ChirpChatDemodMsg::MsgReportDecodeFT, Message)
|
||||
|
@ -80,6 +80,223 @@ namespace ChirpChatDemodMsg
|
||||
m_noiseDb(0.0)
|
||||
{ m_symbols = symbols; }
|
||||
};
|
||||
|
||||
class MsgReportDecodeBytes : public Message {
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
|
||||
public:
|
||||
const QByteArray& getBytes() const { return m_bytes; }
|
||||
unsigned int getSyncWord() const { return m_syncWord; }
|
||||
float getSingalDb() const { return m_signalDb; }
|
||||
float getNoiseDb() const { return m_noiseDb; }
|
||||
const QString& getMsgTimestamp() const { return m_msgTimestamp; }
|
||||
unsigned int getPacketSize() const { return m_packetSize; }
|
||||
unsigned int getNbParityBits() const { return m_nbParityBits; }
|
||||
unsigned int getNbSymbols() const { return m_nbSymbols; }
|
||||
unsigned int getNbCodewords() const { return m_nbCodewords; }
|
||||
bool getHasCRC() const { return m_hasCRC; }
|
||||
bool getEarlyEOM() const { return m_earlyEOM; }
|
||||
int getHeaderParityStatus() const { return m_headerParityStatus; }
|
||||
bool getHeaderCRCStatus() const { return m_headerCRCStatus; }
|
||||
int getPayloadParityStatus() const { return m_payloadParityStatus; }
|
||||
bool getPayloadCRCStatus() const { return m_payloadCRCStatus; }
|
||||
|
||||
static MsgReportDecodeBytes* create(const QByteArray& bytes) {
|
||||
return new MsgReportDecodeBytes(bytes);
|
||||
}
|
||||
void setSyncWord(unsigned int syncWord) {
|
||||
m_syncWord = syncWord;
|
||||
}
|
||||
void setSignalDb(float db) {
|
||||
m_signalDb = db;
|
||||
}
|
||||
void setNoiseDb(float db) {
|
||||
m_noiseDb = db;
|
||||
}
|
||||
void setMsgTimestamp(const QString& ts) {
|
||||
m_msgTimestamp = ts;
|
||||
}
|
||||
void setPacketSize(unsigned int packetSize) {
|
||||
m_packetSize = packetSize;
|
||||
}
|
||||
void setNbParityBits(unsigned int nbParityBits) {
|
||||
m_nbParityBits = nbParityBits;
|
||||
}
|
||||
void setNbSymbols(unsigned int nbSymbols) {
|
||||
m_nbSymbols = nbSymbols;
|
||||
}
|
||||
void setNbCodewords(unsigned int nbCodewords) {
|
||||
m_nbCodewords = nbCodewords;
|
||||
}
|
||||
void setHasCRC(bool hasCRC) {
|
||||
m_hasCRC = hasCRC;
|
||||
}
|
||||
void setEarlyEOM(bool earlyEOM) {
|
||||
m_earlyEOM = earlyEOM;
|
||||
}
|
||||
void setHeaderParityStatus(int headerParityStatus) {
|
||||
m_headerParityStatus = headerParityStatus;
|
||||
}
|
||||
void setHeaderCRCStatus(bool headerCRCStatus) {
|
||||
m_headerCRCStatus = headerCRCStatus;
|
||||
}
|
||||
void setPayloadParityStatus(int payloadParityStatus) {
|
||||
m_payloadParityStatus = payloadParityStatus;
|
||||
}
|
||||
void setPayloadCRCStatus(bool payloadCRCStatus) {
|
||||
m_payloadCRCStatus = payloadCRCStatus;
|
||||
}
|
||||
|
||||
private:
|
||||
QByteArray m_bytes;
|
||||
unsigned int m_syncWord;
|
||||
float m_signalDb;
|
||||
float m_noiseDb;
|
||||
QString m_msgTimestamp;
|
||||
unsigned int m_packetSize;
|
||||
unsigned int m_nbParityBits;
|
||||
unsigned int m_nbSymbols;
|
||||
unsigned int m_nbCodewords;
|
||||
bool m_hasCRC;
|
||||
bool m_earlyEOM;
|
||||
int m_headerParityStatus;
|
||||
bool m_headerCRCStatus;
|
||||
int m_payloadParityStatus;
|
||||
bool m_payloadCRCStatus;
|
||||
|
||||
MsgReportDecodeBytes(const QByteArray& bytes) :
|
||||
Message(),
|
||||
m_bytes(bytes),
|
||||
m_syncWord(0),
|
||||
m_signalDb(0.0),
|
||||
m_noiseDb(0.0),
|
||||
m_packetSize(0),
|
||||
m_nbParityBits(0),
|
||||
m_nbSymbols(0),
|
||||
m_nbCodewords(0),
|
||||
m_hasCRC(false),
|
||||
m_earlyEOM(false),
|
||||
m_headerParityStatus(false),
|
||||
m_headerCRCStatus(false),
|
||||
m_payloadParityStatus(false),
|
||||
m_payloadCRCStatus(false)
|
||||
{ }
|
||||
};
|
||||
|
||||
class MsgReportDecodeString : public Message {
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
|
||||
public:
|
||||
const QString& getString() const { return m_str; }
|
||||
unsigned int getSyncWord() const { return m_syncWord; }
|
||||
float getSingalDb() const { return m_signalDb; }
|
||||
float getNoiseDb() const { return m_noiseDb; }
|
||||
const QString& getMsgTimestamp() const { return m_msgTimestamp; }
|
||||
|
||||
static MsgReportDecodeString* create(const QString& str)
|
||||
{
|
||||
return new MsgReportDecodeString(str);
|
||||
}
|
||||
void setSyncWord(unsigned int syncWord) {
|
||||
m_syncWord = syncWord;
|
||||
}
|
||||
void setSignalDb(float db) {
|
||||
m_signalDb = db;
|
||||
}
|
||||
void setNoiseDb(float db) {
|
||||
m_noiseDb = db;
|
||||
}
|
||||
void setMsgTimestamp(const QString& ts) {
|
||||
m_msgTimestamp = ts;
|
||||
}
|
||||
|
||||
private:
|
||||
QString m_str;
|
||||
unsigned int m_syncWord;
|
||||
float m_signalDb;
|
||||
float m_noiseDb;
|
||||
QString m_msgTimestamp;
|
||||
|
||||
MsgReportDecodeString(const QString& str) :
|
||||
Message(),
|
||||
m_str(str),
|
||||
m_syncWord(0),
|
||||
m_signalDb(0.0),
|
||||
m_noiseDb(0.0)
|
||||
{ }
|
||||
};
|
||||
|
||||
class MsgReportDecodeFT : public Message {
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
|
||||
public:
|
||||
const QString& getMessage() const { return m_message; }
|
||||
const QString& getCall1() const { return m_call1; }
|
||||
const QString& getCall2() const { return m_call2; }
|
||||
const QString& getLoc() const { return m_loc; }
|
||||
bool isReply() const { return m_reply; }
|
||||
bool isFreeText() const { return m_freeText; }
|
||||
unsigned int getSyncWord() const { return m_syncWord; }
|
||||
float getSingalDb() const { return m_signalDb; }
|
||||
float getNoiseDb() const { return m_noiseDb; }
|
||||
const QString& getMsgTimestamp() const { return m_msgTimestamp; }
|
||||
|
||||
static MsgReportDecodeFT* create()
|
||||
{
|
||||
return new MsgReportDecodeFT();
|
||||
}
|
||||
void setMessage(const QString& message) {
|
||||
m_message = message;
|
||||
}
|
||||
void setCall1(const QString& call1) {
|
||||
m_call1 = call1;
|
||||
}
|
||||
void setCall2(const QString& call2) {
|
||||
m_call2 = call2;
|
||||
}
|
||||
void setLoc(const QString& loc) {
|
||||
m_loc = loc;
|
||||
}
|
||||
void setReply(bool reply) {
|
||||
m_reply = reply;
|
||||
}
|
||||
void setFreeText(bool freeText) {
|
||||
m_freeText = freeText;
|
||||
}
|
||||
void setSyncWord(unsigned int syncWord) {
|
||||
m_syncWord = syncWord;
|
||||
}
|
||||
void setSignalDb(float db) {
|
||||
m_signalDb = db;
|
||||
}
|
||||
void setNoiseDb(float db) {
|
||||
m_noiseDb = db;
|
||||
}
|
||||
void setMsgTimestamp(const QString& ts) {
|
||||
m_msgTimestamp = ts;
|
||||
}
|
||||
|
||||
private:
|
||||
QString m_message;
|
||||
QString m_call1;
|
||||
QString m_call2;
|
||||
QString m_loc;
|
||||
bool m_reply;
|
||||
bool m_freeText;
|
||||
unsigned int m_syncWord;
|
||||
float m_signalDb;
|
||||
float m_noiseDb;
|
||||
QString m_msgTimestamp;
|
||||
|
||||
MsgReportDecodeFT() :
|
||||
Message(),
|
||||
m_reply(false),
|
||||
m_freeText(false),
|
||||
m_syncWord(0),
|
||||
m_signalDb(0.0),
|
||||
m_noiseDb(0.0)
|
||||
{ }
|
||||
};
|
||||
}
|
||||
|
||||
#endif // INCLUDE_CHIRPCHATDEMODMSG_H
|
||||
|
Loading…
Reference in New Issue
Block a user