Make AT_CellularSMS support index 0 in SMS inbox

When AT+CGML is used to retrieve list of SMS stored in modem inbox,
every message has an associated index. ETSI TS 127 005 v7.0.0 does not
specify what is the allowed range of such indices - all it says is
"integer type; value in the range of location numbers supported by the
associated memory".

Usually, AT modems use positive indexes (starting at 1). Quectel BG96
modem takes a different approach, indexing messages starting at 0.

Current implementation of `AT_CellularSMS::list_messages()` considers
index 0 invalid and ignores such message, effectively making it
impossible to access using mbed-os API.

This commit changes the behavior so that value of 0 is handled as any
other positive message index.
pull/11249/head
Marcin Radomski 2019-08-14 12:15:43 +02:00
parent 033fffea84
commit 17f6f1c0e3
1 changed files with 1 additions and 1 deletions

View File

@ -1037,7 +1037,7 @@ nsapi_error_t AT_CellularSMS::list_messages()
(void)_at.consume_to_stop_tag(); // consume until <CR><LF>
}
if (index > 0) {
if (index >= 0) {
add_info(info, index, part_number);
} else {
delete info;