mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 07:49:52 +03:00
make sure all std::strings are consts
This commit is contained in:
@@ -120,8 +120,13 @@ enum DeviceValueTAG : uint8_t {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// mqtt-HA flags
|
// MQTT HA flags
|
||||||
enum DeviceValueHA : uint8_t { HA_NONE = 0, HA_VALUE, HA_DONE };
|
enum DeviceValueHA : uint8_t {
|
||||||
|
|
||||||
|
HA_NONE = 0,
|
||||||
|
HA_VALUE,
|
||||||
|
HA_DONE
|
||||||
|
};
|
||||||
|
|
||||||
class EMSdevice {
|
class EMSdevice {
|
||||||
public:
|
public:
|
||||||
@@ -147,8 +152,8 @@ class EMSdevice {
|
|||||||
return device_id_;
|
return device_id_;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string device_type_name() const;
|
const std::string device_type_name() const;
|
||||||
static std::string device_type_2_device_name(const uint8_t device_type);
|
static const std::string device_type_2_device_name(const uint8_t device_type);
|
||||||
static uint8_t device_name_2_device_type(const char * topic);
|
static uint8_t device_name_2_device_type(const char * topic);
|
||||||
|
|
||||||
static const std::string uom_to_string(uint8_t uom);
|
static const std::string uom_to_string(uint8_t uom);
|
||||||
@@ -226,23 +231,23 @@ class EMSdevice {
|
|||||||
has_update_ |= has_update;
|
has_update_ |= has_update;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string brand_to_string() const;
|
const std::string brand_to_string() const;
|
||||||
static uint8_t decode_brand(uint8_t value);
|
static uint8_t decode_brand(uint8_t value);
|
||||||
|
|
||||||
std::string to_string() const;
|
const std::string to_string() const;
|
||||||
std::string to_string_short() const;
|
const std::string to_string_short() const;
|
||||||
|
|
||||||
void show_telegram_handlers(uuid::console::Shell & shell);
|
void show_telegram_handlers(uuid::console::Shell & shell);
|
||||||
void show_device_values_debug(uuid::console::Shell & shell);
|
|
||||||
char * show_telegram_handlers(char * result);
|
char * show_telegram_handlers(char * result);
|
||||||
void show_mqtt_handlers(uuid::console::Shell & shell);
|
void show_mqtt_handlers(uuid::console::Shell & shell);
|
||||||
|
void list_device_entries(JsonObject & json);
|
||||||
|
|
||||||
using process_function_p = std::function<void(std::shared_ptr<const Telegram>)>;
|
using process_function_p = std::function<void(std::shared_ptr<const Telegram>)>;
|
||||||
|
|
||||||
void register_telegram_type(const uint16_t telegram_type_id, const __FlashStringHelper * telegram_type_name, bool fetch, const process_function_p cb);
|
void register_telegram_type(const uint16_t telegram_type_id, const __FlashStringHelper * telegram_type_name, bool fetch, const process_function_p cb);
|
||||||
bool handle_telegram(std::shared_ptr<const Telegram> telegram);
|
bool handle_telegram(std::shared_ptr<const Telegram> telegram);
|
||||||
|
|
||||||
std::string get_value_uom(const char * key);
|
const std::string get_value_uom(const char * key);
|
||||||
bool get_value_info(JsonObject & root, const char * cmd, const int8_t id);
|
bool get_value_info(JsonObject & root, const char * cmd, const int8_t id);
|
||||||
bool generate_values_json(JsonObject & json, const uint8_t tag_filter, const bool nested, const bool console = false);
|
bool generate_values_json(JsonObject & json, const uint8_t tag_filter, const bool nested, const bool console = false);
|
||||||
void generate_values_json_web(JsonObject & json);
|
void generate_values_json_web(JsonObject & json);
|
||||||
@@ -290,7 +295,7 @@ class EMSdevice {
|
|||||||
|
|
||||||
void publish_mqtt_ha_sensor();
|
void publish_mqtt_ha_sensor();
|
||||||
|
|
||||||
std::string telegram_type_name(std::shared_ptr<const Telegram> telegram);
|
const std::string telegram_type_name(std::shared_ptr<const Telegram> telegram);
|
||||||
|
|
||||||
void fetch_values();
|
void fetch_values();
|
||||||
void toggle_fetch(uint16_t telegram_id, bool toggle);
|
void toggle_fetch(uint16_t telegram_id, bool toggle);
|
||||||
@@ -457,13 +462,14 @@ class EMSdevice {
|
|||||||
};
|
};
|
||||||
const std::vector<DeviceValue> devicevalues() const;
|
const std::vector<DeviceValue> devicevalues() const;
|
||||||
|
|
||||||
|
std::vector<TelegramFunction> telegram_functions_; // each EMS device has its own set of registered telegram types
|
||||||
|
std::vector<DeviceValue> devicevalues_;
|
||||||
|
|
||||||
|
const std::string device_entity_ha(DeviceValue const & dv);
|
||||||
|
|
||||||
void init_devicevalues(uint8_t size) {
|
void init_devicevalues(uint8_t size) {
|
||||||
devicevalues_.reserve(size);
|
devicevalues_.reserve(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<TelegramFunction> telegram_functions_; // each EMS device has its own set of registered telegram types
|
|
||||||
|
|
||||||
std::vector<DeviceValue> devicevalues_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace emsesp
|
} // namespace emsesp
|
||||||
|
|||||||
Reference in New Issue
Block a user