Add a bunch of APNs

Fork of C027_Support by Xinlei Cao

Committer:
mazgch
Date:
Fri Mar 14 13:07:48 2014 +0000
Revision:
18:e5697801df29
Parent:
17:296d94a006b4
Child:
19:2b5d097ca15d
Child:
20:535ef78655df
extend Api for GPS and GNSS

Who changed what in which revision?

UserRevisionLine numberNew 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 #include "C027_PinNames.h"
mazgch 17:296d94a006b4 7
mazgch 18:e5697801df29 8 #define RX_SIZE 256
mazgch 18:e5697801df29 9 #define TX_SIZE 128
mazgch 18:e5697801df29 10
mazgch 18:e5697801df29 11 class MDMParser
mazgch 18:e5697801df29 12 {
mazgch 18:e5697801df29 13 public:
mazgch 18:e5697801df29 14 #define WAIT -1
mazgch 18:e5697801df29 15 #define NOT_FOUND 0
mazgch 18:e5697801df29 16
mazgch 18:e5697801df29 17 #define LENGTH(x) (x & 0x00FFFF)
mazgch 18:e5697801df29 18 // #define PROTOCOL(x) (x & 0xFF0000)
mazgch 18:e5697801df29 19 virtual int getLine(char* buf, int len) = 0;
mazgch 18:e5697801df29 20 virtual int getResp(char* buf, int len) = 0;
mazgch 18:e5697801df29 21 virtual int send(const char* buf, int len);
mazgch 18:e5697801df29 22
mazgch 18:e5697801df29 23 protected:
mazgch 18:e5697801df29 24 static int _getLine(Pipe<char>* pipe, char* buffer, int length);
mazgch 18:e5697801df29 25 static int _getResp(Pipe<char>* pipe, char* buffer, int length);
mazgch 18:e5697801df29 26 virtual int _send(const void* buf, int len) = 0;
mazgch 18:e5697801df29 27 };
mazgch 18:e5697801df29 28
mazgch 18:e5697801df29 29 // -----------------------------------------------------------------------
mazgch 18:e5697801df29 30
mazgch 18:e5697801df29 31 class MDMSerial : public SerialPipe, public MDMParser
mazgch 17:296d94a006b4 32 {
mazgch 17:296d94a006b4 33 public:
mazgch 18:e5697801df29 34 MDMSerial(PinName tx = MDMTXD, PinName rx = MDMRXD, int baudrate = MDMBAUD,
mazgch 18:e5697801df29 35 int rxSize = RX_SIZE, int txSize = TX_SIZE);
mazgch 18:e5697801df29 36 MDMSerial(PinName tx = MDMTXD, PinName rx = MDMRXD, int baudrate = MDMBAUD,
mazgch 18:e5697801df29 37 PinName rts = MDMRTS, PinName cts = MDMCTS,
mazgch 18:e5697801df29 38 int rxSize = RX_SIZE, int txSize = TX_SIZE);
mazgch 18:e5697801df29 39 virtual int getLine(char* buffer, int length);
mazgch 18:e5697801df29 40 virtual int getResp(char* buffer, int length);
mazgch 18:e5697801df29 41 protected:
mazgch 18:e5697801df29 42 virtual int _send(const void* buf, int len);
mazgch 17:296d94a006b4 43 };
mazgch 18:e5697801df29 44
mazgch 18:e5697801df29 45 // -----------------------------------------------------------------------
mazgch 18:e5697801df29 46
mazgch 18:e5697801df29 47 #define HAVE_MDMUSB
mazgch 18:e5697801df29 48 #ifdef HAVE_MDMUSB
mazgch 18:e5697801df29 49 class MDMUsb : /*public UsbSerial,*/ public MDMParser
mazgch 18:e5697801df29 50 {
mazgch 18:e5697801df29 51 public:
mazgch 18:e5697801df29 52 MDMUsb(void);
mazgch 18:e5697801df29 53 virtual int getLine(char* buffer, int length);
mazgch 18:e5697801df29 54 virtual int getResp(char* buffer, int length);
mazgch 18:e5697801df29 55 protected:
mazgch 18:e5697801df29 56 virtual int _send(const void* buf, int len);
mazgch 18:e5697801df29 57 };
mazgch 18:e5697801df29 58 #endif
mazgch 18:e5697801df29 59
mazgch 18:e5697801df29 60