Cellular library for MTS Socket Modem Arduino Shield devices from Multi-Tech Systems
Dependents: mtsas mtsas mtsas mtsas
Diff: Cellular/Cellular.h
- Revision:
- 56:43205bd2752a
- Parent:
- 53:1aee5fe47adb
- Child:
- 63:f46ef5823ab5
--- a/Cellular/Cellular.h Mon Aug 11 21:01:50 2014 +0000 +++ b/Cellular/Cellular.h Wed Aug 13 16:46:10 2014 +0000 @@ -403,13 +403,65 @@ * @returns the enumeration name as a string. */ static std::string getRadioNames(Radio radio); + /** A method for changing the echo commands from radio. * @param state Echo mode is off (an argument of 1 turns echos off, anything else turns echo on) * @returns standard Code enumeration */ - virtual Code echo(bool state) = 0; //Implemented the same way in both UIP and EasyIP, - //and thus could be moved to cellular class - virtual Code setSocketCloseable(bool enabled) = 0; + virtual Code echo(bool state); + + /** This method can be used to trade socket functionality for performance. + * Can disable checking socket closed messages from the data socket, and thus the socket + * will only be visibly closed to the local side if the radio is explicitly checked, or + * the socket is closed by the local side through the use of physical pin manipulation. + * + * Uses the Hayes escape sequence (1 second pause, "+++", 1 second pause) to exit the socket + * connection to check if a received "NO CARRIER" string is from the radio indicating the socket + * has been closed, or is merely part of the data stream. Should not occur very often, however, if + * data carrying the string "NO CARRIER" is going to be transmitted frequently, then the socket should + * be set closeable and physical-socket-closing-means be used instead to reduce the large amount of + * overhead switching from checking the validity of the "NO CARRIER" message being and indication of + * the socket connection being closed. + * + * @param enabled set to true if you want the socket closeable, otherwise false. The default + * is true. + * @returns the standard AT Code enumeration. + */ + virtual Code setSocketCloseable(bool enabled); + + + /** Binds the socket to a specific port if able + * @param port integer to bind the socket to. + * + * @returns true if successfully bound port, false if bind failed. + */ + virtual bool bind(unsigned int port); + + /** Checks if a socket is open. + * @returns true if socket is open, false if socket is closed + */ + virtual bool isOpen(); + + /** Checks if there is data available from the socket. + * @returns number of bytes of data available to read. + */ + virtual unsigned int readable(); + + /** Checks data to output on the socket + * @returns number of bytes to be written to the socket. + */ + virtual unsigned int writeable(); + + /** Gets the device IP + * @returns string containing the IP address + */ + virtual std::string getDeviceIP(); + + /** Sets the device IP + * (Not implemented, IP address values are assigned by DHCP) + * @returns true if the IP was set, false if IP address assignment failed. + */ + virtual bool setDeviceIP(std::string address = "DHCP"); protected: MTSBufferedIO* io; //IO interface obect that the radio is accessed through.