diff --git a/src/NB_SMS.cpp b/src/NB_SMS.cpp index 85c391f..55b6709 100644 --- a/src/NB_SMS.cpp +++ b/src/NB_SMS.cpp @@ -436,13 +436,15 @@ void NB_SMS::flush() } } -void NB_SMS::clear() +void NB_SMS::clear(int flag) { _ptrUTF8 = ""; while (MODEM.ready() == 0); - MODEM.sendf("AT+CMGD=0,2"); + if (flag<1 || flag>4) flag = 2; + + MODEM.sendf("AT+CMGD=0,%d",flag); if (_synch) { MODEM.waitForResponse(55000); diff --git a/src/NB_SMS.h b/src/NB_SMS.h index 26b85ae..c5b3777 100644 --- a/src/NB_SMS.h +++ b/src/NB_SMS.h @@ -22,6 +22,11 @@ #include +#define NB_SMS_CLEAR_READ (1) +#define NB_SMS_CLEAR_READ_SENT (2) +#define NB_SMS_CLEAR_READ_SENT_UNSENT (3) +#define NB_SMS_CLEAR_ALL (4) + class NB_SMS : public Stream { public: @@ -86,7 +91,7 @@ class NB_SMS : public Stream { /** Delete all read and sent SMS from Modem memory and process answer */ - void clear(); + void clear(int flag = NB_SMS_CLEAR_READ_SENT); private: bool _synch;