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: wifi/Wifi.h
- Revision:
- 106:358972176b89
- Parent:
- 103:da58d27c15d7
- Child:
- 108:554585370b4a
--- a/wifi/Wifi.h Tue Dec 31 15:11:04 2013 +0000 +++ b/wifi/Wifi.h Tue Dec 31 16:34:22 2013 +0000 @@ -82,7 +82,31 @@ virtual void reset(); + /** A method for sending a generic text command to the radio. Note that you cannot + * send commands and have a socket connection at the same time, unless you first + * switch to command mode. + * + * @param command the command to send to the WiFi module without the escape character. + * @param timeoutMillis the time in millis to wait for a response before returning. + * @param response the text string to look for and to return immediately after finding. + * The default is to look for no specific response. + * @param esc escape character to add at the end of the command, defaults to + * carriage return (CR). Does not append any character if esc == 0. + * @returns all data received from the radio after the command as a string. + */ std::string sendCommand(std::string command, int timeoutMillis, std::string response = "", char esc = CR); + + /** A method for sending a basic command to the radio. A basic text command is + * one that simply has a response of either AOK or ERR without any other information. + * Note that you cannot send commands and have a tcp connection at the same time + * unless you first switch to command mode. + * + * @param command the command to send to the WiFi module without the escape character. + * @param timeoutMillis the time in millis to wait for a response before returning. + * @param esc escape character to add at the end of the command, defaults to + * carriage return (CR). + * @returns the standard Code enumeration. + */ Code sendBasicCommand(std::string command, int timeoutMillis, char esc = CR); /** This method is used to set the network information details. This method must be @@ -93,6 +117,21 @@ * @param key the security key for the network. The default is no key. */ Code setNetwork(const std::string& ssid, SecurityType type = NONE, const std::string& key = ""); + + /** This method is used to set the IP address or puts the module in DHCP mode. + * + * @param address the IP address you want to use in the form of xxx.xxx.xxx.xxx or DHCP + * if you want to use DHCP. The default is DHCP. + * @returns the standard Code enumeration. + */ + Code setDeviceIP(std::string address = "DHCP"); + + /** This method is used to get the IP address of the device, which can be + * set either statically or via DHCP after connecting to a network. + * + * @returns the devices IP address. + */ + std::string getDeviceIP(); /** This method is used to set the DNS which enables the use of URLs instead * of IP addresses when making a socket connection.