From de2a0da915d0bbe871b501fc6306c581dc0e49ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Villac=C3=ADs=20Lasso?= Date: Mon, 21 Dec 2020 13:48:24 -0500 Subject: [PATCH] Implement write() and free() methods Also comment out one prototype not yet implemented. --- src/AsyncTCP.cpp | 12 ++++++++++++ src/AsyncTCP.h | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/AsyncTCP.cpp b/src/AsyncTCP.cpp index 8837073..cab5ec8 100644 --- a/src/AsyncTCP.cpp +++ b/src/AsyncTCP.cpp @@ -777,6 +777,18 @@ void AsyncClient::_clearWriteQueue(void) } } +bool AsyncClient::free(){ + if (_socket == -1) return true; + return (_conn_state == 0 || _conn_state > 4); +} + +size_t AsyncClient::write(const char* data) { + if(data == NULL) { + return 0; + } + return write(data, strlen(data)); +} + size_t AsyncClient::write(const char* data, size_t size, uint8_t apiflags) { size_t will_send = add(data, size, apiflags); if(!will_send || !send()) { diff --git a/src/AsyncTCP.h b/src/AsyncTCP.h index 6ac9601..943edaa 100644 --- a/src/AsyncTCP.h +++ b/src/AsyncTCP.h @@ -87,7 +87,7 @@ class AsyncClient : public AsyncSocketBase bool connect(const char* host, uint16_t port); void close(bool now = false); - int8_t abort(); + //int8_t abort(); bool free(); bool canSend() { return space() > 0; }