rename add_json()

This commit is contained in:
proddy
2021-07-29 16:52:33 +02:00
parent a8382dd6ce
commit 8f438e8045
4 changed files with 7 additions and 7 deletions

View File

@@ -189,7 +189,7 @@ void Command::add(const uint8_t device_type, const __FlashStringHelper * cmd, cm
// add a command to the list, which does return a json object as output // add a command to the list, which does return a json object as output
// flag is fixed to MqttSubFlag::FLAG_NOSUB // flag is fixed to MqttSubFlag::FLAG_NOSUB
void Command::add_returns_json(const uint8_t device_type, void Command::add_json(const uint8_t device_type,
const __FlashStringHelper * cmd, const __FlashStringHelper * cmd,
cmdfunction_json_p cb, cmdfunction_json_p cb,
const __FlashStringHelper * description, const __FlashStringHelper * description,

View File

@@ -109,7 +109,7 @@ class Command {
const __FlashStringHelper * description, const __FlashStringHelper * description,
uint8_t flags = CommandFlag::MQTT_SUB_FLAG_NORMAL); uint8_t flags = CommandFlag::MQTT_SUB_FLAG_NORMAL);
static void add_returns_json(const uint8_t device_type, static void add_json(const uint8_t device_type,
const __FlashStringHelper * cmd, const __FlashStringHelper * cmd,
cmdfunction_json_p cb, cmdfunction_json_p cb,
const __FlashStringHelper * description, const __FlashStringHelper * description,

View File

@@ -41,12 +41,12 @@ void DallasSensor::start() {
bus_.begin(dallas_gpio_); bus_.begin(dallas_gpio_);
#endif #endif
// API calls // API calls
Command::add_returns_json( Command::add_json(
EMSdevice::DeviceType::DALLASSENSOR, EMSdevice::DeviceType::DALLASSENSOR,
F_(info), F_(info),
[&](const char * value, const int8_t id, JsonObject & json) { return command_info(value, id, json); }, [&](const char * value, const int8_t id, JsonObject & json) { return command_info(value, id, json); },
F_(info_cmd)); F_(info_cmd));
Command::add_returns_json( Command::add_json(
EMSdevice::DeviceType::DALLASSENSOR, EMSdevice::DeviceType::DALLASSENSOR,
F_(commands), F_(commands),
[&](const char * value, const int8_t id, JsonObject & json) { return command_commands(value, id, json); }, [&](const char * value, const int8_t id, JsonObject & json) { return command_commands(value, id, json); },

View File

@@ -986,18 +986,18 @@ bool EMSESP::add_device(const uint8_t device_id, const uint8_t product_id, std::
return true; return true;
} }
Command::add_returns_json( Command::add_json(
device_type, device_type,
F_(info), F_(info),
[device_type](const char * value, const int8_t id, JsonObject & json) { return command_info(device_type, json, id, true); }, [device_type](const char * value, const int8_t id, JsonObject & json) { return command_info(device_type, json, id, true); },
F_(info_cmd)); F_(info_cmd));
Command::add_returns_json( Command::add_json(
device_type, device_type,
F("info_short"), F("info_short"),
[device_type](const char * value, const int8_t id, JsonObject & json) { return command_info(device_type, json, id, false); }, [device_type](const char * value, const int8_t id, JsonObject & json) { return command_info(device_type, json, id, false); },
nullptr, nullptr,
CommandFlag::HIDDEN); // this command is hidden CommandFlag::HIDDEN); // this command is hidden
Command::add_returns_json( Command::add_json(
device_type, device_type,
F_(commands), F_(commands),
[device_type](const char * value, const int8_t id, JsonObject & json) { return command_commands(device_type, json, id); }, [device_type](const char * value, const int8_t id, JsonObject & json) { return command_commands(device_type, json, id); },