fwt_software/include/fgc/mock/NullControlChannel.h

30 lines
995 B
C++

#pragma once
#include "fgc/IControlChannel.h"
#include "fgc/Logger.h"
namespace fgc {
// No-op control channel for running without an MQTT broker. Publishes are
// dropped (logged at debug) and poll() never supplies a control command, so
// the scheduler stays in automatic-sweep mode (ControlCode 0).
class NullControlChannel : public IControlChannel {
public:
bool connect() override { return true; }
void disconnect() override {}
bool connected() const override { return true; }
void publishStatus(int code) override {
LOG_TRACE_CAT(LogCat::Mqtt) << "PUB StatusCode " << code << " (null channel)";
}
void publishCamEvent(const CamEvent& e) override {
LOG_TRACE_CAT(LogCat::Mqtt) << "PUB CamEvent cam=" << e.camera
<< " hdg=" << e.heading_decideg << " t=" << e.timestamp_ms
<< " (null channel)";
}
ControlCommand poll() override { return {}; }
};
} // namespace fgc