Skip to content

Commit d676084

Browse files
committed
Increase AT timeout to 10s in AT_CellularSMS::get_sms
When SMS list is big and baudrate is not fast enough, with default timeout we can suffer from timeout error while getting a sms because method is parsing the full list and this takes long.
1 parent 5c49f16 commit d676084

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

connectivity/cellular/source/framework/AT/AT_CellularSMS.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -703,6 +703,7 @@ nsapi_size_or_error_t AT_CellularSMS::get_sms(char *buf, uint16_t len, char *pho
703703
}
704704

705705
_at.lock();
706+
_at.set_at_timeout(10s);
706707

707708
nsapi_size_or_error_t err = list_messages();
708709
if (err == NSAPI_ERROR_OK) {
@@ -716,6 +717,7 @@ nsapi_size_or_error_t AT_CellularSMS::get_sms(char *buf, uint16_t len, char *pho
716717
*buf_size = info->msg_size;
717718
}
718719
free_linked_list();
720+
_at.restore_at_timeout();
719721
_at.unlock();
720722
return NSAPI_ERROR_PARAMETER;
721723
}
@@ -740,6 +742,7 @@ nsapi_size_or_error_t AT_CellularSMS::get_sms(char *buf, uint16_t len, char *pho
740742

741743
free_linked_list();
742744

745+
_at.restore_at_timeout();
743746
_at.unlock();
744747

745748
// update error only when there really was an error, otherwise we return the length

0 commit comments

Comments
 (0)