Skip to content

Commit

Permalink
Rename AT layer OOB functions
Browse files Browse the repository at this point in the history
Veijo Pesonen committed Oct 10, 2018

Verified

This commit was signed with the committer’s verified signature.
sathish-progress Sathish Babu
1 parent 0023892 commit 0e890b7
Showing 3 changed files with 10 additions and 12 deletions.
14 changes: 7 additions & 7 deletions ESP8266/ESP8266.cpp
Original file line number Diff line number Diff line change
@@ -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;
}
4 changes: 2 additions & 2 deletions ESP8266/ESP8266.h
Original file line number Diff line number Diff line change
@@ -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<void()> _conn_stat_cb; // ESP8266Interface registered
};

4 changes: 1 addition & 3 deletions ESP8266Interface.h
Original file line number Diff line number Diff line change
@@ -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<void(nsapi_event_t, intptr_t)> _conn_stat_cb;

// Connection state from AT layer
void update_conn_state_cb();
};

#endif

0 comments on commit 0e890b7

Please sign in to comment.