From 0e890b7a3bd41980fa754ad50da287cd26c17560 Mon Sep 17 00:00:00 2001 From: Veijo Pesonen Date: Mon, 8 Oct 2018 15:33:09 +0300 Subject: [PATCH] Rename AT layer OOB functions --- ESP8266/ESP8266.cpp | 14 +++++++------- ESP8266/ESP8266.h | 4 ++-- ESP8266Interface.h | 4 +--- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/ESP8266/ESP8266.cpp b/ESP8266/ESP8266.cpp index 8af429b..f677f1a 100644 --- a/ESP8266/ESP8266.cpp +++ b/ESP8266/ESP8266.cpp @@ -40,7 +40,7 @@ ESP8266::ESP8266(PinName tx, PinName rx, bool debug, PinName rts, PinName cts) _fail(false), _sock_already(false), _closed(false), - _connection_status(NSAPI_STATUS_DISCONNECTED) + _conn_status(NSAPI_STATUS_DISCONNECTED) { _serial.set_baud( ESP8266_DEFAULT_BAUD_RATE ); _parser.debug_on(debug); @@ -58,7 +58,7 @@ ESP8266::ESP8266(PinName tx, PinName rx, bool debug, PinName rts, PinName cts) _parser.oob("+CWJAP:", callback(this, &ESP8266::_oob_connect_err)); _parser.oob("WIFI ", callback(this, &ESP8266::_oob_connection_status)); _parser.oob("UNLINK", callback(this, &ESP8266::_oob_socket_close_err)); - _parser.oob("ALREADY CONNECTED", callback(this, &ESP8266::_oob_cipstart_already)); + _parser.oob("ALREADY CONNECTED", callback(this, &ESP8266::_oob_conn_already)); for(int i= 0; i < SOCKET_COUNT; i++) { _sock_i[i].open = false; @@ -809,7 +809,7 @@ void ESP8266::_oob_connect_err() } -void ESP8266::_oob_cipstart_already() +void ESP8266::_oob_conn_already() { _sock_already = true; _parser.abort(); @@ -853,11 +853,11 @@ void ESP8266::_oob_connection_status() char status[13]; if (_parser.recv("%12[^\"]\n", status)) { if (strcmp(status, "GOT IP\n") == 0) { - _connection_status = NSAPI_STATUS_GLOBAL_UP; + _conn_status = NSAPI_STATUS_GLOBAL_UP; } else if (strcmp(status, "DISCONNECT\n") == 0) { - _connection_status = NSAPI_STATUS_DISCONNECTED; + _conn_status = NSAPI_STATUS_DISCONNECTED; } else if (strcmp(status, "CONNECTED\n") == 0) { - _connection_status = NSAPI_STATUS_CONNECTING; + _conn_status = NSAPI_STATUS_CONNECTING; } else { MBED_ERROR(MBED_MAKE_ERROR(MBED_MODULE_DRIVER, MBED_ERROR_CODE_EBADMSG), \ "ESP8266::_oob_connection_status: invalid AT cmd\n"); @@ -899,5 +899,5 @@ bool ESP8266::set_default_wifi_mode(const int8_t mode) nsapi_connection_status_t ESP8266::connection_status() const { - return _connection_status; + return _conn_status; } diff --git a/ESP8266/ESP8266.h b/ESP8266/ESP8266.h index 30c0ee4..2659026 100644 --- a/ESP8266/ESP8266.h +++ b/ESP8266/ESP8266.h @@ -387,7 +387,7 @@ class ESP8266 // OOB message handlers void _oob_packet_hdlr(); void _oob_connect_err(); - void _oob_cipstart_already(); + void _oob_conn_already(); void _oob_socket0_closed(); void _oob_socket1_closed(); void _oob_socket2_closed(); @@ -416,7 +416,7 @@ class ESP8266 struct _sock_info _sock_i[SOCKET_COUNT]; // Connection state reporting - nsapi_connection_status_t _connection_status; + nsapi_connection_status_t _conn_status; Callback _conn_stat_cb; // ESP8266Interface registered }; diff --git a/ESP8266Interface.h b/ESP8266Interface.h index 0e46bb4..52b413c 100644 --- a/ESP8266Interface.h +++ b/ESP8266Interface.h @@ -320,6 +320,7 @@ class ESP8266Interface : public NetworkStack, public WiFiInterface private: // AT layer ESP8266 _esp; + void update_conn_state_cb(); // Credentials static const int ESP8266_SSID_MAX_LENGTH = 32; /* 32 is what 802.11 defines as longest possible name */ @@ -353,9 +354,6 @@ class ESP8266Interface : public NetworkStack, public WiFiInterface // Connection state reporting to application nsapi_connection_status_t _conn_stat; Callback _conn_stat_cb; - - // Connection state from AT layer - void update_conn_state_cb(); }; #endif