system: Installation progress notifications
Implement installation progress notifications as defined in
czechlight-system model
(/czechlight-system:firmware/installation/update).
The RAUC D-Bus API invokes PropertyChanged signal on its Progress [1]
property whenever the installation progresses. We capture those signals
and use them to generate Sysrepo notifications to clients.
The update contains current progress (in percents) and a message
containing current installation stage.
[1] https://rauc.readthedocs.io/en/v1.4/reference.html#gdbus-property-de-pengutronix-rauc-installer-progress
Change-Id: I310752919dde523a93943a2a1d7af79f073aedfe
diff --git a/src/system/CzechlightSystem.cpp b/src/system/CzechlightSystem.cpp
index 49479f2..4256015 100644
--- a/src/system/CzechlightSystem.cpp
+++ b/src/system/CzechlightSystem.cpp
@@ -35,7 +35,18 @@
utils::valuesPush(data, std::make_shared<::sysrepo::Session>(m_srConn, SR_DS_OPERATIONAL));
}
},
- []([[maybe_unused]] int32_t perc, [[maybe_unused]] const std::string& msg) { /* TODO notifications */ },
+ [this](int32_t perc, const std::string& msg) {
+ std::map<std::string, std::string> data = {
+ {CZECHLIGHT_SYSTEM_FIRMWARE_MODULE_PREFIX + "installation/update/message", msg},
+ {CZECHLIGHT_SYSTEM_FIRMWARE_MODULE_PREFIX + "installation/update/progress", std::to_string(perc)},
+ };
+
+ libyang::S_Data_Node dataNode;
+ auto session = std::make_shared<::sysrepo::Session>(m_srConn);
+
+ utils::valuesToYang(data, session, dataNode);
+ session->event_notif_send(dataNode);
+ },
[this](int32_t retVal, const std::string& lastError) {
std::map<std::string, std::string> data {
{CZECHLIGHT_SYSTEM_FIRMWARE_MODULE_PREFIX + "installation/message", lastError},