Browse Source

Update frame from TCPIP and APRX

master
US1GHQ 1 month ago
parent
commit
dd653c75dc
  1. 6
      include/version.h
  2. 39
      lib/KISS_TO_TNC2/KISS_TO_TNC2.cpp

6
include/version.h

@ -1,10 +1,10 @@
#ifndef BUILD_NUMBER
#define BUILD_NUMBER "163"
#define BUILD_NUMBER "191"
#endif
#ifndef VERSION
#define VERSION "v0.4.1.163- - 2021-09-15 19:52:36.196438"
#define VERSION "v0.4.2.191- - 2021-09-15 22:11:52.858358"
#endif
#ifndef VERSION_SHORT
#define VERSION_SHORT "v0.4.1.163-"
#define VERSION_SHORT "v0.4.2.191-"
#endif

39
lib/KISS_TO_TNC2/KISS_TO_TNC2.cpp

@ -4,7 +4,7 @@ bool validateTNC2Frame(const String &tnc2FormattedFrame);
String encode_address_ax25(String tnc2Address);
String decode_address_ax25(const String &ax25Address, bool &isLast, bool isRelay);
String decode_path_ax25(const String &ax25Address, bool &isLast, bool isRelay);
String decode_path_ax25(const String &ax25Address);
bool validateKISSFrame(const String &kissFormattedFrame);
@ -137,23 +137,19 @@ String decapsulateKISS(const String &frame) {
String decode_kiss(const String &inputKISSTNCFrame, bool &dataFrame, bool &pktFrame) {
String TNC2Frame = "";
if (validateKISSFrame(inputKISSTNCFrame))
{
if (validateKISSFrame(inputKISSTNCFrame)) {
dataFrame = inputKISSTNCFrame.charAt(1) == CMD_DATA;
String ax25Frame = decapsulateKISS(inputKISSTNCFrame);
bool isLast = false;
String dest_1 = decode_path_ax25(ax25Frame.substring(14, 56), isLast, false);
for (int p = 0; p <= dest_1.indexOf("WIDE"); p++) { pktFrame = true; }
String dest_2 = decode_path_ax25(ax25Frame.substring(14, 56), isLast, false);
for (int p = 0; p <= dest_2.indexOf("ECHO"); p++) { pktFrame = true; }
String dest_3 = decode_path_ax25(ax25Frame.substring(14, 56), isLast, false);
for (int p = 0; p <= dest_3.indexOf("TRACE"); p++) { pktFrame = true; }
String dest_4 = decode_path_ax25(ax25Frame.substring(14, 56), isLast, false);
for (int p = 0; p <= dest_4.indexOf("RELAY"); p++) { pktFrame = true; }
String dest_5 = decode_path_ax25(ax25Frame.substring(14, 56), isLast, false);
for (int p = 0; p <= dest_5.indexOf("TCPIP"); p++) { pktFrame = true; }
}
if (validateKISSFrame(inputKISSTNCFrame)) {
dataFrame = inputKISSTNCFrame.charAt(1) == CMD_DATA;
String dest_1 = decode_path_ax25(ax25Frame.substring(14, 56));
for (int p = 0; p <= dest_1.indexOf("WIDE"); p++) { pktFrame = true;}
String dest_2 = decode_path_ax25(ax25Frame.substring(14, 56));
for (int p = 0; p <= dest_2.indexOf("ECHO"); p++) { pktFrame = true;}
String dest_3 = decode_path_ax25(ax25Frame.substring(14, 56));
for (int p = 0; p <= dest_3.indexOf("TRACE"); p++) { pktFrame = true;}
String dest_4 = decode_path_ax25(ax25Frame.substring(14, 56));
for (int p = 0; p <= dest_4.indexOf("RELAY"); p++) { pktFrame = true;}
String dest_5 = decode_path_ax25(ax25Frame.substring(0, 7));
for (int p = 0; p <= dest_5.indexOf("APRS"); p++) { pktFrame = true;}
if (dataFrame && !pktFrame) {
String ax25Frame = decapsulateKISS(inputKISSTNCFrame);
delay(250);
@ -245,7 +241,7 @@ String decode_address_ax25(const String &ax25Address, bool &isLast, bool isRelay
return TNCAddress;
}
String decode_path_ax25(const String &ax25Address, bool &isLast, bool isRelay) {
String decode_path_ax25(const String &ax25Address) {
String TNCAddress = "";
for (int i = 0; i < 42; ++i) {
uint8_t currentCharacter = ax25Address.charAt(i);
@ -254,13 +250,6 @@ String decode_path_ax25(const String &ax25Address, bool &isLast, bool isRelay) {
TNCAddress += (char) currentCharacter;
}
}
auto ssid_char = (uint8_t) ax25Address.charAt(6);
int ssid = 0b1111 & ssid_char;
if (ssid)
{
TNCAddress += '-';
TNCAddress += ssid;
}
return TNCAddress;
}

Loading…
Cancel
Save