C027_SupportTest_xively_locationで使用しているC027用ライブラリ

Fork of C027_Support by u-blox

下記のプログラムC027_SupportTest_xively_locationで使用しているC027用ライブラリです。

Import programC027_SupportTest_xively_location

インターフェース2014年10月号のu-blox C027で3G通信する記事で使用したプログラム。   CQ publishing Interface 2014.10 issue, C027 3G test program.

オリジナルのライブラリは下記を参照してください。

Import libraryC027_Support

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.

MDM.h

Committer:
mazgch
Date:
2014-03-24
Revision:
19:2b5d097ca15d
Parent:
18:e5697801df29
Child:
21:c4d64830bf02

File content as of revision 19:2b5d097ca15d:

#pragma once 

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

#ifdef TARGET_UBLOX_C027
 // if we detect the C027 platform we will assign the 
 // default pinname and baudrate in the constructor 
 // this helper macro will be used. 
 #define _C027DEFAULT(name) = name
#else
 #define _C027DEFAULT(name)
#endif

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    _C027DEFAULT(MDMTXD), 
              PinName rx    _C027DEFAULT(MDMRXD), 
              int baudrate  _C027DEFAULT(MDMBAUD),
#if DEVICE_SERIAL_FC
              PinName rts   _C027DEFAULT(MDMRTS), 
              PinName cts   _C027DEFAULT(MDMCTS),
#endif
              int rxSize    = 256 , 
              int txSize    = 256 );
    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