ENTS-tock
Environmental NeTworked Sensor firmware on Tock OS
Loading...
Searching...
No Matches
config_server.cpp File Reference
#include "config_server.hpp"
#include <ArduinoLog.h>
#include <LittleFS.h>
#include <WebServer.h>
#include <libents/proto/controller.pb.h>
#include <libents/proto/transcoder.h>
#include "configuration.hpp"
#include "protobuf_utils.hpp"
#include "validation.hpp"

Go to the source code of this file.

Functions

void handleRoot ()
 Handle the root path of the web server.
 
void handleSave ()
 Handle save action.
 
void handleConfig ()
 Get the current configuration.
 
void handleIdentity ()
 Get the ESP32 STA MAC, ESP32 AP MAC, and STM32 device address (DevEUI)
 
void printQuery ()
 Prints debug information for http queries.
 
String validateInputs ()
 Validate user inputs from the web form.
 
void setupServer ()
 Setup webserver.
 
void handleClient ()
 Call to handle requests to the web server.
 

Function Documentation

◆ handleClient()

void handleClient ( )

Call to handle requests to the web server.

This function should be called in the main loop to process incoming HTTP requests.

Definition at line 260 of file config_server.cpp.

Referenced by loop().

◆ handleConfig()

void handleConfig ( )

Get the current configuration.

Returns the user config as a json object

Definition at line 206 of file config_server.cpp.

References getConfigJson(), and printQuery().

Referenced by setupServer().

◆ handleIdentity()

void handleIdentity ( )

Get the ESP32 STA MAC, ESP32 AP MAC, and STM32 device address (DevEUI)

Returns the identity information as text

Definition at line 214 of file config_server.cpp.

References printQuery().

Referenced by setupServer().

◆ handleRoot()

void handleRoot ( )

Handle the root path of the web server.

This function serves the root path of the web server, displaying the configuration form for the user to fill out.

◆ handleSave()

void handleSave ( )

Handle save action.

Definition at line 59 of file config_server.cpp.

References getConfig(), printQuery(), printReceivedConfig(), setConfig(), and validateInputs().

Referenced by setupServer().

◆ printQuery()

void printQuery ( )

Prints debug information for http queries.

Must be called within the web server request handler to log the query.

Definition at line 299 of file config_server.cpp.

Referenced by handleConfig(), handleIdentity(), and handleSave().

◆ setupServer()

void setupServer ( )

Setup webserver.

Definition at line 246 of file config_server.cpp.

References handleConfig(), handleIdentity(), and handleSave().

Referenced by setup().

◆ validateInputs()

String validateInputs ( )

Validate user inputs from the web form.

This function checks the inputs provided by the user in the web form and returns a string containing any validation errors.

Returns
A string with validation errors. Emptyry string for no errors.

Definition at line 262 of file config_server.cpp.

References validateFloat(), validateUInt(), and validateURL().

Referenced by handleSave().