Fix varicode bug with empty messages

This commit is contained in:
Jordan Sherer 2018-07-20 09:38:34 -04:00
parent 87a631f5f0
commit 7b409a6ff4
2 changed files with 10 additions and 7 deletions

View File

@ -163,8 +163,8 @@ QVector<QColor> g_ColorTbl;
namespace
{
Radio::Frequency constexpr default_frequency {14074000};
QRegExp message_alphabet {"[- A-Za-z0-9+./?]*"};
QRegExp message_input_alphabet {"[- A-Za-z0-9+./?\\n:@&]*"};
QRegExp message_alphabet {"[- A-Za-z0-9+./?:!^]*"};
QRegExp message_input_alphabet {"[- A-Za-z0-9+./?\\n:!^@&]*"};
// 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"};
@ -5525,7 +5525,7 @@ QPair<QStringList, QStringList> MainWindow::buildFT8MessageFrames(QString const&
}
}
#if 0
#if 1
qDebug() << "parsed frames:";
foreach(auto frame, frames){
qDebug() << "->" << frame << Varicode::unpackDataMessage(frame);

View File

@ -38,9 +38,10 @@ QString callsign_alphabet = {"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ "};
QMap<QString, int> directed_cmds = {
// any changes here need to be made also in the directed regular xpression for parsing
{"?", 0 }, // query snr
//{"$", 1 }, // query stations heard
{"@", 2 }, // query qth
{"&", 3 }, // query station message
{"@", 1 }, // query qth
{"&", 2 }, // query station message
//{"$", 3 }, // query stations heard
//{"|", 4 }, // relay message
// ...
@ -188,6 +189,8 @@ QString Varicode::huffDecode(QVector<bool> const& bitvec, int pad){
foreach(auto key, huff.keys()){
if(bits.startsWith(huff[key])){
if(key == huffeot){
out.append(" ");
found = false;
break;
}
out.append(key);
@ -640,7 +643,7 @@ QString Varicode::packDataMessage(const QString &text, int *n){
int pad = 64 - frameBits.length();
if(pad){
frameBits += Varicode::intToBits(1, pad);
frameBits += Varicode::intToBits(0, pad);
}
frame = Varicode::pack64bits(Varicode::bitsToInt(frameBits)) + Varicode::pack5bits(pad & 31);