final 1
Fork of C027_Support by
Diff: MDM.cpp
- Revision:
- 134:2fbd5723e063
- Parent:
- 133:57b208dd96fb
- Child:
- 135:cbccf4052d45
--- a/MDM.cpp Thu Nov 26 09:42:01 2015 +0000 +++ b/MDM.cpp Tue Jan 12 08:37:29 2016 +0000 @@ -267,6 +267,8 @@ return RESP_OK; if (type == TYPE_ERROR) return RESP_ERROR; + if (type == TYPE_ERROR_CME) + return RESP_ERROR_CME; if (type == TYPE_PROMPT) return RESP_PROMPT; } @@ -672,11 +674,15 @@ { if ((type == TYPE_PLUS) && status){ int act = 99; + int mode = 99; // +COPS: <mode>[,<format>,<oper>[,<AcT>]] - if (sscanf(buf, "\r\n+COPS: %*d,%*d,\"%[^\"]\",%d",status->opr,&act) >= 1) { + if (sscanf(buf, "\r\n+COPS: %d,%*d,\"%[^\"]\",%d",&mode,status->opr,&act) >= 1) { if (act == 0) status->act = ACT_GSM; // 0: GSM, else if (act == 2) status->act = ACT_UTRAN; // 2: UTRAN else if (act == 7) status->act = ACT_LTE; // 2: UTRAN + if (mode == 0) status->regStatus = COPS_AUTOMATIC_REG; + else if (mode == 1) status->regStatus = COPS_MANUAL_REG; + else if (mode == 2) status->regStatus = COPS_DISABLED_REG; } } return WAIT; @@ -1728,7 +1734,7 @@ } lut[] = { { "\r\nOK\r\n", NULL, TYPE_OK }, { "\r\nERROR\r\n", NULL, TYPE_ERROR }, - { "\r\n+CME ERROR:", "\r\n", TYPE_ERROR }, + { "\r\n+CME ERROR:", "\r\n", TYPE_ERROR_CME }, { "\r\n+CMS ERROR:", "\r\n", TYPE_ERROR }, { "\r\nRING\r\n", NULL, TYPE_RING }, { "\r\nCONNECT\r\n", NULL, TYPE_CONNECT },