updated QueryAnswer for 3rdPartyPacket

This commit is contained in:
richonguzman 2024-06-28 16:05:04 -04:00
parent 413bef67fb
commit 848492dc36
6 changed files with 19 additions and 20 deletions

View File

@ -37,7 +37,7 @@ ________________________________________________________________________________
#include "A7670_utils.h"
#endif
String versionDate = "2024.06.27";
String versionDate = "2024.06.28";
Configuration Config;
WiFiClient espClient;

View File

@ -59,7 +59,7 @@ namespace APRS_IS_Utils {
aprsauth += Config.callsign;
aprsauth += " pass ";
aprsauth += Config.aprs_is.passcode;
aprsauth += " vers CA2RXU_LoRa_iGate 1.3 filter ";
aprsauth += " vers CA2RXU_LoRa_iGate 1.4 filter ";
aprsauth += Config.aprs_is.filter;
upload(aprsauth);
delay(200);
@ -129,7 +129,7 @@ namespace APRS_IS_Utils {
return buildedPacket;
}
bool processReceivedLoRaMessage(const String& sender, const String& packet) {
bool processReceivedLoRaMessage(const String& sender, const String& packet, bool thirdParty) {
String receivedMessage;
if (packet.indexOf("{") > 0) { // ack?
String ackMessage = "ack";
@ -162,7 +162,7 @@ namespace APRS_IS_Utils {
if (!Config.display.alwaysOn && Config.display.timeout != 0) {
display_toggle(true);
}
STATION_Utils::addToOutputPacketBuffer(QUERY_Utils::process(receivedMessage, sender, 0)); // LoRa
STATION_Utils::addToOutputPacketBuffer(QUERY_Utils::process(receivedMessage, sender, false, thirdParty));
lastScreenOn = millis();
show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, "Callsign = " + sender, "TYPE --> QUERY", 0);
return true;
@ -187,7 +187,7 @@ namespace APRS_IS_Utils {
Addressee.trim();
bool queryMessage = false;
if (packet.indexOf("::") > 10 && Addressee == Config.callsign) { // its a message for me!
queryMessage = processReceivedLoRaMessage(Sender, checkForStartingBytes(AddresseeAndMessage));
queryMessage = processReceivedLoRaMessage(Sender, checkForStartingBytes(AddresseeAndMessage), false);
}
if (!queryMessage) {
const String& aprsPacket = buildPacketToUpload(packet);
@ -291,7 +291,7 @@ namespace APRS_IS_Utils {
}
if (receivedMessage.indexOf("?") == 0) {
Utils::println("Received Query APRS-IS : " + packet);
String queryAnswer = QUERY_Utils::process(receivedMessage, Sender, 1); // APRSIS
String queryAnswer = QUERY_Utils::process(receivedMessage, Sender, true, false);
//Serial.println("---> QUERY Answer : " + queryAnswer.substring(0,queryAnswer.indexOf("\n")));
if (!Config.display.alwaysOn && Config.display.timeout != 0) {
display_toggle(true);

View File

@ -12,7 +12,7 @@ namespace APRS_IS_Utils {
String checkForStartingBytes(const String& packet);
String buildPacketToUpload(const String& packet);
bool processReceivedLoRaMessage(const String& sender, const String& packet);
bool processReceivedLoRaMessage(const String& sender, const String& packet, bool thirdParty);
void processLoRaPacket(const String& packet);
String buildPacketToTx(const String& aprsisPacket, uint8_t packetType);

View File

@ -84,7 +84,7 @@ namespace DIGI_Utils {
String Addressee = AddresseeAndMessage.substring(0, AddresseeAndMessage.indexOf(":"));
Addressee.trim();
if (Addressee == Config.callsign) { // it's a message for me!
queryMessage = APRS_IS_Utils::processReceivedLoRaMessage(Sender, AddresseeAndMessage);
queryMessage = APRS_IS_Utils::processReceivedLoRaMessage(Sender, AddresseeAndMessage, thirdPartyPacket);
}
}
if (!queryMessage) {

View File

@ -12,12 +12,12 @@ extern int freqError;
namespace QUERY_Utils {
String process(const String& query, const String& station, const uint8_t queryOrigin) {
String process(const String& query, const String& station, bool queryFromAPRSIS, bool thirdParty) {
String answer;
if (query=="?APRS?" || query=="?aprs?" || query=="?Aprs?" || query=="H" || query=="h" || query=="HELP" || query=="Help" || query=="help" || query=="?") {
answer.concat("?APRSV ?APRSP ?APRSL ?APRSH ?WHERE callsign");
} else if (query=="?APRSV" || query=="?aprsv" || query=="?Aprsv") {
answer = "CA2RXU_LoRa_iGate 1.3 v";
answer = "CA2RXU_LoRa_iGate 1.4 v";
answer.concat(versionDate);
} else if (query=="?APRSP" || query=="?aprsp" || query=="?Aprsp") {
answer = "iGate QTH: ";
@ -53,18 +53,17 @@ namespace QUERY_Utils {
processedStation += ' ';
}
String queryAnswer = Config.callsign;
queryAnswer += ">APLRG1,";
if (queryOrigin == 1) { // from APRS-IS
queryAnswer += "TCPIP,qAC::";
} else { // else == 0 , from LoRa
if (Config.beacon.path == "") {
queryAnswer += "RFONLY::";
queryAnswer += ">APLRG1";
if (queryFromAPRSIS) {
queryAnswer += ",TCPIP,qAC";
} else {
queryAnswer += "RFONLY,";
if (!thirdParty) queryAnswer += ",RFONLY";
if (Config.beacon.path != "") {
queryAnswer += ",";
queryAnswer += Config.beacon.path;
}
}
queryAnswer += "::";
}
}
queryAnswer += processedStation;
queryAnswer += ":";
queryAnswer += answer;

View File

@ -6,7 +6,7 @@
namespace QUERY_Utils {
String process(const String& query, const String& station, const uint8_t queryOrigin);
String process(const String& query, const String& station, bool queryFromAPRSIS, bool thirdParty);
}