Add localIP()

This commit is contained in:
Volodymyr Shymanskyy
2017-09-11 09:19:03 +03:00
parent 22e7464a08
commit 5b0e72f6bc
2 changed files with 9 additions and 6 deletions

View File

@@ -387,6 +387,8 @@ public:
String getLocalIP() TINY_GSM_ATTR_NOT_IMPLEMENTED;
IPAddress localIP() TINY_GSM_ATTR_NOT_IMPLEMENTED;
/*
* Phone Call functions
*/
@@ -448,7 +450,7 @@ public:
private:
int modemConnect(const char* host, uint16_t port, uint8_t mux) {
bool modemConnect(const char* host, uint16_t port, uint8_t mux) {
for (int i=0; i<3; i++) { // TODO: no need for loop?
String ip = dnsIpQuery(host);

View File

@@ -109,7 +109,7 @@ public:
virtual int available() {
TINY_GSM_YIELD();
if (sock_connected && !rx.size()) {
if (!rx.size() && sock_connected) {
// Workaround: sometimes SIM800 forgets to notify about data arrival.
// TODO: Currently we ping the module periodically,
// but maybe there's a better indicator that we need to poll
@@ -446,9 +446,7 @@ public:
}
sendAT(GF("+CIFSR;E0"));
String data;
if (waitResponse(10000L, data) != 1) {
data.replace(GSM_NL, "");
if (waitResponse(10000L) != 1) {
return false;
}
@@ -475,6 +473,8 @@ public:
return res;
}
IPAddress localIP() TINY_GSM_ATTR_NOT_IMPLEMENTED;
/*
* Phone Call functions
*/
@@ -598,7 +598,8 @@ public:
}
private:
int modemConnect(const char* host, uint16_t port, uint8_t mux) {
bool modemConnect(const char* host, uint16_t port, uint8_t mux) {
sendAT(GF("+CIPSTART="), mux, ',', GF("\"TCP"), GF("\",\""), host, GF("\","), port);
int rsp = waitResponse(75000L,
GF("CONNECT OK" GSM_NL),