vvvv
Diff: MDM.cpp
- Revision:
- 120:305e520c136e
- Parent:
- 118:c2c4b6b421c8
--- a/MDM.cpp Thu Mar 12 17:10:17 2015 +0000 +++ b/MDM.cpp Tue Aug 06 12:55:22 2019 +0000 @@ -321,9 +321,9 @@ DigitalOut pin(pn, 1); while (i--) { // SARA-U2/LISA-U2 50..80us - pin = 0; ::wait_us(50); + /*pin = 0; ::wait_us(50); pin = 1; ::wait_ms(10); - + */ // SARA-G35 >5ms, LISA-C2 > 150ms, LEON-G2 >5ms pin = 0; ::wait_ms(150); pin = 1; ::wait_ms(100); @@ -441,7 +441,7 @@ // get the sendFormated("AT+CGMR\r\n"); if (RESP_OK != waitFinalResp(_cbString, _dev.ver)) - goto failure; + goto failure; // Returns the ICCID (Integrated Circuit Card ID) of the SIM-card. // ICCID is a serial number identifying the SIM. sendFormated("AT+CCID\r\n"); @@ -476,10 +476,13 @@ sendFormated("AT+CNMI=2,1\r\n"); if (RESP_OK != waitFinalResp()) goto failure; + /* // Request IMSI (International Mobile Subscriber Identification) sendFormated("AT+CIMI\r\n"); if (RESP_OK != waitFinalResp(_cbString, _dev.imsi)) goto failure; + */ + if (status) memcpy(status, &_dev, sizeof(DevStatus)); UNLOCK(); @@ -490,7 +493,7 @@ } bool MDMParser::powerOff(void) -{ +{/* bool ok = false; if (_init) { LOCK(); @@ -502,7 +505,7 @@ } UNLOCK(); } - return ok; + return ok;*/ } int MDMParser::_cbATI(int type, const char* buf, int len, Dev* dev) @@ -803,6 +806,43 @@ return NOIP; } +//------------------------------------------------------------------------------ +/* + Check Connection of Modem +*/ +bool MDMParser::CheckCon() +{ + bool ok = false; + LOCK(); + + // Check the profile + int a = 0; + bool force = true; + sendFormated("AT+UPSND=" PROFILE ",8\r\n"); + if (RESP_OK != waitFinalResp(_cbUPSND, &a)) + goto failure; + + TRACE("+UPSND: " PROFILE ",8,%d\r\n",a); + + if (a == 1 && force) + { + // if connected, return true directly + ok = true; + } + if (a == 0) + { + // if not connected, return false directly + ok = false; + } + UNLOCK(); + return ok; + + failure: + unlock(); + return false; +} + +//------------------------------------------------------------------------------ int MDMParser::_cbUDOPN(int type, const char* buf, int len, char* mccmnc) { if ((type == TYPE_PLUS) && mccmnc) {