Skip to content

Commit b67ae60

Browse files
committed
Add a choice of what messages to preserve to clear()
1 parent 9abcaad commit b67ae60

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/NB_SMS.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -436,13 +436,15 @@ void NB_SMS::flush()
436436
}
437437
}
438438

439-
void NB_SMS::clear()
439+
void NB_SMS::clear(int flag)
440440
{
441441
_ptrUTF8 = "";
442442

443443
while (MODEM.ready() == 0);
444444

445-
MODEM.sendf("AT+CMGD=0,2");
445+
if (flag<1 || flag>4) flag = 2;
446+
447+
MODEM.sendf("AT+CMGD=0,%d",flag);
446448

447449
if (_synch) {
448450
MODEM.waitForResponse(55000);

src/NB_SMS.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,12 @@ class NB_SMS : public Stream {
8585
void flush();
8686

8787
/** Delete all read and sent SMS from Modem memory and process answer
88+
* flag=1 preserves sent, unsent, and unread messages
89+
* flag=2 preserves unsent and unread messages
90+
* flag=3 preserves unread messages
91+
* flag=4 preserves no messages
8892
*/
89-
void clear();
93+
void clear(int flag=2);
9094

9195
private:
9296
bool _synch;

0 commit comments

Comments
 (0)