Added function to determine the checksum size needed for a buffered command

This commit is contained in:
Jordan Sherer
2018-08-27 22:04:17 -04:00
parent 7868c3fe70
commit 565bdb5690
3 changed files with 31 additions and 7 deletions
+15
View File
@@ -78,6 +78,13 @@ QSet<int> allowed_cmds = {0, 1, 2, 3, 4, 5, 6, 7, 8, /*...*/ 15, 16, 17, 18, 19,
QSet<int> buffered_cmds = {6, 7, 8, 15};
QMap<int, int> checksum_cmds = {
{6, 16},
{7, 16},
{8, 32},
{15, 0}
};
QString callsign_pattern = QString("(?<callsign>[A-Z0-9/]+)");
QString optional_cmd_pattern = QString("(?<cmd>\\s?(?:AGN[?]|ACK|73|YES|NO|SNR|PWR|QSL[?]?|RR|HEARING|HW CPY[?]|FB|QTH|QTC|GRID|[?@&$%|!#^ ]))?");
QString optional_grid_pattern = QString("(?<grid>\\s?[A-R]{2}[0-9]{2})?");
@@ -1121,6 +1128,14 @@ bool Varicode::isCommandBuffered(const QString &cmd){
return directed_cmds.contains(cmd) && buffered_cmds.contains(directed_cmds[cmd]);
}
int Varicode::isCommandChecksumed(const QString &cmd){
if(!directed_cmds.contains(cmd) || !checksum_cmds.contains(directed_cmds[cmd])){
return 0;
}
return checksum_cmds[directed_cmds[cmd]];
}
// CQCQCQ EM73
// BEACON EM73
QString Varicode::packBeaconMessage(QString const &text, const QString &callsign, int *n){