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

Committer:
mazgch
Date:
2014-03-14
Revision:
18:e5697801df29
Parent:
17:296d94a006b4
Child:
19:2b5d097ca15d
Child:
20:535ef78655df

File content as of revision 18:e5697801df29:

#pragma once 

#include "mbed.h"
#include "Pipe.h"
#include "SerialPipe.h"
#include "C027_PinNames.h"

#define RX_SIZE 256
#define TX_SIZE 128

class MDMParser
{
public:
    #define WAIT      -1
    #define NOT_FOUND  0
    
    #define LENGTH(x)   (x & 0x00FFFF)
//    #define PROTOCOL(x) (x & 0xFF0000)
    virtual int getLine(char* buf, int len) = 0; 
    virtual int getResp(char* buf, int len) = 0; 
    virtual int send(const char* buf, int len);
    
protected:
    static int _getLine(Pipe<char>* pipe, char* buffer, int length);
    static int _getResp(Pipe<char>* pipe, char* buffer, int length);
    virtual int _send(const void* buf, int len) = 0;
};

// -----------------------------------------------------------------------

class MDMSerial :  public SerialPipe, public MDMParser
{
public: 
    MDMSerial(PinName tx = MDMTXD, PinName rx = MDMRXD, int baudrate = MDMBAUD,
              int rxSize = RX_SIZE, int txSize = TX_SIZE);
    MDMSerial(PinName tx = MDMTXD, PinName rx = MDMRXD, int baudrate = MDMBAUD,
              PinName rts = MDMRTS, PinName cts = MDMCTS,
              int rxSize = RX_SIZE, int txSize = TX_SIZE);
    virtual int getLine(char* buffer, int length);
    virtual int getResp(char* buffer, int length);
protected:
    virtual int _send(const void* buf, int len);
};

// -----------------------------------------------------------------------

#define HAVE_MDMUSB
#ifdef HAVE_MDMUSB
class MDMUsb :  /*public UsbSerial,*/ public MDMParser
{
public: 
    MDMUsb(void);
    virtual int getLine(char* buffer, int length);
    virtual int getResp(char* buffer, int length);
protected:
    virtual int _send(const void* buf, int len);
};
#endif