From 55d19bbc2d0b61e042b606e03e294cf9b2e13cac Mon Sep 17 00:00:00 2001 From: Proddy Date: Thu, 23 Feb 2023 19:28:11 +0100 Subject: [PATCH] comment --- src/emsdevicevalue.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/emsdevicevalue.cpp b/src/emsdevicevalue.cpp index 7a9a017ae..30e742f1b 100644 --- a/src/emsdevicevalue.cpp +++ b/src/emsdevicevalue.cpp @@ -115,7 +115,6 @@ const char * DeviceValue::DeviceValueUOM_s[] = { }; // mapping of TAGs, to match order in DeviceValueTAG enum in emsdevicevalue.h -// must be an int of 4 bytes, 32bit aligned const char * const * DeviceValue::DeviceValueTAG_s[] = { FL_(tag_none), // "" @@ -161,7 +160,7 @@ const char * const * DeviceValue::DeviceValueTAG_s[] = { }; -// MQTT topics derived from tags +// tags used in MQTT topic names. Macthes sequence from DeviceValueTAG_s const char * const DeviceValue::DeviceValueTAG_mqtt[] = { FL_(tag_none)[0], // "" @@ -253,6 +252,11 @@ bool DeviceValue::hasValue() const { return has_value; } +// See if the device value has a tag and it's not empty +bool DeviceValue::has_tag() const { + return ((tag < DeviceValue::NUM_TAGS) && (tag != TAG_NONE) && strlen(DeviceValueTAG_s[tag][0])); +} + // set the min and max value for a device value // converts to signed int, which means rounding to an whole integer // returns false if there is no min/max needed