Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of C027_Support by
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