Skip to content

Commit c4065f5

Browse files
committed
GSM: limit the number of internal state machine retries to 6
1 parent 9a81f86 commit c4065f5

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

libraries/GSM/src/GSM.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ int arduino::GSMClass::begin(const char* pin, const char* apn, const char* usern
8181

8282
_context->set_sim_pin(pin);
8383

84+
_device->set_retry_timeout_array(_retry_timeout, sizeof(_retry_timeout) / sizeof(_retry_timeout[0]));
8485
#if GSM_DEBUG_ENABLE
8586
_device->attach(mbed::callback(this, &GSMClass::onStatusChange));
8687
#endif

libraries/GSM/src/GSM.h

+5
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,11 @@ class GSMClass : public MbedSocketClass {
154154
mbed::CellularDevice* _device = nullptr;
155155
bool _at_debug = false;
156156

157+
/* Internal cellular state machine retries. Values are in seconds.
158+
* This array also defines the maximum number of retries to 6
159+
*/
160+
const uint16_t _retry_timeout[6] = {1, 2, 4, 8, 16, 32};
161+
157162
#if GSM_DEBUG_ENABLE
158163
static constexpr int RSSI_UNKNOWN = 99;
159164
static const char * const sim_state_str[];

0 commit comments

Comments
 (0)