platform: arduno: mqtt: fix mqtt build
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
This commit is contained in:
parent
a598d62523
commit
e994f1f20c
@ -37,8 +37,8 @@ struct Variant {
|
|||||||
CRGB asRGB() const;
|
CRGB asRGB() const;
|
||||||
int asInt() const;
|
int asInt() const;
|
||||||
bool asBool() const;
|
bool asBool() const;
|
||||||
template<typename T> T* as() const {
|
template<typename T> const T& as() const {
|
||||||
return (T*)m_value.asPointer;
|
return *static_cast<const T*>(m_value.asPointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -183,6 +183,8 @@ class ConfigTaskMixin : public virtual Loopable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void loop() override {}
|
||||||
|
|
||||||
virtual void handleConfigChange(const InputEvent& evt) {}
|
virtual void handleConfigChange(const InputEvent& evt) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -201,8 +201,8 @@ MQTTTelemetry::handleEventOnline(const InputEvent& evt)
|
|||||||
void
|
void
|
||||||
MQTTTelemetry::handleConfigChange(const InputEvent& event)
|
MQTTTelemetry::handleConfigChange(const InputEvent& event)
|
||||||
{
|
{
|
||||||
const JsonObject* obj = static_cast<JsonObject*>(event.value().asPointer());
|
const JsonObject& obj = event.as<JsonObject>();
|
||||||
strncpy(m_hostBuf, obj["mqtt.ip"].c_str(), sizeof(m_hostBuf));
|
strncpy(m_hostBuf, obj["mqtt.ip"].as<JsonString>().c_str(), sizeof(m_hostBuf));
|
||||||
m_mqtt.disconnect();
|
m_mqtt.disconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -217,7 +217,7 @@ MQTTTelemetry::loop()
|
|||||||
void
|
void
|
||||||
MQTTTelemetry::handleEvent(const InputEvent& evt)
|
MQTTTelemetry::handleEvent(const InputEvent& evt)
|
||||||
{
|
{
|
||||||
OnlineTaskMixin::handle(evt);
|
OnlineTaskMixin::handleEvent(evt);
|
||||||
ConfigTaskMixin::handleEvent(evt);
|
ConfigTaskMixin::handleEvent(evt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ class MQTTTelemetry : public BufferedInputSource, OnlineTaskMixin, ConfigTaskMix
|
|||||||
bool m_isOn = true;
|
bool m_isOn = true;
|
||||||
static char s_topicBuf[128];
|
static char s_topicBuf[128];
|
||||||
static char s_payloadBuf[512];
|
static char s_payloadBuf[512];
|
||||||
static char s_hostBuf[15];
|
char m_hostBuf[15];
|
||||||
|
|
||||||
void publishDoc(const char* topic);
|
void publishDoc(const char* topic);
|
||||||
void publishDoc(const char* topic, bool retain);
|
void publishDoc(const char* topic, bool retain);
|
||||||
|
Loading…
Reference in New Issue
Block a user