From 82a1c6edf5b635eb9ecc89c5cae5a57aab441153 Mon Sep 17 00:00:00 2001 From: Sebastian Romero Date: Fri, 12 Apr 2024 09:51:52 +0200 Subject: [PATCH] Make ATCommand function accept const char ptr --- src/ArduinoCellular.cpp | 7 +++---- src/ArduinoCellular.h | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/ArduinoCellular.cpp b/src/ArduinoCellular.cpp index 856c3f3..bbaaea2 100644 --- a/src/ArduinoCellular.cpp +++ b/src/ArduinoCellular.cpp @@ -247,15 +247,13 @@ bool ArduinoCellular::enableGPS(bool assisted){ //delay(10000); } -String ArduinoCellular::sendATCommand( char * command, unsigned long timeout){ +String ArduinoCellular::sendATCommand(const char * command, unsigned long timeout){ String resp; - modem.sendAT(const_cast(command)); + modem.sendAT(command); modem.waitResponse(timeout, resp); return resp; } - - Time parseTimestamp(const String ×tampStr) { int hour, minute, second, day, month, year, offset; @@ -280,6 +278,7 @@ Time parseTimestamp(const String ×tampStr) { return Time(year, month, day, hour, minute, second, offset); } + // Parses a single SMS entry from the data SMS parseSMSEntry(const String& entry, const String& message) { SMS sms; diff --git a/src/ArduinoCellular.h b/src/ArduinoCellular.h index bfa3f92..8b12589 100644 --- a/src/ArduinoCellular.h +++ b/src/ArduinoCellular.h @@ -189,7 +189,7 @@ class ArduinoCellular { * @param timeout The timeout (In milliseconds) to wait for the response. * @return The response from the modem. */ - String sendATCommand(char * command, unsigned long timeout = 1000); + String sendATCommand(const char * command, unsigned long timeout = 1000); /**