added some comments

This commit is contained in:
proddy
2024-10-08 22:54:24 +02:00
parent f94ac6b067
commit dbaefe4d50
2 changed files with 19 additions and 16 deletions

View File

@@ -369,6 +369,7 @@ std::string DeviceValue::get_fullname() const {
return customname; return customname;
} }
// returns any custom name defined in the entity_id
std::string DeviceValue::get_name(const std::string & entity) { std::string DeviceValue::get_name(const std::string & entity) {
auto pos = entity.find('|'); auto pos = entity.find('|');
if (pos != std::string::npos) { if (pos != std::string::npos) {

View File

@@ -130,7 +130,7 @@ class DeviceValue {
DV_WEB_EXCLUDE = (1 << 4), // 16 - not shown on web DV_WEB_EXCLUDE = (1 << 4), // 16 - not shown on web
DV_API_MQTT_EXCLUDE = (1 << 5), // 32 - not shown on mqtt, API DV_API_MQTT_EXCLUDE = (1 << 5), // 32 - not shown on mqtt, API
DV_READONLY = (1 << 6), // 64 - read only DV_READONLY = (1 << 6), // 64 - read only
DV_FAVORITE = (1 << 7) // 128 - sort to front DV_FAVORITE = (1 << 7) // 128 - marked as a favorite
}; };
// numeric operators // numeric operators
@@ -154,7 +154,6 @@ class DeviceValue {
const char * const ** options; // options as a flash char array const char * const ** options; // options as a flash char array
const char * const * options_single; // options are not translated const char * const * options_single; // options are not translated
int8_t numeric_operator; int8_t numeric_operator;
uint8_t options_size; // number of options in the char array, calculated
const char * const short_name; // used in MQTT and API const char * const short_name; // used in MQTT and API
const char * const * fullname; // used in Web and Console, is translated const char * const * fullname; // used in Web and Console, is translated
std::string custom_fullname; // optional, from customization std::string custom_fullname; // optional, from customization
@@ -164,21 +163,24 @@ class DeviceValue {
uint32_t max; // max range uint32_t max; // max range
uint8_t state; // DeviceValueState::* uint8_t state; // DeviceValueState::*
DeviceValue(uint8_t device_type, uint8_t options_size; // number of options in the char array, calculated at class initialization
int8_t tag,
void * value_p, DeviceValue(uint8_t device_type, // EMSdevice::DeviceType
uint8_t type, int8_t tag, // DeviceValueTAG::*
const char * const ** options, void * value_p, // pointer to variable of any type
const char * const * options_single, uint8_t type, // DeviceValueType::*
const char * const ** options, // options as a flash char array
const char * const * options_single, // options are not translated
int8_t numeric_operator, int8_t numeric_operator,
const char * const short_name, const char * const short_name, // used in MQTT and API
const char * const * fullname, const char * const * fullname, // used in Web and Console, is translated
std::string & custom_fullname, std::string & custom_fullname, // optional, from customization
uint8_t uom, uint8_t uom, // DeviceValueUOM::*
bool has_cmd, bool has_cmd, // true if there is a Console/MQTT command which matches the short_name
int16_t min, int16_t min, // min range
uint32_t max, uint32_t max, // max range
uint8_t state); uint8_t state // DeviceValueState::* (also known as the mask)
);
bool hasValue() const; bool hasValue() const;
bool has_tag() const; bool has_tag() const;