Update bblanchon/ArduinoJson from 7.1.0 to 7.2.0

This commit is contained in:
Thomas Basler 2024-09-21 00:12:15 +02:00
parent 3b3e6995c2
commit 2f41f43d49
12 changed files with 73 additions and 70 deletions

View File

@ -40,7 +40,7 @@ build_unflags =
lib_deps =
mathieucarbou/ESPAsyncWebServer @ 3.3.1
bblanchon/ArduinoJson @ 7.1.0
bblanchon/ArduinoJson @ 7.2.0
https://github.com/bertmelis/espMqttClient.git#v1.7.0
nrf24/RF24 @ 1.4.9
olikraus/U8g2 @ 2.35.30

View File

@ -61,7 +61,7 @@ void WebApiConfigClass::onConfigDelete(AsyncWebServerRequest* request)
auto& retMsg = response->getRoot();
if (!(root.containsKey("delete"))) {
if (!(root["delete"].is<bool>())) {
retMsg["message"] = "Values are missing!";
retMsg["code"] = WebApiError::GenericValueMissing;
WebApi.sendJsonResponse(request, response, __FUNCTION__, __LINE__);

View File

@ -103,8 +103,8 @@ void WebApiDeviceClass::onDeviceAdminPost(AsyncWebServerRequest* request)
auto& retMsg = response->getRoot();
if (!(root.containsKey("curPin")
|| root.containsKey("display"))) {
if (!(root["curPin"].is<JsonObject>()
|| root["display"].is<JsonObject>())) {
retMsg["message"] = "Values are missing!";
retMsg["code"] = WebApiError::GenericValueMissing;
WebApi.sendJsonResponse(request, response, __FUNCTION__, __LINE__);

View File

@ -90,12 +90,12 @@ void WebApiDtuClass::onDtuAdminPost(AsyncWebServerRequest* request)
auto& retMsg = response->getRoot();
if (!(root.containsKey("serial")
&& root.containsKey("pollinterval")
&& root.containsKey("nrf_palevel")
&& root.containsKey("cmt_palevel")
&& root.containsKey("cmt_frequency")
&& root.containsKey("cmt_country"))) {
if (!(root["serial"].is<String>()
&& root["pollinterval"].is<uint32_t>()
&& root["nrf_palevel"].is<uint8_t>()
&& root["cmt_palevel"].is<uint8_t>()
&& root["cmt_frequency"].is<uint32_t>()
&& root["cmt_country"].is<uint8_t>())) {
retMsg["message"] = "Values are missing!";
retMsg["code"] = WebApiError::GenericValueMissing;
WebApi.sendJsonResponse(request, response, __FUNCTION__, __LINE__);

View File

@ -95,8 +95,8 @@ void WebApiInverterClass::onInverterAdd(AsyncWebServerRequest* request)
auto& retMsg = response->getRoot();
if (!(root.containsKey("serial")
&& root.containsKey("name"))) {
if (!(root["serial"].is<String>()
&& root["name"].is<String>())) {
retMsg["message"] = "Values are missing!";
retMsg["code"] = WebApiError::GenericValueMissing;
WebApi.sendJsonResponse(request, response, __FUNCTION__, __LINE__);
@ -165,7 +165,10 @@ void WebApiInverterClass::onInverterEdit(AsyncWebServerRequest* request)
auto& retMsg = response->getRoot();
if (!(root.containsKey("id") && root.containsKey("serial") && root.containsKey("name") && root.containsKey("channel"))) {
if (!(root["id"].is<uint8_t>()
&& root["serial"].is<String>()
&& root["name"].is<String>()
&& root["channel"].is<JsonArray>())) {
retMsg["message"] = "Values are missing!";
retMsg["code"] = WebApiError::GenericValueMissing;
WebApi.sendJsonResponse(request, response, __FUNCTION__, __LINE__);
@ -281,7 +284,7 @@ void WebApiInverterClass::onInverterDelete(AsyncWebServerRequest* request)
auto& retMsg = response->getRoot();
if (!(root.containsKey("id"))) {
if (!(root["id"].is<uint8_t>())) {
retMsg["message"] = "Values are missing!";
retMsg["code"] = WebApiError::GenericValueMissing;
WebApi.sendJsonResponse(request, response, __FUNCTION__, __LINE__);
@ -323,7 +326,7 @@ void WebApiInverterClass::onInverterOrder(AsyncWebServerRequest* request)
auto& retMsg = response->getRoot();
if (!(root.containsKey("order"))) {
if (!(root["order"].is<JsonArray>())) {
retMsg["message"] = "Values are missing!";
retMsg["code"] = WebApiError::GenericValueMissing;
WebApi.sendJsonResponse(request, response, __FUNCTION__, __LINE__);

View File

@ -64,9 +64,9 @@ void WebApiLimitClass::onLimitPost(AsyncWebServerRequest* request)
auto& retMsg = response->getRoot();
if (!(root.containsKey("serial")
&& root.containsKey("limit_value")
&& root.containsKey("limit_type"))) {
if (!(root["serial"].is<String>()
&& root["limit_value"].is<float>()
&& root["limit_type"].is<uint16_t>())) {
retMsg["message"] = "Values are missing!";
retMsg["code"] = WebApiError::GenericValueMissing;
WebApi.sendJsonResponse(request, response, __FUNCTION__, __LINE__);

View File

@ -30,7 +30,7 @@ void WebApiMaintenanceClass::onRebootPost(AsyncWebServerRequest* request)
auto& retMsg = response->getRoot();
if (!(root.containsKey("reboot"))) {
if (!(root["reboot"].is<bool>())) {
retMsg["message"] = "Values are missing!";
retMsg["code"] = WebApiError::GenericValueMissing;
WebApi.sendJsonResponse(request, response, __FUNCTION__, __LINE__);

View File

@ -107,29 +107,29 @@ void WebApiMqttClass::onMqttAdminPost(AsyncWebServerRequest* request)
auto& retMsg = response->getRoot();
if (!(root.containsKey("mqtt_enabled")
&& root.containsKey("mqtt_hostname")
&& root.containsKey("mqtt_port")
&& root.containsKey("mqtt_clientid")
&& root.containsKey("mqtt_username")
&& root.containsKey("mqtt_password")
&& root.containsKey("mqtt_topic")
&& root.containsKey("mqtt_retain")
&& root.containsKey("mqtt_tls")
&& root.containsKey("mqtt_tls_cert_login")
&& root.containsKey("mqtt_client_cert")
&& root.containsKey("mqtt_client_key")
&& root.containsKey("mqtt_lwt_topic")
&& root.containsKey("mqtt_lwt_online")
&& root.containsKey("mqtt_lwt_offline")
&& root.containsKey("mqtt_lwt_qos")
&& root.containsKey("mqtt_publish_interval")
&& root.containsKey("mqtt_clean_session")
&& root.containsKey("mqtt_hass_enabled")
&& root.containsKey("mqtt_hass_expire")
&& root.containsKey("mqtt_hass_retain")
&& root.containsKey("mqtt_hass_topic")
&& root.containsKey("mqtt_hass_individualpanels"))) {
if (!(root["mqtt_enabled"].is<bool>()
&& root["mqtt_hostname"].is<String>()
&& root["mqtt_port"].is<uint>()
&& root["mqtt_clientid"].is<String>()
&& root["mqtt_username"].is<String>()
&& root["mqtt_password"].is<String>()
&& root["mqtt_topic"].is<String>()
&& root["mqtt_retain"].is<bool>()
&& root["mqtt_tls"].is<bool>()
&& root["mqtt_tls_cert_login"].is<bool>()
&& root["mqtt_client_cert"].is<String>()
&& root["mqtt_client_key"].is<String>()
&& root["mqtt_lwt_topic"].is<String>()
&& root["mqtt_lwt_online"].is<String>()
&& root["mqtt_lwt_offline"].is<String>()
&& root["mqtt_lwt_qos"].is<uint8_t>()
&& root["mqtt_publish_interval"].is<uint32_t>()
&& root["mqtt_clean_session"].is<bool>()
&& root["mqtt_hass_enabled"].is<bool>()
&& root["mqtt_hass_expire"].is<bool>()
&& root["mqtt_hass_retain"].is<bool>()
&& root["mqtt_hass_topic"].is<String>()
&& root["mqtt_hass_individualpanels"].is<bool>())) {
retMsg["message"] = "Values are missing!";
retMsg["code"] = WebApiError::GenericValueMissing;
WebApi.sendJsonResponse(request, response, __FUNCTION__, __LINE__);

View File

@ -88,16 +88,16 @@ void WebApiNetworkClass::onNetworkAdminPost(AsyncWebServerRequest* request)
auto& retMsg = response->getRoot();
if (!(root.containsKey("ssid")
&& root.containsKey("password")
&& root.containsKey("hostname")
&& root.containsKey("dhcp")
&& root.containsKey("ipaddress")
&& root.containsKey("netmask")
&& root.containsKey("gateway")
&& root.containsKey("dns1")
&& root.containsKey("dns2")
&& root.containsKey("aptimeout"))) {
if (!(root["ssid"].is<String>()
&& root["password"].is<String>()
&& root["hostname"].is<String>()
&& root["dhcp"].is<bool>()
&& root["ipaddress"].is<String>()
&& root["netmask"].is<String>()
&& root["gateway"].is<String>()
&& root["dns1"].is<String>()
&& root["dns2"].is<String>()
&& root["aptimeout"].is<uint>())) {
retMsg["message"] = "Values are missing!";
retMsg["code"] = WebApiError::GenericValueMissing;
WebApi.sendJsonResponse(request, response, __FUNCTION__, __LINE__);

View File

@ -100,11 +100,11 @@ void WebApiNtpClass::onNtpAdminPost(AsyncWebServerRequest* request)
auto& retMsg = response->getRoot();
if (!(root.containsKey("ntp_server")
&& root.containsKey("ntp_timezone")
&& root.containsKey("longitude")
&& root.containsKey("latitude")
&& root.containsKey("sunsettype"))) {
if (!(root["ntp_server"].is<String>()
&& root["ntp_timezone"].is<String>()
&& root["longitude"].is<double>()
&& root["latitude"].is<double>()
&& root["sunsettype"].is<uint8_t>())) {
retMsg["message"] = "Values are missing!";
retMsg["code"] = WebApiError::GenericValueMissing;
WebApi.sendJsonResponse(request, response, __FUNCTION__, __LINE__);
@ -193,12 +193,12 @@ void WebApiNtpClass::onNtpTimePost(AsyncWebServerRequest* request)
auto& retMsg = response->getRoot();
if (!(root.containsKey("year")
&& root.containsKey("month")
&& root.containsKey("day")
&& root.containsKey("hour")
&& root.containsKey("minute")
&& root.containsKey("second"))) {
if (!(root["year"].is<uint>()
&& root["month"].is<uint>()
&& root["day"].is<uint>()
&& root["hour"].is<uint>()
&& root["minute"].is<uint>()
&& root["second"].is<uint>())) {
retMsg["message"] = "Values are missing!";
retMsg["code"] = WebApiError::GenericValueMissing;
WebApi.sendJsonResponse(request, response, __FUNCTION__, __LINE__);

View File

@ -57,9 +57,9 @@ void WebApiPowerClass::onPowerPost(AsyncWebServerRequest* request)
auto& retMsg = response->getRoot();
if (!(root.containsKey("serial")
&& (root.containsKey("power")
|| root.containsKey("restart")))) {
if (!(root["serial"].is<String>()
&& (root["power"].is<bool>()
|| root["restart"].is<bool>()))) {
retMsg["message"] = "Values are missing!";
retMsg["code"] = WebApiError::GenericValueMissing;
WebApi.sendJsonResponse(request, response, __FUNCTION__, __LINE__);
@ -84,8 +84,8 @@ void WebApiPowerClass::onPowerPost(AsyncWebServerRequest* request)
return;
}
if (root.containsKey("power")) {
uint16_t power = root["power"].as<bool>();
if (root["power"].is<bool>()) {
bool power = root["power"].as<bool>();
inv->sendPowerControlRequest(power);
} else {
if (root["restart"].as<bool>()) {

View File

@ -48,8 +48,8 @@ void WebApiSecurityClass::onSecurityPost(AsyncWebServerRequest* request)
auto& retMsg = response->getRoot();
if (!root.containsKey("password")
&& root.containsKey("allow_readonly")) {
if (!root["password"].is<String>()
&& root["allow_readonly"].is<bool>()) {
retMsg["message"] = "Values are missing!";
retMsg["code"] = WebApiError::GenericValueMissing;
WebApi.sendJsonResponse(request, response, __FUNCTION__, __LINE__);