Skip to content

GSM: Add cellular state machine events reporting #767

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Nov 21, 2023
Prev Previous commit
Next Next commit
GSM: reorder function calls
  • Loading branch information
pennam committed Nov 21, 2023
commit fb10917fe6aff583d7e923dbf59671fd3cd64669
16 changes: 6 additions & 10 deletions libraries/GSM/src/GSM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,41 +55,37 @@ int arduino::GSMClass::begin(const char* pin, const char* apn, const char* usern
DEBUG_ERROR("Invalid mbed::CellularContext");
return 0;
}

pinMode(MBED_CONF_GEMALTO_CINTERION_ON, INPUT_PULLDOWN);

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

_device = _context->get_device();
_device->modem_debug_on(_at_debug);

if (!isReady()) {
DEBUG_ERROR("Cellular device not ready");
return 0;
}

_device->modem_debug_on(_at_debug);

_device->set_cmux_status_flag(_cmuxGSMenable);

_context->set_sim_pin(pin);

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

_device->init();

_context->set_authentication_type((mbed::CellularContext::AuthenticationType)1);

_pin = pin;
_apn = apn;
_username = username;
_password = password;
_rat = rat;
_band = (FrequencyBand) band;
_context->set_credentials(apn, username, password);

_context->set_access_technology(rat);
_context->set_sim_pin(pin);
_context->set_authentication_type(mbed::CellularContext::AuthenticationType::PAP);
_context->set_credentials(_apn, _username, _password);
_context->set_access_technology(_rat);
_context->set_band(_band);

int connect_status = NSAPI_ERROR_AUTH_FAILURE;
Expand Down