Experimental foundation of all or nothing checksummed messages
This commit is contained in:
parent
115a9d65f7
commit
39a536bb91
@ -3238,24 +3238,36 @@ void MainWindow::readFromStdout() //readFromStdout
|
|||||||
d.isFree = !decodedtext.isStandardMessage();
|
d.isFree = !decodedtext.isStandardMessage();
|
||||||
d.isCompound = decodedtext.isCompoundMessage();
|
d.isCompound = decodedtext.isCompoundMessage();
|
||||||
d.bits = decodedtext.bits();
|
d.bits = decodedtext.bits();
|
||||||
d.firstCall = decodedtext.CQersCall();
|
|
||||||
if(d.firstCall.isEmpty()){
|
|
||||||
auto words = decodedtext.messageWords();
|
|
||||||
if(words.length() == 2){
|
|
||||||
d.firstCall = words.at(0);
|
|
||||||
d.secondCall = words.at(1);
|
|
||||||
} else if(words.length() == 3){
|
|
||||||
d.firstCall = words.at(1);
|
|
||||||
d.secondCall = words.at(2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
d.freq = offset;
|
d.freq = offset;
|
||||||
d.text = decodedtext.messageWords().isEmpty() ? "" : decodedtext.messageWords().first().trimmed();
|
d.text = decodedtext.messageWords().isEmpty() ? "" : decodedtext.messageWords().first().trimmed();
|
||||||
d.utcTimestamp = QDateTime::currentDateTimeUtc();
|
d.utcTimestamp = QDateTime::currentDateTimeUtc();
|
||||||
d.snr = decodedtext.snr();
|
d.snr = decodedtext.snr();
|
||||||
m_bandActivity[offset].append(d);
|
m_bandActivity[offset].append(d);
|
||||||
|
|
||||||
|
#if TEST_ALL_OR_NOTHING
|
||||||
|
if(m_messageCache.contains(d.freq/10*10)){
|
||||||
|
m_messageCache[d.freq/10*10].second.append(d);
|
||||||
|
|
||||||
|
if(d.bits == Varicode::FT8CallLast){
|
||||||
|
auto c = m_messageCache[d.freq/10*10].first;
|
||||||
|
auto fs = m_messageCache[d.freq/10*10].second;
|
||||||
|
if(!fs.isEmpty()){
|
||||||
|
qDebug() << "MESSAGE COMPLETE:" << c.from << c.to;
|
||||||
|
QString message;
|
||||||
|
foreach(auto f, fs){
|
||||||
|
message.append(f.text);
|
||||||
|
}
|
||||||
|
QString checksum = message.left(3);
|
||||||
|
message = message.mid(3);
|
||||||
|
qDebug() << "> CHECKSUM:" << checksum;
|
||||||
|
qDebug() << "> MESSAGE:" << message;
|
||||||
|
qDebug() << "> VALID:" << Varicode::checksum16Valid(checksum, message);
|
||||||
|
}
|
||||||
|
m_messageCache.remove(d.freq/10*10);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
while(m_bandActivity[offset].count() > 10){
|
while(m_bandActivity[offset].count() > 10){
|
||||||
m_bandActivity[offset].removeFirst();
|
m_bandActivity[offset].removeFirst();
|
||||||
}
|
}
|
||||||
@ -3331,6 +3343,14 @@ void MainWindow::readFromStdout() //readFromStdout
|
|||||||
d.utcTimestamp = QDateTime::currentDateTimeUtc();
|
d.utcTimestamp = QDateTime::currentDateTimeUtc();
|
||||||
m_rxCommandQueue.append(d);
|
m_rxCommandQueue.append(d);
|
||||||
|
|
||||||
|
// TODO: jsherer - process this elsewhere?
|
||||||
|
if(d.cmd == "|"){
|
||||||
|
// cache the message buffer commands
|
||||||
|
m_messageCache[d.freq/10*10].first = d;
|
||||||
|
m_messageCache[d.freq/10*10].second.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
CallDetail cd;
|
CallDetail cd;
|
||||||
cd.call = d.from;
|
cd.call = d.from;
|
||||||
cd.grid = "";
|
cd.grid = "";
|
||||||
@ -3434,7 +3454,7 @@ void MainWindow::readFromStdout() //readFromStdout
|
|||||||
m_QSOText = decodedtext.string ().trimmed ();
|
m_QSOText = decodedtext.string ().trimmed ();
|
||||||
|
|
||||||
// TODO: jsherer - parse decode...
|
// TODO: jsherer - parse decode...
|
||||||
RXDetail d;
|
ActivityDetail d;
|
||||||
d.isFree = !decodedtext.isStandardMessage();
|
d.isFree = !decodedtext.isStandardMessage();
|
||||||
d.isCompound = decodedtext.isCompoundMessage();
|
d.isCompound = decodedtext.isCompoundMessage();
|
||||||
d.bits = decodedtext.bits();
|
d.bits = decodedtext.bits();
|
||||||
@ -5619,18 +5639,6 @@ QPair<QStringList, QStringList> MainWindow::buildFT8MessageFrames(QString const&
|
|||||||
|
|
||||||
foreach(QString line, text.split(QRegExp("[\\r\\n]"), QString::SkipEmptyParts)){
|
foreach(QString line, text.split(QRegExp("[\\r\\n]"), QString::SkipEmptyParts)){
|
||||||
|
|
||||||
#if 0
|
|
||||||
// TODO: jsherer - maybe preprocess the line for validated messages in Varicode?
|
|
||||||
QRegularExpression r("^(?<cmd>[A-Z0-9/]+\\s?[|])(?<text>.+)");
|
|
||||||
auto match = r.match(line);
|
|
||||||
if(match.hasMatch()){
|
|
||||||
auto lineCmd = match.captured("cmd");
|
|
||||||
auto lineText = match.captured("text");
|
|
||||||
auto checksum = Varicode::checksum(lineText);
|
|
||||||
line = lineCmd + checksum + lineText;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// once we find a directed call, data encode the rest of the line.
|
// once we find a directed call, data encode the rest of the line.
|
||||||
bool hasDirected = false;
|
bool hasDirected = false;
|
||||||
|
|
||||||
@ -5701,11 +5709,14 @@ QPair<QStringList, QStringList> MainWindow::buildFT8MessageFrames(QString const&
|
|||||||
lines.append(line.left(n) + " ");
|
lines.append(line.left(n) + " ");
|
||||||
line = line.mid(n);
|
line = line.mid(n);
|
||||||
|
|
||||||
#if 0
|
#if TEST_ALL_OR_NOTHING
|
||||||
// TODO: jsherer - this is how we'll prepend a 16-bit checksum to the message, just encode it in the data...
|
// TODO: jsherer - don't do this... refactor pack to return the packed frame _and_ its components instead
|
||||||
|
if(Varicode::unpackDirectedMessage(dirFrame).at(2) == "|"){
|
||||||
|
// TODO: jsherer - this is how we can add 16-bit checksum to the message, just encode it in the data...
|
||||||
if(!line.isEmpty()){
|
if(!line.isEmpty()){
|
||||||
line = Varicode::checksum16(line) + line;
|
line = Varicode::checksum16(line) + line;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -8544,7 +8555,7 @@ void MainWindow::displayActivity(bool force){
|
|||||||
|
|
||||||
// Recently Directed Activity
|
// Recently Directed Activity
|
||||||
while(!m_rxFrameQueue.isEmpty()){
|
while(!m_rxFrameQueue.isEmpty()){
|
||||||
RXDetail d = m_rxFrameQueue.dequeue();
|
ActivityDetail d = m_rxFrameQueue.dequeue();
|
||||||
|
|
||||||
// TODO: jsherer - is it safe to just ignore printing these?
|
// TODO: jsherer - is it safe to just ignore printing these?
|
||||||
if(d.isCompound){
|
if(d.isCompound){
|
||||||
|
18
mainwindow.h
18
mainwindow.h
@ -664,31 +664,20 @@ private:
|
|||||||
bool isLowConfidence;
|
bool isLowConfidence;
|
||||||
bool isCompound;
|
bool isCompound;
|
||||||
int bits;
|
int bits;
|
||||||
QString firstCall;
|
|
||||||
QString secondCall;
|
|
||||||
int freq;
|
int freq;
|
||||||
QString text;
|
QString text;
|
||||||
QDateTime utcTimestamp;
|
QDateTime utcTimestamp;
|
||||||
int snr;
|
int snr;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct RXDetail
|
|
||||||
{
|
|
||||||
bool isFree;
|
|
||||||
bool isLowConfidence;
|
|
||||||
bool isCompound;
|
|
||||||
int bits;
|
|
||||||
int freq;
|
|
||||||
QString text;
|
|
||||||
QDateTime utcTimestamp;
|
|
||||||
};
|
|
||||||
|
|
||||||
bool m_rxDirty;
|
bool m_rxDirty;
|
||||||
int m_txFrameCount;
|
int m_txFrameCount;
|
||||||
QString m_lastTxMessage;
|
QString m_lastTxMessage;
|
||||||
QDateTime m_lastTxTime;
|
QDateTime m_lastTxTime;
|
||||||
|
|
||||||
|
|
||||||
QQueue<QString> m_txFrameQueue;
|
QQueue<QString> m_txFrameQueue;
|
||||||
QQueue<RXDetail> m_rxFrameQueue;
|
QQueue<ActivityDetail> m_rxFrameQueue;
|
||||||
QQueue<CommandDetail> m_rxCommandQueue;
|
QQueue<CommandDetail> m_rxCommandQueue;
|
||||||
QMap<QString, QString> m_compoundCallCache; // base callsign -> compound callsign
|
QMap<QString, QString> m_compoundCallCache; // base callsign -> compound callsign
|
||||||
QCache<QString, QDateTime> m_txAllcallCommandCache; // callsign -> last tx
|
QCache<QString, QDateTime> m_txAllcallCommandCache; // callsign -> last tx
|
||||||
@ -697,6 +686,7 @@ private:
|
|||||||
QCache<QString, int> m_rxCallCache; // call -> last freq seen
|
QCache<QString, int> m_rxCallCache; // call -> last freq seen
|
||||||
QMap<int, int> m_rxFrameBlockNumbers; // freq -> block
|
QMap<int, int> m_rxFrameBlockNumbers; // freq -> block
|
||||||
QMap<int, QList<ActivityDetail>> m_bandActivity; // freq -> [(text, last timestamp), ...]
|
QMap<int, QList<ActivityDetail>> m_bandActivity; // freq -> [(text, last timestamp), ...]
|
||||||
|
QMap<int, QPair<CommandDetail, QList<ActivityDetail>>> m_messageCache; // freq -> (cmd, [frames, ...])
|
||||||
QMap<QString, CallDetail> m_callActivity; // call -> (last freq, last timestamp)
|
QMap<QString, CallDetail> m_callActivity; // call -> (last freq, last timestamp)
|
||||||
QSet<QString> m_callSeenBeacon; // call
|
QSet<QString> m_callSeenBeacon; // call
|
||||||
int m_previousFreq;
|
int m_previousFreq;
|
||||||
|
Loading…
Reference in New Issue
Block a user