We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent aad97a6 commit 6d4e280Copy full SHA for 6d4e280
features/cellular/framework/AT/AT_CellularNetwork.cpp
@@ -556,10 +556,20 @@ nsapi_error_t AT_CellularNetwork::set_registration(const char *plmn)
556
557
if (!plmn) {
558
tr_debug("Automatic network registration");
559
- _at.cmd_start("AT+COPS=0");
+ uint8_t len=8;
560
+ uint8_t buf[8];
561
+ _at.cmd_start("AT+COPS?");
562
_at.cmd_stop();
563
_at.resp_start();
564
+ _at.read_bytes(buf,len);
565
_at.resp_stop();
566
+ if (strncmp((char*)buf,"+COPS: 0",len) != 0) {
567
+ _at.clear_error();
568
+ _at.cmd_start("AT+COPS=0");
569
+ _at.cmd_stop();
570
+ _at.resp_start();
571
+ _at.resp_stop();
572
+ }
573
} else {
574
tr_debug("Manual network registration to %s", plmn);
575
_at.cmd_start("AT+COPS=4,2,");
0 commit comments