Skip to content

Commit fb10917

Browse files
committed
GSM: reorder function calls
1 parent 02dfb64 commit fb10917

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

libraries/GSM/src/GSM.cpp

+6-10
Original file line numberDiff line numberDiff line change
@@ -55,41 +55,37 @@ int arduino::GSMClass::begin(const char* pin, const char* apn, const char* usern
5555
DEBUG_ERROR("Invalid mbed::CellularContext");
5656
return 0;
5757
}
58+
5859
pinMode(MBED_CONF_GEMALTO_CINTERION_ON, INPUT_PULLDOWN);
5960

6061
static mbed::DigitalOut rts(MBED_CONF_GEMALTO_CINTERION_RTS, 0);
6162

6263
_device = _context->get_device();
64+
_device->modem_debug_on(_at_debug);
6365

6466
if (!isReady()) {
6567
DEBUG_ERROR("Cellular device not ready");
6668
return 0;
6769
}
6870

69-
_device->modem_debug_on(_at_debug);
70-
7171
_device->set_cmux_status_flag(_cmuxGSMenable);
72-
73-
_context->set_sim_pin(pin);
74-
7572
_device->set_retry_timeout_array(_retry_timeout, sizeof(_retry_timeout) / sizeof(_retry_timeout[0]));
7673
#if GSM_DEBUG_ENABLE
7774
_device->attach(mbed::callback(this, &GSMClass::onStatusChange));
7875
#endif
79-
8076
_device->init();
8177

82-
_context->set_authentication_type((mbed::CellularContext::AuthenticationType)1);
83-
8478
_pin = pin;
8579
_apn = apn;
8680
_username = username;
8781
_password = password;
8882
_rat = rat;
8983
_band = (FrequencyBand) band;
90-
_context->set_credentials(apn, username, password);
9184

92-
_context->set_access_technology(rat);
85+
_context->set_sim_pin(pin);
86+
_context->set_authentication_type(mbed::CellularContext::AuthenticationType::PAP);
87+
_context->set_credentials(_apn, _username, _password);
88+
_context->set_access_technology(_rat);
9389
_context->set_band(_band);
9490

9591
int connect_status = NSAPI_ERROR_AUTH_FAILURE;

0 commit comments

Comments
 (0)