ENTS-tock
Environmental NeTworked Sensor firmware on Tock OS
Loading...
Searching...
No Matches
configuration.cpp File Reference
#include "configuration.hpp"
#include <ArduinoLog.h>
#include <libents/proto/transcoder.h>
#include <string.h>

Go to the source code of this file.

Functions

void setConfig (const UserConfiguration &new_config)
 Set the user configuration.
 
const UserConfiguration & getConfig ()
 Get a copy of the current user configuration.
 
String getConfigJson ()
 Get the current configuration as a JSON string.
 
void printConfig (const UserConfiguration &pconfig)
 Print a user config.
 
void printReceivedConfig ()
 Print the current user configuration to the log.
 

Function Documentation

◆ getConfig()

const UserConfiguration & getConfig ( )

Get a copy of the current user configuration.

This function returns a SHALLOW coyy of the user config. No modification should be made.

Checks are also performed to ensure the configuration can be encoded/decoded.

Returns
A copy of the current user configuration.

Definition at line 48 of file configuration.cpp.

Referenced by getConfigJson(), and handleSave().

◆ getConfigJson()

String getConfigJson ( )

Get the current configuration as a JSON string.

This function converts the current user configuration to a JSON string representation.

Returns
A JSON string representing the current user configuration.

Definition at line 50 of file configuration.cpp.

References getConfig(), and i.

Referenced by handleConfig().

◆ printConfig()

void printConfig ( const UserConfiguration &  pconfig)

Print a user config.

Parameters
pconfigConfig to print

Definition at line 123 of file configuration.cpp.

References i.

Referenced by printReceivedConfig().

◆ printReceivedConfig()

void printReceivedConfig ( )

Print the current user configuration to the log.

Definition at line 183 of file configuration.cpp.

References printConfig().

Referenced by handleSave().

◆ setConfig()

void setConfig ( const UserConfiguration &  new_config)

Set the user configuration.

Performs a deep copy of the configuration.

Definition at line 10 of file configuration.cpp.

References buffer, DecodeUserConfiguration(), and EncodeUserConfiguration().

Referenced by handleSave(), and ModuleHandler::ModuleUserConfig::ModuleUserConfig().