Skip to content

Commit 716cbef

Browse files
author
brentru
committed
allow num_sms to read internal module storage
1 parent aa77f0a commit 716cbef

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

adafruit_fona/adafruit_fona.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -542,14 +542,17 @@ def num_sms(self, sim_storage=True):
542542
return False
543543

544544
# ask how many SMS are stored
545-
# TODO: look @ this again!
546-
if not self._send_parse_reply(b"AT+CPMS?", b"\"SM\",", idx=1):
547-
return False
548-
if not self._send_parse_reply(b"AT+CPMS?", b"\"SM_P\",", idx=1):
549-
return False
550-
551-
self._uart.reset_input_buffer()
552-
return self._buf
545+
if sim_storage:
546+
if self._send_parse_reply(b"AT+CPMS?", FONA_SMS_STORAGE_SIM + b",", idx=1):
547+
return self._buf
548+
else:
549+
if self._send_parse_reply(b"AT+CPMS?", FONA_SMS_STORAGE_INTERNAL + b",", idx=1):
550+
return self._buf
551+
if self._send_parse_reply(b"AT+CPMS?", b"\"SM\",", idx=1):
552+
return self._buf
553+
if self._send_parse_reply(b"AT+CPMS?", b"\"SM_P\",", idx=1):
554+
return self._buf
555+
return False
553556

554557
def delete_all_sms(self):
555558
"""Deletes all SMS messages on the FONA SIM."""

0 commit comments

Comments
 (0)