SpokeZoneConfig
Inherits:
QObject
Owns the validated Spoke.Zone state associated with one caller-owned configuration store.
The caller retains ownership of the ConfigStore and must keep it alive longer than this wrapper. The wrapper begins unloaded, replaces its immutable Config snapshot and canonical path only after a successful load, and preserves the last valid state when a later load or replacement fails. Accessors read only from this snapshot and return their schema defaults (or empty required values) while unloaded.
Configuration lifecycle
Section titled “Configuration lifecycle”Construct the wrapper, inspect its v3 schema and canonical path, and load a validated snapshot from disk.
| Return | Name | Description |
|---|---|---|
mrx::core::ConfigResult | Result | Result returned by schema validation and file loading. |
SpokeZoneConfig explicit | ||
Result | load | Loads and validates the INI file bound through the configuration store. |
mrx::core::ConfigSchema | schema static | Fetches the current Spoke.Zone configuration schema. |
QString | path static | Returns the canonical path to the config file. |
Result
Section titled “Result”Result returned by schema validation and file loading.
explicit
SpokeZoneConfig
Section titled “SpokeZoneConfig”Loads and validates the INI file bound through the configuration store.
Returns
Section titled “Returns”The exact Core validation result for this attempt.
A successful load replaces the stored immutable Config snapshot and canonical path. A failed initial load leaves the wrapper unloaded, while a failed reload preserves the last successful snapshot and path.
static
schema
Section titled “schema”Fetches the current Spoke.Zone configuration schema.
Returns
Section titled “Returns”Module-owned schema declaration.
static
Returns the canonical path to the config file.
Returns
Section titled “Returns”Canonical INI path, or an empty string while the wrapper is unloaded.
Authentication and device identity
Section titled “Authentication and device identity”Settings for the Spoke.Zone API identity and shared token.
The token is also used as the MQTT username.
| Return | Name | Description |
|---|---|---|
bool | replaceToken | Replaces the shared token in the loaded v3 INI file. |
QString | mqttUsername const | Derives the MQTT username from the stored shared token. |
QString | apiServer const | Reads the configured Spoke.Zone API server URL. |
QString | deviceId const | Reads the configured device identifier. |
QString | deviceUuid const | Reads the configured device UUID. |
replaceToken
Section titled “replaceToken”Replaces the shared token in the loaded v3 INI file.
Returns
Section titled “Returns”True only after the complete staged INI has been verifiably committed.
A successful call updates the stored validated snapshot after the file commit.
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
newToken | const QString& | Proposed non-empty shared token; the literal is never put in an error message. |
const
mqttUsername
Section titled “mqttUsername”Derives the MQTT username from the stored shared token.
Returns
Section titled “Returns”The token value supplied as the MQTT username at the adapter boundary.
A successful load() is a precondition for this accessor.
const
apiServer
Section titled “apiServer”Reads the configured Spoke.Zone API server URL.
Returns
Section titled “Returns”The configured API server, or the schema default when omitted.
const
deviceId
Section titled “deviceId”Reads the configured device identifier.
Returns
Section titled “Returns”The required device identifier stored in the validated configuration.
const
deviceUuid
Section titled “deviceUuid”Reads the configured device UUID.
Returns
Section titled “Returns”The required device UUID stored in the validated configuration.
MQTT connection
Section titled “MQTT connection”Broker credentials and transport parameters used when the device connects to Spoke.Zone over MQTT.
| Return | Name | Description |
|---|---|---|
QString | mqttPassword const | Reads the configured literal MQTT password from the stored snapshot. |
QString | mqttHost const | Reads the configured MQTT broker host. |
quint16 | mqttPort const | Reads the configured MQTT broker port. |
quint32 | mqttKeepAlive const | Reads the configured MQTT keep-alive interval. |
const
mqttPassword
Section titled “mqttPassword”Reads the configured literal MQTT password from the stored snapshot.
Returns
Section titled “Returns”The configured password, including the schema default when omitted.
A successful load() is a precondition for this accessor.
const
mqttHost
Section titled “mqttHost”Reads the configured MQTT broker host.
Returns
Section titled “Returns”The configured MQTT host, or the schema default when omitted.
const
mqttPort
Section titled “mqttPort”Reads the configured MQTT broker port.
Returns
Section titled “Returns”The configured MQTT port, or the schema default when omitted.
const
mqttKeepAlive
Section titled “mqttKeepAlive”Reads the configured MQTT keep-alive interval.
Returns
Section titled “Returns”The configured keep-alive interval, or the schema default when omitted.
Local data files
Section titled “Local data files”Local filenames for alert-event data and the downloaded model definition; these are not MQTT model settings.
| Return | Name | Description |
|---|---|---|
QString | alertsFile const | Reads the configured alerts data filename. |
QString | modelFile const | Reads the configured model data filename. |
const
alertsFile
Section titled “alertsFile”Reads the configured alerts data filename.
Returns
Section titled “Returns”The configured alerts filename, or the schema default when omitted.
const
modelFile
Section titled “modelFile”Reads the configured model data filename.
Returns
Section titled “Returns”The configured model filename, or the schema default when omitted.
Model Live Data settings
Section titled “Model Live Data settings”Values from the Live Data section of the Spoke.Zone model.
They control live CAN/GPS broadcasts and how much data around an event trigger is included. MQTT values are persisted under their exact topic suffixes in [model].
| Return | Name | Description |
|---|---|---|
bool | liveCanDataEnabled const | Reads whether the device should publish live CAN data from the model’s Live Data section (live_can_data). |
bool | setLiveCanDataEnabled | Persists the model’s Live Data section live_can_data MQTT setting. |
bool | liveGpsDataEnabled const | Reads whether the device should publish live GPS data from the model’s Live Data section (live_gps_data). |
bool | setLiveGpsDataEnabled | Persists the model’s Live Data section live_gps_data MQTT setting. |
quint32 | canPublishIntervalSeconds const | Reads the CAN publish frequency from the model’s Live Data section (publish_freq). |
bool | setCanPublishIntervalSeconds | Persists the model’s Live Data section publish_freq MQTT setting. |
quint32 | locationPublishIntervalSeconds const | Reads the location publish frequency from the model’s Live Data section (location_freq). |
bool | setLocationPublishIntervalSeconds | Persists the model’s Live Data section location_freq MQTT setting. |
quint32 | eventCaptureBeforeSeconds const | Reads the pre-trigger capture interval from the model’s Live Data section (event_capture_before). |
bool | setEventCaptureBeforeSeconds | Persists the model’s Live Data section event_capture_before setting, in seconds. |
quint32 | eventCaptureAfterSeconds const | Reads the post-trigger capture interval from the model’s Live Data section (event_capture_after). |
bool | setEventCaptureAfterSeconds | Persists the model’s Live Data section event_capture_after setting, in seconds. |
const
liveCanDataEnabled
Section titled “liveCanDataEnabled”Reads whether the device should publish live CAN data from the model’s Live Data section (live_can_data).
Returns
Section titled “Returns”The configured state, or false until Spoke.Zone sends the setting.
setLiveCanDataEnabled
Section titled “setLiveCanDataEnabled”Persists the model’s Live Data section live_can_data MQTT setting.
const
liveGpsDataEnabled
Section titled “liveGpsDataEnabled”Reads whether the device should publish live GPS data from the model’s Live Data section (live_gps_data).
Returns
Section titled “Returns”The configured state, or false until Spoke.Zone sends the setting.
setLiveGpsDataEnabled
Section titled “setLiveGpsDataEnabled”Persists the model’s Live Data section live_gps_data MQTT setting.
const
canPublishIntervalSeconds
Section titled “canPublishIntervalSeconds”Reads the CAN publish frequency from the model’s Live Data section (publish_freq).
Returns
Section titled “Returns”Seconds between live CAN data broadcasts, or the schema default when omitted.
setCanPublishIntervalSeconds
Section titled “setCanPublishIntervalSeconds”Persists the model’s Live Data section publish_freq MQTT setting.
Returns
Section titled “Returns”True only when the value validates and is successfully persisted.
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
seconds | quint32 | Seconds between live CAN data broadcasts. |
const
locationPublishIntervalSeconds
Section titled “locationPublishIntervalSeconds”Reads the location publish frequency from the model’s Live Data section (location_freq).
Returns
Section titled “Returns”Seconds between location broadcasts, or the schema default when omitted.
setLocationPublishIntervalSeconds
Section titled “setLocationPublishIntervalSeconds”Persists the model’s Live Data section location_freq MQTT setting.
Returns
Section titled “Returns”True only when the value validates and is successfully persisted.
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
seconds | quint32 | Seconds between location broadcasts. |
const
eventCaptureBeforeSeconds
Section titled “eventCaptureBeforeSeconds”Reads the pre-trigger capture interval from the model’s Live Data section (event_capture_before).
Returns
Section titled “Returns”The configured interval in seconds, or zero until Spoke.Zone sends the setting.
setEventCaptureBeforeSeconds
Section titled “setEventCaptureBeforeSeconds”Persists the model’s Live Data section event_capture_before setting, in seconds.
const
eventCaptureAfterSeconds
Section titled “eventCaptureAfterSeconds”Reads the post-trigger capture interval from the model’s Live Data section (event_capture_after).
Returns
Section titled “Returns”The configured interval in seconds, or zero until Spoke.Zone sends the setting.
setEventCaptureAfterSeconds
Section titled “setEventCaptureAfterSeconds”Persists the model’s Live Data section event_capture_after setting, in seconds.
Model Logging settings
Section titled “Model Logging settings”Values from the Logging section of the Spoke.Zone model.
They control log uploads, file size and rotation, recording cadence, and the optional UTC upload schedule. MQTT values use their exact topic suffixes in [model].
| Return | Name | Description |
|---|---|---|
bool | logFileUploadEnabled const | Reads the Logging section’s “Upload Log Files” setting (log_file). |
bool | setLogFileUploadEnabled | Persists the model’s Logging section log_file MQTT setting. |
quint32 | logUploadPeriodMinutes const | Reads the log upload cadence from the model’s Logging section (log_upload_period). |
bool | setLogUploadPeriodMinutes | Persists the model’s Logging section log_upload_period setting, in minutes. |
quint32 | logSizeMegabytes const | Reads the maximum log file size from the model’s Logging section (log_size). |
bool | setLogSizeMegabytes | Persists the model’s Logging section log_size setting, in megabytes. |
quint32 | logRotations const | Reads the Logging section’s “Log Rotations” setting (log_count). |
bool | setLogRotations | Persists the model’s Logging section log_count MQTT setting. |
bool | uploadScheduleEnabled const | Reads the Logging section’s upload-schedule toggle (enable_upload_schedule). |
bool | setUploadScheduleEnabled | Persists the model’s Logging section enable_upload_schedule MQTT setting. |
QJsonObject | uploadSchedule const | Reads allowed upload days and UTC time from the model’s Logging section (upload_schedule). |
bool | setUploadSchedule | Persists the Logging section’s upload_schedule object with string days_of_week and start_time fields. |
quint32 | logDataFrequencySeconds const | Reads the CAN recording cadence from the model’s Logging section (log_freq). |
bool | setLogDataFrequencySeconds | Persists the model’s Logging section log_freq setting, in seconds. |
quint32 | logGpsFrequencySeconds const | Reads the GPS recording cadence from the model’s Logging section (log_gps_freq). |
bool | setLogGpsFrequencySeconds | Persists the model’s Logging section log_gps_freq setting, in seconds. |
const
logFileUploadEnabled
Section titled “logFileUploadEnabled”Reads the Logging section’s “Upload Log Files” setting (log_file).
Returns
Section titled “Returns”The configured state, or false until Spoke.Zone sends the setting.
setLogFileUploadEnabled
Section titled “setLogFileUploadEnabled”Persists the model’s Logging section log_file MQTT setting.
const
logUploadPeriodMinutes
Section titled “logUploadPeriodMinutes”Reads the log upload cadence from the model’s Logging section (log_upload_period).
Returns
Section titled “Returns”The configured interval in minutes, or zero until Spoke.Zone sends the setting.
setLogUploadPeriodMinutes
Section titled “setLogUploadPeriodMinutes”Persists the model’s Logging section log_upload_period setting, in minutes.
const
logSizeMegabytes
Section titled “logSizeMegabytes”Reads the maximum log file size from the model’s Logging section (log_size).
Returns
Section titled “Returns”The configured size in megabytes, or zero until Spoke.Zone sends the setting.
setLogSizeMegabytes
Section titled “setLogSizeMegabytes”Persists the model’s Logging section log_size setting, in megabytes.
const
logRotations
Section titled “logRotations”Reads the Logging section’s “Log Rotations” setting (log_count).
Returns
Section titled “Returns”The configured rotation count, or zero until Spoke.Zone sends the setting.
setLogRotations
Section titled “setLogRotations”Persists the model’s Logging section log_count MQTT setting.
const
uploadScheduleEnabled
Section titled “uploadScheduleEnabled”Reads the Logging section’s upload-schedule toggle (enable_upload_schedule).
Returns
Section titled “Returns”The configured state, or false until Spoke.Zone sends the setting.
setUploadScheduleEnabled
Section titled “setUploadScheduleEnabled”Persists the model’s Logging section enable_upload_schedule MQTT setting.
const
uploadSchedule
Section titled “uploadSchedule”Reads allowed upload days and UTC time from the model’s Logging section (upload_schedule).
Returns
Section titled “Returns”The JSON object with string days_of_week and start_time fields, or an empty object until configured.
setUploadSchedule
Section titled “setUploadSchedule”Persists the Logging section’s upload_schedule object with string days_of_week and start_time fields.
Returns
Section titled “Returns”True only when the object has the expected fields and the typed store write succeeds.
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
schedule | const QJsonObject& | Schedule payload from Spoke.Zone. |
const
logDataFrequencySeconds
Section titled “logDataFrequencySeconds”Reads the CAN recording cadence from the model’s Logging section (log_freq).
Returns
Section titled “Returns”The configured interval in seconds, or zero until Spoke.Zone sends the setting.
setLogDataFrequencySeconds
Section titled “setLogDataFrequencySeconds”Persists the model’s Logging section log_freq setting, in seconds.
const
logGpsFrequencySeconds
Section titled “logGpsFrequencySeconds”Reads the GPS recording cadence from the model’s Logging section (log_gps_freq).
Returns
Section titled “Returns”The configured interval in seconds, or zero until Spoke.Zone sends the setting.
setLogGpsFrequencySeconds
Section titled “setLogGpsFrequencySeconds”Persists the model’s Logging section log_gps_freq setting, in seconds.
MQTT Commands
Section titled “MQTT Commands”Controls whether incoming commands are handled and exposes the configured command-topic list.
| Return | Name | Description |
|---|---|---|
bool | commandsEnabled const | Reads whether command processing is enabled. |
bool | setCommandsEnabled | Persists whether command processing is enabled. |
const QStringList | forcedCommandTopics const | Reads the configured command topics as a normalized list. |
const
commandsEnabled
Section titled “commandsEnabled”Reads whether command processing is enabled.
Returns
Section titled “Returns”The configured command-processing state, or the schema default when omitted.
setCommandsEnabled
Section titled “setCommandsEnabled”Persists whether command processing is enabled.
Returns
Section titled “Returns”True only when a successful load validates the proposal and the typed store write succeeds.
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
enabled | bool | Proposed command-processing state. |
const
forcedCommandTopics
Section titled “forcedCommandTopics”Reads the configured command topics as a normalized list.
Returns
Section titled “Returns”Topics in declaration order, with surrounding whitespace removed.
The configuration file stores these as a scalar string. This accessor returns a detached list so callers cannot mutate the validated snapshot. A successful load() is a precondition.
SDK telemetry
Section titled “SDK telemetry”Controls how often the SDK publishes its own version information.
This cadence is SDK-owned and is not a setting in the Spoke.Zone model editor, so it remains under [telemetry] rather than [model].
| Return | Name | Description |
|---|---|---|
quint32 | versionsPublishIntervalSeconds const | Reads the SDK’s version-reporting cadence from [telemetry]; this is not a Spoke.Zone model setting. |
bool | setVersionsPublishIntervalSeconds | Persists the SDK’s version-reporting cadence under [telemetry], not in the Spoke.Zone model settings. |
const
versionsPublishIntervalSeconds
Section titled “versionsPublishIntervalSeconds”Reads the SDK’s version-reporting cadence from [telemetry]; this is not a Spoke.Zone model setting.
Returns
Section titled “Returns”The configured interval in seconds, or the schema default when omitted.
setVersionsPublishIntervalSeconds
Section titled “setVersionsPublishIntervalSeconds”Persists the SDK’s version-reporting cadence under [telemetry], not in the Spoke.Zone model settings.
Returns
Section titled “Returns”True only when a successful load validates the proposal and the typed store write succeeds.
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
seconds | quint32 | Proposed interval in seconds; it must satisfy the complete v3 schema. |
Signals
Section titled “Signals”| Return | Name | Description |
|---|---|---|
void | mqttUsernameChanged | Property-change signals are emitted when a successful load after the initial load, or a successful write, changes the corresponding value. |
void | serverUrlChanged | |
void | deviceIdChanged | |
void | deviceUuidChanged | |
void | mqttPasswordChanged | |
void | mqttHostChanged | |
void | mqttPortChanged | |
void | mqttKeepAliveChanged | |
void | alertsFileChanged | |
void | modelFileChanged | |
void | liveCanDataEnabledChanged | |
void | liveGpsDataEnabledChanged | |
void | canPublishIntervalSecondsChanged | |
void | locationPublishIntervalSecondsChanged | |
void | eventCaptureBeforeSecondsChanged | |
void | eventCaptureAfterSecondsChanged | |
void | logFileUploadEnabledChanged | |
void | logUploadPeriodMinutesChanged | |
void | logSizeMegabytesChanged | |
void | logRotationsChanged | |
void | uploadScheduleEnabledChanged | |
void | uploadScheduleChanged | |
void | logDataFrequencySecondsChanged | |
void | logGpsFrequencySecondsChanged | |
void | commandsEnabledChanged | |
void | forcedCommandTopicsChanged | |
void | versionsPublishIntervalSecondsChanged |
mqttUsernameChanged
Section titled “mqttUsernameChanged”Property-change signals are emitted when a successful load after the initial load, or a successful write, changes the corresponding value.
The initial successful load is silent; before it, accessors return defaults.