Fixed packet format for APRS

This commit is contained in:
Jordan Sherer 2018-10-02 14:28:33 -04:00
parent d042fffe75
commit 4e1c04f74a
2 changed files with 9 additions and 3 deletions

View File

@ -184,6 +184,10 @@ QPair<QString, QString> APRSISClient::grid2aprs(QString grid){
};
}
QString APRSISClient::stripSSID(QString call){
return QString(call.split("-").first().toUpper());
}
QString APRSISClient::replaceCallsignSuffixWithSSID(QString call, QString base){
if(call != base){
QRegularExpression re("[/](?<ssid>(P|\\d+))");
@ -202,13 +206,13 @@ QString APRSISClient::replaceCallsignSuffixWithSSID(QString call, QString base){
return call;
}
void APRSISClient::enqueueSpot(QString theircall, QString grid, QString comment){
if(m_localCall.isEmpty()) return;
auto geo = APRSISClient::grid2aprs(grid);
auto spotFrame = QString("%1>APRS,TCPIP*:=%2/%3nFT8CALL %4\n");
auto spotFrame = QString("%1>APRS,%2,TCPIP*:=%3/%4nFT8CALL %5\n");
spotFrame = spotFrame.arg(theircall);
spotFrame = spotFrame.arg(stripSSID(m_localCall));
spotFrame = spotFrame.arg(geo.first);
spotFrame = spotFrame.arg(geo.second);
spotFrame = spotFrame.arg(comment.left(43));
@ -220,8 +224,9 @@ void APRSISClient::enqueueThirdParty(QString theircall, QString payload){
return;
}
auto frame = QString("%1>APRS,TCPIP*:%2\n");
auto frame = QString("%1>APRS,%2,TCPIP*:%3\n");
frame = frame.arg(theircall);
frame = frame.arg(stripSSID(m_localCall));
frame = frame.arg(payload);
enqueueRaw(frame);
}

View File

@ -17,6 +17,7 @@ public:
static QString loginFrame(QString callsign);
static QPair<float, float> grid2deg(QString grid);
static QPair<QString, QString> grid2aprs(QString grid);
static QString APRSISClient::stripSSID(QString call);
static QString replaceCallsignSuffixWithSSID(QString call, QString base);
void setServer(QString host, quint16 port){