@@ -420,6 +420,7 @@ nsapi_size_or_error_t AT_CellularSMS::send_sms(const char *phone_number, const c
420
420
}
421
421
422
422
_at.lock ();
423
+ _at.set_at_timeout (10s);
423
424
424
425
int write_size = 0 ;
425
426
@@ -437,6 +438,7 @@ nsapi_size_or_error_t AT_CellularSMS::send_sms(const char *phone_number, const c
437
438
// sending can be cancelled by giving <ESC> character (IRA 27).
438
439
_at.cmd_start (ESC);
439
440
_at.cmd_stop ();
441
+ _at.restore_at_timeout ();
440
442
_at.unlock ();
441
443
return write_size;
442
444
}
@@ -482,6 +484,7 @@ nsapi_size_or_error_t AT_CellularSMS::send_sms(const char *phone_number, const c
482
484
pdu_str = create_pdu (phone_number, message + i * concatenated_sms_length, pdu_len,
483
485
sms_count, i + 1 , header_len);
484
486
if (!pdu_str) {
487
+ _at.restore_at_timeout ();
485
488
_at.unlock ();
486
489
return NSAPI_ERROR_NO_MEMORY;
487
490
}
@@ -509,6 +512,7 @@ nsapi_size_or_error_t AT_CellularSMS::send_sms(const char *phone_number, const c
509
512
// sending can be cancelled by giving <ESC> character (IRA 27).
510
513
_at.cmd_start (ESC);
511
514
_at.cmd_stop ();
515
+ _at.restore_at_timeout ();
512
516
_at.unlock ();
513
517
delete [] pdu_str;
514
518
return msg_write_len;
@@ -523,13 +527,15 @@ nsapi_size_or_error_t AT_CellularSMS::send_sms(const char *phone_number, const c
523
527
delete [] pdu_str;
524
528
remaining_len -= concatenated_sms_length;
525
529
if (_at.get_last_error () != NSAPI_ERROR_OK) {
530
+ _at.restore_at_timeout ();
526
531
return _at.unlock_return_error ();
527
532
}
528
533
}
529
534
}
530
535
531
536
_sms_message_ref_number++;
532
537
nsapi_error_t ret = _at.get_last_error ();
538
+ _at.restore_at_timeout ();
533
539
_at.unlock ();
534
540
535
541
return (ret == NSAPI_ERROR_OK) ? msg_len : ret;
0 commit comments