refactor classes to accomodate SerialModule

This commit is contained in:
Thomas Göttgens
2022-12-22 18:24:42 +01:00
parent 1a3f2a8ab5
commit a289406863
9 changed files with 19 additions and 13 deletions

View File

@@ -14,7 +14,7 @@ void initApiServer(int port)
}
}
ethServerAPI::ethServerAPI(EthernetClient &_client) : StreamAPI(&client), client(_client)
ethServerAPI::ethServerAPI(EthernetClient &_client) : StreamAPI(&client), concurrency::OSThread("ethServerAPI"), client(_client)
{
DEBUG_MSG("Incoming ethernet connection\n");
}
@@ -42,7 +42,7 @@ bool ethServerAPI::checkIsConnected()
int32_t ethServerAPI::runOnce()
{
if (client.connected()) {
return StreamAPI::runOnce();
return StreamAPI::runOncePart();
} else {
DEBUG_MSG("Client dropped connection, suspending API service\n");
enabled = false; // we no longer need to run

View File

@@ -7,7 +7,7 @@
* Provides both debug printing and, if the client starts sending protobufs to us, switches to send/receive protobufs
* (and starts dropping debug printing - FIXME, eventually those prints should be encapsulated in protobufs).
*/
class ethServerAPI : public StreamAPI
class ethServerAPI : public StreamAPI, private concurrency::OSThread
{
private:
EthernetClient client;