D-Bus API
Klas communicates with the system using D-Bus and exposes the following APIs:
Telemetries D-Bus API
node /com/witekio/klas/telemetries {
interface com.witekio.klas.Telemetries {
methods:
sendUserTelemetriesJson(in s userTelemetriesJson);
}
}
Methods
sendUserTelemetriesJson()
Send a payload as telemetries to Kamea.
- userTelemetriesJson (in s) is a JSON string containing the telemetries to send.
Errors
com.witekio.klas.Telemetries.Error.InvalidJSONFormat
Indicates that the provided JSON string is not valid.
Configuration D-Bus API
node /com/witekio/klas/configuration {
interface com.witekio.klas.Configuration {
methods:
sendUserConfigurationJson(in s userConfigurationJson);
signals:
b connectionChanged;
s receivedDesiredJson;
properties:
readonly b connected;
}
}
Methods
sendUserConfigurationJson()
Send user Json as a reported configuration to Kamea.
- userConfigurationJson (in s) is a JSON string containing the user configuration to report.
Signals
connectionChanged()
Signal emitted when the MQTT connection status changes.
receivedDesiredJson()
Signal emitted when a new user desired configuration is received from Kamea.
Properties
connected
Indicates if the agent is connected to Kamea.
Errors
com.witekio.klas.Configuration.Error.InvalidJSONFormat
Indicates that the provided JSON string is not valid.
Firmware D-Bus API
node /com/witekio/klas/firmware {
interface com.witekio.klas.Firmware {
methods:
acceptFirmware(in (ssbs) firmware);
confirmFirmwareInstall(in (ssbs) firmware);
signals:
a(ss) newFirmwareVersionsAvailable;
a(sss) newFirmwareFilesAvailable;
properties:
readonly a(ss) availableFirmwareVersions;
readonly a(sss) availableFirmwareFiles;
readonly a(ss) firmwareStatuses;
}
}
Methods
acceptFirmware()
Accept or reject the download of a firmware file and update its status on kamea.
firmware: in (ssbs)
Structure containing the following data types:
- name (string) is the name of the firmware to download.
- version (string) is the version of the firmware to accept, for example 1.0.0.
- accept (bool) is set to true if the new firmware version should be downloaded, false otherwise.
- errorCode (string) is an optional error code to report if the firmware version was not accepted.
Example 1: ('firmware1', '1.0.0', true, '')
Example 2: ('firmware2', 'a.b.c', false, 'unsupported-version')
confirmFirmwareInstall()
confirm the installation of a firmware file and update its status on kamea.
firmware: in (ssbs)
Structure containing the following data types:
- name (string) is the name of the firmware file that was installed.
- version (string) is the version of the firmware file that was installed.
- confirm (bool) is set to true if the firmware file was successfully installed, false otherwise.
- errorCode (string) is an optional error code to report if the firmware installation failed.
Example 1: ('firmware1', '1.0.0', true, ''),
Example 2: ('firmware2', 'a.b.c', false, 'installation-failed')
Signals
newFirmwareVersionsAvailable()
Signal emitted when new firmware versions are available.
Contains an array of structure with the firmware name and version: a(ss)
Example:
[
('Firmware1', '1.0.0'),
('Firmware2', 'a.b.c')
]
newFirmwareFilesAvailable()
Signal emitted when a new firmware file has been downloaded.
Contains an array of structure with the firmware name, versions and file path: a(sss)
Example:
[
('app', 'a.b.c', '/work/klas/dl/app_firmware.bin'),
('os', '1.0.0', '/work/klas/dl/os_firmware.bin')
]
Properties
availableFirmwareVersions
An array of structure with the firmware names and version: a(ss), similar to the one emitted by the newFirmwareVersionsAvailable signal.
availableFirmwareFiles
An array of structure with the firmware name, version and file path: a(sss), similar to the one emitted by the newFirmwareFilesAvailable signal.
firmwareStatuses
An array of structure with the firmware name and its current update status: a(ss)
Refer to the firmware update documentation for the possible status values.
Errors
com.witekio.klas.Firmware.Error.InvalidFirmwareVersion
Indicates that the firmware version provided to the method is not valid.
com.witekio.klas.Firmware.Error.InvalidFirmwareState
Indicates that the firmware provided to the method is not in a state that allows the requested operation.
For example, trying to confirm the installation of a firmware that was not downloaded.