step: version-return

This commit is contained in:
Jakob Gegeniger committed 2026-10-17 11:46:48 +02:00
1 parent b34a3a4acd
commit dbe482655c
4 files changed
+49 -17

No files matched your search

+11 -1
View File
@@ -4,8 +4,11 @@
class MqttChannel {
public:
static constexpr array<const char*, 3> Modes = {"Undefined", "Maintanance", "Production"};
MqttChannel(string name, string version, SwordConfig cfg, DeviceIoState& ioStat, SeqLogger& log)
: Config(cfg),
: Version(version),
Config(cfg),
IoStat(ioStat),
Logger(log),
cfgTopic(cfg.StationPath + "cfg"),
@@ -24,6 +27,7 @@ class MqttChannel {
{"playSound:Promo", ServiceCommands_e::PlaySoundPromo},
{"playSound:Deny", ServiceCommands_e::PlaySoundDeny},
{"playSound:Chosen", ServiceCommands_e::PlaySoundChosen},
{"setMaintanance", ServiceCommands_e::SetMaintanence},
}),
setCommands({
// cfg-topic
@@ -102,6 +106,11 @@ class MqttChannel {
if (serMsg->Topic == instance.resetTopic) {
return;
}
if (serMsg->Payload == "setMaintanance") {
std::string m{Modes[static_cast<int>(instance.IoStat.Mode)]};
instance.client.send(instance.verTopic, fmt::format("{}", instance.Version));
continue;
}
auto payload = serMsg->Payload;
if (payload == "mute") {
@@ -204,6 +213,7 @@ class MqttChannel {
const std::map<string, ServiceCommands_e>& getSerCommands() { return serviceCommands; }
private:
std::string Version;
SwordConfig Config;
Queue<MqttQe> MasterQueue;
Queue<MqttQe> MqttQueue;