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_Plus_Dialing by
Revision 122:1360902e8632, committed 2017-08-01
- Comitter:
- irsanjul
- Date:
- Tue Aug 01 08:09:16 2017 +0000
- Parent:
- 121:3e1d84b2d34c
- Commit message:
- my editing. sorry for developper if it ilegal. call me if you want i delete it. thanks
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 Sun Oct 11 09:56:57 2015 +0000 +++ b/MDM.cpp Tue Aug 01 08:09:16 2017 +0000 @@ -5,9 +5,6 @@ #endif #include "MDMAPN.h" #include <sstream> - -extern Serial dbg; -extern time_t t; #define PROFILE "0" //!< this is the psd profile used #define MAX_SIZE 128 //!< max expected messages @@ -436,6 +433,9 @@ ERROR("SIM not inserted\r\n"); goto failure; } + // stop message waaiting indication + sendFormated("AT+UMWI=0\r\n"); + waitFinalResp(); // get the manufacturer sendFormated("AT+CGMI\r\n"); if (RESP_OK != waitFinalResp(_cbString, _dev.manu)) @@ -482,26 +482,10 @@ sendFormated("AT+CNMI=2,1\r\n"); if (RESP_OK != waitFinalResp()) goto failure; - // setup audio path mode - //sendFormated("AT+USPM=0,0,0,0,0\r\n"); - //if (RESP_OK != waitFinalResp()) - //goto failure; - // setup loudness speaker - //sendFormated("ATL2\r\n"); - //if (RESP_OK != waitFinalResp()) - //goto failure; // setup report sendFormated("AT+CMER=1,0,0,2,1\r\n"); if (RESP_OK != waitFinalResp()) goto failure; - // setup call status - sendFormated("AT+UCALLSTAT=1\r\n"); - if (RESP_OK != waitFinalResp()) - goto failure; - // setup calling line identification - sendFormated("AT+CLIP=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)) @@ -1268,7 +1252,7 @@ CMGLparam param; param.ix = ix; param.num = num; - if (RESP_OK == waitFinalResp(_cbCMGL, ¶m)) + if (RESP_OK == waitFinalResp(_cbCMGL, ¶m,60*1000)) ret = num - param.num; UNLOCK(); return ret; @@ -1276,6 +1260,7 @@ bool MDMParser::smsSend(const char* num, const char* buf) { + purge(); bool ok = false; LOCK(); sendFormated("AT+CMGS=\"%s\"\r\n",num); @@ -1366,7 +1351,7 @@ if (type == TYPE_PLUS) { if (sscanf(buf, "\r\n+CLIP: %31[^\"]\",%d,,,,%*d", param->num, param->stat) == 2) { - dbg.printf("number %s call you\r\n",param->num); + ; } } } @@ -1450,6 +1435,34 @@ return ok; } +int MDMParser::signal() +{ + int sig = 0; + LOCK(); + NetStatus _status; + sendFormated("AT+CSQ\r\n"); + if (RESP_OK != waitFinalResp(_cbCSQ, &_status)) + goto failure; + + // konversi dihilangkan untuk mempermudah kerja. kirim dalam satuan dbm + + if(_status.rssi <= -105) + sig = 0; + if((_status.rssi < -93) && (_status.rssi > -105)) + sig = 1; + if((_status.rssi < -81) && (_status.rssi >= -93)) + sig = 2; + if((_status.rssi < -69) && (_status.rssi >= -81)) + sig = 3; + if((_status.rssi < -57) && (_status.rssi >= -69)) + sig = 4; + if(_status.rssi >= -57) + sig = 5; + UNLOCK(); + failure: + return sig; +} + bool MDMParser::mute(bool act) { if(act) @@ -1469,6 +1482,17 @@ return false; } } + +bool MDMParser::sendAT() +{ + bool ok = 0; + purge(); + LOCK(); + sendFormated("AT\r\n"); + ok = (RESP_OK == waitFinalResp()); + UNLOCK(); + return ok; +} //----------------------------------------------------------------- bool MDMParser::CopsCtzu() @@ -1489,10 +1513,8 @@ { if(type == TYPE_PLUS) { - dbg.printf("masuk _cbCCLK\r\n"); if(sscanf(buf, "\r\n+CCLK: \"%[^\"]", param->buf) == 1) { - dbg.printf("masuk if nya\r\n"); return RESP_OK; } else return WAIT;
--- a/MDM.h Sun Oct 11 09:56:57 2015 +0000 +++ b/MDM.h Tue Aug 01 08:09:16 2017 +0000 @@ -319,6 +319,7 @@ bool clk(char *num); + bool sendAT(); // ---------------------------------------------------------------- // Signal Service // ---------------------------------------------------------------- @@ -328,7 +329,7 @@ \return value of signal strenght */ - int chkSig(MDMParser::NetStatus *status); + int signal(); /** Chek status of debug for set the next action \param status debug