Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of C027_Support by
Revision 135:2fbd5723e063, committed 2016-01-12
- Comitter:
- msinig
- Date:
- Tue Jan 12 08:37:29 2016 +0000
- Parent:
- 133:57b208dd96fb
- Commit message:
- added features for connection manager
Changed in this revision
| MDM.cpp | Show annotated file Show diff for this revision Revisions of this file |
| MDM.h | Show annotated file Show diff for this revision Revisions of this file |
--- 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 },
--- a/MDM.h Thu Nov 26 09:42:01 2015 +0000
+++ b/MDM.h Tue Jan 12 08:37:29 2016 +0000
@@ -36,9 +36,11 @@
DEV_SARA_G35, DEV_LISA_U2, DEV_LISA_U2_03S, DEV_LISA_C2,
DEV_SARA_U2, DEV_LEON_G2, DEV_TOBY_L2, DEV_MPCI_L2 } Dev;
//! SIM Status
- typedef enum { SIM_UNKNOWN, SIM_MISSING, SIM_PIN, SIM_READY } Sim;
+ typedef enum { SIM_UNKNOWN, SIM_MISSING, SIM_PIN, SIM_PUK, SIM_READY, WRONG_PIN } Sim;
//! SIM Status
typedef enum { LPM_DISABLED, LPM_ENABLED, LPM_ACTIVE } Lpm;
+ //! COPS status
+ typedef enum { COPS_UNKOWN, COPS_AUTOMATIC_REG, COPS_MANUAL_REG, COPS_DISABLED_REG} CopsMode;
//! Device status
typedef struct {
Dev dev; //!< Device Type
@@ -68,6 +70,7 @@
char num[32]; //!< Mobile Directory Number
unsigned short lac; //!< location area code in hexadecimal format (2 bytes in hex)
unsigned int ci; //!< Cell ID in hexadecimal format (2 to 4 bytes in hex)
+ CopsMode regStatus; //!< Cops mode
} NetStatus;
//! Cell Locate Data
typedef struct {
@@ -452,6 +455,7 @@
RESP_OK = -2,
RESP_ERROR = -3,
RESP_PROMPT = -4,
+ RESP_ERROR_CME= -5,
// getLine Responses
#define LENGTH(x) (x & 0x00FFFF) //!< extract/mask the length
@@ -460,6 +464,7 @@
TYPE_UNKNOWN = 0x000000,
TYPE_OK = 0x110000,
TYPE_ERROR = 0x120000,
+ TYPE_ERROR_CME = 0x130000,
TYPE_RING = 0x210000,
TYPE_CONNECT = 0x220000,
TYPE_NOCARRIER = 0x230000,
