diff --git a/src/GPRS.cpp b/src/GPRS.cpp index 3e04987..0abbf4c 100644 --- a/src/GPRS.cpp +++ b/src/GPRS.cpp @@ -320,6 +320,11 @@ IPAddress GPRS::getIPAddress() return IPAddress(0, 0, 0, 0); } +unsigned long GPRS::timeout() +{ + return _timeout; +} + void GPRS::setTimeout(unsigned long timeout) { _timeout = timeout; @@ -398,6 +403,16 @@ GSM3_NetworkStatus_t GPRS::status() return _status; } +int GPRS::state() +{ + return _state; +} + +void GPRS::setState(int state) +{ + _state = state; +} + void GPRS::handleUrc(const String& urc) { if (urc.startsWith("+UUPINGER: ")) { diff --git a/src/GPRS.h b/src/GPRS.h index 407b36f..c0a73b7 100644 --- a/src/GPRS.h +++ b/src/GPRS.h @@ -80,6 +80,7 @@ class GPRS : public ModemUrcHandler { */ IPAddress getIPAddress(); + unsigned long timeout(); void setTimeout(unsigned long timeout); int hostByName(const char* hostname, IPAddress& result); @@ -90,6 +91,8 @@ class GPRS : public ModemUrcHandler { int ping(IPAddress ip, uint8_t ttl = 128); GSM3_NetworkStatus_t status(); + int state(); + void setState(int state); void handleUrc(const String& urc); diff --git a/src/GSM.cpp b/src/GSM.cpp index d9a9fb7..42c912f 100644 --- a/src/GSM.cpp +++ b/src/GSM.cpp @@ -321,6 +321,11 @@ int GSM::ready() return ready; } +unsigned long GSM::timeout() +{ + return _timeout; +} + void GSM::setTimeout(unsigned long timeout) { _timeout = timeout; @@ -388,3 +393,13 @@ GSM3_NetworkStatus_t GSM::status() { return _state; } + +GSM3_NetworkStatus_t GSM::state() +{ + return _state; +} + +void GSM::setState(GSM3_NetworkStatus_t state) +{ + _state = state; +} diff --git a/src/GSM.h b/src/GSM.h index e9cd99b..988171c 100644 --- a/src/GSM.h +++ b/src/GSM.h @@ -66,6 +66,7 @@ class GSM { */ int ready(); + unsigned long timeout(); void setTimeout(unsigned long timeout); unsigned long getTime(); @@ -75,6 +76,8 @@ class GSM { int noLowPowerMode(); GSM3_NetworkStatus_t status(); + GSM3_NetworkStatus_t state(); + void setState(GSM3_NetworkStatus_t state); private: GSM3_NetworkStatus_t _state; diff --git a/src/GSMClient.cpp b/src/GSMClient.cpp index 24a6254..039f82a 100644 --- a/src/GSMClient.cpp +++ b/src/GSMClient.cpp @@ -23,20 +23,6 @@ #include "GSMClient.h" -enum { - CLIENT_STATE_IDLE, - CLIENT_STATE_CREATE_SOCKET, - CLIENT_STATE_WAIT_CREATE_SOCKET_RESPONSE, - CLIENT_STATE_ENABLE_SSL, - CLIENT_STATE_WAIT_ENABLE_SSL_RESPONSE, - CLIENT_STATE_MANAGE_SSL_PROFILE, - CLIENT_STATE_WAIT_MANAGE_SSL_PROFILE_RESPONSE, - CLIENT_STATE_CONNECT, - CLIENT_STATE_WAIT_CONNECT_RESPONSE, - CLIENT_STATE_CLOSE_SOCKET, - CLIENT_STATE_WAIT_CLOSE_SOCKET -}; - GSMClient::GSMClient(bool synch) : GSMClient(-1, synch) { @@ -446,3 +432,23 @@ void GSMClient::handleUrc(const String& urc) } } } + +int GSMClient::state() +{ + return _state; +} + +void GSMClient::setState(int state) +{ + _state = state; +} + +int GSMClient::socket() +{ + return _socket; +} + +const char* GSMClient::host() +{ + return _host; +} diff --git a/src/GSMClient.h b/src/GSMClient.h index 1455d58..f29033c 100644 --- a/src/GSMClient.h +++ b/src/GSMClient.h @@ -24,6 +24,20 @@ #include +enum { + CLIENT_STATE_IDLE, + CLIENT_STATE_CREATE_SOCKET, + CLIENT_STATE_WAIT_CREATE_SOCKET_RESPONSE, + CLIENT_STATE_ENABLE_SSL, + CLIENT_STATE_WAIT_ENABLE_SSL_RESPONSE, + CLIENT_STATE_MANAGE_SSL_PROFILE, + CLIENT_STATE_WAIT_MANAGE_SSL_PROFILE_RESPONSE, + CLIENT_STATE_CONNECT, + CLIENT_STATE_WAIT_CONNECT_RESPONSE, + CLIENT_STATE_CLOSE_SOCKET, + CLIENT_STATE_WAIT_CLOSE_SOCKET +}; + class GSMClient : public Client, public ModemUrcHandler { public: @@ -130,6 +144,11 @@ class GSMClient : public Client, public ModemUrcHandler { virtual void handleUrc(const String& urc); + int state(); + void setState(int state); + int socket(); + const char* host(); + private: int connect();