Correctly handle "ssid" in dstar callsign #33

feature/ipv6_#35
Geoffrey Merck 3 years ago
parent 30031eb852
commit 3a7cfeb465

@ -22,12 +22,6 @@
void CAPRSUtils::dstarCallsignToAPRS(std::string& dstarCallsign)
{
// 20230425 Fix for https://github.com/F4FXL/DStarGateway/issues/33
size_t hyphenIndex = dstarCallsign.find('-');
if(hyphenIndex != std::string::npos) {
dstarCallsign = dstarCallsign.substr(0, hyphenIndex);
}
if(dstarCallsign[dstarCallsign.length() - 1] == ' ') {
boost::trim(dstarCallsign);
} else {

@ -67,8 +67,8 @@ bool CHeardData::setIcomRepeaterData(const unsigned char *data, unsigned int len
std::string suser((const char *)data + 10U);
std::string srptr((const char *)data + 18U);
m_user = suser.substr(LONG_CALLSIGN_LENGTH);
m_repeater = srptr.substr(LONG_CALLSIGN_LENGTH);
m_user = suser.substr(0, LONG_CALLSIGN_LENGTH);
m_repeater = srptr.substr(0, LONG_CALLSIGN_LENGTH);
m_address = address;
m_port = port;

@ -107,8 +107,15 @@ bool CNMEASentenceCollector::getDataInt(std::string& data)
std::string fromCall = getMyCall1();
CAPRSUtils::dstarCallsignToAPRS(fromCall);
// 20230425 Fix for https://github.com/F4FXL/DStarGateway/issues/33
size_t hyphenIndex = fromCall.find('-');
if(hyphenIndex != std::string::npos) {
fromCall = fromCall.append("-5");
}
std::string aprsFrame(fromCall);
aprsFrame.append("-5>GPS30,DSTAR*:")
aprsFrame.append(">GPS30,DSTAR*:")
.append(nmea);
data.assign(aprsFrame);

@ -33,12 +33,12 @@ namespace APRSUtilsTests
EXPECT_STRCASEEQ(call.c_str(), "N0CALL") << "Call shall not have changed";
}
TEST_F(APRSUtils_dstarCallsignToAPRS, withHyphen)
TEST_F(APRSUtils_dstarCallsignToAPRS, twoBlanks)
{
std::string call("N0CALL-H");
std::string call("F4ABC B");
CAPRSUtils::dstarCallsignToAPRS(call);
EXPECT_STRCASEEQ(call.c_str(), "N0CALL") << "-H shall have been removed";
EXPECT_STRCASEEQ(call.c_str(), "F4ABC-B") << "-H shall have been removed";
}
TEST_F(APRSUtils_dstarCallsignToAPRS, threeBlanks)

Loading…
Cancel
Save

Powered by TurnKey Linux.