Description
I am trying to understand how the receive message code works in example 5. It looks like it executes a function called mySARA.getPreferredMessageStorage and then calls mySARA.readSMSmessage for each message. Over several days of testing it looks like txt messages received never get deleted and I am worried it will fill up where they are stored (local SIM?)
Is there a 'delete all' messages function I can call once a day ? I use this on my boat to send txt messages to turn on/off deck lights, get status, etc, but I think I need to delete a message once it is received or just delete all messages periodically.
I was searching and found this command in the ublox doc +CMGD to delete one or more messages but cannot find a function to call to execute it.
thanks !
part of SARA-R5_Example5_ReceiveSMS:
if (mySARA.getPreferredMessageStorage(&used, &total) != SARA_R5_SUCCESS)
{
Serial.println(F("An error occurred when trying to read ME memory!"));
}
else
{
if (used > previousUsed) // Has a new message arrived?
{
Serial.print(F("Number of used memory locations: "));
Serial.println(used);
Serial.print(F("Total number of memory locations: "));
Serial.println(total);
Serial.println();
int memoryLocation = 1;
int foundMessages = 0;
// Keep reading until we find all the messages or we reach the end of the memory
while ((foundMessages < used) && (memoryLocation <= total))
{
String unread = "";
String from = "";
String dateTime = "";
String message = "";
// Read the message from this location. Reading from empty message locations returns an ERROR
if (mySARA.readSMSmessage(memoryLocation, &unread, &from, &dateTime, &message) == SARA_R5_SUCCESS)