mirror of
https://github.com/richonguzman/LoRa_APRS_iGate.git
synced 2026-08-07 09:22:57 +02:00
test1
This commit is contained in:
+9
-11
@@ -195,7 +195,6 @@ namespace APRS_IS_Utils {
|
||||
if ((packet.substring(0, 3) == "\x3c\xff\x01") && (packet.indexOf("TCPIP") == -1) && (packet.indexOf("NOGATE") == -1) && (packet.indexOf("RFONLY") == -1)) {
|
||||
Sender = packet.substring(3, packet.indexOf(">"));
|
||||
if (Sender != Config.callsign && Utils::checkValidCallsign(Sender)) {
|
||||
//if (Sender != Config.callsign) { // avoid listening yourself by digirepeating
|
||||
if (STATION_Utils::check25SegBuffer(Sender, packet.substring(packet.indexOf(":")+2))) {
|
||||
STATION_Utils::updateLastHeard(Sender);
|
||||
Utils::typeOfPacket(packet.substring(3), 0); // LoRa-APRS
|
||||
@@ -231,9 +230,9 @@ namespace APRS_IS_Utils {
|
||||
void processAPRSISPacket(const String& packet) {
|
||||
String Sender, AddresseeAndMessage, Addressee, receivedMessage;
|
||||
if (!packet.startsWith("#")) {
|
||||
Sender = packet.substring(0, packet.indexOf(">"));
|
||||
if (Utils::checkValidCallsign(Sender)) {
|
||||
if (Config.aprs_is.messagesToRF && packet.indexOf("::") > 0) {
|
||||
if (Config.aprs_is.messagesToRF && packet.indexOf("::") > 0) {
|
||||
Sender = packet.substring(0, packet.indexOf(">"));
|
||||
if (Utils::checkValidCallsign(Sender)) {
|
||||
AddresseeAndMessage = packet.substring(packet.indexOf("::") + 2);
|
||||
Addressee = AddresseeAndMessage.substring(0, AddresseeAndMessage.indexOf(":"));
|
||||
Addressee.trim();
|
||||
@@ -283,7 +282,6 @@ namespace APRS_IS_Utils {
|
||||
} else {
|
||||
Utils::print("Received Message from APRS-IS : " + packet);
|
||||
if (STATION_Utils::wasHeard(Addressee) && Utils::checkValidCallsign(Addressee)) {
|
||||
//if (STATION_Utils::wasHeard(Addressee)) {
|
||||
STATION_Utils::addToOutputPacketBuffer(buildPacketToTx(packet, 1));
|
||||
display_toggle(true);
|
||||
lastScreenOn = millis();
|
||||
@@ -291,13 +289,13 @@ namespace APRS_IS_Utils {
|
||||
}
|
||||
}
|
||||
show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine, 0);
|
||||
} else if (Config.aprs_is.objectsToRF && packet.indexOf(":;") > 0) {
|
||||
Utils::println("Received Object from APRS-IS : " + packet);
|
||||
STATION_Utils::addToOutputPacketBuffer(buildPacketToTx(packet, 5));
|
||||
display_toggle(true);
|
||||
lastScreenOn = millis();
|
||||
Utils::typeOfPacket(packet, 1); // APRS-LoRa
|
||||
}
|
||||
} else if (Config.aprs_is.objectsToRF && packet.indexOf(":;") > 0) {
|
||||
Utils::println("Received Object from APRS-IS : " + packet);
|
||||
STATION_Utils::addToOutputPacketBuffer(buildPacketToTx(packet, 5));
|
||||
display_toggle(true);
|
||||
lastScreenOn = millis();
|
||||
Utils::typeOfPacket(packet, 1); // APRS-LoRa
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,6 @@ namespace DIGI_Utils {
|
||||
if ((packet.substring(0, 3) == "\x3c\xff\x01") && (packet.indexOf("NOGATE") == -1)) {
|
||||
Sender = packet.substring(3, packet.indexOf(">"));
|
||||
if (Sender != Config.callsign && Utils::checkValidCallsign(Sender)) {
|
||||
//if (Sender != Config.callsign) {
|
||||
if (STATION_Utils::check25SegBuffer(Sender, packet.substring(packet.indexOf(":") + 2))) {
|
||||
STATION_Utils::updateLastHeard(Sender);
|
||||
Utils::typeOfPacket(packet.substring(3), 2); // Digi
|
||||
|
||||
+14
-4
@@ -326,6 +326,9 @@ namespace Utils {
|
||||
}
|
||||
|
||||
bool checkValidCallsign(const String& callsign) {
|
||||
if (callsign == "WLNK-1") {
|
||||
return true;
|
||||
}
|
||||
String cleanCallsign;
|
||||
if (callsign.indexOf("-")) {
|
||||
cleanCallsign = callsign.substring(0, callsign.indexOf("-"));
|
||||
@@ -343,11 +346,18 @@ namespace Utils {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isDigit(cleanCallsign[1]) && cleanCallsign.length() < 6) {
|
||||
if (isDigit(cleanCallsign[1]) && cleanCallsign.length() < 6 && cleanCallsign.indexOf("S5") != 0 && cleanCallsign.indexOf("E7") != 0 && cleanCallsign.indexOf("Z3") != 0) {
|
||||
cleanCallsign = " " + cleanCallsign; // ANAA --> _ANAA
|
||||
}
|
||||
if (!isAlpha(cleanCallsign[1]) && !isDigit(cleanCallsign[2]) && !isAlpha(cleanCallsign[3])) {
|
||||
return false;
|
||||
|
||||
if (cleanCallsign.indexOf("S5") == 0 || cleanCallsign.indexOf("E7") == 0 || cleanCallsign.indexOf("Z3") == 0) {
|
||||
if (!isDigit(cleanCallsign[2]) && !isAlpha(cleanCallsign[3])) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (!isAlphaNumeric(cleanCallsign[1]) && !isDigit(cleanCallsign[2]) && !isAlpha(cleanCallsign[3])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (cleanCallsign.length() == 5 && !isAlpha(cleanCallsign[4])) {
|
||||
return false;
|
||||
@@ -357,7 +367,7 @@ namespace Utils {
|
||||
}
|
||||
/* ABCDEFG - XX
|
||||
0 A = _ or alpha num
|
||||
1 B = alpha
|
||||
1 B = alpha (+num S5, E7, Z3)
|
||||
2 C = num
|
||||
3 D = alpha
|
||||
4 E = _ or alpha
|
||||
|
||||
Reference in New Issue
Block a user