[AX25] Update to 5.0.0

This commit is contained in:
jgromes 2021-11-14 11:38:05 +01:00
parent fbdb3eb6a2
commit ba1568669f
5 changed files with 123 additions and 122 deletions

View file

@ -58,7 +58,7 @@ void setup() {
// (RF69, CC1101, Si4432 etc.), use the basic begin() method
// int state = radio.begin();
if(state == ERR_NONE) {
if(state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
@ -72,7 +72,7 @@ void setup() {
// source station SSID: 0
// preamble length: 8 bytes
state = ax25.begin("N7LEM");
if(state == ERR_NONE) {
if(state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
@ -97,7 +97,7 @@ void loop() {
// send the frame
Serial.print(F("[AX.25] Sending UI frame ... "));
int state = ax25.sendFrame(&frameUI);
if (state == ERR_NONE) {
if (state == RADIOLIB_ERR_NONE) {
// the packet was successfully transmitted
Serial.println(F("success!"));
@ -125,7 +125,7 @@ void loop() {
// send the frame
Serial.print(F("[AX.25] Sending RR frame ... "));
state = ax25.sendFrame(&frameRR);
if (state == ERR_NONE) {
if (state == RADIOLIB_ERR_NONE) {
// the packet was successfully transmitted
Serial.println(F("success!"));
@ -159,7 +159,7 @@ void loop() {
// send the frame
Serial.print(F("[AX.25] Sending I frame ... "));
state = ax25.sendFrame(&frameI);
if (state == ERR_NONE) {
if (state == RADIOLIB_ERR_NONE) {
// the packet was successfully transmitted
Serial.println(F("success!"));

View file

@ -50,7 +50,7 @@ void setup() {
// (RF69, CC1101,, Si4432 etc.), use the basic begin() method
// int state = radio.begin();
if(state == ERR_NONE) {
if(state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
@ -64,7 +64,7 @@ void setup() {
// source station SSID: 0
// preamble length: 8 bytes
state = ax25.begin("N7LEM");
if(state == ERR_NONE) {
if(state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
@ -79,7 +79,7 @@ void loop() {
// destination station callsign: "NJ7P"
// destination station SSID: 0
int state = ax25.transmit("Hello World!", "NJ7P");
if (state == ERR_NONE) {
if (state == RADIOLIB_ERR_NONE) {
// the packet was successfully transmitted
Serial.println(F("success!"));

View file

@ -53,7 +53,7 @@ void setup() {
// (RF69, CC1101,, Si4432 etc.), use the basic begin() method
// int state = radio.begin();
if(state == ERR_NONE) {
if(state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
@ -67,7 +67,7 @@ void setup() {
// source station SSID: 0
// preamble length: 8 bytes
state = ax25.begin("N7LEM");
if(state == ERR_NONE) {
if(state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
@ -82,7 +82,7 @@ void setup() {
/*
Serial.print(F("[AX.25] Setting correction ... "));
state = ax25.setCorrection(100, -100);
if(state == ERR_NONE) {
if(state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
@ -98,7 +98,7 @@ void loop() {
// destination station callsign: "NJ7P"
// destination station SSID: 0
int state = ax25.transmit("Hello World!", "NJ7P");
if (state == ERR_NONE) {
if (state == RADIOLIB_ERR_NONE) {
// the packet was successfully transmitted
Serial.println(F("success!"));

View file

@ -24,7 +24,7 @@ AX25Frame::AX25Frame(const char* destCallsign, uint8_t destSSID, const char* src
// set repeaters
this->numRepeaters = 0;
#ifndef RADIOLIB_STATIC_ONLY
#if !defined(RADIOLIB_STATIC_ONLY)
this->repeaterCallsigns = NULL;
this->repeaterSSIDs = NULL;
#endif
@ -42,7 +42,7 @@ AX25Frame::AX25Frame(const char* destCallsign, uint8_t destSSID, const char* src
// info field
this->infoLen = infoLen;
if(infoLen > 0) {
#ifndef RADIOLIB_STATIC_ONLY
#if !defined(RADIOLIB_STATIC_ONLY)
this->info = new uint8_t[infoLen];
#endif
memcpy(this->info, info, infoLen);
@ -54,7 +54,7 @@ AX25Frame::AX25Frame(const AX25Frame& frame) {
}
AX25Frame::~AX25Frame() {
#ifndef RADIOLIB_STATIC_ONLY
#if !defined(RADIOLIB_STATIC_ONLY)
// deallocate info field
if(infoLen > 0) {
delete[] this->info;
@ -109,21 +109,21 @@ AX25Frame& AX25Frame::operator=(const AX25Frame& frame) {
int16_t AX25Frame::setRepeaters(char** repeaterCallsigns, uint8_t* repeaterSSIDs, uint8_t numRepeaters) {
// check number of repeaters
if((numRepeaters < 1) || (numRepeaters > 8)) {
return(ERR_INVALID_NUM_REPEATERS);
return(RADIOLIB_ERR_INVALID_NUM_REPEATERS);
}
// check repeater configuration
if((repeaterCallsigns == NULL) || (repeaterSSIDs == NULL)) {
return(ERR_INVALID_NUM_REPEATERS);
return(RADIOLIB_ERR_INVALID_NUM_REPEATERS);
}
for(uint16_t i = 0; i < numRepeaters; i++) {
if(strlen(repeaterCallsigns[i]) > AX25_MAX_CALLSIGN_LEN) {
return(ERR_INVALID_REPEATER_CALLSIGN);
if(strlen(repeaterCallsigns[i]) > RADIOLIB_AX25_MAX_CALLSIGN_LEN) {
return(RADIOLIB_ERR_INVALID_REPEATER_CALLSIGN);
}
}
// create buffers
#ifndef RADIOLIB_STATIC_ONLY
#if !defined(RADIOLIB_STATIC_ONLY)
this->repeaterCallsigns = new char*[numRepeaters];
for(uint8_t i = 0; i < numRepeaters; i++) {
this->repeaterCallsigns[i] = new char[strlen(repeaterCallsigns[i]) + 1];
@ -139,7 +139,7 @@ int16_t AX25Frame::setRepeaters(char** repeaterCallsigns, uint8_t* repeaterSSIDs
}
memcpy(this->repeaterSSIDs, repeaterSSIDs, numRepeaters);
return(ERR_NONE);
return(RADIOLIB_ERR_NONE);
}
void AX25Frame::setRecvSequence(uint8_t seqNumber) {
@ -161,14 +161,14 @@ AX25Client::AX25Client(PhysicalLayer* phy) {
AX25Client::AX25Client(AFSKClient* audio) {
_phy = audio->_phy;
_audio = audio;
_afskMark = AX25_AFSK_MARK;
_afskSpace = AX25_AFSK_SPACE;
_afskMark = RADIOLIB_AX25_AFSK_MARK;
_afskSpace = RADIOLIB_AX25_AFSK_SPACE;
}
int16_t AX25Client::setCorrection(int16_t mark, int16_t space) {
_afskMark = AX25_AFSK_MARK + mark;
_afskSpace = AX25_AFSK_SPACE + space;
return(ERR_NONE);
_afskMark = RADIOLIB_AX25_AFSK_MARK + mark;
_afskSpace = RADIOLIB_AX25_AFSK_SPACE + space;
return(RADIOLIB_ERR_NONE);
}
#endif
@ -177,8 +177,8 @@ int16_t AX25Client::begin(const char* srcCallsign, uint8_t srcSSID, uint8_t prea
_srcSSID = srcSSID;
// check source callsign length (6 characters max)
if(strlen(srcCallsign) > AX25_MAX_CALLSIGN_LEN) {
return(ERR_INVALID_CALLSIGN);
if(strlen(srcCallsign) > RADIOLIB_AX25_MAX_CALLSIGN_LEN) {
return(RADIOLIB_ERR_INVALID_CALLSIGN);
}
// copy callsign
@ -194,10 +194,10 @@ int16_t AX25Client::begin(const char* srcCallsign, uint8_t srcSSID, uint8_t prea
int16_t AX25Client::transmit(const char* str, const char* destCallsign, uint8_t destSSID) {
// create control field
uint8_t controlField = AX25_CONTROL_U_UNNUMBERED_INFORMATION | AX25_CONTROL_POLL_FINAL_DISABLED | AX25_CONTROL_UNNUMBERED_FRAME;
uint8_t controlField = RADIOLIB_AX25_CONTROL_U_UNNUMBERED_INFORMATION | RADIOLIB_AX25_CONTROL_POLL_FINAL_DISABLED | RADIOLIB_AX25_CONTROL_UNNUMBERED_FRAME;
// build the frame
AX25Frame frame(destCallsign, destSSID, _srcCallsign, _srcSSID, controlField, AX25_PID_NO_LAYER_3, (uint8_t*)str, strlen(str));
AX25Frame frame(destCallsign, destSSID, _srcCallsign, _srcSSID, controlField, RADIOLIB_AX25_PID_NO_LAYER_3, (uint8_t*)str, strlen(str));
// send Unnumbered Information frame
return(sendFrame(&frame));
@ -205,27 +205,27 @@ int16_t AX25Client::transmit(const char* str, const char* destCallsign, uint8_t
int16_t AX25Client::sendFrame(AX25Frame* frame) {
// check destination callsign length (6 characters max)
if(strlen(frame->destCallsign) > AX25_MAX_CALLSIGN_LEN) {
return(ERR_INVALID_CALLSIGN);
if(strlen(frame->destCallsign) > RADIOLIB_AX25_MAX_CALLSIGN_LEN) {
return(RADIOLIB_ERR_INVALID_CALLSIGN);
}
// check repeater configuration
#ifndef RADIOLIB_STATIC_ONLY
#if !defined(RADIOLIB_STATIC_ONLY)
if(!(((frame->repeaterCallsigns == NULL) && (frame->repeaterSSIDs == NULL) && (frame->numRepeaters == 0)) ||
((frame->repeaterCallsigns != NULL) && (frame->repeaterSSIDs != NULL) && (frame->numRepeaters != 0)))) {
return(ERR_INVALID_NUM_REPEATERS);
return(RADIOLIB_ERR_INVALID_NUM_REPEATERS);
}
for(uint16_t i = 0; i < frame->numRepeaters; i++) {
if(strlen(frame->repeaterCallsigns[i]) > AX25_MAX_CALLSIGN_LEN) {
return(ERR_INVALID_REPEATER_CALLSIGN);
if(strlen(frame->repeaterCallsigns[i]) > RADIOLIB_AX25_MAX_CALLSIGN_LEN) {
return(RADIOLIB_ERR_INVALID_REPEATER_CALLSIGN);
}
}
#endif
// calculate frame length without FCS (destination address, source address, repeater addresses, control, PID, info)
size_t frameBuffLen = ((2 + frame->numRepeaters)*(AX25_MAX_CALLSIGN_LEN + 1)) + 1 + 1 + frame->infoLen;
size_t frameBuffLen = ((2 + frame->numRepeaters)*(RADIOLIB_AX25_MAX_CALLSIGN_LEN + 1)) + 1 + 1 + frame->infoLen;
// create frame buffer without preamble, start or stop flags
#ifndef RADIOLIB_STATIC_ONLY
#if !defined(RADIOLIB_STATIC_ONLY)
uint8_t* frameBuff = new uint8_t[frameBuffLen + 2];
#else
uint8_t frameBuff[RADIOLIB_STATIC_ARRAY_SIZE];
@ -233,37 +233,37 @@ int16_t AX25Client::sendFrame(AX25Frame* frame) {
uint8_t* frameBuffPtr = frameBuff;
// set destination callsign - all address field bytes are shifted by one bit to make room for HDLC address extension bit
memset(frameBuffPtr, ' ' << 1, AX25_MAX_CALLSIGN_LEN);
memset(frameBuffPtr, ' ' << 1, RADIOLIB_AX25_MAX_CALLSIGN_LEN);
for(size_t i = 0; i < strlen(frame->destCallsign); i++) {
*(frameBuffPtr + i) = frame->destCallsign[i] << 1;
}
frameBuffPtr += AX25_MAX_CALLSIGN_LEN;
frameBuffPtr += RADIOLIB_AX25_MAX_CALLSIGN_LEN;
// set destination SSID
*(frameBuffPtr++) = AX25_SSID_COMMAND_DEST | AX25_SSID_RESERVED_BITS | (frame->destSSID & 0x0F) << 1 | AX25_SSID_HDLC_EXTENSION_CONTINUE;
*(frameBuffPtr++) = RADIOLIB_AX25_SSID_COMMAND_DEST | RADIOLIB_AX25_SSID_RESERVED_BITS | (frame->destSSID & 0x0F) << 1 | RADIOLIB_AX25_SSID_HDLC_EXTENSION_CONTINUE;
// set source callsign - all address field bytes are shifted by one bit to make room for HDLC address extension bit
memset(frameBuffPtr, ' ' << 1, AX25_MAX_CALLSIGN_LEN);
memset(frameBuffPtr, ' ' << 1, RADIOLIB_AX25_MAX_CALLSIGN_LEN);
for(size_t i = 0; i < strlen(frame->srcCallsign); i++) {
*(frameBuffPtr + i) = frame->srcCallsign[i] << 1;
}
frameBuffPtr += AX25_MAX_CALLSIGN_LEN;
frameBuffPtr += RADIOLIB_AX25_MAX_CALLSIGN_LEN;
// set source SSID
*(frameBuffPtr++) = AX25_SSID_RESPONSE_SOURCE | AX25_SSID_RESERVED_BITS | (frame->srcSSID & 0x0F) << 1 | AX25_SSID_HDLC_EXTENSION_CONTINUE;
*(frameBuffPtr++) = RADIOLIB_AX25_SSID_RESPONSE_SOURCE | RADIOLIB_AX25_SSID_RESERVED_BITS | (frame->srcSSID & 0x0F) << 1 | RADIOLIB_AX25_SSID_HDLC_EXTENSION_CONTINUE;
// set repeater callsigns
for(uint16_t i = 0; i < frame->numRepeaters; i++) {
memset(frameBuffPtr, ' ' << 1, AX25_MAX_CALLSIGN_LEN);
memset(frameBuffPtr, ' ' << 1, RADIOLIB_AX25_MAX_CALLSIGN_LEN);
for(size_t j = 0; j < strlen(frame->repeaterCallsigns[i]); j++) {
*(frameBuffPtr + j) = frame->repeaterCallsigns[i][j] << 1;
}
frameBuffPtr += AX25_MAX_CALLSIGN_LEN;
*(frameBuffPtr++) = AX25_SSID_HAS_NOT_BEEN_REPEATED | AX25_SSID_RESERVED_BITS | (frame->repeaterSSIDs[i] & 0x0F) << 1 | AX25_SSID_HDLC_EXTENSION_CONTINUE;
frameBuffPtr += RADIOLIB_AX25_MAX_CALLSIGN_LEN;
*(frameBuffPtr++) = RADIOLIB_AX25_SSID_HAS_NOT_BEEN_REPEATED | RADIOLIB_AX25_SSID_RESERVED_BITS | (frame->repeaterSSIDs[i] & 0x0F) << 1 | RADIOLIB_AX25_SSID_HDLC_EXTENSION_CONTINUE;
}
// set HDLC extension end bit
*(frameBuffPtr - 1) |= AX25_SSID_HDLC_EXTENSION_END;
*(frameBuffPtr - 1) |= RADIOLIB_AX25_SSID_HDLC_EXTENSION_END;
// set sequence numbers of the frames that have it
uint8_t controlField = frame->control;
@ -301,7 +301,7 @@ int16_t AX25Client::sendFrame(AX25Frame* frame) {
*(frameBuffPtr++) = (uint8_t)(fcs & 0xFF);
// prepare buffer for the final frame (stuffed, with added preamble + flags and NRZI-encoded)
#ifndef RADIOLIB_STATIC_ONLY
#if !defined(RADIOLIB_STATIC_ONLY)
// worst-case scenario: sequence of 1s, will have 120% of the original length, stuffed frame also includes both flags
uint8_t* stuffedFrameBuff = new uint8_t[_preambleLen + 1 + (6*frameBuffLen)/5 + 2];
#else
@ -345,13 +345,13 @@ int16_t AX25Client::sendFrame(AX25Frame* frame) {
}
// deallocate memory
#ifndef RADIOLIB_STATIC_ONLY
#if !defined(RADIOLIB_STATIC_ONLY)
delete[] frameBuff;
#endif
// set preamble bytes and start flag field
for(uint16_t i = 0; i < _preambleLen + 1; i++) {
stuffedFrameBuff[i] = AX25_FLAG;
stuffedFrameBuff[i] = RADIOLIB_AX25_FLAG;
}
// get stuffed frame length in bytes
@ -361,10 +361,10 @@ int16_t AX25Client::sendFrame(AX25Frame* frame) {
// set end flag field (may be split into two bytes due to misalignment caused by extra stuffing bits)
if(trailingLen != 0) {
stuffedFrameBuffLen++;
stuffedFrameBuff[stuffedFrameBuffLen - 2] = AX25_FLAG >> trailingLen;
stuffedFrameBuff[stuffedFrameBuffLen - 1] = AX25_FLAG << (8 - trailingLen);
stuffedFrameBuff[stuffedFrameBuffLen - 2] = RADIOLIB_AX25_FLAG >> trailingLen;
stuffedFrameBuff[stuffedFrameBuffLen - 1] = RADIOLIB_AX25_FLAG << (8 - trailingLen);
} else {
stuffedFrameBuff[stuffedFrameBuffLen - 1] = AX25_FLAG;
stuffedFrameBuff[stuffedFrameBuffLen - 1] = RADIOLIB_AX25_FLAG;
}
// convert to NRZI
@ -390,9 +390,10 @@ int16_t AX25Client::sendFrame(AX25Frame* frame) {
}
// transmit
int16_t state = ERR_NONE;
int16_t state = RADIOLIB_ERR_NONE;
#if !defined(RADIOLIB_EXCLUDE_AFSK)
if(_audio != nullptr) {
Module* mod = _phy->getMod();
_phy->transmitDirect();
// iterate over all bytes in the buffer
@ -400,14 +401,14 @@ int16_t AX25Client::sendFrame(AX25Frame* frame) {
// check each bit
for(uint16_t mask = 0x80; mask >= 0x01; mask >>= 1) {
uint32_t start = Module::micros();
uint32_t start = mod->micros();
if(stuffedFrameBuff[i] & mask) {
_audio->tone(_afskMark, false);
} else {
_audio->tone(_afskSpace, false);
}
while(Module::micros() - start < AX25_AFSK_TONE_DURATION) {
Module::yield();
while(mod->micros() - start < RADIOLIB_AX25_AFSK_TONE_DURATION) {
mod->yield();
}
}
@ -423,7 +424,7 @@ int16_t AX25Client::sendFrame(AX25Frame* frame) {
#endif
// deallocate memory
#ifndef RADIOLIB_STATIC_ONLY
#if !defined(RADIOLIB_STATIC_ONLY)
delete[] stuffedFrameBuff;
#endif

View file

@ -1,5 +1,5 @@
#if !defined(_RADIOLIB_AX25_H)
#define _RADIOLIB_AX25_H
#if !defined(_RADIOLIB_RADIOLIB_AX25_H)
#define _RADIOLIB_RADIOLIB_AX25_H
#include "../../TypeDef.h"
@ -9,76 +9,76 @@
#include "../AFSK/AFSK.h"
// macros to access bits in byte array, from http://www.mathcs.emory.edu/~cheung/Courses/255/Syllabus/1-C-intro/bit-array.html
#define SET_BIT_IN_ARRAY(A, k) ( A[(k/8)] |= (1 << (k%8)) )
#define CLEAR_BIT_IN_ARRAY(A, k) ( A[(k/8)] &= ~(1 << (k%8)) )
#define TEST_BIT_IN_ARRAY(A, k) ( A[(k/8)] & (1 << (k%8)) )
#define GET_BIT_IN_ARRAY(A, k) ( (A[(k/8)] & (1 << (k%8))) ? 1 : 0 )
#define SET_BIT_IN_ARRAY(A, k) ( A[(k/8)] |= (1 << (k%8)) )
#define CLEAR_BIT_IN_ARRAY(A, k) ( A[(k/8)] &= ~(1 << (k%8)) )
#define TEST_BIT_IN_ARRAY(A, k) ( A[(k/8)] & (1 << (k%8)) )
#define GET_BIT_IN_ARRAY(A, k) ( (A[(k/8)] & (1 << (k%8))) ? 1 : 0 )
// CRC-CCITT calculation macros
#define XOR(A, B) ( ((A) || (B)) && !((A) && (B)) )
#define CRC_CCITT_POLY 0x1021 // generator polynomial
#define CRC_CCITT_POLY_REVERSED 0x8408 // CRC_CCITT_POLY in reversed bit order
#define CRC_CCITT_INIT 0xFFFF // initial value
#define XOR(A, B) ( ((A) || (B)) && !((A) && (B)) )
#define CRC_CCITT_POLY 0x1021 // generator polynomial
#define CRC_CCITT_POLY_REVERSED 0x8408 // CRC_CCITT_POLY in reversed bit order
#define CRC_CCITT_INIT 0xFFFF // initial value
// maximum callsign length in bytes
#define AX25_MAX_CALLSIGN_LEN 6
#define RADIOLIB_AX25_MAX_CALLSIGN_LEN 6
// flag field MSB LSB DESCRIPTION
#define AX25_FLAG 0b01111110 // 7 0 AX.25 frame start/end flag
#define RADIOLIB_AX25_FLAG 0b01111110 // 7 0 AX.25 frame start/end flag
// address field
#define AX25_SSID_COMMAND_DEST 0b10000000 // 7 7 frame type: command (set in destination SSID)
#define AX25_SSID_COMMAND_SOURCE 0b00000000 // 7 7 command (set in source SSID)
#define AX25_SSID_RESPONSE_DEST 0b00000000 // 7 7 response (set in destination SSID)
#define AX25_SSID_RESPONSE_SOURCE 0b10000000 // 7 7 response (set in source SSID)
#define AX25_SSID_HAS_NOT_BEEN_REPEATED 0b00000000 // 7 7 not repeated yet (set in repeater SSID)
#define AX25_SSID_HAS_BEEN_REPEATED 0b10000000 // 7 7 repeated (set in repeater SSID)
#define AX25_SSID_RESERVED_BITS 0b01100000 // 6 5 reserved bits in SSID
#define AX25_SSID_HDLC_EXTENSION_CONTINUE 0b00000000 // 0 0 HDLC extension bit: next octet contains more address information
#define AX25_SSID_HDLC_EXTENSION_END 0b00000001 // 0 0 address field end
#define RADIOLIB_AX25_SSID_COMMAND_DEST 0b10000000 // 7 7 frame type: command (set in destination SSID)
#define RADIOLIB_AX25_SSID_COMMAND_SOURCE 0b00000000 // 7 7 command (set in source SSID)
#define RADIOLIB_AX25_SSID_RESPONSE_DEST 0b00000000 // 7 7 response (set in destination SSID)
#define RADIOLIB_AX25_SSID_RESPONSE_SOURCE 0b10000000 // 7 7 response (set in source SSID)
#define RADIOLIB_AX25_SSID_HAS_NOT_BEEN_REPEATED 0b00000000 // 7 7 not repeated yet (set in repeater SSID)
#define RADIOLIB_AX25_SSID_HAS_BEEN_REPEATED 0b10000000 // 7 7 repeated (set in repeater SSID)
#define RADIOLIB_AX25_SSID_RESERVED_BITS 0b01100000 // 6 5 reserved bits in SSID
#define RADIOLIB_AX25_SSID_HDLC_EXTENSION_CONTINUE 0b00000000 // 0 0 HDLC extension bit: next octet contains more address information
#define RADIOLIB_AX25_SSID_HDLC_EXTENSION_END 0b00000001 // 0 0 address field end
// control field
#define AX25_CONTROL_U_SET_ASYNC_BAL_MODE 0b01101100 // 7 2 U frame type: set asynchronous balanced mode (connect request)
#define AX25_CONTROL_U_SET_ASYNC_BAL_MODE_EXT 0b00101100 // 7 2 set asynchronous balanced mode extended (connect request with module 128)
#define AX25_CONTROL_U_DISCONNECT 0b01000000 // 7 2 disconnect request
#define AX25_CONTROL_U_DISCONNECT_MODE 0b00001100 // 7 2 disconnect mode (system busy or disconnected)
#define AX25_CONTROL_U_UNNUMBERED_ACK 0b01100000 // 7 2 unnumbered acknowledge
#define AX25_CONTROL_U_FRAME_REJECT 0b10000100 // 7 2 frame reject
#define AX25_CONTROL_U_UNNUMBERED_INFORMATION 0b00000000 // 7 2 unnumbered information
#define AX25_CONTROL_U_EXHANGE_IDENTIFICATION 0b10101100 // 7 2 exchange ID
#define AX25_CONTROL_U_TEST 0b11100000 // 7 2 test
#define AX25_CONTROL_POLL_FINAL_ENABLED 0b00010000 // 4 4 control field poll/final bit: enabled
#define AX25_CONTROL_POLL_FINAL_DISABLED 0b00000000 // 4 4 disabled
#define AX25_CONTROL_S_RECEIVE_READY 0b00000000 // 3 2 S frame type: receive ready (system ready to receive)
#define AX25_CONTROL_S_RECEIVE_NOT_READY 0b00000100 // 3 2 receive not ready (TNC buffer full)
#define AX25_CONTROL_S_REJECT 0b00001000 // 3 2 reject (out of sequence or duplicate)
#define AX25_CONTROL_S_SELECTIVE_REJECT 0b00001100 // 3 2 selective reject (single frame repeat request)
#define AX25_CONTROL_INFORMATION_FRAME 0b00000000 // 0 0 frame type: information (I frame)
#define AX25_CONTROL_SUPERVISORY_FRAME 0b00000001 // 1 0 supervisory (S frame)
#define AX25_CONTROL_UNNUMBERED_FRAME 0b00000011 // 1 0 unnumbered (U frame)
#define RADIOLIB_AX25_CONTROL_U_SET_ASYNC_BAL_MODE 0b01101100 // 7 2 U frame type: set asynchronous balanced mode (connect request)
#define RADIOLIB_AX25_CONTROL_U_SET_ASYNC_BAL_MODE_EXT 0b00101100 // 7 2 set asynchronous balanced mode extended (connect request with module 128)
#define RADIOLIB_AX25_CONTROL_U_DISCONNECT 0b01000000 // 7 2 disconnect request
#define RADIOLIB_AX25_CONTROL_U_DISCONNECT_MODE 0b00001100 // 7 2 disconnect mode (system busy or disconnected)
#define RADIOLIB_AX25_CONTROL_U_UNNUMBERED_ACK 0b01100000 // 7 2 unnumbered acknowledge
#define RADIOLIB_AX25_CONTROL_U_FRAME_REJECT 0b10000100 // 7 2 frame reject
#define RADIOLIB_AX25_CONTROL_U_UNNUMBERED_INFORMATION 0b00000000 // 7 2 unnumbered information
#define RADIOLIB_AX25_CONTROL_U_EXHANGE_IDENTIFICATION 0b10101100 // 7 2 exchange ID
#define RADIOLIB_AX25_CONTROL_U_TEST 0b11100000 // 7 2 test
#define RADIOLIB_AX25_CONTROL_POLL_FINAL_ENABLED 0b00010000 // 4 4 control field poll/final bit: enabled
#define RADIOLIB_AX25_CONTROL_POLL_FINAL_DISABLED 0b00000000 // 4 4 disabled
#define RADIOLIB_AX25_CONTROL_S_RECEIVE_READY 0b00000000 // 3 2 S frame type: receive ready (system ready to receive)
#define RADIOLIB_AX25_CONTROL_S_RECEIVE_NOT_READY 0b00000100 // 3 2 receive not ready (TNC buffer full)
#define RADIOLIB_AX25_CONTROL_S_REJECT 0b00001000 // 3 2 reject (out of sequence or duplicate)
#define RADIOLIB_AX25_CONTROL_S_SELECTIVE_REJECT 0b00001100 // 3 2 selective reject (single frame repeat request)
#define RADIOLIB_AX25_CONTROL_INFORMATION_FRAME 0b00000000 // 0 0 frame type: information (I frame)
#define RADIOLIB_AX25_CONTROL_SUPERVISORY_FRAME 0b00000001 // 1 0 supervisory (S frame)
#define RADIOLIB_AX25_CONTROL_UNNUMBERED_FRAME 0b00000011 // 1 0 unnumbered (U frame)
// protocol identifier field
#define AX25_PID_ISO_8208 0x01
#define AX25_PID_TCP_IP_COMPRESSED 0x06
#define AX25_PID_TCP_IP_UNCOMPRESSED 0x07
#define AX25_PID_SEGMENTATION_FRAGMENT 0x08
#define AX25_PID_TEXNET_DATAGRAM_PROTOCOL 0xC3
#define AX25_PID_LINK_QUALITY_PROTOCOL 0xC4
#define AX25_PID_APPLETALK 0xCA
#define AX25_PID_APPLETALK_ARP 0xCB
#define AX25_PID_ARPA_INTERNET_PROTOCOL 0xCC
#define AX25_PID_ARPA_ADDRESS_RESOLUTION 0xCD
#define AX25_PID_FLEXNET 0xCE
#define AX25_PID_NET_ROM 0xCF
#define AX25_PID_NO_LAYER_3 0xF0
#define AX25_PID_ESCAPE_CHARACTER 0xFF
#define RADIOLIB_AX25_PID_ISO_8208 0x01
#define RADIOLIB_AX25_PID_TCP_IP_COMPRESSED 0x06
#define RADIOLIB_AX25_PID_TCP_IP_UNCOMPRESSED 0x07
#define RADIOLIB_AX25_PID_SEGMENTATION_FRAGMENT 0x08
#define RADIOLIB_AX25_PID_TEXNET_DATAGRAM_PROTOCOL 0xC3
#define RADIOLIB_AX25_PID_LINK_QUALITY_PROTOCOL 0xC4
#define RADIOLIB_AX25_PID_APPLETALK 0xCA
#define RADIOLIB_AX25_PID_APPLETALK_ARP 0xCB
#define RADIOLIB_AX25_PID_ARPA_INTERNET_PROTOCOL 0xCC
#define RADIOLIB_AX25_PID_ARPA_ADDRESS_RESOLUTION 0xCD
#define RADIOLIB_AX25_PID_FLEXNET 0xCE
#define RADIOLIB_AX25_PID_NET_ROM 0xCF
#define RADIOLIB_AX25_PID_NO_LAYER_3 0xF0
#define RADIOLIB_AX25_PID_ESCAPE_CHARACTER 0xFF
// AFSK tones in Hz
#define AX25_AFSK_MARK 1200
#define AX25_AFSK_SPACE 2200
#define RADIOLIB_AX25_AFSK_MARK 1200
#define RADIOLIB_AX25_AFSK_SPACE 2200
// tone duration in us (for 1200 baud AFSK)
#define AX25_AFSK_TONE_DURATION 833
#define RADIOLIB_AX25_AFSK_TONE_DURATION 833
/*!
\class AX25Frame
@ -90,7 +90,7 @@ class AX25Frame {
/*!
\brief Callsign of the destination station.
*/
char destCallsign[AX25_MAX_CALLSIGN_LEN + 1];
char destCallsign[RADIOLIB_AX25_MAX_CALLSIGN_LEN + 1];
/*!
\brief SSID of the destination station.
@ -100,7 +100,7 @@ class AX25Frame {
/*!
\brief Callsign of the source station.
*/
char srcCallsign[AX25_MAX_CALLSIGN_LEN + 1];
char srcCallsign[RADIOLIB_AX25_MAX_CALLSIGN_LEN + 1];
/*!
\brief SSID of the source station.
@ -137,7 +137,7 @@ class AX25Frame {
*/
uint16_t sendSeqNumber;
#ifndef RADIOLIB_STATIC_ONLY
#if !defined(RADIOLIB_STATIC_ONLY)
/*!
\brief The info field.
*/
@ -161,7 +161,7 @@ class AX25Frame {
/*!
\brief Array of repeater callsigns.
*/
char repeaterCallsigns[8][AX25_MAX_CALLSIGN_LEN + 1];
char repeaterCallsigns[8][RADIOLIB_AX25_MAX_CALLSIGN_LEN + 1];
/*!
\brief Array of repeater SSIDs.
@ -314,7 +314,7 @@ class AX25Client {
\param srcSSID 4-bit SSID of the source station (in case there are more stations with the same callsign). Defaults to 0.
\param preambleLen Number of "preamble" bytes (AX25_FLAG) sent ahead of the actual AX.25 frame. Does not include the first AX25_FLAG byte, which is considered part of the frame. Defaults to 8.
\param preambleLen Number of "preamble" bytes (RADIOLIB_AX25_FLAG) sent ahead of the actual AX.25 frame. Does not include the first RADIOLIB_AX25_FLAG byte, which is considered part of the frame. Defaults to 8.
\returns \ref status_codes
*/
@ -342,7 +342,7 @@ class AX25Client {
*/
int16_t sendFrame(AX25Frame* frame);
#ifndef RADIOLIB_GODMODE
#if !defined(ADIOLIB_GODMODE)
private:
#endif
PhysicalLayer* _phy;
@ -352,7 +352,7 @@ class AX25Client {
uint32_t _afskSpace;
#endif
char _srcCallsign[AX25_MAX_CALLSIGN_LEN + 1] = {0, 0, 0, 0, 0, 0, 0};
char _srcCallsign[RADIOLIB_AX25_MAX_CALLSIGN_LEN + 1] = {0, 0, 0, 0, 0, 0, 0};
uint8_t _srcSSID = 0;
uint16_t _preambleLen = 0;