diff --git a/APRS/APRSUtils.cpp b/APRS/APRSUtils.cpp index 1d4694c..5684088 100644 --- a/APRS/APRSUtils.cpp +++ b/APRS/APRSUtils.cpp @@ -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 { diff --git a/Common/HeardData.cpp b/Common/HeardData.cpp index 8db0434..1b1ac8d 100644 --- a/Common/HeardData.cpp +++ b/Common/HeardData.cpp @@ -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; diff --git a/Common/NMEASentenceCollector.cpp b/Common/NMEASentenceCollector.cpp index 5136a61..3e114dd 100644 --- a/Common/NMEASentenceCollector.cpp +++ b/Common/NMEASentenceCollector.cpp @@ -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); diff --git a/Tests/APRSUtils/dstarCallsignToAPRS.cpp b/Tests/APRSUtils/dstarCallsignToAPRS.cpp index 832b8fa..4f8cdcb 100644 --- a/Tests/APRSUtils/dstarCallsignToAPRS.cpp +++ b/Tests/APRSUtils/dstarCallsignToAPRS.cpp @@ -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)