Send data frames after directed. Fix bug with enter key double sending
This commit is contained in:
+19
-3
@@ -61,7 +61,7 @@ QMap<QString, int> directed_cmds = {
|
||||
{" ", 31 }, // send freetext
|
||||
};
|
||||
|
||||
QSet<int> allowed_cmds = {0, 1, 2, 3, 4, /*5,*/ 10, 23, 24, 25, 26, 27, 28, 29, 30, 31};
|
||||
QSet<int> allowed_cmds = {0, 1, 2, 3, 4, 5, /*6,*/ 10, 23, 24, 25, 26, 27, 28, 29, 30, 31};
|
||||
|
||||
QRegularExpression directed_re("^"
|
||||
"(?<to>[A-Z0-9/]+)"
|
||||
@@ -199,7 +199,7 @@ QString Varicode::formatPWR(int dbm){
|
||||
return QString("%1W").arg(mwatts/1000);
|
||||
}
|
||||
|
||||
QString Varicode::checksum(QString const &input){
|
||||
QString Varicode::checksum16(QString const &input){
|
||||
auto fromBytes = input.toLocal8Bit();
|
||||
auto crc = CRC::Calculate(fromBytes.data(), fromBytes.length(), CRC::CRC_16_KERMIT());
|
||||
auto checksum = Varicode::pack16bits(crc);
|
||||
@@ -209,12 +209,28 @@ QString Varicode::checksum(QString const &input){
|
||||
return checksum;
|
||||
}
|
||||
|
||||
bool Varicode::checksumValid(QString const &checksum, QString const &input){
|
||||
bool Varicode::checksum16Valid(QString const &checksum, QString const &input){
|
||||
auto fromBytes = input.toLocal8Bit();
|
||||
auto crc = CRC::Calculate(fromBytes.data(), fromBytes.length(), CRC::CRC_16_KERMIT());
|
||||
return Varicode::pack16bits(crc) == checksum;
|
||||
}
|
||||
|
||||
QString Varicode::checksum32(QString const &input){
|
||||
auto fromBytes = input.toLocal8Bit();
|
||||
auto crc = CRC::Calculate(fromBytes.data(), fromBytes.length(), CRC::CRC_32_BZIP2());
|
||||
auto checksum = Varicode::pack32bits(crc);
|
||||
if(checksum.length() < 6){
|
||||
checksum += QString(" ").repeated(6-checksum.length());
|
||||
}
|
||||
return checksum;
|
||||
}
|
||||
|
||||
bool Varicode::checksum32Valid(QString const &checksum, QString const &input){
|
||||
auto fromBytes = input.toLocal8Bit();
|
||||
auto crc = CRC::Calculate(fromBytes.data(), fromBytes.length(), CRC::CRC_32_BZIP2());
|
||||
return Varicode::pack32bits(crc) == checksum;
|
||||
}
|
||||
|
||||
QStringList Varicode::parseCallsigns(QString const &input){
|
||||
QStringList callsigns;
|
||||
QRegularExpression re(compound_callsign_pattern);
|
||||
|
||||
Reference in New Issue
Block a user