DataServer class

Creates a WebServer on ESP32 to display perif data.

Constructors, destructors, conversion operators

DataServer(int port) explicit

Public functions

void wifiConnected()
auto remoteAvailable() -> bool
void handleClient()
void registerSensor()
template<class S, class... SensorTypes>
void registerSensor(S sensor, SensorTypes... sT)

Function documentation

DataServer::DataServer(int port) explicit

Parameters
port the WebServer port number (default is 80 for browser use)

Creates and sets up the WebServer with the specified port and sensors.

void DataServer::wifiConnected()

Callback when WiFi is connected.

bool DataServer::remoteAvailable()

Returns whether a remote is available

Returns whether a remote device is available on the network.

void DataServer::handleClient()

Wrapper so Arduino loop() function can handle client connections without exposing the entire WebServer.

void DataServer::registerSensor()

Variadic template termination function. Adds the not found page for bad URLs.

template<class S, class... SensorTypes>
void DataServer::registerSensor(S sensor, SensorTypes... sT)

Template parameters
S the data type for a perif
SensorTypes the sensors types to register
Parameters
sensor the first perif to register
sT the rest of the sensors to register

Adds all specified sensors to the WebServer.