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-19
- Revision:
- 41:81d035fb0b6a
- Parent:
- 17:2d7c4ea7491b
- Child:
- 43:3cacf019ed7d
File content as of revision 41:81d035fb0b6a:
#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(const 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 */