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
Diff: io/MTSSerial.h
- Revision:
- 45:40745c2036cf
- Parent:
- 36:bb6b293c7495
- Child:
- 46:b30547bf07d5
diff -r 4739e039421a -r 40745c2036cf io/MTSSerial.h --- a/io/MTSSerial.h Thu Dec 19 16:54:09 2013 +0000 +++ b/io/MTSSerial.h Thu Dec 19 21:38:01 2013 +0000 @@ -5,22 +5,23 @@ #include "MTSBufferedIO.h" /** This class derives from MTSBufferedIO and provides a buffered wrapper to the -* standard Mbed Serial class. Since it depends only on the Mbed Serial class for -* accessing serial data, this class is inherently portable accross Mbed platforms. +* standard mbed Serial class. Since it depends only on the mbed Serial class for +* accessing serial data, this class is inherently portable accross different mbed +* platforms. */ class MTSSerial : public MTSBufferedIO { public: - /** Creates a new MTSSerial object that can be used to talk to an Mbed serial port + /** Creates a new MTSSerial object that can be used to talk to an mbed serial port * through internal SW buffers. * - * @param TXD the transmit data pin on the desired Mbed serial interface. - * @param RXD the receive data pin on the desired Mbed serial interface. + * @param TXD the transmit data pin on the desired mbed Serial interface. + * @param RXD the receive data pin on the desired mbed Serial interface. * @param txBufferSize the size in bytes of the internal SW transmit buffer. The * default is 64 bytes. * @param rxBufferSize the size in bytes of the internal SW receive buffer. The * default is 64 bytes. - * @param name an optional name for the serial port. The default is blank. + * @param name an optional name for the serial port. The default is "". */ MTSSerial(PinName TXD, PinName RXD, int txBufferSize = 64, int rxBufferSize = 64, char* name = ""); @@ -28,30 +29,29 @@ * internal buffers. */ ~MTSSerial(); - + /** This method is used to the set the baud rate of the serial port. - * - * @param baudrate the baudrate in bps as an int. The internal interface - * default is 9600 bps. + * + * @param baudrate the baudrate in bps as an int. The default is 9600 bps. */ void baud(int baudrate); - -// void format(int bits=8, Parity parity=SerialBase::None, int stop_bits=1); - /** Overridden method used internally to handle reading from the serial interface. - * Do not call directly, use data access methods available in MTSBufferedIO. + /** This method sets the transmission format used by the serial port. + * + * @param bits the number of bits in a word (5-8; default = 8) + * @param parity the parity used (SerialBase::None, SerialBase::Odd, SerialBase::Even, + * SerialBase::Forced1, SerialBase::Forced0; default = SerialBase::None) + * @param stop the number of stop bits (1 or 2; default = 1) */ - virtual void handleRead(); - - /** Overridden method used internally to handle writing to the serial interface. - * Do not call directly, use data access methods available in MTSBufferedIO. - */ - virtual void handleWrite(); + void format(int bits=8, SerialBase::Parity parity=SerialBase::None, int stop_bits=1); private: Serial* serial; // Internal mbed Serial object int writeSize; // Amount of data to write based on buffer size char* if_name; // Name of the interface + + virtual void handleWrite(); // Method for handling data to be written + virtual void handleRead(); // Method for handling data to be read }; #endif /* MTSSERIAL_H */ \ No newline at end of file