mirror of
https://github.com/thooge/esp32-nmea2000-obp60.git
synced 2025-12-16 07:23:07 +01:00
tcp client resolve mdns
This commit is contained in:
@@ -1,33 +1,48 @@
|
||||
#pragma once
|
||||
#include "GwSocketConnection.h"
|
||||
#include "GwChannelInterface.h"
|
||||
#include "GwSynchronized.h"
|
||||
class GwTcpClient : public GwChannelInterface
|
||||
{
|
||||
class ResolvedAddress{
|
||||
public:
|
||||
IPAddress address;
|
||||
bool resolved=false;
|
||||
};
|
||||
static const unsigned long CON_TIMEOUT=10000;
|
||||
GwSocketConnection *connection = NULL;
|
||||
String remoteAddress;
|
||||
ResolvedAddress resolvedAddress;
|
||||
uint16_t port = 0;
|
||||
unsigned long connectStart=0;
|
||||
GwLog *logger;
|
||||
int sourceId;
|
||||
bool configured=false;
|
||||
String error;
|
||||
SemaphoreHandle_t locker;
|
||||
|
||||
public:
|
||||
typedef enum
|
||||
{
|
||||
C_DISABLED = 0,
|
||||
C_INITIALIZED = 1,
|
||||
C_CONNECTING = 2,
|
||||
C_CONNECTED = 3
|
||||
C_RESOLVING = 2,
|
||||
C_RESOLVED = 3,
|
||||
C_CONNECTING = 4,
|
||||
C_CONNECTED = 5
|
||||
} State;
|
||||
|
||||
private:
|
||||
|
||||
State state = C_DISABLED;
|
||||
void stop();
|
||||
void startResolving();
|
||||
void startConnection();
|
||||
void checkConnection();
|
||||
bool hasConfig();
|
||||
void resolveHost(String host);
|
||||
void setResolved(IPAddress addr, bool valid);
|
||||
ResolvedAddress getResolved();
|
||||
|
||||
public:
|
||||
GwTcpClient(GwLog *logger);
|
||||
|
||||
Reference in New Issue
Block a user