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: cellular/Cellular.h
- Revision:
- 23:bc6f98a1eb22
- Parent:
- 19:38794784e009
- Child:
- 27:8e6188cbcfd4
- Child:
- 29:7408b1bdad37
--- a/cellular/Cellular.h Tue Dec 17 17:23:40 2013 +0000 +++ b/cellular/Cellular.h Tue Dec 17 18:49:06 2013 +0000 @@ -7,6 +7,9 @@ #include <string> #include <vector> +#define PINGDELAY 3 +#define PINGNUM 4 + class Cellular : virtual IPStack { public: @@ -55,13 +58,36 @@ std::string sendCommand(std::string command, int timeoutMillis, ESC_CHAR esc = CR); Code sendBasicCommand(std::string command, int timeoutMillis, ESC_CHAR esc = CR); + /** A method for testing command access to the radio. This method sends the + * command "AT" to the radio, which is a standard radio test to see if you + * have command access to the radio. + * + * @returns the standard AT Code enumeration. + */ Code test(); + + /** A method for configuring command ehco capability on the radio. This command + * sets whether sent characters are echoed back from the radio, in which case you + * will receive back every command you send. + * + * @param state if true echo will be turned off, otherwise it will be turned on. + * @returns the standard AT Code enumeration. + */ Code echoOff(bool state); + + /** A method for getting the signal strength of the radio. This method allows you to + * get a value that maps to signal strength in dBm. Here 0-1 is Poor, 2-9 is Marginal, + * 10-14 is Ok, 15-19 is Good, and 20+ is Excellent. If you get a result of 99 the + * signal strength is not known or not detectable. + * + * @returns an integer representing the signal strength. + */ int getSignalStrength(); std::string getPhoneNumber(); Registration getRegistration(); Code setApn(const std::string& apn); Code setDns(const std::string& apn); + bool ping(const std::string& address = "8.8.8.8"); Code setSocketCloseable(bool enabled = true); //ETX closes socket (ETX and DLE in payload are escaped with DLE) //SMS @@ -73,24 +99,24 @@ private: - static Cellular* instance; + static Cellular* instance; //Static pointer to the single Cellular object. - MTSBufferedIO* io; - bool echoMode; + MTSBufferedIO* io; //IO interface obect that the radio is accessed through. + bool echoMode; //Specifies if the echo mode is currently enabled. - bool pppConnected; - std::string apn; + bool pppConnected; //Specifies if a PPP session is currently connected. + std::string apn; //A string that holds the APN for the radio. - Mode mode; - bool socketOpened; - bool socketCloseable; - unsigned int local_port; + Mode mode; + bool socketOpened; //Specifies if a Socket is presently opened. + bool socketCloseable; //Specifies is a Socket can be closed. + unsigned int local_port; std::string local_address; unsigned int host_port; std::string host_address; - Cellular(); - Cellular(MTSBufferedIO* io); + Cellular(); //Private constructor, use the getInstance() method. + Cellular(MTSBufferedIO* io); //Private constructor, use the getInstance method. };