|
Motion Master 6.0.0-alpha.111
Next-generation motion control software
|
#include <cstdint>#include <expected>#include <nlohmann/json.hpp>#include <string>#include <vector>Go to the source code of this file.
Classes | |
| struct | ServerConfig |
"server" block — the HTTP API and WebSocket listeners. More... | |
| struct | SpoeConfig |
"fieldbus.spoe" block — settings that apply only to the SPoE driver. More... | |
| struct | FieldbusConfig |
"fieldbus" block — the driver to auto-init at startup. An empty driver means "do not auto-init"; the fieldbus then waits for POST /api/init. More... | |
| struct | TlsConfig |
"tls" block — certificate paths and startup self-heal policy. More... | |
| struct | GameLoopConfig |
"gameLoop" block — the real-time cyclic loop. More... | |
| struct | RecorderConfig |
"recorder" block — the lossless process-data recorder ring. More... | |
| struct | ParameterCacheConfig |
"parameterCache" block — the on-disk cache of CoE parameter definitions. More... | |
| struct | UserCacheConfig |
"userCache" block — the user-writable file store served at /api/user-cache. More... | |
| struct | ParametersConfig |
"parameters" block — CoE object-dictionary behaviour. More... | |
| struct | AutoTuningConfig |
"autoTuning" block — the auto-tuning child process. More... | |
| struct | FileLoggingConfig |
"logging.file" block — the rotating log file. More... | |
| struct | LoggingConfig |
"logging" block — verbosity and the log file. More... | |
| struct | Config |
| The whole config file. Top-level keys map to these members. More... | |
Functions | |
| NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT (ServerConfig, bindAddress, httpPort, wsPort, corsOrigin) NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(FieldbusConfig | |
| mailboxStatusFmmu | NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT (ParameterCacheConfig, enabled, cacheAllVendors, directory) NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(ParametersConfig |
| mailboxStatusFmmu useCompleteAccess | NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT (FileLoggingConfig, enabled, level, directory, maxSizeMb, maxFiles) NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(Config |
| mailboxStatusFmmu useCompleteAccess autoTuning std::expected< Config, std::string > | parseConfig (const nlohmann::json &doc) |
Deserialises a parsed JSONC document into a Config, applying defaults for absent keys. | |
| std::expected< void, std::string > | validateFieldbusConfig (const FieldbusConfig &fieldbus) |
Checks the "fieldbus" block. The config file and POST /api/init share it. | |
Variables | |
| driver | |
| adapter | |
| ipAddresses | |
| spoe | |
| mailboxStatusFmmu | readObjectDictionaryOnPreop |
| mailboxStatusFmmu useCompleteAccess | server |
| mailboxStatusFmmu useCompleteAccess | fieldbus |
| mailboxStatusFmmu useCompleteAccess | logging |
| mailboxStatusFmmu useCompleteAccess | tls |
| mailboxStatusFmmu useCompleteAccess | gameLoop |
| mailboxStatusFmmu useCompleteAccess | recorder |
| mailboxStatusFmmu useCompleteAccess | parameterCache |
| mailboxStatusFmmu useCompleteAccess | userCache |
| mailboxStatusFmmu useCompleteAccess | parameters |
The on-disk configuration, modelled as a struct tree that maps 1-1 to the JSONC file.
Each sub-struct mirrors one JSONC object; nlohmann's _WITH_DEFAULT (de)serialization fills any key the file omits from a default-constructed instance, so a partial config "overrides the
defaults" with no per-field plumbing. parseConfig adds the enum/value checks nlohmann cannot express. This is deliberately separate from Options, which also carries CLI-only fields (actions and cert source URLs) that have no place in the file.
| mailboxStatusFmmu useCompleteAccess NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT | ( | FileLoggingConfig | , |
| enabled | , | ||
| level | , | ||
| directory | , | ||
| maxSizeMb | , | ||
| maxFiles | |||
| ) |
| mailboxStatusFmmu NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT | ( | ParameterCacheConfig | , |
| enabled | , | ||
| cacheAllVendors | , | ||
| directory | |||
| ) |
| NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT | ( | ServerConfig | , |
| bindAddress | , | ||
| httpPort | , | ||
| wsPort | , | ||
| corsOrigin | |||
| ) |
| mailboxStatusFmmu useCompleteAccess autoTuning std::expected< Config, std::string > parseConfig | ( | const nlohmann::json & | doc | ) |
Deserialises a parsed JSONC document into a Config, applying defaults for absent keys.
Pure: no file I/O, no process exit. Unknown keys are ignored (forward-compatible). nlohmann validates value types; this adds the enum and range checks it cannot (logging.level, fieldbus.driver; gameLoop.periodUs, recorder.capacity and autoTuning.port must be > 0).
| doc | A parsed JSON value (must be an object). |
Config, or an error string on a wrong top-level type, a field type mismatch (from nlohmann), or an invalid enum value. | std::expected< void, std::string > validateFieldbusConfig | ( | const FieldbusConfig & | fieldbus | ) |
Checks the "fieldbus" block. The config file and POST /api/init share it.
An empty driver passes, because it means "do not init". For "spoe" it needs at least one address, a known mode, a watchdogMs of at least 50 and a nonzero port.
| adapter |
| driver |
| mailboxStatusFmmu useCompleteAccess fieldbus |
| mailboxStatusFmmu useCompleteAccess gameLoop |
| ipAddresses |
| mailboxStatusFmmu useCompleteAccess logging |
| mailboxStatusFmmu useCompleteAccess parameterCache |
| mailboxStatusFmmu useCompleteAccess parameters |
| mailboxStatusFmmu readObjectDictionaryOnPreop |
| mailboxStatusFmmu useCompleteAccess recorder |
| mailboxStatusFmmu useCompleteAccess server |
| spoe |
| mailboxStatusFmmu useCompleteAccess tls |
| mailboxStatusFmmu useCompleteAccess userCache |