Merge pull request #6350 from u-blox/cellular_test

Cellular: update attach test
pull/6401/merge
Cruz Monrreal 2018-03-20 14:27:02 -05:00 committed by GitHub
commit 53adeed521
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 2 deletions

View File

@ -556,10 +556,18 @@ nsapi_error_t AT_CellularNetwork::set_registration(const char *plmn)
if (!plmn) {
tr_debug("Automatic network registration");
_at.cmd_start("AT+COPS=0");
_at.cmd_start("AT+COPS?");
_at.cmd_stop();
_at.resp_start();
_at.resp_start("AT+COPS:");
int mode = _at.read_int();
_at.resp_stop();
if (mode != 0) {
_at.clear_error();
_at.cmd_start("AT+COPS=0");
_at.cmd_stop();
_at.resp_start();
_at.resp_stop();
}
} else {
tr_debug("Manual network registration to %s", plmn);
_at.cmd_start("AT+COPS=4,2,");