support library for C027 helper functions for Buffer Pipes, Buffered Serial Port (rtos capable) and GPS parsing. It includes modem APIs for USSD, SMS and Sockets.
Dependents: HTTPClient_Cellular_HelloWorld Cellular_HelloMQTT MbedSmartRestMain Car_Bon_car_module ... more
This library is intended to be used with u-blox products such as the C027 or a shield with u-blox cellular and GPS modules like the cellular and positioning shield from Embedded Artist.
For 2G/GSM and 3G/UMTS you need to:
- have a SIM card and know its PIN number
- need to know you network operators APN setting These setting should be passed to the connect or init and join functions. You can also extend the APN database in MDMAPN.h.
For CDMA products you need to make sure that you have provisioned and activated the modem with either Sprint or Verizon.
Diff: MDM.cpp
- Revision:
- 66:69072b3c5bca
- Parent:
- 65:dd94f920a762
- Child:
- 68:33a96cf64986
--- a/MDM.cpp Tue May 13 14:41:03 2014 +0000 +++ b/MDM.cpp Tue May 13 15:56:28 2014 +0000 @@ -189,7 +189,8 @@ // relax a bit WAIT_MS(10); } - while (timer.read_ms() < timeout_ms); + while ((timeout_ms == TIMEOUT_BLOCKING) || + (timer.read_ms() < timeout_ms)); timer.stop(); timer.reset(); return WAIT; @@ -706,7 +707,7 @@ // successfull _sockets[socket].state = SOCK_CREATED; _sockets[socket].pending = 0; - _sockets[socket].timeout_ms = 0; // non blocking + _sockets[socket].timeout_ms = TIMEOUT_BLOCKING; return socket; } @@ -735,7 +736,7 @@ return _sockets[socket].state == SOCK_CONNECTED; } -bool MDMParser::socketSetBlocking(int socket, unsigned int timeout_ms) +bool MDMParser::socketSetBlocking(int socket, int timeout_ms) { TRACE("socketSetBlocking(%d,%d)\r\n", socket, timeout_ms); if (!ISSOCKET(socket)) @@ -844,7 +845,7 @@ buf += blk; _sockets[socket].pending -= blk; } else if ((_sockets[socket].state == SOCK_CONNECTED) && ( - (_sockets[socket].timeout_ms == (unsigned int)-1 /* blocking */) || + (_sockets[socket].timeout_ms == TIMEOUT_BLOCKING) || (timer.read_ms() < _sockets[socket].timeout_ms))){ // allow to receive unsolicited commands waitFinalResp(NULL, NULL, 10); @@ -900,7 +901,7 @@ cnt += blk; buf += blk; _sockets[socket].pending -= blk; - } else if ((_sockets[socket].timeout_ms == (unsigned int)-1 /* blocking */) || + } else if ((_sockets[socket].timeout_ms == TIMEOUT_BLOCKING) || (timer.read_ms() < _sockets[socket].timeout_ms)) { // allow to receive unsolicited commands waitFinalResp(NULL, NULL, 10);