Restructuring beacons to be more like standard allcalls
This commit is contained in:
parent
96f7b9fd66
commit
eb7882e253
@ -100,9 +100,8 @@ bool DecodedText::tryUnpackBeacon(){
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isBeacon = false;
|
|
||||||
bool isAlt = false;
|
bool isAlt = false;
|
||||||
QStringList parts = Varicode::unpackBeaconMessage(m, &isBeacon, &isAlt);
|
QStringList parts = Varicode::unpackBeaconMessage(m, &isAlt);
|
||||||
|
|
||||||
if(parts.isEmpty() || parts.length() < 2){
|
if(parts.isEmpty() || parts.length() < 2){
|
||||||
return false;
|
return false;
|
||||||
@ -112,9 +111,7 @@ bool DecodedText::tryUnpackBeacon(){
|
|||||||
// ---------------
|
// ---------------
|
||||||
// 1 0 BCN
|
// 1 0 BCN
|
||||||
// 1 1 CQ
|
// 1 1 CQ
|
||||||
// 0 0 DE
|
isBeacon_ = true;
|
||||||
// 0 1 TO
|
|
||||||
isBeacon_ = isBeacon;
|
|
||||||
isAlt_ = isAlt;
|
isAlt_ = isAlt;
|
||||||
extra_ = parts.at(2);
|
extra_ = parts.at(2);
|
||||||
|
|
||||||
@ -126,20 +123,7 @@ bool DecodedText::tryUnpackBeacon(){
|
|||||||
cmp.append(parts.at(1));
|
cmp.append(parts.at(1));
|
||||||
}
|
}
|
||||||
compound_ = cmp.join("/");
|
compound_ = cmp.join("/");
|
||||||
|
message_ = QString("%1: ALLCALL %2 %3 ").arg(compound_).arg(isAlt ? "CQ" : "BCN").arg(extra_);
|
||||||
// BCN|CQ
|
|
||||||
if(isBeacon){
|
|
||||||
message_ = QString("%1: %2 %3 ").arg(compound_).arg(isAlt ? "CQ" : "BCN").arg(extra_);
|
|
||||||
} else {
|
|
||||||
// :TO
|
|
||||||
if(isAlt){
|
|
||||||
message_ = QString("%1").arg(compound_);
|
|
||||||
}
|
|
||||||
// DE:
|
|
||||||
else {
|
|
||||||
message_ = QString("%1: ").arg(compound_);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -5985,7 +5985,7 @@ QStringList MainWindow::buildFT8MessageFrames(QString const& text){
|
|||||||
// to compound callsign
|
// to compound callsign
|
||||||
if(!dirTo.isEmpty()){
|
if(!dirTo.isEmpty()){
|
||||||
if(dirTo.contains("/")){
|
if(dirTo.contains("/")){
|
||||||
QString compoundMessage = QString("TO");
|
QString compoundMessage = QString("CALL");
|
||||||
QString beaconFrame = Varicode::packBeaconMessage(compoundMessage, dirTo, nullptr);
|
QString beaconFrame = Varicode::packBeaconMessage(compoundMessage, dirTo, nullptr);
|
||||||
if(!beaconFrame.isEmpty()){
|
if(!beaconFrame.isEmpty()){
|
||||||
frames.append(beaconFrame);
|
frames.append(beaconFrame);
|
||||||
@ -6016,7 +6016,7 @@ QStringList MainWindow::buildFT8MessageFrames(QString const& text){
|
|||||||
#if 1
|
#if 1
|
||||||
qDebug() << "parsed frames:";
|
qDebug() << "parsed frames:";
|
||||||
foreach(auto frame, frames){
|
foreach(auto frame, frames){
|
||||||
qDebug() << "->" << frame << Varicode::unpackDataMessage(frame) << Varicode::unpackDirectedMessage(frame) << Varicode::unpackCompoundFrame(frame, nullptr, nullptr) << Varicode::unpackBeaconMessage(frame, nullptr, nullptr);
|
qDebug() << "->" << frame << Varicode::unpackDataMessage(frame) << Varicode::unpackDirectedMessage(frame) << Varicode::unpackCompoundFrame(frame, nullptr, nullptr) << Varicode::unpackBeaconMessage(frame, nullptr);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -9022,11 +9022,13 @@ void MainWindow::processCommandActivity() {
|
|||||||
|
|
||||||
auto d = m_callActivity[call];
|
auto d = m_callActivity[call];
|
||||||
|
|
||||||
lines.append(QString("%1 SNR %2").arg(d.call).arg(Varicode::formatSNR(d.snr)));
|
lines.append(QString("%1 %2").arg(d.call).arg(Varicode::formatSNR(d.snr)));
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
reply = lines.join('\n');
|
|
||||||
|
lines.prepend(QString("%1 ACK %2\n").arg(d.from).arg(i));
|
||||||
|
reply = lines.join(' ');
|
||||||
}
|
}
|
||||||
// PROCESS RETRANSMIT
|
// PROCESS RETRANSMIT
|
||||||
else if (d.cmd == "|" && !isAllCall) {
|
else if (d.cmd == "|" && !isAllCall) {
|
||||||
|
54
varicode.cpp
54
varicode.cpp
@ -988,7 +988,7 @@ bool Varicode::isCommandBuffered(const QString &cmd){
|
|||||||
QString Varicode::packBeaconMessage(QString const &text, const QString &callsign, int *n){
|
QString Varicode::packBeaconMessage(QString const &text, const QString &callsign, int *n){
|
||||||
QString frame;
|
QString frame;
|
||||||
|
|
||||||
auto parsedText = QRegularExpression(R"(^(?<type>BCN|CQ|DE|TO)(?:\s(?<grid>[A-Z]{2}[0-9]{2}))?\b)").match(text);
|
auto parsedText = QRegularExpression(R"(^ALLCALL\s(?<type>CQ|BCN)(?:\s(?<grid>[A-Z]{2}[0-9]{2}))?\b)").match(text);
|
||||||
if(!parsedText.hasMatch()){
|
if(!parsedText.hasMatch()){
|
||||||
if(n) *n = 0;
|
if(n) *n = 0;
|
||||||
return frame;
|
return frame;
|
||||||
@ -996,25 +996,13 @@ QString Varicode::packBeaconMessage(QString const &text, const QString &callsign
|
|||||||
|
|
||||||
auto extra = parsedText.captured("grid");
|
auto extra = parsedText.captured("grid");
|
||||||
|
|
||||||
/*
|
|
||||||
if(extra.isEmpty()){
|
|
||||||
if(n) *n = 0;
|
|
||||||
return frame;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Beacon Alt Type
|
// Beacon Alt Type
|
||||||
// ---------------
|
// ---------------
|
||||||
// 1 0 BCN
|
// 1 0 BCN
|
||||||
// 1 1 CQ
|
// 1 1 CQ
|
||||||
// 0 0 DE
|
|
||||||
// 0 1 TO
|
|
||||||
|
|
||||||
auto type = parsedText.captured("type");
|
auto type = parsedText.captured("type");
|
||||||
auto isBeacon = type == "BCN" || type == "CQ";
|
auto isAlt = type == "CQ";
|
||||||
auto isAlt = type == "CQ" || type == "TO";
|
|
||||||
auto isDe = type == "DE";
|
|
||||||
Q_UNUSED(isDe);
|
|
||||||
|
|
||||||
auto parsedCall = QRegularExpression(compound_callsign_pattern).match(callsign);
|
auto parsedCall = QRegularExpression(compound_callsign_pattern).match(callsign);
|
||||||
if(!parsedCall.hasMatch()){
|
if(!parsedCall.hasMatch()){
|
||||||
@ -1043,7 +1031,8 @@ QString Varicode::packBeaconMessage(QString const &text, const QString &callsign
|
|||||||
packed_extra |= (1<<15);
|
packed_extra |= (1<<15);
|
||||||
}
|
}
|
||||||
|
|
||||||
frame = packCompoundFrame(base, fix, isPrefix, isBeacon, packed_extra);
|
|
||||||
|
frame = packCompoundFrame(base, fix, isPrefix, FrameBeacon, packed_extra);
|
||||||
if(frame.isEmpty()){
|
if(frame.isEmpty()){
|
||||||
if(n) *n = 0;
|
if(n) *n = 0;
|
||||||
return frame;
|
return frame;
|
||||||
@ -1053,22 +1042,31 @@ QString Varicode::packBeaconMessage(QString const &text, const QString &callsign
|
|||||||
return frame;
|
return frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList Varicode::unpackBeaconMessage(const QString &text, bool *isBeacon, bool * isAlt){
|
QStringList Varicode::unpackBeaconMessage(const QString &text, bool * isAlt){
|
||||||
|
quint8 type = 0;
|
||||||
quint16 num = 0;
|
quint16 num = 0;
|
||||||
|
|
||||||
QStringList unpacked = unpackCompoundFrame(text, isBeacon, &num);
|
QStringList unpacked = unpackCompoundFrame(text, &type, &num);
|
||||||
|
if(unpacked.isEmpty()){
|
||||||
if(isAlt) *isAlt = (num & (1<<15));
|
return unpacked;
|
||||||
|
}
|
||||||
|
|
||||||
unpacked.append(Varicode::unpackGrid(num & ((1<<15)-1)));
|
unpacked.append(Varicode::unpackGrid(num & ((1<<15)-1)));
|
||||||
|
|
||||||
|
if(isAlt) *isAlt = (num & (1<<15));
|
||||||
|
|
||||||
return unpacked;
|
return unpacked;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Varicode::packCompoundFrame(const QString &baseCallsign, const QString &fix, bool isPrefix, bool isBeacon, quint16 num){
|
QString Varicode::packCompoundFrame(const QString &baseCallsign, const QString &fix, bool isPrefix, quint8 type, quint16 num){
|
||||||
QString frame;
|
QString frame;
|
||||||
|
|
||||||
quint8 packed_flag = isBeacon ? FrameBeacon : FrameCompound;
|
// needs to be a beacon type...
|
||||||
|
if(type == FrameDataPadded || type == FrameDataUnpadded || type == FrameDirectedPositive || type == FrameDirectedNegative){
|
||||||
|
return frame;
|
||||||
|
}
|
||||||
|
|
||||||
|
quint8 packed_flag = type;
|
||||||
quint32 packed_base = Varicode::packCallsign(baseCallsign);
|
quint32 packed_base = Varicode::packCallsign(baseCallsign);
|
||||||
quint32 packed_fix = Varicode::packAlphaNumeric22(fix, isPrefix);
|
quint32 packed_fix = Varicode::packAlphaNumeric22(fix, isPrefix);
|
||||||
|
|
||||||
@ -1083,6 +1081,12 @@ QString Varicode::packCompoundFrame(const QString &baseCallsign, const QString &
|
|||||||
quint8 packed_5 = num & mask5;
|
quint8 packed_5 = num & mask5;
|
||||||
|
|
||||||
// [3][28][22][11],[5] = 69
|
// [3][28][22][11],[5] = 69
|
||||||
|
/*
|
||||||
|
if(extra.isEmpty()){
|
||||||
|
if(n) *n = 0;
|
||||||
|
return frame;
|
||||||
|
}
|
||||||
|
*/
|
||||||
auto bits = (
|
auto bits = (
|
||||||
Varicode::intToBits(packed_flag, 3) +
|
Varicode::intToBits(packed_flag, 3) +
|
||||||
Varicode::intToBits(packed_base, 28) +
|
Varicode::intToBits(packed_base, 28) +
|
||||||
@ -1093,7 +1097,7 @@ QString Varicode::packCompoundFrame(const QString &baseCallsign, const QString &
|
|||||||
return Varicode::pack64bits(Varicode::bitsToInt(bits)) + Varicode::pack5bits(packed_5 % 32);
|
return Varicode::pack64bits(Varicode::bitsToInt(bits)) + Varicode::pack5bits(packed_5 % 32);
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList Varicode::unpackCompoundFrame(const QString &text, bool *isBeacon, quint16 *pNum){
|
QStringList Varicode::unpackCompoundFrame(const QString &text, quint8 *pType, quint16 *pNum){
|
||||||
QStringList unpacked;
|
QStringList unpacked;
|
||||||
|
|
||||||
if(text.length() < 13 || text.contains(" ")){
|
if(text.length() < 13 || text.contains(" ")){
|
||||||
@ -1105,7 +1109,9 @@ QStringList Varicode::unpackCompoundFrame(const QString &text, bool *isBeacon, q
|
|||||||
quint8 packed_5 = Varicode::unpack5bits(text.right(1));
|
quint8 packed_5 = Varicode::unpack5bits(text.right(1));
|
||||||
|
|
||||||
quint8 packed_flag = Varicode::bitsToInt(Varicode::strToBits(bits.left(3)));
|
quint8 packed_flag = Varicode::bitsToInt(Varicode::strToBits(bits.left(3)));
|
||||||
if(packed_flag != FrameBeacon && packed_flag != FrameCompound){
|
|
||||||
|
// needs to be a beacon type...
|
||||||
|
if(packed_flag == FrameDataPadded || packed_flag == FrameDataUnpadded || packed_flag == FrameDirectedPositive || packed_flag == FrameDirectedNegative){
|
||||||
return unpacked;
|
return unpacked;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1120,8 +1126,8 @@ QStringList Varicode::unpackCompoundFrame(const QString &text, bool *isBeacon, q
|
|||||||
|
|
||||||
quint16 num = (packed_11 << 5) | packed_5;
|
quint16 num = (packed_11 << 5) | packed_5;
|
||||||
|
|
||||||
|
if(pType) *pType = packed_flag;
|
||||||
if(pNum) *pNum = num;
|
if(pNum) *pNum = num;
|
||||||
if(isBeacon) *isBeacon = packed_flag == FrameBeacon;
|
|
||||||
|
|
||||||
if(isPrefix){
|
if(isPrefix){
|
||||||
unpacked.append(fix);
|
unpacked.append(fix);
|
||||||
|
@ -96,10 +96,10 @@ public:
|
|||||||
static bool isCommandBuffered(const QString &cmd);
|
static bool isCommandBuffered(const QString &cmd);
|
||||||
|
|
||||||
static QString packBeaconMessage(QString const &text, QString const&callsign, int *n);
|
static QString packBeaconMessage(QString const &text, QString const&callsign, int *n);
|
||||||
static QStringList unpackBeaconMessage(const QString &text, bool *isBeacon, bool *isAlt);
|
static QStringList unpackBeaconMessage(const QString &text, bool *isAlt);
|
||||||
|
|
||||||
static QString packCompoundFrame(const QString &baseCallsign, const QString &fix, bool isPrefix, bool isBeacon, quint16 num);
|
static QString packCompoundFrame(const QString &baseCallsign, const QString &fix, bool isPrefix, quint8 type, quint16 num);
|
||||||
static QStringList unpackCompoundFrame(const QString &text, bool *isBeacon, quint16 *pNum);
|
static QStringList unpackCompoundFrame(const QString &text, quint8 *pType, quint16 *pNum);
|
||||||
|
|
||||||
static QString packDirectedMessage(QString const& text, QString const& callsign, QString *pTo, QString * pCmd, int *n);
|
static QString packDirectedMessage(QString const& text, QString const& callsign, QString *pTo, QString * pCmd, int *n);
|
||||||
static QStringList unpackDirectedMessage(QString const& text);
|
static QStringList unpackDirectedMessage(QString const& text);
|
||||||
|
Loading…
Reference in New Issue
Block a user