|
26 | 26 | #include "CellularInterface.h" |
27 | 27 | #include "GEMALTO_CINTERION_CellularStack.h" |
28 | 28 |
|
29 | | -#define MAXRETRY 3 |
30 | | - |
31 | 29 | arduino::CMUXClass *arduino::CMUXClass::get_default_instance() |
32 | 30 | { |
33 | 31 | static mbed::UnbufferedSerial serial(MBED_CONF_GEMALTO_CINTERION_TX, MBED_CONF_GEMALTO_CINTERION_RX, 115200); |
@@ -102,24 +100,17 @@ int arduino::GSMClass::begin(const char* pin, const char* apn, const char* usern |
102 | 100 | _context->set_band(_band); |
103 | 101 |
|
104 | 102 | int connect_status = NSAPI_ERROR_AUTH_FAILURE; |
105 | | - uint8_t retryCount = 0; |
106 | | - while(connect_status != NSAPI_ERROR_OK && retryCount < MAXRETRY) { |
107 | | - |
108 | | - connect_status = _context->connect(pin, apn, username, password); |
109 | | - retryCount++; |
110 | | - |
111 | | - if (connect_status == NSAPI_ERROR_AUTH_FAILURE) { |
112 | | - DEBUG_ERROR("Authentication Failure. Exiting application."); |
113 | | - } else if (connect_status == NSAPI_ERROR_OK || connect_status == NSAPI_ERROR_IS_CONNECTED) { |
114 | | - connect_status = NSAPI_ERROR_OK; |
115 | | - DEBUG_INFO("Connection Established."); |
116 | | - } else if (retryCount > 2) { |
117 | | - DEBUG_ERROR("Fatal connection failure: %d", connect_status); |
118 | | - } else { |
119 | | - DEBUG_WARNING("Couldn't connect, will retry..."); |
120 | | - continue; |
121 | | - } |
122 | 103 |
|
| 104 | + DEBUG_INFO("Connecting..."); |
| 105 | + connect_status = _context->connect(pin, apn, username, password); |
| 106 | + |
| 107 | + if (connect_status == NSAPI_ERROR_AUTH_FAILURE) { |
| 108 | + DEBUG_ERROR("Authentication Failure. Exiting application."); |
| 109 | + } else if (connect_status == NSAPI_ERROR_OK || connect_status == NSAPI_ERROR_IS_CONNECTED) { |
| 110 | + connect_status = NSAPI_ERROR_OK; |
| 111 | + DEBUG_INFO("Connection Established."); |
| 112 | + } else { |
| 113 | + DEBUG_ERROR("Couldn't connect."); |
123 | 114 | } |
124 | 115 |
|
125 | 116 | return connect_status == NSAPI_ERROR_OK ? 1 : 0; |
|
0 commit comments