Wombat Environmental Node 1.0
An environmental node for SDI-12 and digital sensors.
Loading...
Searching...
No Matches
CLIConfigIntervals Class Reference

Setup acquisition intervals based on device configuration stored in SPIFFS memory or via the CLI. More...

#include <acquisition_intervals.h>

Collaboration diagram for CLIConfigIntervals:

Static Public Member Functions

static BaseType_t enter_cli (char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString)
 CLI entrypoint for measurement and uplink interval setup. More...
 
static void dump (Stream &stream)
 Print out interval information into a provided Stream. More...
 

Static Public Attributes

static const std::string cmd = "interval"
 Command to change measurement and/or uplink interval. More...
 

Static Private Attributes

static DeviceConfigconfig = DeviceConfig::get()
 Get the device configuration from SPIFFS memory on initialisation. More...
 

Detailed Description

Setup acquisition intervals based on device configuration stored in SPIFFS memory or via the CLI.

Member Function Documentation

◆ dump()

void CLIConfigIntervals::dump ( Stream &  stream)
static

Print out interval information into a provided Stream.

A debug method to print out the available information about current acquisition intervals which have either been setup through device memory or through the CLI.

Parameters
streamOutput stream to write to.

◆ enter_cli()

BaseType_t CLIConfigIntervals::enter_cli ( char *  pcWriteBuffer,
size_t  xWriteBufferLen,
const char *  pcCommandString 
)
static

CLI entrypoint for measurement and uplink interval setup.

The function first checks if there is any data left in the response_buffer and, if so, copies it to the write buffer and returns. If no data is left in the response_buffer, the function retrieves the first parameter from the command and checks if it is a "list", "measure", or "uplink" command.

If the list command is entered, the function clears the response_buffer and calls the dump() function to print a list of the current measurement and uplink intervals to the buffer.

If the measure command is entered, the function retrieves the next parameter from the command string and converts it to an integer. If the parameter is valid, the function sets the measurement interval to the specified value and writes an "OK" message to the write buffer, or an "ERROR" message if the interval was not set.

If the uplink command is entered, the function retrieves the next parameter from the command string and converts it to an integer. If the parameter is valid, the function sets the uplink interval to the specified value and writes an "OK" message to the write buffer, or an "ERROR" message if the interval was not set.

If none of the above conditions are met, the function writes a "Syntax error" message to the write buffer and returns.

Note
Intervals are specified in seconds.
Parameters
pcWriteBufferA buffer for storing the response to the command. The response will be displayed to the user.
xWriteBufferLenThe length of the write buffer, in bytes.
pcCommandStringThe command entered by the user.
Returns
pdFALSE if the buffer is full and there is more output to be written, otherwise pdTRUE.

Member Data Documentation

◆ cmd

const std::string CLIConfigIntervals::cmd = "interval"
inlinestatic

Command to change measurement and/or uplink interval.

◆ config

DeviceConfig& CLIConfigIntervals::config = DeviceConfig::get()
inlinestaticprivate

Get the device configuration from SPIFFS memory on initialisation.


The documentation for this class was generated from the following files: