A library for talking to Multi-Tech's Cellular SocketModem Devices.
Dependents: M2X_dev axeda_wrapper_dev MTS_M2x_Example1 MTS_Cellular_Connect_Example ... more
io/MTSBufferedIO.h
- Committer:
- sgodinez
- Date:
- 2013-12-16
- Revision:
- 17:2d7c4ea7491b
- Parent:
- 0:563b70517320
- Child:
- 36:bb6b293c7495
- Child:
- 39:6e94520a3217
- Child:
- 41:81d035fb0b6a
File content as of revision 17:2d7c4ea7491b:
#ifndef MTSBUFFEREDIO_H #define MTSBUFFEREDIO_H #include "mbed.h" #include "MTSCircularBuffer.h" class MTSBufferedIO { public: MTSBufferedIO(int txBufferSize = 128, int rxBufferSize = 128); ~MTSBufferedIO(); int write(char* data, int length); int write(char data); int writeable(); int read(char* data, int length); int read(char& data); int readable(); template<typename T> void attach(T *tptr, void(T::*mptr)(void), int threshold, Vars::RelationalOperator op, Serial::IrqType type); void attach(void(*fptr)(void), int threshold, Vars::RelationalOperator op, Serial::IrqType type); bool txEmpty(); bool rxEmpty(); bool txFull(); bool rxFull(); void txClear(); void rxClear(); int txAvailable(); int rxAvailable(); int txCapacity(); int rxCapacity(); virtual void handleWrite() = 0; virtual void handleRead() = 0; protected: MTSCircularBuffer* txBuffer; MTSCircularBuffer* rxBuffer; }; #endif /* MTSBUFFEREDIO_H */