first 3rdparty correction
This commit is contained in:
parent
35e79709e3
commit
7baa98bf7e
|
|
@ -37,7 +37,7 @@ ________________________________________________________________________________
|
|||
#include "A7670_utils.h"
|
||||
#endif
|
||||
|
||||
String versionDate = "2024.06.21";
|
||||
String versionDate = "2024.06.24";
|
||||
Configuration Config;
|
||||
WiFiClient espClient;
|
||||
|
||||
|
|
|
|||
|
|
@ -129,51 +129,6 @@ namespace APRS_IS_Utils {
|
|||
return buildedPacket;
|
||||
}
|
||||
|
||||
String buildPacketToTx(const String& aprsisPacket, uint8_t packetType) {
|
||||
String packet = aprsisPacket;
|
||||
packet.trim();
|
||||
String outputPacket = Config.callsign;
|
||||
outputPacket += ">APLRG1";
|
||||
if (Config.beacon.path != "") {
|
||||
outputPacket += ",";
|
||||
outputPacket += Config.beacon.path;
|
||||
}
|
||||
outputPacket += ":}";
|
||||
outputPacket += packet.substring(0, packet.indexOf(",")); // Callsign>Tocall
|
||||
outputPacket.concat(",TCPIP,");
|
||||
outputPacket.concat(Config.callsign);
|
||||
outputPacket.concat("*");
|
||||
switch (packetType) {
|
||||
case 0: // gps
|
||||
if (packet.indexOf(":=") > 0) {
|
||||
outputPacket += packet.substring(packet.indexOf(":="));
|
||||
} else {
|
||||
outputPacket += packet.substring(packet.indexOf(":!"));
|
||||
}
|
||||
break;
|
||||
case 1: // messages
|
||||
outputPacket += packet.substring(packet.indexOf("::"));
|
||||
break;
|
||||
case 2: // status
|
||||
outputPacket += packet.substring(packet.indexOf(":>"));
|
||||
break;
|
||||
case 3: // telemetry
|
||||
outputPacket += packet.substring(packet.indexOf("::"));
|
||||
break;
|
||||
case 4: // mic-e
|
||||
if (packet.indexOf(":`") > 0) {
|
||||
outputPacket += packet.substring(packet.indexOf(":`"));
|
||||
} else {
|
||||
outputPacket += packet.substring(packet.indexOf(":'"));
|
||||
}
|
||||
break;
|
||||
case 5: // object
|
||||
outputPacket += packet.substring(packet.indexOf(":;"));
|
||||
break;
|
||||
}
|
||||
return outputPacket;
|
||||
}
|
||||
|
||||
bool processReceivedLoRaMessage(const String& sender, const String& packet) {
|
||||
String receivedMessage;
|
||||
if (packet.indexOf("{") > 0) { // ack?
|
||||
|
|
@ -220,40 +175,88 @@ namespace APRS_IS_Utils {
|
|||
void processLoRaPacket(const String& packet) {
|
||||
if (espClient.connected() || modemLoggedToAPRSIS) {
|
||||
if (packet != "") {
|
||||
if ((packet.substring(0, 3) == "\x3c\xff\x01") && (packet.indexOf("}") == -1 && packet.indexOf("TCPIP") == -1) && (packet.indexOf("NOGATE") == -1) && (packet.indexOf("RFONLY") == -1)) {
|
||||
const String& Sender = packet.substring(3, packet.indexOf(">"));
|
||||
if (Sender != Config.callsign && Utils::checkValidCallsign(Sender)) {
|
||||
STATION_Utils::updateLastHeard(Sender);
|
||||
Utils::typeOfPacket(packet.substring(3), 0); // LoRa-APRS
|
||||
const String& AddresseeAndMessage = packet.substring(packet.indexOf("::") + 2);
|
||||
String Addressee = AddresseeAndMessage.substring(0, AddresseeAndMessage.indexOf(":"));
|
||||
Addressee.trim();
|
||||
bool queryMessage = false;
|
||||
if (packet.indexOf("::") > 10 && Addressee == Config.callsign) { // its a message for me!
|
||||
queryMessage = processReceivedLoRaMessage(Sender, checkForStartingBytes(AddresseeAndMessage));
|
||||
}
|
||||
if (!queryMessage) {
|
||||
const String& aprsPacket = buildPacketToUpload(packet);
|
||||
if (!Config.display.alwaysOn && Config.display.timeout != 0) {
|
||||
display_toggle(true);
|
||||
if ((packet.substring(0, 3) == "\x3c\xff\x01") && (packet.indexOf("NOGATE") == -1) && (packet.indexOf("RFONLY") == -1)) {
|
||||
int firstColonIndex = packet.indexOf(":");
|
||||
if (firstColonIndex > 0 && packet[firstColonIndex + 1] == '}' && packet.indexOf("TCPIP") == -1) {
|
||||
const String& Sender = packet.substring(3, packet.indexOf(">"));
|
||||
if (Sender != Config.callsign && Utils::checkValidCallsign(Sender)) {
|
||||
STATION_Utils::updateLastHeard(Sender);
|
||||
Utils::typeOfPacket(packet.substring(3), 0); // LoRa-APRS
|
||||
const String& AddresseeAndMessage = packet.substring(packet.indexOf("::") + 2);
|
||||
String Addressee = AddresseeAndMessage.substring(0, AddresseeAndMessage.indexOf(":"));
|
||||
Addressee.trim();
|
||||
bool queryMessage = false;
|
||||
if (packet.indexOf("::") > 10 && Addressee == Config.callsign) { // its a message for me!
|
||||
queryMessage = processReceivedLoRaMessage(Sender, checkForStartingBytes(AddresseeAndMessage));
|
||||
}
|
||||
if (!queryMessage) {
|
||||
const String& aprsPacket = buildPacketToUpload(packet);
|
||||
if (!Config.display.alwaysOn && Config.display.timeout != 0) {
|
||||
display_toggle(true);
|
||||
}
|
||||
lastScreenOn = millis();
|
||||
#ifdef HAS_A7670
|
||||
stationBeacon = true;
|
||||
A7670_Utils::uploadToAPRSIS(aprsPacket);
|
||||
stationBeacon = false;
|
||||
#else
|
||||
upload(aprsPacket);
|
||||
#endif
|
||||
Utils::println("---> Uploaded to APRS-IS");
|
||||
show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine, 0);
|
||||
}
|
||||
lastScreenOn = millis();
|
||||
#ifdef HAS_A7670
|
||||
stationBeacon = true;
|
||||
A7670_Utils::uploadToAPRSIS(aprsPacket);
|
||||
stationBeacon = false;
|
||||
#else
|
||||
upload(aprsPacket);
|
||||
#endif
|
||||
Utils::println("---> Uploaded to APRS-IS");
|
||||
show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String buildPacketToTx(const String& aprsisPacket, uint8_t packetType) {
|
||||
String packet = aprsisPacket;
|
||||
packet.trim();
|
||||
String outputPacket = Config.callsign;
|
||||
outputPacket += ">APLRG1";
|
||||
if (Config.beacon.path != "") {
|
||||
outputPacket += ",";
|
||||
outputPacket += Config.beacon.path;
|
||||
}
|
||||
outputPacket += ":}";
|
||||
outputPacket += packet.substring(0, packet.indexOf(",")); // Callsign>Tocall
|
||||
outputPacket.concat(",TCPIP,");
|
||||
outputPacket.concat(Config.callsign);
|
||||
outputPacket.concat("*");
|
||||
switch (packetType) {
|
||||
case 0: // gps
|
||||
if (packet.indexOf(":=") > 0) {
|
||||
outputPacket += packet.substring(packet.indexOf(":="));
|
||||
} else {
|
||||
outputPacket += packet.substring(packet.indexOf(":!"));
|
||||
}
|
||||
break;
|
||||
case 1: // messages
|
||||
outputPacket += packet.substring(packet.indexOf("::"));
|
||||
break;
|
||||
case 2: // status
|
||||
outputPacket += packet.substring(packet.indexOf(":>"));
|
||||
break;
|
||||
case 3: // telemetry
|
||||
outputPacket += packet.substring(packet.indexOf("::"));
|
||||
break;
|
||||
case 4: // mic-e
|
||||
if (packet.indexOf(":`") > 0) {
|
||||
outputPacket += packet.substring(packet.indexOf(":`"));
|
||||
} else {
|
||||
outputPacket += packet.substring(packet.indexOf(":'"));
|
||||
}
|
||||
break;
|
||||
case 5: // object
|
||||
outputPacket += packet.substring(packet.indexOf(":;"));
|
||||
break;
|
||||
}
|
||||
return outputPacket;
|
||||
}
|
||||
|
||||
void processAPRSISPacket(const String& packet) {
|
||||
if (!packet.startsWith("#")) {
|
||||
if (Config.aprs_is.messagesToRF && packet.indexOf("::") > 0) {
|
||||
|
|
|
|||
|
|
@ -10,10 +10,12 @@ namespace APRS_IS_Utils {
|
|||
void connect();
|
||||
void checkStatus();
|
||||
String checkForStartingBytes(const String& packet);
|
||||
|
||||
String buildPacketToUpload(const String& packet);
|
||||
String buildPacketToTx(const String& aprsisPacket, uint8_t packetType);
|
||||
bool processReceivedLoRaMessage(const String& sender, const String& packet);
|
||||
void processLoRaPacket(const String& packet);
|
||||
|
||||
String buildPacketToTx(const String& aprsisPacket, uint8_t packetType);
|
||||
void processAPRSISPacket(const String& packet);
|
||||
void listenAPRSIS();
|
||||
|
||||
|
|
|
|||
|
|
@ -62,7 +62,8 @@ namespace DIGI_Utils {
|
|||
if ((packet.substring(0, 3) == "\x3c\xff\x01") && (packet.indexOf("NOGATE") == -1)) {
|
||||
bool thirdPartyPacket = false;
|
||||
String temp, Sender;
|
||||
if (packet.indexOf("}") > 0 && packet.indexOf("TCPIP") > 0) { // 3rd Party
|
||||
int firstColonIndex = packet.indexOf(":");
|
||||
if (firstColonIndex > 0 && packet[firstColonIndex + 1] == '}' && packet.indexOf("TCPIP") > 0) { // 3rd Party
|
||||
thirdPartyPacket = true;
|
||||
temp = packet.substring(packet.indexOf(":}") + 2);
|
||||
Sender = temp.substring(0, temp.indexOf(">"));
|
||||
|
|
|
|||
Loading…
Reference in New Issue