[APRS] Use compact Doxygen and stop using reserved format

This commit is contained in:
jgromes 2023-04-22 19:35:58 +02:00
parent 5da2a023fe
commit 668ff4fb01
2 changed files with 21 additions and 47 deletions

View file

@ -5,17 +5,17 @@
#if !defined(RADIOLIB_EXCLUDE_APRS)
APRSClient::APRSClient(AX25Client* ax) {
_ax = ax;
axClient = ax;
}
int16_t APRSClient::begin(char symbol, bool alt) {
RADIOLIB_CHECK_RANGE(symbol, ' ', '}', RADIOLIB_ERR_INVALID_SYMBOL);
_symbol = symbol;
int16_t APRSClient::begin(char sym, bool alt) {
RADIOLIB_CHECK_RANGE(sym, ' ', '}', RADIOLIB_ERR_INVALID_SYMBOL);
symbol = sym;
if(alt) {
_table = '\\';
table = '\\';
} else {
_table = '/';
table = '/';
}
return(RADIOLIB_ERR_NONE);
@ -38,16 +38,16 @@ int16_t APRSClient::sendPosition(char* destCallsign, uint8_t destSSID, char* lat
// build the info field
if((msg == NULL) && (time == NULL)) {
// no message, no timestamp
sprintf(info, RADIOLIB_APRS_DATA_TYPE_POSITION_NO_TIME_NO_MSG "%s%c%s%c", lat, _table, lon, _symbol);
sprintf(info, RADIOLIB_APRS_DATA_TYPE_POSITION_NO_TIME_NO_MSG "%s%c%s%c", lat, table, lon, symbol);
} else if((msg != NULL) && (time == NULL)) {
// message, no timestamp
sprintf(info, RADIOLIB_APRS_DATA_TYPE_POSITION_NO_TIME_MSG "%s%c%s%c%s", lat, _table, lon, _symbol, msg);
sprintf(info, RADIOLIB_APRS_DATA_TYPE_POSITION_NO_TIME_MSG "%s%c%s%c%s", lat, table, lon, symbol, msg);
} else if((msg == NULL) && (time != NULL)) {
// timestamp, no message
sprintf(info, RADIOLIB_APRS_DATA_TYPE_POSITION_TIME_NO_MSG "%s%s%c%s%c", time, lat, _table, lon, _symbol);
sprintf(info, RADIOLIB_APRS_DATA_TYPE_POSITION_TIME_NO_MSG "%s%s%c%s%c", time, lat, table, lon, symbol);
} else {
// timestamp and message
sprintf(info, RADIOLIB_APRS_DATA_TYPE_POSITION_TIME_MSG "%s%s%c%s%c%s", time, lat, _table, lon, _symbol, msg);
sprintf(info, RADIOLIB_APRS_DATA_TYPE_POSITION_TIME_MSG "%s%s%c%s%c%s", time, lat, table, lon, symbol, msg);
}
// send the frame
@ -170,8 +170,8 @@ int16_t APRSClient::sendMicE(float lat, float lon, uint16_t heading, uint16_t sp
info[infoPos++] = speed_uni*10 + head_hun + 32;
info[infoPos++] = head_ten_uni + 28;
info[infoPos++] = _symbol;
info[infoPos++] = _table;
info[infoPos++] = symbol;
info[infoPos++] = table;
// onto the optional stuff - check telemetry first
if(telemLen > 0) {
@ -221,13 +221,13 @@ int16_t APRSClient::sendMicE(float lat, float lon, uint16_t heading, uint16_t sp
int16_t APRSClient::sendFrame(char* destCallsign, uint8_t destSSID, char* info) {
// get AX.25 callsign
char srcCallsign[RADIOLIB_AX25_MAX_CALLSIGN_LEN + 1];
_ax->getCallsign(srcCallsign);
axClient->getCallsign(srcCallsign);
AX25Frame frameUI(destCallsign, destSSID, srcCallsign, _ax->getSSID(), RADIOLIB_AX25_CONTROL_U_UNNUMBERED_INFORMATION |
AX25Frame frameUI(destCallsign, destSSID, srcCallsign, axClient->getSSID(), RADIOLIB_AX25_CONTROL_U_UNNUMBERED_INFORMATION |
RADIOLIB_AX25_CONTROL_POLL_FINAL_DISABLED | RADIOLIB_AX25_CONTROL_UNNUMBERED_FRAME,
RADIOLIB_AX25_PID_NO_LAYER_3, (const char*)info);
return(_ax->sendFrame(&frameUI));
return(axClient->sendFrame(&frameUI));
}
#endif

View file

@ -60,14 +60,12 @@
/*!
\class APRSClient
\brief Client for APRS communication.
*/
class APRSClient {
public:
/*!
\brief Default constructor.
\param ax Pointer to the instance of AX25Client to be used for APRS.
*/
explicit APRSClient(AX25Client* ax);
@ -76,68 +74,44 @@ class APRSClient {
/*!
\brief Initialization method.
\param symbol APRS symbol to be displayed.
\param sym APRS symbol to be displayed.
\param alt Whether to use the primary (false) or alternate (true) symbol table. Defaults to primary table.
\returns \ref status_codes
*/
int16_t begin(char symbol, bool alt = false);
int16_t begin(char sym, bool alt = false);
/*!
\brief Transmit position.
\param destCallsign Destination station callsign.
\param destSSID Destination station SSID.
\param lat Latitude as a null-terminated string.
\param long Longitude as a null-terminated string.
\param msg Message to be transmitted. Defaults to NULL (no message).
\param msg Position timestamp. Defaults to NULL (no timestamp).
\returns \ref status_codes
*/
int16_t sendPosition(char* destCallsign, uint8_t destSSID, char* lat, char* lon, char* msg = NULL, char* time = NULL);
/*
/*!
\brief Transmit position using Mic-E encoding.
\param lat Geographical latitude, positive for north, negative for south.
\param lon Geographical longitude, positive for east, negative for west.
\param heading Heading in degrees.
\param speed Speed in knots.
\param type Mic-E message type - see \ref mic_e_message_types.
\param telem Pointer to telemetry array (either 2 or 5 bytes long). NULL when telemetry is not used.
\param telemLen Telemetry length, 2 or 5. 0 when telemetry is not used.
\param grid Maidenhead grid locator. NULL when not used.
\param status Status message to send. NULL when not used.
\param alt Altitude to send. RADIOLIB_APRS_MIC_E_ALTITUDE_UNUSED when not used.
*/
int16_t sendMicE(float lat, float lon, uint16_t heading, uint16_t speed, uint8_t type, uint8_t* telem = NULL, size_t telemLen = 0, char* grid = NULL, char* status = NULL, int32_t alt = RADIOLIB_APRS_MIC_E_ALTITUDE_UNUSED);
/*!
\brief Transmit generic APRS frame.
\param destCallsign Destination station callsign.
\param destSSID Destination station SSID.
\param info AX.25 info field contents.
\returns \ref status_codes
*/
int16_t sendFrame(char* destCallsign, uint8_t destSSID, char* info);
@ -145,11 +119,11 @@ class APRSClient {
#if !defined(RADIOLIB_GODMODE)
private:
#endif
AX25Client* _ax;
AX25Client* axClient;
// default APRS symbol (car)
char _symbol = '>';
char _table = '/';
char symbol = '>';
char table = '/';
};
#endif