Wombat Environmental Node 1.0
An environmental node for SDI-12 and digital sensors.
|
Setup acquisition intervals based on device configuration stored in SPIFFS memory or via the CLI. More...
#include <acquisition_intervals.h>
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 DeviceConfig & | config = DeviceConfig::get() |
Get the device configuration from SPIFFS memory on initialisation. More... | |
Setup acquisition intervals based on device configuration stored in SPIFFS memory or via the CLI.
|
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.
stream | Output stream to write to. |
|
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.
pcWriteBuffer | A buffer for storing the response to the command. The response will be displayed to the user. |
xWriteBufferLen | The length of the write buffer, in bytes. |
pcCommandString | The command entered by the user. |
|
inlinestatic |
Command to change measurement and/or uplink interval.
|
inlinestaticprivate |
Get the device configuration from SPIFFS memory on initialisation.