Skip to content

Commit

Permalink
Update bblanchon/ArduinoJson from 7.1.0 to 7.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
tbnobody committed Sep 20, 2024
1 parent 3b3e699 commit 2f41f43
Show file tree
Hide file tree
Showing 12 changed files with 73 additions and 70 deletions.
2 changes: 1 addition & 1 deletion platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/WebApi_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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__);
Expand Down
4 changes: 2 additions & 2 deletions src/WebApi_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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__);
Expand Down
12 changes: 6 additions & 6 deletions src/WebApi_dtu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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__);
Expand Down
13 changes: 8 additions & 5 deletions src/WebApi_inverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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__);
Expand Down Expand Up @@ -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__);
Expand Down Expand Up @@ -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__);
Expand Down Expand Up @@ -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__);
Expand Down
6 changes: 3 additions & 3 deletions src/WebApi_limit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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__);
Expand Down
2 changes: 1 addition & 1 deletion src/WebApi_maintenance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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__);
Expand Down
46 changes: 23 additions & 23 deletions src/WebApi_mqtt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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__);
Expand Down
20 changes: 10 additions & 10 deletions src/WebApi_network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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__);
Expand Down
22 changes: 11 additions & 11 deletions src/WebApi_ntp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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__);
Expand Down Expand Up @@ -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__);
Expand Down
10 changes: 5 additions & 5 deletions src/WebApi_power.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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__);
Expand All @@ -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>()) {
Expand Down
4 changes: 2 additions & 2 deletions src/WebApi_security.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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__);
Expand Down

0 comments on commit 2f41f43

Please sign in to comment.