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: GPS.cpp
- Revision:
- 7:9aa830f5811e
- Parent:
- 6:775aef3f1d1f
- Child:
- 9:e7a5959ffae1
--- a/GPS.cpp Sat Nov 09 12:20:25 2013 +0000 +++ b/GPS.cpp Sat Nov 09 13:31:01 2013 +0000 @@ -31,18 +31,32 @@ int GPSParser::_parseNmea(Pipe<char>* pipe, int len) { - int ix = 0; + int o = 0; + int c = 0; + char ch; pipe->start(); - if (++ix > len) return WAIT; + if (++o > len) return WAIT; if ('$' != pipe->next()) return NOT_FOUND; // this needs to be extended by crc checking for (;;) { - if (++ix > len) return WAIT; - char ch = pipe->next(); - if ('\n' == ch) return ix; - if (!isprint(ch) && '\r'!= ch) return NOT_FOUND; + if (++o > len) return WAIT; + ch = pipe->next(); + if ('*' == ch) break; // crc delimiter + if (!isprint(ch)) return NOT_FOUND; + c ^= ch; } + if (++o > len) return WAIT; + ch = toHex[(c >> 4) & 0xF]; // high nibble + if (ch != pipe->next()) return NOT_FOUND; + if (++o > len) return WAIT; + ch = toHex[(c >> 0) & 0xF]; // low nibble + if (ch != pipe->next()) return NOT_FOUND; + if (++o > len) return WAIT; + if ('\r' != pipe->next()) return NOT_FOUND; + if (++o > len) return WAIT; + if ('\n' != pipe->next()) return NOT_FOUND; + return o; } int GPSParser::_parseUbx(Pipe<char>* pipe, int l)