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.
MDM.h@19:2b5d097ca15d, 2014-03-24 (annotated)
- Committer:
- mazgch
- Date:
- Mon Mar 24 07:38:05 2014 +0000
- Revision:
- 19:2b5d097ca15d
- Parent:
- 18:e5697801df29
- Child:
- 21:c4d64830bf02
prepare for native C027 platform support; add api to get lat/lon; better separation of mdm libarary from serial
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mazgch | 17:296d94a006b4 | 1 | #pragma once |
mazgch | 17:296d94a006b4 | 2 | |
mazgch | 17:296d94a006b4 | 3 | #include "mbed.h" |
mazgch | 18:e5697801df29 | 4 | #include "Pipe.h" |
mazgch | 18:e5697801df29 | 5 | #include "SerialPipe.h" |
mazgch | 17:296d94a006b4 | 6 | |
mazgch | 19:2b5d097ca15d | 7 | #ifdef TARGET_UBLOX_C027 |
mazgch | 19:2b5d097ca15d | 8 | // if we detect the C027 platform we will assign the |
mazgch | 19:2b5d097ca15d | 9 | // default pinname and baudrate in the constructor |
mazgch | 19:2b5d097ca15d | 10 | // this helper macro will be used. |
mazgch | 19:2b5d097ca15d | 11 | #define _C027DEFAULT(name) = name |
mazgch | 19:2b5d097ca15d | 12 | #else |
mazgch | 19:2b5d097ca15d | 13 | #define _C027DEFAULT(name) |
mazgch | 19:2b5d097ca15d | 14 | #endif |
mazgch | 18:e5697801df29 | 15 | |
mazgch | 18:e5697801df29 | 16 | class MDMParser |
mazgch | 18:e5697801df29 | 17 | { |
mazgch | 18:e5697801df29 | 18 | public: |
mazgch | 18:e5697801df29 | 19 | #define WAIT -1 |
mazgch | 18:e5697801df29 | 20 | #define NOT_FOUND 0 |
mazgch | 18:e5697801df29 | 21 | |
mazgch | 18:e5697801df29 | 22 | #define LENGTH(x) (x & 0x00FFFF) |
mazgch | 18:e5697801df29 | 23 | // #define PROTOCOL(x) (x & 0xFF0000) |
mazgch | 18:e5697801df29 | 24 | virtual int getLine(char* buf, int len) = 0; |
mazgch | 18:e5697801df29 | 25 | virtual int getResp(char* buf, int len) = 0; |
mazgch | 18:e5697801df29 | 26 | virtual int send(const char* buf, int len); |
mazgch | 18:e5697801df29 | 27 | |
mazgch | 18:e5697801df29 | 28 | protected: |
mazgch | 18:e5697801df29 | 29 | static int _getLine(Pipe<char>* pipe, char* buffer, int length); |
mazgch | 18:e5697801df29 | 30 | static int _getResp(Pipe<char>* pipe, char* buffer, int length); |
mazgch | 18:e5697801df29 | 31 | virtual int _send(const void* buf, int len) = 0; |
mazgch | 18:e5697801df29 | 32 | }; |
mazgch | 18:e5697801df29 | 33 | |
mazgch | 18:e5697801df29 | 34 | // ----------------------------------------------------------------------- |
mazgch | 18:e5697801df29 | 35 | |
mazgch | 18:e5697801df29 | 36 | class MDMSerial : public SerialPipe, public MDMParser |
mazgch | 17:296d94a006b4 | 37 | { |
mazgch | 17:296d94a006b4 | 38 | public: |
mazgch | 19:2b5d097ca15d | 39 | MDMSerial(PinName tx _C027DEFAULT(MDMTXD), |
mazgch | 19:2b5d097ca15d | 40 | PinName rx _C027DEFAULT(MDMRXD), |
mazgch | 19:2b5d097ca15d | 41 | int baudrate _C027DEFAULT(MDMBAUD), |
mazgch | 19:2b5d097ca15d | 42 | #if DEVICE_SERIAL_FC |
mazgch | 19:2b5d097ca15d | 43 | PinName rts _C027DEFAULT(MDMRTS), |
mazgch | 19:2b5d097ca15d | 44 | PinName cts _C027DEFAULT(MDMCTS), |
mazgch | 19:2b5d097ca15d | 45 | #endif |
mazgch | 19:2b5d097ca15d | 46 | int rxSize = 256 , |
mazgch | 19:2b5d097ca15d | 47 | int txSize = 256 ); |
mazgch | 18:e5697801df29 | 48 | virtual int getLine(char* buffer, int length); |
mazgch | 18:e5697801df29 | 49 | virtual int getResp(char* buffer, int length); |
mazgch | 18:e5697801df29 | 50 | protected: |
mazgch | 18:e5697801df29 | 51 | virtual int _send(const void* buf, int len); |
mazgch | 17:296d94a006b4 | 52 | }; |
mazgch | 18:e5697801df29 | 53 | |
mazgch | 18:e5697801df29 | 54 | // ----------------------------------------------------------------------- |
mazgch | 18:e5697801df29 | 55 | |
mazgch | 18:e5697801df29 | 56 | #define HAVE_MDMUSB |
mazgch | 18:e5697801df29 | 57 | #ifdef HAVE_MDMUSB |
mazgch | 18:e5697801df29 | 58 | class MDMUsb : /*public UsbSerial,*/ public MDMParser |
mazgch | 18:e5697801df29 | 59 | { |
mazgch | 18:e5697801df29 | 60 | public: |
mazgch | 18:e5697801df29 | 61 | MDMUsb(void); |
mazgch | 18:e5697801df29 | 62 | virtual int getLine(char* buffer, int length); |
mazgch | 18:e5697801df29 | 63 | virtual int getResp(char* buffer, int length); |
mazgch | 18:e5697801df29 | 64 | protected: |
mazgch | 18:e5697801df29 | 65 | virtual int _send(const void* buf, int len); |
mazgch | 18:e5697801df29 | 66 | }; |
mazgch | 18:e5697801df29 | 67 | #endif |
mazgch | 18:e5697801df29 | 68 | |
mazgch | 18:e5697801df29 | 69 |