Fix varicode bug with empty messages
This commit is contained in:
parent
87a631f5f0
commit
7b409a6ff4
@ -163,8 +163,8 @@ QVector<QColor> g_ColorTbl;
|
|||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
Radio::Frequency constexpr default_frequency {14074000};
|
Radio::Frequency constexpr default_frequency {14074000};
|
||||||
QRegExp message_alphabet {"[- A-Za-z0-9+./?]*"};
|
QRegExp message_alphabet {"[- A-Za-z0-9+./?:!^]*"};
|
||||||
QRegExp message_input_alphabet {"[- A-Za-z0-9+./?\\n:@&]*"};
|
QRegExp message_input_alphabet {"[- A-Za-z0-9+./?\\n:!^@&]*"};
|
||||||
// grid exact match excluding RR73
|
// grid exact match excluding RR73
|
||||||
QRegularExpression grid_regexp {"\\A(?![Rr]{2}73)[A-Ra-r]{2}[0-9]{2}([A-Xa-x]{2}){0,1}\\z"};
|
QRegularExpression grid_regexp {"\\A(?![Rr]{2}73)[A-Ra-r]{2}[0-9]{2}([A-Xa-x]{2}){0,1}\\z"};
|
||||||
|
|
||||||
@ -5525,7 +5525,7 @@ QPair<QStringList, QStringList> MainWindow::buildFT8MessageFrames(QString const&
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 1
|
||||||
qDebug() << "parsed frames:";
|
qDebug() << "parsed frames:";
|
||||||
foreach(auto frame, frames){
|
foreach(auto frame, frames){
|
||||||
qDebug() << "->" << frame << Varicode::unpackDataMessage(frame);
|
qDebug() << "->" << frame << Varicode::unpackDataMessage(frame);
|
||||||
|
11
varicode.cpp
11
varicode.cpp
@ -38,9 +38,10 @@ QString callsign_alphabet = {"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ "};
|
|||||||
QMap<QString, int> directed_cmds = {
|
QMap<QString, int> directed_cmds = {
|
||||||
// any changes here need to be made also in the directed regular xpression for parsing
|
// any changes here need to be made also in the directed regular xpression for parsing
|
||||||
{"?", 0 }, // query snr
|
{"?", 0 }, // query snr
|
||||||
//{"$", 1 }, // query stations heard
|
{"@", 1 }, // query qth
|
||||||
{"@", 2 }, // query qth
|
{"&", 2 }, // query station message
|
||||||
{"&", 3 }, // query station message
|
|
||||||
|
//{"$", 3 }, // query stations heard
|
||||||
//{"|", 4 }, // relay message
|
//{"|", 4 }, // relay message
|
||||||
|
|
||||||
// ...
|
// ...
|
||||||
@ -188,6 +189,8 @@ QString Varicode::huffDecode(QVector<bool> const& bitvec, int pad){
|
|||||||
foreach(auto key, huff.keys()){
|
foreach(auto key, huff.keys()){
|
||||||
if(bits.startsWith(huff[key])){
|
if(bits.startsWith(huff[key])){
|
||||||
if(key == huffeot){
|
if(key == huffeot){
|
||||||
|
out.append(" ");
|
||||||
|
found = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
out.append(key);
|
out.append(key);
|
||||||
@ -640,7 +643,7 @@ QString Varicode::packDataMessage(const QString &text, int *n){
|
|||||||
|
|
||||||
int pad = 64 - frameBits.length();
|
int pad = 64 - frameBits.length();
|
||||||
if(pad){
|
if(pad){
|
||||||
frameBits += Varicode::intToBits(1, pad);
|
frameBits += Varicode::intToBits(0, pad);
|
||||||
}
|
}
|
||||||
|
|
||||||
frame = Varicode::pack64bits(Varicode::bitsToInt(frameBits)) + Varicode::pack5bits(pad & 31);
|
frame = Varicode::pack64bits(Varicode::bitsToInt(frameBits)) + Varicode::pack5bits(pad & 31);
|
||||||
|
Loading…
Reference in New Issue
Block a user