mirror of https://github.com/ARMmbed/mbed-os.git
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.pull/15477/head
parent
5c49f161fb
commit
d676084600
|
@ -703,6 +703,7 @@ nsapi_size_or_error_t AT_CellularSMS::get_sms(char *buf, uint16_t len, char *pho
|
||||||
}
|
}
|
||||||
|
|
||||||
_at.lock();
|
_at.lock();
|
||||||
|
_at.set_at_timeout(10s);
|
||||||
|
|
||||||
nsapi_size_or_error_t err = list_messages();
|
nsapi_size_or_error_t err = list_messages();
|
||||||
if (err == NSAPI_ERROR_OK) {
|
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
|
||||||
*buf_size = info->msg_size;
|
*buf_size = info->msg_size;
|
||||||
}
|
}
|
||||||
free_linked_list();
|
free_linked_list();
|
||||||
|
_at.restore_at_timeout();
|
||||||
_at.unlock();
|
_at.unlock();
|
||||||
return NSAPI_ERROR_PARAMETER;
|
return NSAPI_ERROR_PARAMETER;
|
||||||
}
|
}
|
||||||
|
@ -740,6 +742,7 @@ nsapi_size_or_error_t AT_CellularSMS::get_sms(char *buf, uint16_t len, char *pho
|
||||||
|
|
||||||
free_linked_list();
|
free_linked_list();
|
||||||
|
|
||||||
|
_at.restore_at_timeout();
|
||||||
_at.unlock();
|
_at.unlock();
|
||||||
|
|
||||||
// update error only when there really was an error, otherwise we return the length
|
// update error only when there really was an error, otherwise we return the length
|
||||||
|
|
Loading…
Reference in New Issue