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

Revision:
68:c490e4a51778
Parent:
46:b30547bf07d5
Child:
81:45e1359a5c69
--- a/io/MTSBufferedIO.h	Mon Dec 23 19:55:31 2013 +0000
+++ b/io/MTSBufferedIO.h	Tue Dec 24 01:15:44 2013 +0000
@@ -33,7 +33,19 @@
     */
     ~MTSBufferedIO();
 
-    /** This method enables bulk writes to the Tx or wriet buffer. If more data
+    /** This method enables bulk writes to the Tx or write buffer. If more data
+    * is requested to be written then space available the method writes
+    * as much data as possible within the timeout period and returns the actual amount written.
+    *
+    * @param data the byte array to be written.
+    * @param length the length of data to be written from the data paramter.
+    * @timeoutMillis amount of time in milliseconds to complete operation.
+    * @returns the number of bytes written to the buffer, which is 0 if
+    * the buffer is full.
+    */
+    int write(const char* data, int length, unsigned int timeoutMillis);
+    
+    /** This method enables bulk writes to the Tx or write buffer. If more data
     * is requested to be written then space available the method writes
     * as much data as possible and returns the actual amount written.
     *
@@ -44,6 +56,15 @@
     */
     int write(const char* data, int length);
 
+    /** This method attempts to write a single byte to the tx buffer
+    * within the timeout period.
+    *
+    * @param data the byte to be written as a char.
+    * @timeoutMillis amount of time in milliseconds to complete operation.
+    * @returns 1 if the byte was written or 0 if the buffer was full.
+    */
+    int write(char data, unsigned int timeoutMillis);
+    
     /** This method writes a signle byte as a char to the Tx or write buffer.
     *
     * @param data the byte to be written as a char.
@@ -63,6 +84,17 @@
     *
     * @param data the buffer where data read will be added to.
     * @param length the amount of data in bytes to be read into the buffer.
+    * @timeoutMillis amount of time to complete operation.
+    * @returns the total number of bytes that were read.
+    */
+    int read(char* data, int length, unsigned int timeoutMillis);
+    
+    /** This method enables bulk reads from the Rx or read buffer.  If more data is
+    * requested then available it simply returns all remaining data within the
+    * buffer.
+    *
+    * @param data the buffer where data read will be added to.
+    * @param length the amount of data in bytes to be read into the buffer.
     * @returns the total number of bytes that were read.
     */
     int read(char* data, int length);
@@ -70,6 +102,14 @@
     /** This method reads a single byte from the Rx or read buffer.
     *
     * @param data char where the read byte will be stored.
+    * @timeoutMillis amount of time to complete operation.
+    * @returns 1 if byte is read or 0 if no byte is available.
+    */
+    int read(char& data, unsigned int timeoutMillis);
+    
+    /** This method reads a single byte from the Rx or read buffer.
+    *
+    * @param data char where the read byte will be stored.
     * @returns 1 if byte is read or 0 if no byte is available.
     */
     int read(char& data);