Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESP32 changes in APIs #23

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions TelnetSpy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ void TelnetSpy::setPort(uint16_t portToUse) {
if (listening) {
if (client.connected()) {
sendBlock();
client.flush();
client.clear();
client.stop();
}
if (connected && (callbackDisconnect != NULL)) {
Expand Down Expand Up @@ -408,13 +408,13 @@ int TelnetSpy::peek (void) {
return val;
}

void TelnetSpy::flush (void) {
void TelnetSpy::clear (void) {
if (usedSer) {
usedSer->flush();
}
if (client.connected()) {
sendBlock();
client.flush();
client.clear();
}
}

Expand Down Expand Up @@ -449,7 +449,7 @@ void TelnetSpy::end() {
}
if (client.connected()) {
sendBlock();
client.flush();
client.clear();
client.stop();
}
if (connected && (callbackDisconnect != NULL)) {
Expand Down Expand Up @@ -637,7 +637,7 @@ void TelnetSpy::setCallbackOnDisconnect(void (*callback)()) {
void TelnetSpy::disconnectClient() {
if (client.connected()) {
sendBlock();
client.flush();
client.clear();
client.stop();
}
if (connected && (callbackDisconnect != NULL)) {
Expand Down Expand Up @@ -737,14 +737,14 @@ void TelnetSpy::handle() {
}
if (telnetServer->hasClient()) {
if (client.connected()) {
WiFiClient rejectClient = telnetServer->available();
WiFiClient rejectClient = telnetServer->accept(); //available();
if (strlen(rejectMsg) > 0) {
rejectClient.write((const uint8_t*) rejectMsg, strlen(rejectMsg));
}
rejectClient.flush();
rejectClient.clear();
rejectClient.stop();
} else {
client = telnetServer->available();
client = telnetServer->accept(); //available();
if (strlen(welcomeMsg) > 0) {
client.write((const uint8_t*) welcomeMsg, strlen(welcomeMsg));
}
Expand All @@ -764,7 +764,7 @@ void TelnetSpy::handle() {
if (connected) {
connected = false;
sendBlock();
client.flush();
client.clear();
client.stop();
pingRef = 0xFFFFFFFF;
waitRef = 0xFFFFFFFF;
Expand Down
4 changes: 3 additions & 1 deletion TelnetSpy.h
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@
#define CRITCAL_SECTION_END portEXIT_CRITICAL(&AtomicMutex);
#endif
#include <WiFiClient.h>
#include "rom/ets_sys.h"

class TelnetSpy : public Stream {
public:
Expand Down Expand Up @@ -332,7 +333,8 @@ class TelnetSpy : public Stream {
int peek(void) override;
int read(void) override;
int availableForWrite(void);
void flush(void) override;
// void clear(void) override;
void clear(void);
void debugWrite(uint8_t);
size_t write(uint8_t) override;
inline size_t write(unsigned long n) { return write((uint8_t) n); }
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=TelnetSpy
version=1.4
version=1.5
author=Wolfgang Mattis (Y)
maintainer=Wolfgang Mattis (Y)
sentence=Cloning the serial port via Telnet / Debugging "over the air" (for ESP8266/ESP32)
Expand Down