* move offical related members to seperate class * remove static references * add buildMqttPath and comparePrefixedPath methods to NukiOfficial * make offMqttPath private * fix references and syntax errors * move nuki official publish state update check to NukiNetworkLock * make _disableNonJSON private * make NukiOfficial members private * move _offCommand to NukiWrapper * make offCommandExecutedTs private * make offTopics privte * fix nuki publisher reference not set * use NukiPublisher in NukiNetworkOpener * fix build updater * fix pl_off and stat_off strings
60 lines
1.7 KiB
C++
60 lines
1.7 KiB
C++
#include "NukiPublisher.h"
|
|
|
|
|
|
NukiPublisher::NukiPublisher(NukiNetwork *network, const char* mqttPath)
|
|
: _network(network),
|
|
_mqttPath(mqttPath)
|
|
{
|
|
}
|
|
|
|
void NukiPublisher::publishFloat(const char *topic, const float value, bool retain, const uint8_t precision)
|
|
{
|
|
_network->publishFloat(_mqttPath, topic, value, retain, precision);
|
|
}
|
|
|
|
void NukiPublisher::publishInt(const char *topic, const int value, bool retain)
|
|
{
|
|
_network->publishInt(_mqttPath, topic, value, retain);
|
|
}
|
|
|
|
void NukiPublisher::publishUInt(const char *topic, const unsigned int value, bool retain)
|
|
{
|
|
_network->publishUInt(_mqttPath, topic, value, retain);
|
|
}
|
|
|
|
void NukiPublisher::publishBool(const char *topic, const bool value, bool retain)
|
|
{
|
|
_network->publishBool(_mqttPath, topic, value, retain);
|
|
}
|
|
|
|
bool NukiPublisher::publishString(const char *topic, const String &value, bool retain)
|
|
{
|
|
char str[value.length() + 1];
|
|
memset(str, 0, sizeof(str));
|
|
memcpy(str, value.begin(), value.length());
|
|
return publishString(topic, str, retain);
|
|
}
|
|
|
|
bool NukiPublisher::publishString(const char *topic, const std::string &value, bool retain)
|
|
{
|
|
char str[value.size() + 1];
|
|
memset(str, 0, sizeof(str));
|
|
memcpy(str, value.data(), value.length());
|
|
return publishString(topic, str, retain);
|
|
}
|
|
|
|
bool NukiPublisher::publishString(const char *topic, const char *value, bool retain)
|
|
{
|
|
return _network->publishString(_mqttPath, topic, value, retain);
|
|
}
|
|
|
|
void NukiPublisher::publishULong(const char *topic, const unsigned long value, bool retain)
|
|
{
|
|
return _network->publishULong(_mqttPath, topic, value, retain);
|
|
}
|
|
|
|
void NukiPublisher::publishLongLong(const char *topic, int64_t value, bool retain)
|
|
{
|
|
return _network->publishLongLong(_mqttPath, topic, value, retain);
|
|
}
|