From f19ee613d8564cc2783dd4254a4a83dbab36e193 Mon Sep 17 00:00:00 2001 From: Geoffrey Merck Date: Sun, 20 Nov 2022 18:04:58 +0100 Subject: [PATCH 1/3] Add unittest DPRS Object supprt #28 --- APRS/APRSParser.cpp | 5 +++++ Tests/APRSParser/parseAPRSFrame.cpp | 14 ++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/APRS/APRSParser.cpp b/APRS/APRSParser.cpp index 0eeaabd..b5e60a2 100644 --- a/APRS/APRSParser.cpp +++ b/APRS/APRSParser.cpp @@ -138,6 +138,11 @@ bool CAPRSParser::parseInt(CAPRSFrame& frame) type = APFT_TELEMETRY; } break; + case ';' : + if( body.length() >= 10 && (body[9] == '*' || body[9] == '_')) { + type = APFT_OBJECT; + } + break; default: type = APFT_UNKNOWN; break; diff --git a/Tests/APRSParser/parseAPRSFrame.cpp b/Tests/APRSParser/parseAPRSFrame.cpp index a2d1ae1..59a8faa 100644 --- a/Tests/APRSParser/parseAPRSFrame.cpp +++ b/Tests/APRSParser/parseAPRSFrame.cpp @@ -173,6 +173,20 @@ namespace APRSParserTests EXPECT_EQ(aprsFrame.getPath().size(), 0); } + TEST_F(APRSParser_parseAPRSFrame, Object) + { + CAPRSFrame aprsFrame; + bool retVal = CAPRSParser::parseFrame("F8DSN-15>API510,DSTAR*:;F1ZBV *091510h4802.40N/00647.12ErPHG7430/A=003182R Vosges 145,6625@-0,6MHz", aprsFrame); + + EXPECT_TRUE(retVal); + EXPECT_STRCASEEQ(aprsFrame.getBody().c_str(), ";F1ZBV *091510h4802.40N/00647.12ErPHG7430/A=003182R Vosges 145,6625@-0,6MHz"); + EXPECT_STRCASEEQ(aprsFrame.getDestination().c_str(), "API510"); + EXPECT_STRCASEEQ(aprsFrame.getSource().c_str(), "F8DSN-15"); + EXPECT_EQ(aprsFrame.getType(), APFT_OBJECT); + EXPECT_EQ(aprsFrame.getPath().size(), 1); + EXPECT_STRCASEEQ(aprsFrame.getPath().at(0).c_str(), "DSTAR*"); + } + TEST_F(APRSParser_parseAPRSFrame, messageToSelf) { CAPRSFrame aprsFrame; From 5cbca7975cb8267e446208e2916a5a219aebcb9c Mon Sep 17 00:00:00 2001 From: Geoffrey Merck Date: Sun, 20 Nov 2022 18:32:14 +0100 Subject: [PATCH 2/3] Update README #28 --- README.md | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 5003389..2807ff7 100644 --- a/README.md +++ b/README.md @@ -21,12 +21,13 @@ - [4.1. Work Flow](#41-work-flow) - [4.2. Continuous Integration](#42-continuous-integration) - [5. Version History](#5-version-history) - - [5.1. Version 0.6](#51-version-06) - - [5.2. Version 0.5](#52-version-05) - - [5.3. Version 0.4](#53-version-04) - - [5.4. Version 0.3](#54-version-03) - - [5.5. Version 0.2](#55-version-02) - - [5.6. Version 0.1](#56-version-01) + - [5.1. Version 0.7](#51-version-07) + - [5.2. Version 0.6](#52-version-06) + - [5.3. Version 0.5](#53-version-05) + - [5.4. Version 0.4](#54-version-04) + - [5.5. Version 0.3](#55-version-03) + - [5.6. Version 0.2](#56-version-02) + - [5.7. Version 0.1](#57-version-01) - [6. Future](#6-future) @@ -142,7 +143,9 @@ I have added some basic CI using CircleCI [![F4FXL](https://circleci.com/gh/F4FX The testing framwework used is Google Test. # 5. Version History -## 5.1. Version 0.6 +## 5.1. Version 0.7 +- [**Improvement**] Add/Fix DPRS Object support([#28](https://github.com/F4FXL/DStarGateway/issues/22)) +## 5.2. Version 0.6 - [**Improvement**] Add DRats Support ([#22](https://github.com/F4FXL/DStarGateway/issues/22)) - [**Improvement**] Add call sign lists ([#22](https://github.com/F4FXL/DStarGateway/issues/22)) - [**Improvement**] Add a way to override Slow Data in VoiceTransmit ([#23](https://github.com/F4FXL/DStarGateway/issues/23)) @@ -150,7 +153,7 @@ The testing framwework used is Google Test. - [**Improvement**] Gracefully exit on SIGINT and SIGTERM ([#21](https://github.com/F4FXL/DStarGateway/issues/21)). DStarGateway can also be run as a "forking" daemon. This might be required for distros still using sysv. Systemd can live without it. - [**Improvement**] Add text transmit utility dgwtexttransmit ([#18](https://github.com/F4FXL/DStarGateway/issues/18)) - [**Improvement**] Add voice transmit utility dgwvoicetransmit ([#18](https://github.com/F4FXL/DStarGateway/issues/18)) -## 5.2. Version 0.5 +## 5.3. Version 0.5 - [**Improvement**] Add remote control utility dgwremotecontrol ([#17](https://github.com/F4FXL/DStarGateway/issues/17)) - [**Bugfix**] Two simultaneous incoming G2 streams would fail to be transmitted on dual band repeaters ([#16](https://github.com/F4FXL/DStarGateway/issues/16)) - [**Improvement**] Add NAT Traversal for G2 and DExtra, using IRCDDB as a Rendez Vous server ([#5](https://github.com/F4FXL/DStarGateway/issues/5)) @@ -158,17 +161,17 @@ The testing framwework used is Google Test. - [**Bugfix**] Failed to download XLX Hosts when URL contains a = sign ([#14](https://github.com/F4FXL/DStarGateway/issues/14)) - [**Bugfix**] Remote control connection failed ([#13](https://github.com/F4FXL/DStarGateway/issues/13)) - [**Bugfix**] Trying to connect to ghost ircDDB when no ircDDB is configured -## 5.3. Version 0.4 +## 5.4. Version 0.4 - [**Improvement**] Add APRS status link feature ([#8](https://github.com/F4FXL/DStarGateway/issues/8)) - [**Bugfix**] Posotions received over radio were not sent to APRS-IS when GPDS connection failed. ([#7](https://github.com/F4FXL/DStarGateway/issues/7)) - [**Improvement**] Bring back GPSD support ([#6](https://github.com/F4FXL/DStarGateway/issues/6)) - [**Improvement**] Log enhancements ([#4](https://github.com/F4FXL/DStarGateway/issues/4)) -## 5.4. Version 0.3 +## 5.5. Version 0.3 - [**Improvement**] Get ride of libcongig++ dependency. When upgrading from earlier version you need to manualy delete the config file before reinstalling. -## 5.5. Version 0.2 +## 5.6. Version 0.2 - [**Bugfix**] ircDDBFreeze when repeater not found ([#1](https://github.com/F4FXL/DStarGateway/issues/1)) - Code sanitization -## 5.6. Version 0.1 +## 5.7. Version 0.1 First working version # 6. Future I started this during my 2021 seasons holiday. It took me almost 8 days to get to a workable version. Here are a couple of stuff I'd like to do : From d6ff567909b08231e8e2a37cd22c294f34f914fe Mon Sep 17 00:00:00 2001 From: Geoffrey Merck Date: Sun, 20 Nov 2022 18:36:19 +0100 Subject: [PATCH 3/3] Add some more tests for object parsing #28 --- Tests/APRSParser/parseAPRSFrame.cpp | 32 ++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/Tests/APRSParser/parseAPRSFrame.cpp b/Tests/APRSParser/parseAPRSFrame.cpp index 59a8faa..bf60a96 100644 --- a/Tests/APRSParser/parseAPRSFrame.cpp +++ b/Tests/APRSParser/parseAPRSFrame.cpp @@ -173,7 +173,7 @@ namespace APRSParserTests EXPECT_EQ(aprsFrame.getPath().size(), 0); } - TEST_F(APRSParser_parseAPRSFrame, Object) + TEST_F(APRSParser_parseAPRSFrame, ObjectAlive) { CAPRSFrame aprsFrame; bool retVal = CAPRSParser::parseFrame("F8DSN-15>API510,DSTAR*:;F1ZBV *091510h4802.40N/00647.12ErPHG7430/A=003182R Vosges 145,6625@-0,6MHz", aprsFrame); @@ -187,6 +187,36 @@ namespace APRSParserTests EXPECT_STRCASEEQ(aprsFrame.getPath().at(0).c_str(), "DSTAR*"); } + TEST_F(APRSParser_parseAPRSFrame, ObjectKilled) + { + CAPRSFrame aprsFrame; + bool retVal = CAPRSParser::parseFrame("F8DSN-15>API510,DSTAR*:;F1ZBV _091510h4802.40N/00647.12ErPHG7430/A=003182R Vosges 145,6625@-0,6MHz", aprsFrame); + + EXPECT_TRUE(retVal); + EXPECT_STRCASEEQ(aprsFrame.getBody().c_str(), ";F1ZBV _091510h4802.40N/00647.12ErPHG7430/A=003182R Vosges 145,6625@-0,6MHz"); + EXPECT_STRCASEEQ(aprsFrame.getDestination().c_str(), "API510"); + EXPECT_STRCASEEQ(aprsFrame.getSource().c_str(), "F8DSN-15"); + EXPECT_EQ(aprsFrame.getType(), APFT_OBJECT); + EXPECT_EQ(aprsFrame.getPath().size(), 1); + EXPECT_STRCASEEQ(aprsFrame.getPath().at(0).c_str(), "DSTAR*"); + } + + TEST_F(APRSParser_parseAPRSFrame, ObjectInvalid) + { + CAPRSFrame aprsFrame; + bool retVal = CAPRSParser::parseFrame("F8DSN-15>API510,DSTAR*:;F1ZBV ~091510h4802.40N/00647.12ErPHG7430/A=003182R Vosges 145,6625@-0,6MHz", aprsFrame); + + EXPECT_FALSE(retVal); + } + + TEST_F(APRSParser_parseAPRSFrame, ObjectTooShort) + { + CAPRSFrame aprsFrame; + bool retVal = CAPRSParser::parseFrame("F8DSN-15>API510,DSTAR*:;F1ZBV", aprsFrame); + + EXPECT_FALSE(retVal); + } + TEST_F(APRSParser_parseAPRSFrame, messageToSelf) { CAPRSFrame aprsFrame;