[APRS] Cppcheck fixes

This commit is contained in:
jgromes 2025-01-18 17:48:41 +01:00
parent 80a44a3232
commit d4d98d37ce
2 changed files with 6 additions and 6 deletions

View file

@ -14,7 +14,7 @@ APRSClient::APRSClient(PhysicalLayer* phy) {
phyLayer = phy; phyLayer = phy;
} }
int16_t APRSClient::begin(char sym, char* callsign, uint8_t ssid, bool alt) { int16_t APRSClient::begin(char sym, const char* callsign, uint8_t ssid, bool alt) {
RADIOLIB_CHECK_RANGE(sym, ' ', '}', RADIOLIB_ERR_INVALID_SYMBOL); RADIOLIB_CHECK_RANGE(sym, ' ', '}', RADIOLIB_ERR_INVALID_SYMBOL);
symbol = sym; symbol = sym;
@ -39,7 +39,7 @@ int16_t APRSClient::begin(char sym, char* callsign, uint8_t ssid, bool alt) {
return(RADIOLIB_ERR_NONE); return(RADIOLIB_ERR_NONE);
} }
int16_t APRSClient::sendPosition(char* destCallsign, uint8_t destSSID, char* lat, char* lon, char* msg, char* time) { int16_t APRSClient::sendPosition(char* destCallsign, uint8_t destSSID, const char* lat, const char* lon, const char* msg, const char* time) {
size_t len = 1 + strlen(lat) + 1 + strlen(lon); size_t len = 1 + strlen(lat) + 1 + strlen(lon);
if(msg != NULL) { if(msg != NULL) {
len += 1 + strlen(msg); len += 1 + strlen(msg);
@ -84,7 +84,7 @@ int16_t APRSClient::sendPosition(char* destCallsign, uint8_t destSSID, char* lat
return(state); return(state);
} }
int16_t APRSClient::sendMicE(float lat, float lon, uint16_t heading, uint16_t speed, uint8_t type, uint8_t* telem, size_t telemLen, char* grid, char* status, int32_t alt) { int16_t APRSClient::sendMicE(float lat, float lon, uint16_t heading, uint16_t speed, uint8_t type, const uint8_t* telem, size_t telemLen, const char* grid, const char* status, int32_t alt) {
// sanity checks first // sanity checks first
if(((telemLen == 0) && (telem != NULL)) || ((telemLen != 0) && (telem == NULL))) { if(((telemLen == 0) && (telem != NULL)) || ((telemLen != 0) && (telem == NULL))) {
return(RADIOLIB_ERR_INVALID_MIC_E_TELEMETRY); return(RADIOLIB_ERR_INVALID_MIC_E_TELEMETRY);

View file

@ -106,7 +106,7 @@ class APRSClient {
\param alt Whether to use the primary (false) or alternate (true) symbol table. Defaults to primary table. \param alt Whether to use the primary (false) or alternate (true) symbol table. Defaults to primary table.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t begin(char sym, char* callsign = NULL, uint8_t ssid = 0, bool alt = false); int16_t begin(char sym, const char* callsign = NULL, uint8_t ssid = 0, bool alt = false);
/*! /*!
\brief Transmit position. \brief Transmit position.
@ -118,7 +118,7 @@ class APRSClient {
\param time Position timestamp. Defaults to NULL (no timestamp). \param time Position timestamp. Defaults to NULL (no timestamp).
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t sendPosition(char* destCallsign, uint8_t destSSID, char* lat, char* lon, char* msg = NULL, char* time = NULL); int16_t sendPosition(char* destCallsign, uint8_t destSSID, const char* lat, const char* lon, const char* msg = NULL, const char* time = NULL);
/*! /*!
\brief Transmit position using Mic-E encoding. \brief Transmit position using Mic-E encoding.
@ -133,7 +133,7 @@ class APRSClient {
\param status Status message to send. 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. \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); int16_t sendMicE(float lat, float lon, uint16_t heading, uint16_t speed, uint8_t type, const uint8_t* telem = NULL, size_t telemLen = 0, const char* grid = NULL, const char* status = NULL, int32_t alt = RADIOLIB_APRS_MIC_E_ALTITUDE_UNUSED);
/*! /*!
\brief Transmit generic APRS frame. \brief Transmit generic APRS frame.