diff --git a/README.md b/README.md
index bc4583067..a44a845d8 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
## Sonoff-Tasmota
Provide ESP8266 based Sonoff by [iTead Studio](https://www.itead.cc/) and ElectroDragon IoT Relay with Serial, Web and MQTT control allowing 'Over the Air' or OTA firmware updates using Arduino IDE.
-Current version is **5.9.1** - See [sonoff/_releasenotes.ino](https://github.com/arendst/Sonoff-Tasmota/blob/master/sonoff/_releasenotes.ino) for change information.
+Current version is **5.10.0** - See [sonoff/_releasenotes.ino](https://github.com/arendst/Sonoff-Tasmota/blob/master/sonoff/_releasenotes.ino) for change information.
### ATTENTION All versions
@@ -37,13 +37,13 @@ The following devices are supported:
- [iTead Sonoff RF](https://www.itead.cc/smart-home/sonoff-rf.html)
- [iTead Sonoff SV](https://www.itead.cc/smart-home/sonoff-sv.html)
- [iTead Sonoff TH10/TH16 with temperature sensor](https://www.itead.cc/smart-home/sonoff-th.html)
-- [iTead Sonoff Dual](https://www.itead.cc/smart-home/sonoff-dual.html)
+- [iTead Sonoff Dual (R2)](https://www.itead.cc/smart-home/sonoff-dual.html)
- [iTead Sonoff Pow](https://www.itead.cc/smart-home/sonoff-pow.html)
- [iTead Sonoff 4CH](https://www.itead.cc/smart-home/sonoff-4ch.html)
- [iTead Sonoff 4CH Pro](https://www.itead.cc/smart-home/sonoff-4ch-pro.html)
- [iTead S20 Smart Socket](https://www.itead.cc/smart-socket.html)
- [iTead Slampher](https://www.itead.cc/slampher.html)
-- [iTead Sonoff Touch](https://www.itead.cc/sonoff-touch-eu-local.html)
+- [iTead Sonoff Touch](https://www.itead.cc/sonoff-touch.html)
- [iTead Sonoff T1](https://www.itead.cc/sonoff-t1.html)
- [iTead Sonoff SC](https://www.itead.cc/sonoff-sc.html)
- [iTead Sonoff Led](https://www.itead.cc/sonoff-led.html)
diff --git a/lib/ArduinoJson/ArduinoJson.h b/lib/ArduinoJson-5.11.2/ArduinoJson.h
similarity index 62%
rename from lib/ArduinoJson/ArduinoJson.h
rename to lib/ArduinoJson-5.11.2/ArduinoJson.h
index ffea66013..896503a6c 100644
--- a/lib/ArduinoJson/ArduinoJson.h
+++ b/lib/ArduinoJson-5.11.2/ArduinoJson.h
@@ -2,7 +2,7 @@
// MIT License
//
// Arduino JSON library
-// https://github.com/bblanchon/ArduinoJson
+// https://bblanchon.github.io/ArduinoJson/
// If you like this project, please add a star!
-#include "include/ArduinoJson.h"
+#include "src/ArduinoJson.h"
diff --git a/lib/ArduinoJson/CHANGELOG.md b/lib/ArduinoJson-5.11.2/CHANGELOG.md
similarity index 79%
rename from lib/ArduinoJson/CHANGELOG.md
rename to lib/ArduinoJson-5.11.2/CHANGELOG.md
index d92d0472b..490e25c8c 100644
--- a/lib/ArduinoJson/CHANGELOG.md
+++ b/lib/ArduinoJson-5.11.2/CHANGELOG.md
@@ -1,6 +1,88 @@
ArduinoJson: change log
=======================
+v5.11.2
+-------
+
+* Fixed `DynamicJsonBuffer::clear()` not resetting allocation size (issue #561)
+* Fixed incorrect rounding for float values (issue #588)
+
+v5.11.1
+-------
+
+* Removed dependency on `PGM_P` as Particle 0.6.2 doesn't define it (issue #546)
+* Fixed warning "dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]"
+* Fixed warning "floating constant exceeds range of 'float' [-Woverflow]" (issue #544)
+* Fixed warning "this statement may fall through" [-Wimplicit-fallthrough=] (issue #539)
+* Removed `ARDUINOJSON_DOUBLE_IS_64BITS` as it became useless.
+* Fixed too many decimals places in float serialization (issue #543)
+
+v5.11.0
+-------
+
+* Made `JsonBuffer` non-copyable (PR #524 by @luisrayas3)
+* Added `StaticJsonBuffer::clear()`
+* Added `DynamicJsonBuffer::clear()`
+
+v5.10.1
+-------
+
+* Fixed IntelliSense errors in Visual Micro (issue #483)
+* Fixed compilation in IAR Embedded Workbench (issue #515)
+* Fixed reading "true" as a float (issue #516)
+* Added `ARDUINOJSON_DOUBLE_IS_64BITS`
+* Added `ARDUINOJSON_EMBEDDED_MODE`
+
+v5.10.0
+-------
+
+* Removed configurable number of decimal places (issues #288, #427 and #506)
+* Changed exponentiation thresholds to `1e7` and `1e-5` (issues #288, #427 and #506)
+* `JsonVariant::is()` now returns `true` for integers
+* Fixed error `IsBaseOf is not a member of ArduinoJson::TypeTraits` (issue #495)
+* Fixed error `forming reference to reference` (issue #495)
+
+### BREAKING CHANGES :warning:
+
+| Old syntax | New syntax |
+|---------------------------------|---------------------|
+| `double_with_n_digits(3.14, 2)` | `3.14` |
+| `float_with_n_digits(3.14, 2)` | `3.14f` |
+| `obj.set("key", 3.14, 2)` | `obj["key"] = 3.14` |
+| `arr.add(3.14, 2)` | `arr.add(3.14)` |
+
+| Input | Old output | New output |
+|-----------|------------|------------|
+| `3.14159` | `3.14` | `3.14159` |
+| `42.0` | `42.00` | `42` |
+| `0.0` | `0.00` | `0` |
+
+| Expression | Old result | New result |
+|--------------------------------|------------|------------|
+| `JsonVariant(42).is()` | `true` | `true` |
+| `JsonVariant(42).is()` | `false` | `true` |
+| `JsonVariant(42).is()` | `false` | `true` |
+
+
+v5.9.0
+------
+
+* Added `JsonArray::remove(iterator)` (issue #479)
+* Added `JsonObject::remove(iterator)`
+* Renamed `JsonArray::removeAt(size_t)` into `remove(size_t)`
+* Renamed folder `include/` to `src/`
+* Fixed warnings `floating constant exceeds range of float`and `floating constant truncated to zero` (issue #483)
+* Removed `Print` class and converted `printTo()` to a template method (issue #276)
+* Removed example `IndentedPrintExample.ino`
+* Now compatible with Particle 0.6.1, thanks to Jacob Nite (issue #294 and PR #461 by @foodbag)
+
+v5.8.4
+------
+
+* Added custom implementation of `strtod()` (issue #453)
+* Added custom implementation of `strtol()` (issue #465)
+* `char` is now treated as an integral type (issue #337, #370)
+
v5.8.3
------
@@ -34,7 +116,7 @@ v5.8.0
* Added support for `Stream` (issue #300)
* Reduced memory consumption by not duplicating spaces and comments
-**BREAKING CHANGES**:
+### BREAKING CHANGES :warning:
`JsonBuffer::parseObject()` and `JsonBuffer::parseArray()` have been pulled down to the derived classes `DynamicJsonBuffer` and `StaticJsonBufferBase`.
@@ -52,6 +134,7 @@ void myFunction(StaticJsonBufferBase& jsonBuffer);
template void myFunction(TJsonBuffer& jsonBuffer);
```
+
v5.7.3
------
@@ -83,7 +166,7 @@ v5.7.0
* Added example `StringExample.ino` to show where `String` can be used
* Increased default nesting limit to 50 when compiled for a computer (issue #349)
-**BREAKING CHANGES**:
+### BREAKING CHANGES :warning:
The non-template functions `JsonObject::get()` and `JsonArray.get()` have been removed. This means that you need to explicitely tell the type you expect in return.
@@ -210,7 +293,8 @@ v5.0.7
* Made library easier to use from a CMake project: simply `add_subdirectory(ArduinoJson/src)`
* Changed `String` to be a `typedef` of `std::string` (issues #142 and #161)
-**BREAKING CHANGES**:
+### BREAKING CHANGES :warning:
+
- `JsonVariant(true).as()` now returns `"true"` instead of `"1"`
- `JsonVariant(false).as()` now returns `"false"` instead of `"0"`
@@ -266,7 +350,8 @@ v5.0.0
* Redesigned `JsonVariant` to leverage converting constructors instead of assignment operators (issue #66)
* Switched to new the library layout (requires Arduino 1.0.6 or above)
-**BREAKING CHANGES**:
+### BREAKING CHANGES :warning:
+
- `JsonObject::add()` was renamed to `set()`
- `JsonArray::at()` and `JsonObject::at()` were renamed to `get()`
- Number of digits of floating point value are now set with `double_with_n_digits()`
diff --git a/lib/ArduinoJson/LICENSE.md b/lib/ArduinoJson-5.11.2/LICENSE.md
similarity index 100%
rename from lib/ArduinoJson/LICENSE.md
rename to lib/ArduinoJson-5.11.2/LICENSE.md
diff --git a/lib/ArduinoJson/README.md b/lib/ArduinoJson-5.11.2/README.md
similarity index 70%
rename from lib/ArduinoJson/README.md
rename to lib/ArduinoJson-5.11.2/README.md
index 25afbfa47..6ee8a37a6 100644
--- a/lib/ArduinoJson/README.md
+++ b/lib/ArduinoJson-5.11.2/README.md
@@ -1,8 +1,10 @@
+[](https://ci.appveyor.com/project/bblanchon/arduinojson/branch/master) [](https://travis-ci.org/bblanchon/ArduinoJson) [](https://coveralls.io/r/bblanchon/ArduinoJson?branch=master) [](https://github.com/bblanchon/ArduinoJson)
+
+
+
ArduinoJson - C++ JSON library for IoT
====================
-[](https://ci.appveyor.com/project/bblanchon/arduinojson/branch/master) [](https://travis-ci.org/bblanchon/ArduinoJson) [](https://coveralls.io/r/bblanchon/ArduinoJson?branch=master) [](https://github.com/bblanchon/ArduinoJson)
-
*An elegant and efficient JSON library for embedded systems.*
It's designed to have the most intuitive API, the smallest footprint and is able to work without any allocation on the heap (no malloc).
@@ -27,16 +29,16 @@ Features
Works on
--------
-* All Arduino boards (Uno, Due, Mini, Micro, Yun...)
-* ESP8266
+* Arduino boards: Uno, Due, Mini, Micro, Yun...
+* ESP8266, ESP32
* Teensy
-* Intel Edison and Galileo
-* PlatformIO
-* Energia
* RedBearLab boards (BLE Nano...)
-* Computers (Windows, Linux, OSX...)
-
-See [FAQ: Compatibility issues](https://bblanchon.github.io/ArduinoJson/faq/compilation-fails-device-crashes-nothing-on-serial-console)
+* Intel Edison and Galileo
+* WeMos boards: D1...
+* Computers: Windows, Linux, OSX...
+* PlatformIO
+* Particle
+* Energia
Quick start
-----------
@@ -58,6 +60,8 @@ double longitude = root["data"][1];
[See JsonParserExample.ino](examples/JsonParserExample/JsonParserExample.ino)
+Use [ArduinoJson Assistant](https://bblanchon.github.io/ArduinoJson/assistant/) to compute the buffer size.
+
#### Encoding / Generating
```c++
@@ -68,8 +72,8 @@ root["sensor"] = "gps";
root["time"] = 1351824120;
JsonArray& data = root.createNestedArray("data");
-data.add(48.756080, 6); // 6 is the number of decimals to print
-data.add(2.302038, 6); // if not specified, 2 digits are printed
+data.add(48.756080);
+data.add(2.302038);
root.printTo(Serial);
// This prints:
@@ -78,42 +82,17 @@ root.printTo(Serial);
[See JsonGeneratorExample.ino](examples/JsonGeneratorExample/JsonGeneratorExample.ino)
+Use [ArduinoJson Assistant](https://bblanchon.github.io/ArduinoJson/assistant/) to compute the buffer size.
+
Documentation
-------------
-The documentation is available online in the [ArduinoJson wiki](https://github.com/bblanchon/ArduinoJson/wiki).
+The documentation is available online in the [ArduinoJson Website](https://bblanchon.github.io/ArduinoJson/).
The [ArduinoJson Assistant](https://bblanchon.github.io/ArduinoJson/assistant/) helps you get started with the library.
-Testimonials
-------------
-
-From Arduino's Forum user `jflaplante`:
-> I tried aJson json-arduino before trying your library. I always ran into memory problem after a while.
-> I have no such problem so far with your library. It is working perfectly with my web services.
-
-From StackOverflow user `thegreendroid`:
-> It has a really elegant, simple API and it works like a charm on embedded and Windows/Linux platforms. We recently started using this on an embedded project and I can vouch for its quality.
-
-From GitHub user `zacsketches`:
-> Thanks for a great library!!!
-> I've been watching you consistently develop this library over the past six months, and I used it today for a publish and subscribe architecture designed to help hobbyists move into more advanced robotics. Your library allowed me to implement remote subscription in order to facilitate multi-processor robots.
-> ArduinoJson saved me a week's worth of time!!
-
-[From Reddit user `erm_what_`](https://www.reddit.com/r/arduino/comments/3jj6ep/announcing_arduinojson_50/cusjk8c):
-> This is a great library and I wouldn't be able to do the project I'm doing without it. I completely recommend it.
-
-[From Reddit user `makerhacks`](https://www.reddit.com/r/arduino/comments/3jj6ep/announcing_arduinojson_50/cusqg7b):
-> I am just starting an ESP8266 clock project and now I can output JSON from my server script and interpret it painlessly.
-
-[From Twitter user `@hemalchevli`](https://twitter.com/hemalchevli/status/715788439397011456):
-> ArduinoJson library should be used as a benchmark/reference for making libraries. Truly elegant.
-
-[From GitHub user `sticilface`](https://github.com/bblanchon/ArduinoJson/issues/381#issuecomment-260203594):
-> its a great lib:) and i use it in everything!
-
Donators
--------
@@ -136,7 +115,15 @@ Special thanks to the following persons and companies who made generous donation
* Yoeri Kroon
* Andrew Melvin
* Doanh Luong
-* Christoph Schmidt
+* Christoph Schmidt
+* OpenEVSE LLC
+* Prokhoryatov Alexey
+* Google Inc.
+* Charles Haynes
+* Charles Walker
+* Günther Jehle
+* Patrick Elliott
+
---
diff --git a/lib/ArduinoJson/examples/JsonGeneratorExample/JsonGeneratorExample.ino b/lib/ArduinoJson-5.11.2/examples/JsonGeneratorExample/JsonGeneratorExample.ino
similarity index 88%
rename from lib/ArduinoJson/examples/JsonGeneratorExample/JsonGeneratorExample.ino
rename to lib/ArduinoJson-5.11.2/examples/JsonGeneratorExample/JsonGeneratorExample.ino
index dd912f113..0f636faf8 100644
--- a/lib/ArduinoJson/examples/JsonGeneratorExample/JsonGeneratorExample.ino
+++ b/lib/ArduinoJson-5.11.2/examples/JsonGeneratorExample/JsonGeneratorExample.ino
@@ -2,7 +2,7 @@
// MIT License
//
// Arduino JSON library
-// https://github.com/bblanchon/ArduinoJson
+// https://bblanchon.github.io/ArduinoJson/
// If you like this project, please add a star!
#include
@@ -17,13 +17,13 @@ void setup() {
//
// Inside the brackets, 200 is the size of the pool in bytes.
// If the JSON object is more complex, you need to increase that value.
+ // See https://bblanchon.github.io/ArduinoJson/assistant/
StaticJsonBuffer<200> jsonBuffer;
// StaticJsonBuffer allocates memory on the stack, it can be
// replaced by DynamicJsonBuffer which allocates in the heap.
- // It's simpler but less efficient.
//
- // DynamicJsonBuffer jsonBuffer;
+ // DynamicJsonBuffer jsonBuffer(200);
// Create the root of the object tree.
//
@@ -44,8 +44,8 @@ void setup() {
// It's also possible to create the array separately and add it to the
// JsonObject but it's less efficient.
JsonArray& data = root.createNestedArray("data");
- data.add(double_with_n_digits(48.756080, 6));
- data.add(double_with_n_digits(2.302038, 6));
+ data.add(48.756080);
+ data.add(2.302038);
root.printTo(Serial);
// This prints:
diff --git a/lib/ArduinoJson/examples/JsonHttpClient/JsonHttpClient.ino b/lib/ArduinoJson-5.11.2/examples/JsonHttpClient/JsonHttpClient.ino
similarity index 97%
rename from lib/ArduinoJson/examples/JsonHttpClient/JsonHttpClient.ino
rename to lib/ArduinoJson-5.11.2/examples/JsonHttpClient/JsonHttpClient.ino
index 35954fb6e..5edb817f1 100644
--- a/lib/ArduinoJson/examples/JsonHttpClient/JsonHttpClient.ino
+++ b/lib/ArduinoJson-5.11.2/examples/JsonHttpClient/JsonHttpClient.ino
@@ -5,7 +5,7 @@
// MIT License
//
// Arduino JSON library
-// https://github.com/bblanchon/ArduinoJson
+// https://bblanchon.github.io/ArduinoJson/
// If you like this project, please add a star!
#include
@@ -135,7 +135,7 @@ bool skipResponseHeaders() {
// }
bool readReponseContent(struct UserData* userData) {
// Compute optimal size of the JSON buffer according to what we need to parse.
- // This is only required if you use StaticJsonBuffer.
+ // See https://bblanchon.github.io/ArduinoJson/assistant/
const size_t BUFFER_SIZE =
JSON_OBJECT_SIZE(8) // the root object has 8 elements
+ JSON_OBJECT_SIZE(5) // the "address" object has 5 elements
diff --git a/lib/ArduinoJson/examples/JsonParserExample/JsonParserExample.ino b/lib/ArduinoJson-5.11.2/examples/JsonParserExample/JsonParserExample.ino
similarity index 92%
rename from lib/ArduinoJson/examples/JsonParserExample/JsonParserExample.ino
rename to lib/ArduinoJson-5.11.2/examples/JsonParserExample/JsonParserExample.ino
index ee215f649..719d2ee28 100644
--- a/lib/ArduinoJson/examples/JsonParserExample/JsonParserExample.ino
+++ b/lib/ArduinoJson-5.11.2/examples/JsonParserExample/JsonParserExample.ino
@@ -2,7 +2,7 @@
// MIT License
//
// Arduino JSON library
-// https://github.com/bblanchon/ArduinoJson
+// https://bblanchon.github.io/ArduinoJson/
// If you like this project, please add a star!
#include
@@ -17,13 +17,13 @@ void setup() {
//
// Inside the brackets, 200 is the size of the pool in bytes,
// If the JSON object is more complex, you need to increase that value.
+ // See https://bblanchon.github.io/ArduinoJson/assistant/
StaticJsonBuffer<200> jsonBuffer;
// StaticJsonBuffer allocates memory on the stack, it can be
// replaced by DynamicJsonBuffer which allocates in the heap.
- // It's simpler but less efficient.
//
- // DynamicJsonBuffer jsonBuffer;
+ // DynamicJsonBuffer jsonBuffer(200);
// JSON input string.
//
diff --git a/lib/ArduinoJson/examples/JsonServer/JsonServer.ino b/lib/ArduinoJson-5.11.2/examples/JsonServer/JsonServer.ino
similarity index 94%
rename from lib/ArduinoJson/examples/JsonServer/JsonServer.ino
rename to lib/ArduinoJson-5.11.2/examples/JsonServer/JsonServer.ino
index d3fec3ece..555842b82 100644
--- a/lib/ArduinoJson/examples/JsonServer/JsonServer.ino
+++ b/lib/ArduinoJson-5.11.2/examples/JsonServer/JsonServer.ino
@@ -2,9 +2,9 @@
// Created by Benoit Blanchon.
// Heavily inspired by "Web Server" from David A. Mellis and Tom Igoe
-#include
-#include
#include
+#include
+#include
byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
IPAddress ip(192, 168, 0, 177);
@@ -64,6 +64,8 @@ void loop() {
if (client) {
bool success = readRequest(client);
if (success) {
+ // Use https://bblanchon.github.io/ArduinoJson/assistant/ to
+ // compute the right size for the buffer
StaticJsonBuffer<500> jsonBuffer;
JsonObject& json = prepareResponse(jsonBuffer);
writeResponse(client, json);
diff --git a/lib/ArduinoJson/examples/JsonUdpBeacon/JsonUdpBeacon.ino b/lib/ArduinoJson-5.11.2/examples/JsonUdpBeacon/JsonUdpBeacon.ino
similarity index 92%
rename from lib/ArduinoJson/examples/JsonUdpBeacon/JsonUdpBeacon.ino
rename to lib/ArduinoJson-5.11.2/examples/JsonUdpBeacon/JsonUdpBeacon.ino
index 2975fad4c..b3bd5fc50 100644
--- a/lib/ArduinoJson/examples/JsonUdpBeacon/JsonUdpBeacon.ino
+++ b/lib/ArduinoJson-5.11.2/examples/JsonUdpBeacon/JsonUdpBeacon.ino
@@ -49,6 +49,8 @@ void setup() {
void loop() {
delay(1000);
+ // Use https://bblanchon.github.io/ArduinoJson/assistant/ to
+ // compute the right size for the buffer
StaticJsonBuffer<300> jsonBuffer;
JsonObject& json = buildJson(jsonBuffer);
sendJson(json);
diff --git a/lib/ArduinoJson/examples/ProgmemExample/ProgmemExample.ino b/lib/ArduinoJson-5.11.2/examples/ProgmemExample/ProgmemExample.ino
similarity index 97%
rename from lib/ArduinoJson/examples/ProgmemExample/ProgmemExample.ino
rename to lib/ArduinoJson-5.11.2/examples/ProgmemExample/ProgmemExample.ino
index dc8dd4bc0..195b014fb 100644
--- a/lib/ArduinoJson/examples/ProgmemExample/ProgmemExample.ino
+++ b/lib/ArduinoJson-5.11.2/examples/ProgmemExample/ProgmemExample.ino
@@ -2,7 +2,7 @@
// MIT License
//
// Arduino JSON library
-// https://github.com/bblanchon/ArduinoJson
+// https://bblanchon.github.io/ArduinoJson/
// If you like this project, please add a star!
#include
diff --git a/lib/ArduinoJson/examples/StringExample/StringExample.ino b/lib/ArduinoJson-5.11.2/examples/StringExample/StringExample.ino
similarity index 97%
rename from lib/ArduinoJson/examples/StringExample/StringExample.ino
rename to lib/ArduinoJson-5.11.2/examples/StringExample/StringExample.ino
index f76f9dbe2..50b8db6ec 100644
--- a/lib/ArduinoJson/examples/StringExample/StringExample.ino
+++ b/lib/ArduinoJson-5.11.2/examples/StringExample/StringExample.ino
@@ -2,7 +2,7 @@
// MIT License
//
// Arduino JSON library
-// https://github.com/bblanchon/ArduinoJson
+// https://bblanchon.github.io/ArduinoJson/
// If you like this project, please add a star!
#include
diff --git a/lib/ArduinoJson/keywords.txt b/lib/ArduinoJson-5.11.2/keywords.txt
similarity index 100%
rename from lib/ArduinoJson/keywords.txt
rename to lib/ArduinoJson-5.11.2/keywords.txt
diff --git a/lib/ArduinoJson/library.properties b/lib/ArduinoJson-5.11.2/library.properties
similarity index 81%
rename from lib/ArduinoJson/library.properties
rename to lib/ArduinoJson-5.11.2/library.properties
index 8f1e649a2..9809a3c0b 100644
--- a/lib/ArduinoJson/library.properties
+++ b/lib/ArduinoJson-5.11.2/library.properties
@@ -1,9 +1,9 @@
name=ArduinoJson
-version=5.8.3
+version=5.11.2
author=Benoit Blanchon
maintainer=Benoit Blanchon
sentence=An efficient and elegant JSON library for Arduino.
paragraph=Like this project? Please star it on GitHub!
category=Data Processing
-url=https://github.com/bblanchon/ArduinoJson
+url=https://bblanchon.github.io/ArduinoJson/
architectures=*
diff --git a/lib/ArduinoJson/include/ArduinoJson.h b/lib/ArduinoJson-5.11.2/src/ArduinoJson.h
similarity index 75%
rename from lib/ArduinoJson/include/ArduinoJson.h
rename to lib/ArduinoJson-5.11.2/src/ArduinoJson.h
index 48609d849..c1ec7c02f 100644
--- a/lib/ArduinoJson/include/ArduinoJson.h
+++ b/lib/ArduinoJson-5.11.2/src/ArduinoJson.h
@@ -2,8 +2,11 @@
// MIT License
//
// Arduino JSON library
-// https://github.com/bblanchon/ArduinoJson
+// https://bblanchon.github.io/ArduinoJson/
// If you like this project, please add a star!
+#pragma once
+
#include "ArduinoJson.hpp"
+
using namespace ArduinoJson;
diff --git a/lib/ArduinoJson/include/ArduinoJson.hpp b/lib/ArduinoJson-5.11.2/src/ArduinoJson.hpp
similarity index 82%
rename from lib/ArduinoJson/include/ArduinoJson.hpp
rename to lib/ArduinoJson-5.11.2/src/ArduinoJson.hpp
index 3031f5922..949fa5ca0 100644
--- a/lib/ArduinoJson/include/ArduinoJson.hpp
+++ b/lib/ArduinoJson-5.11.2/src/ArduinoJson.hpp
@@ -2,7 +2,7 @@
// MIT License
//
// Arduino JSON library
-// https://github.com/bblanchon/ArduinoJson
+// https://bblanchon.github.io/ArduinoJson/
// If you like this project, please add a star!
#pragma once
@@ -10,7 +10,6 @@
#include "ArduinoJson/DynamicJsonBuffer.hpp"
#include "ArduinoJson/JsonArray.hpp"
#include "ArduinoJson/JsonObject.hpp"
-#include "ArduinoJson/JsonVariantComparisons.hpp"
#include "ArduinoJson/StaticJsonBuffer.hpp"
#include "ArduinoJson/Deserialization/JsonParserImpl.hpp"
@@ -19,5 +18,3 @@
#include "ArduinoJson/JsonObjectImpl.hpp"
#include "ArduinoJson/JsonVariantImpl.hpp"
#include "ArduinoJson/Serialization/JsonSerializerImpl.hpp"
-
-using namespace ArduinoJson;
diff --git a/lib/ArduinoJson/include/ArduinoJson/Configuration.hpp b/lib/ArduinoJson-5.11.2/src/ArduinoJson/Configuration.hpp
similarity index 58%
rename from lib/ArduinoJson/include/ArduinoJson/Configuration.hpp
rename to lib/ArduinoJson-5.11.2/src/ArduinoJson/Configuration.hpp
index ba8a90df4..a1015a6f3 100644
--- a/lib/ArduinoJson/include/ArduinoJson/Configuration.hpp
+++ b/lib/ArduinoJson-5.11.2/src/ArduinoJson/Configuration.hpp
@@ -2,24 +2,28 @@
// MIT License
//
// Arduino JSON library
-// https://github.com/bblanchon/ArduinoJson
+// https://bblanchon.github.io/ArduinoJson/
// If you like this project, please add a star!
#pragma once
-// enable deprecated functions by default
-#ifndef ARDUINOJSON_ENABLE_DEPRECATED
-#define ARDUINOJSON_ENABLE_DEPRECATED 1
+// Small or big machine?
+#ifndef ARDUINOJSON_EMBEDDED_MODE
+#if defined(ARDUINO) || defined(__IAR_SYSTEMS_ICC__)
+#define ARDUINOJSON_EMBEDDED_MODE 1
+#else
+#define ARDUINOJSON_EMBEDDED_MODE 0
+#endif
#endif
-#ifdef ARDUINO // assume this is an embedded platform
+#if ARDUINOJSON_EMBEDDED_MODE
-// store using float instead of double to reduce the memory usage (issue #134)
+// Store floats by default to reduce the memory usage (issue #134)
#ifndef ARDUINOJSON_USE_DOUBLE
#define ARDUINOJSON_USE_DOUBLE 0
#endif
-// store using a long because it usually match the size of a float.
+// Store longs by default, because they usually match the size of a float.
#ifndef ARDUINOJSON_USE_LONG_LONG
#define ARDUINOJSON_USE_LONG_LONG 0
#endif
@@ -27,57 +31,29 @@
#define ARDUINOJSON_USE_INT64 0
#endif
-// Arduino has its own implementation of String to replace std::string
-#ifndef ARDUINOJSON_ENABLE_ARDUINO_STRING
-#define ARDUINOJSON_ENABLE_ARDUINO_STRING 1
-#endif
-
-#ifndef ARDUINOJSON_ENABLE_ARDUINO_STREAM
-#define ARDUINOJSON_ENABLE_ARDUINO_STREAM 1
-#endif
-
-// On AVR archiecture, we can use PROGMEM
-#ifndef ARDUINOJSON_ENABLE_PROGMEM
-#ifdef PROGMEM
-#define ARDUINOJSON_ENABLE_PROGMEM 1
-#else
-#define ARDUINOJSON_ENABLE_PROGMEM 0
-#endif
-#endif
-
-// Arduino doesn't have std::string
+// Embedded systems usually don't have std::string
#ifndef ARDUINOJSON_ENABLE_STD_STRING
#define ARDUINOJSON_ENABLE_STD_STRING 0
#endif
-// Arduino doesn't support STL stream
+// Embedded systems usually don't have std::stream
#ifndef ARDUINOJSON_ENABLE_STD_STREAM
#define ARDUINOJSON_ENABLE_STD_STREAM 0
#endif
-#ifndef ARDUINOJSON_ENABLE_ALIGNMENT
-#ifdef ARDUINO_ARCH_AVR
-// alignment isn't needed for 8-bit AVR
-#define ARDUINOJSON_ENABLE_ALIGNMENT 0
-#else
-// but must processor needs pointer to be align on word size
-#define ARDUINOJSON_ENABLE_ALIGNMENT 1
-#endif
-#endif
-
-// low value to prevent stack overflow
+// Limit nesting as the stack is likely to be small
#ifndef ARDUINOJSON_DEFAULT_NESTING_LIMIT
#define ARDUINOJSON_DEFAULT_NESTING_LIMIT 10
#endif
-#else // assume this is a computer
+#else // ARDUINOJSON_EMBEDDED_MODE
-// on a computer we have plenty of memory so we can use doubles
+// On a computer we have plenty of memory so we can use doubles
#ifndef ARDUINOJSON_USE_DOUBLE
#define ARDUINOJSON_USE_DOUBLE 1
#endif
-// use long long when available
+// Use long long when available
#ifndef ARDUINOJSON_USE_LONG_LONG
#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800)
#define ARDUINOJSON_USE_LONG_LONG 1
@@ -86,7 +62,7 @@
#endif
#endif
-// use _int64 on old versions of Visual Studio
+// Use _int64 on old versions of Visual Studio
#ifndef ARDUINOJSON_USE_INT64
#if defined(_MSC_VER) && _MSC_VER <= 1700
#define ARDUINOJSON_USE_INT64 1
@@ -95,41 +71,81 @@
#endif
#endif
-// on a computer, we can use std::string
+// On a computer, we can use std::string
#ifndef ARDUINOJSON_ENABLE_STD_STRING
#define ARDUINOJSON_ENABLE_STD_STRING 1
#endif
-// on a computer, there is no reason to beleive Arduino String is available
-#ifndef ARDUINOJSON_ENABLE_ARDUINO_STRING
-#define ARDUINOJSON_ENABLE_ARDUINO_STRING 0
-#endif
-
-// PROGMEM is only available on AVR architecture
-#ifndef ARDUINOJSON_ENABLE_PROGMEM
-#define ARDUINOJSON_ENABLE_PROGMEM 0
-#endif
-
-// on a computer, we can assume that the STL is there
+// On a computer, we can assume std::stream
#ifndef ARDUINOJSON_ENABLE_STD_STREAM
#define ARDUINOJSON_ENABLE_STD_STREAM 1
#endif
-// on a computer, there is no reason to beleive Arduino Stream is available
-#ifndef ARDUINOJSON_ENABLE_ARDUINO_STREAM
-#define ARDUINOJSON_ENABLE_ARDUINO_STREAM 0
-#endif
-
-#ifndef ARDUINOJSON_ENABLE_ALIGNMENT
-// even if not required, most cpu's are faster with aligned pointers
-#define ARDUINOJSON_ENABLE_ALIGNMENT 1
-#endif
-
-// on a computer, we should have a lot of space on the stack
+// On a computer, the stack is large so we can increase nesting limit
#ifndef ARDUINOJSON_DEFAULT_NESTING_LIMIT
#define ARDUINOJSON_DEFAULT_NESTING_LIMIT 50
#endif
+#endif // ARDUINOJSON_EMBEDDED_MODE
+
+#ifdef ARDUINO
+
+// Enable support for Arduino String
+#ifndef ARDUINOJSON_ENABLE_ARDUINO_STRING
+#define ARDUINOJSON_ENABLE_ARDUINO_STRING 1
+#endif
+
+// Enable support for Arduino Stream
+#ifndef ARDUINOJSON_ENABLE_ARDUINO_STREAM
+#define ARDUINOJSON_ENABLE_ARDUINO_STREAM 1
+#endif
+
+#else // ARDUINO
+
+// Disable support for Arduino String
+#ifndef ARDUINOJSON_ENABLE_ARDUINO_STRING
+#define ARDUINOJSON_ENABLE_ARDUINO_STRING 0
+#endif
+
+// Disable support for Arduino Stream
+#ifndef ARDUINOJSON_ENABLE_ARDUINO_STREAM
+#define ARDUINOJSON_ENABLE_ARDUINO_STREAM 0
+#endif
+
+#endif // ARDUINO
+
+#ifndef ARDUINOJSON_ENABLE_PROGMEM
+#ifdef PROGMEM
+#define ARDUINOJSON_ENABLE_PROGMEM 1
+#else
+#define ARDUINOJSON_ENABLE_PROGMEM 0
+#endif
+#endif
+
+#ifndef ARDUINOJSON_ENABLE_ALIGNMENT
+#ifdef ARDUINO_ARCH_AVR
+// alignment isn't needed for 8-bit AVR
+#define ARDUINOJSON_ENABLE_ALIGNMENT 0
+#else
+// but most processors need pointers to be align on word size
+#define ARDUINOJSON_ENABLE_ALIGNMENT 1
+#endif
+#endif
+
+// Enable deprecated functions by default
+#ifndef ARDUINOJSON_ENABLE_DEPRECATED
+#define ARDUINOJSON_ENABLE_DEPRECATED 1
+#endif
+
+// Control the exponentiation threshold for big numbers
+// CAUTION: cannot be more that 1e9 !!!!
+#ifndef ARDUINOJSON_POSITIVE_EXPONENTIATION_THRESHOLD
+#define ARDUINOJSON_POSITIVE_EXPONENTIATION_THRESHOLD 1e7
+#endif
+
+// Control the exponentiation threshold for small numbers
+#ifndef ARDUINOJSON_NEGATIVE_EXPONENTIATION_THRESHOLD
+#define ARDUINOJSON_NEGATIVE_EXPONENTIATION_THRESHOLD 1e-5
#endif
#if ARDUINOJSON_USE_LONG_LONG && ARDUINOJSON_USE_INT64
diff --git a/lib/ArduinoJson/include/ArduinoJson/Data/Encoding.hpp b/lib/ArduinoJson-5.11.2/src/ArduinoJson/Data/Encoding.hpp
similarity index 91%
rename from lib/ArduinoJson/include/ArduinoJson/Data/Encoding.hpp
rename to lib/ArduinoJson-5.11.2/src/ArduinoJson/Data/Encoding.hpp
index 27d13517f..dba785aae 100644
--- a/lib/ArduinoJson/include/ArduinoJson/Data/Encoding.hpp
+++ b/lib/ArduinoJson-5.11.2/src/ArduinoJson/Data/Encoding.hpp
@@ -2,13 +2,11 @@
// MIT License
//
// Arduino JSON library
-// https://github.com/bblanchon/ArduinoJson
+// https://bblanchon.github.io/ArduinoJson/
// If you like this project, please add a star!
#pragma once
-#include "../Print.hpp"
-
namespace ArduinoJson {
namespace Internals {
diff --git a/lib/ArduinoJson/include/ArduinoJson/Data/JsonBufferAllocated.hpp b/lib/ArduinoJson-5.11.2/src/ArduinoJson/Data/JsonBufferAllocated.hpp
similarity index 80%
rename from lib/ArduinoJson/include/ArduinoJson/Data/JsonBufferAllocated.hpp
rename to lib/ArduinoJson-5.11.2/src/ArduinoJson/Data/JsonBufferAllocated.hpp
index 0004949bb..ff74adc55 100644
--- a/lib/ArduinoJson/include/ArduinoJson/Data/JsonBufferAllocated.hpp
+++ b/lib/ArduinoJson-5.11.2/src/ArduinoJson/Data/JsonBufferAllocated.hpp
@@ -2,7 +2,7 @@
// MIT License
//
// Arduino JSON library
-// https://github.com/bblanchon/ArduinoJson
+// https://bblanchon.github.io/ArduinoJson/
// If you like this project, please add a star!
#pragma once
@@ -19,7 +19,7 @@ class JsonBufferAllocated {
return jsonBuffer->alloc(n);
}
- void operator delete(void *, JsonBuffer *)throw() {}
+ void operator delete(void *, JsonBuffer *)throw();
};
}
}
diff --git a/lib/ArduinoJson/include/ArduinoJson/Data/JsonFloat.hpp b/lib/ArduinoJson-5.11.2/src/ArduinoJson/Data/JsonFloat.hpp
similarity index 87%
rename from lib/ArduinoJson/include/ArduinoJson/Data/JsonFloat.hpp
rename to lib/ArduinoJson-5.11.2/src/ArduinoJson/Data/JsonFloat.hpp
index 40276fdcd..a4a8e937f 100644
--- a/lib/ArduinoJson/include/ArduinoJson/Data/JsonFloat.hpp
+++ b/lib/ArduinoJson-5.11.2/src/ArduinoJson/Data/JsonFloat.hpp
@@ -2,7 +2,7 @@
// MIT License
//
// Arduino JSON library
-// https://github.com/bblanchon/ArduinoJson
+// https://bblanchon.github.io/ArduinoJson/
// If you like this project, please add a star!
#pragma once
diff --git a/lib/ArduinoJson/include/ArduinoJson/Data/JsonInteger.hpp b/lib/ArduinoJson-5.11.2/src/ArduinoJson/Data/JsonInteger.hpp
similarity index 91%
rename from lib/ArduinoJson/include/ArduinoJson/Data/JsonInteger.hpp
rename to lib/ArduinoJson-5.11.2/src/ArduinoJson/Data/JsonInteger.hpp
index d8fefa46a..574a5e109 100644
--- a/lib/ArduinoJson/include/ArduinoJson/Data/JsonInteger.hpp
+++ b/lib/ArduinoJson-5.11.2/src/ArduinoJson/Data/JsonInteger.hpp
@@ -2,7 +2,7 @@
// MIT License
//
// Arduino JSON library
-// https://github.com/bblanchon/ArduinoJson
+// https://bblanchon.github.io/ArduinoJson/
// If you like this project, please add a star!
#pragma once
diff --git a/lib/ArduinoJson/include/ArduinoJson/Data/JsonVariantAs.hpp b/lib/ArduinoJson-5.11.2/src/ArduinoJson/Data/JsonVariantAs.hpp
similarity index 94%
rename from lib/ArduinoJson/include/ArduinoJson/Data/JsonVariantAs.hpp
rename to lib/ArduinoJson-5.11.2/src/ArduinoJson/Data/JsonVariantAs.hpp
index f8e6cd1e7..3f19fd23a 100644
--- a/lib/ArduinoJson/include/ArduinoJson/Data/JsonVariantAs.hpp
+++ b/lib/ArduinoJson-5.11.2/src/ArduinoJson/Data/JsonVariantAs.hpp
@@ -2,7 +2,7 @@
// MIT License
//
// Arduino JSON library
-// https://github.com/bblanchon/ArduinoJson
+// https://bblanchon.github.io/ArduinoJson/
// If you like this project, please add a star!
#pragma once
diff --git a/lib/ArduinoJson/include/ArduinoJson/Data/JsonVariantContent.hpp b/lib/ArduinoJson-5.11.2/src/ArduinoJson/Data/JsonVariantContent.hpp
similarity index 94%
rename from lib/ArduinoJson/include/ArduinoJson/Data/JsonVariantContent.hpp
rename to lib/ArduinoJson-5.11.2/src/ArduinoJson/Data/JsonVariantContent.hpp
index ca86020a3..b27716299 100644
--- a/lib/ArduinoJson/include/ArduinoJson/Data/JsonVariantContent.hpp
+++ b/lib/ArduinoJson-5.11.2/src/ArduinoJson/Data/JsonVariantContent.hpp
@@ -2,7 +2,7 @@
// MIT License
//
// Arduino JSON library
-// https://github.com/bblanchon/ArduinoJson
+// https://bblanchon.github.io/ArduinoJson/
// If you like this project, please add a star!
#pragma once
diff --git a/lib/ArduinoJson/include/ArduinoJson/Data/JsonVariantDefault.hpp b/lib/ArduinoJson-5.11.2/src/ArduinoJson/Data/JsonVariantDefault.hpp
similarity index 91%
rename from lib/ArduinoJson/include/ArduinoJson/Data/JsonVariantDefault.hpp
rename to lib/ArduinoJson-5.11.2/src/ArduinoJson/Data/JsonVariantDefault.hpp
index 4e69a5700..a59fd46c9 100644
--- a/lib/ArduinoJson/include/ArduinoJson/Data/JsonVariantDefault.hpp
+++ b/lib/ArduinoJson-5.11.2/src/ArduinoJson/Data/JsonVariantDefault.hpp
@@ -2,7 +2,7 @@
// MIT License
//
// Arduino JSON library
-// https://github.com/bblanchon/ArduinoJson
+// https://bblanchon.github.io/ArduinoJson/
// If you like this project, please add a star!
#pragma once
diff --git a/lib/ArduinoJson/include/ArduinoJson/Data/JsonVariantType.hpp b/lib/ArduinoJson-5.11.2/src/ArduinoJson/Data/JsonVariantType.hpp
similarity index 58%
rename from lib/ArduinoJson/include/ArduinoJson/Data/JsonVariantType.hpp
rename to lib/ArduinoJson-5.11.2/src/ArduinoJson/Data/JsonVariantType.hpp
index da0e9a2ef..ba6a24999 100644
--- a/lib/ArduinoJson/include/ArduinoJson/Data/JsonVariantType.hpp
+++ b/lib/ArduinoJson-5.11.2/src/ArduinoJson/Data/JsonVariantType.hpp
@@ -2,7 +2,7 @@
// MIT License
//
// Arduino JSON library
-// https://github.com/bblanchon/ArduinoJson
+// https://bblanchon.github.io/ArduinoJson/
// If you like this project, please add a star!
#pragma once
@@ -20,20 +20,11 @@ enum JsonVariantType {
JSON_UNPARSED, // JsonVariant contains an unparsed string
JSON_STRING, // JsonVariant stores a const char*
JSON_BOOLEAN, // JsonVariant stores a bool
- JSON_POSITIVE_INTEGER, // JsonVariant stores an unsigned long
- JSON_NEGATIVE_INTEGER, // JsonVariant stores an unsigned long that must be
- // negated
+ JSON_POSITIVE_INTEGER, // JsonVariant stores an JsonUInt
+ JSON_NEGATIVE_INTEGER, // JsonVariant stores an JsonUInt that must be negated
JSON_ARRAY, // JsonVariant stores a pointer to a JsonArray
JSON_OBJECT, // JsonVariant stores a pointer to a JsonObject
-
- // The following values are reserved for float values
- // Multiple values are used for double, depending on the number of decimal
- // digits that must be printed in the JSON output.
- // This little trick allow to save one extra member in JsonVariant
- JSON_FLOAT_0_DECIMALS
- // JSON_FLOAT_1_DECIMAL
- // JSON_FLOAT_2_DECIMALS
- // ...
+ JSON_FLOAT // JsonVariant stores a JsonFloat
};
}
}
diff --git a/lib/ArduinoJson/include/ArduinoJson/Data/List.hpp b/lib/ArduinoJson-5.11.2/src/ArduinoJson/Data/List.hpp
similarity index 93%
rename from lib/ArduinoJson/include/ArduinoJson/Data/List.hpp
rename to lib/ArduinoJson-5.11.2/src/ArduinoJson/Data/List.hpp
index e405635a8..8a24666ec 100644
--- a/lib/ArduinoJson/include/ArduinoJson/Data/List.hpp
+++ b/lib/ArduinoJson-5.11.2/src/ArduinoJson/Data/List.hpp
@@ -2,7 +2,7 @@
// MIT License
//
// Arduino JSON library
-// https://github.com/bblanchon/ArduinoJson
+// https://bblanchon.github.io/ArduinoJson/
// If you like this project, please add a star!
#pragma once
@@ -48,6 +48,20 @@ class List {
return nodeCount;
}
+ iterator add() {
+ node_type *newNode = new (_buffer) node_type();
+
+ if (_firstNode) {
+ node_type *lastNode = _firstNode;
+ while (lastNode->next) lastNode = lastNode->next;
+ lastNode->next = newNode;
+ } else {
+ _firstNode = newNode;
+ }
+
+ return iterator(newNode);
+ }
+
iterator begin() {
return iterator(_firstNode);
}
@@ -62,22 +76,8 @@ class List {
return const_iterator(NULL);
}
- protected:
- node_type *addNewNode() {
- node_type *newNode = new (_buffer) node_type();
-
- if (_firstNode) {
- node_type *lastNode = _firstNode;
- while (lastNode->next) lastNode = lastNode->next;
- lastNode->next = newNode;
- } else {
- _firstNode = newNode;
- }
-
- return newNode;
- }
-
- void removeNode(node_type *nodeToRemove) {
+ void remove(iterator it) {
+ node_type *nodeToRemove = it._node;
if (!nodeToRemove) return;
if (nodeToRemove == _firstNode) {
_firstNode = nodeToRemove->next;
@@ -87,7 +87,10 @@ class List {
}
}
+ protected:
JsonBuffer *_buffer;
+
+ private:
node_type *_firstNode;
};
}
diff --git a/lib/ArduinoJson/include/ArduinoJson/Data/ListConstIterator.hpp b/lib/ArduinoJson-5.11.2/src/ArduinoJson/Data/ListConstIterator.hpp
similarity index 80%
rename from lib/ArduinoJson/include/ArduinoJson/Data/ListConstIterator.hpp
rename to lib/ArduinoJson-5.11.2/src/ArduinoJson/Data/ListConstIterator.hpp
index 1707fe851..bce1bfa5e 100644
--- a/lib/ArduinoJson/include/ArduinoJson/Data/ListConstIterator.hpp
+++ b/lib/ArduinoJson-5.11.2/src/ArduinoJson/Data/ListConstIterator.hpp
@@ -2,7 +2,7 @@
// MIT License
//
// Arduino JSON library
-// https://github.com/bblanchon/ArduinoJson
+// https://bblanchon.github.io/ArduinoJson/
// If you like this project, please add a star!
#pragma once
@@ -38,6 +38,14 @@ class ListConstIterator {
return *this;
}
+ ListConstIterator &operator+=(size_t distance) {
+ while (_node && distance) {
+ _node = _node->next;
+ --distance;
+ }
+ return *this;
+ }
+
private:
const ListNode *_node;
};
diff --git a/lib/ArduinoJson/include/ArduinoJson/Data/ListIterator.hpp b/lib/ArduinoJson-5.11.2/src/ArduinoJson/Data/ListIterator.hpp
similarity index 78%
rename from lib/ArduinoJson/include/ArduinoJson/Data/ListIterator.hpp
rename to lib/ArduinoJson-5.11.2/src/ArduinoJson/Data/ListIterator.hpp
index 6604f5dd7..a491866f0 100644
--- a/lib/ArduinoJson/include/ArduinoJson/Data/ListIterator.hpp
+++ b/lib/ArduinoJson-5.11.2/src/ArduinoJson/Data/ListIterator.hpp
@@ -2,7 +2,7 @@
// MIT License
//
// Arduino JSON library
-// https://github.com/bblanchon/ArduinoJson
+// https://bblanchon.github.io/ArduinoJson/
// If you like this project, please add a star!
#pragma once
@@ -13,9 +13,14 @@
namespace ArduinoJson {
namespace Internals {
+template
+class List;
+
// A read-write forward iterator for List
template
class ListIterator {
+ friend class List;
+
public:
explicit ListIterator(ListNode *node = NULL) : _node(node) {}
@@ -39,6 +44,14 @@ class ListIterator {
return *this;
}
+ ListIterator &operator+=(size_t distance) {
+ while (_node && distance) {
+ _node = _node->next;
+ --distance;
+ }
+ return *this;
+ }
+
operator ListConstIterator() const {
return ListConstIterator(_node);
}
diff --git a/lib/ArduinoJson/include/ArduinoJson/Data/ListNode.hpp b/lib/ArduinoJson-5.11.2/src/ArduinoJson/Data/ListNode.hpp
similarity index 84%
rename from lib/ArduinoJson/include/ArduinoJson/Data/ListNode.hpp
rename to lib/ArduinoJson-5.11.2/src/ArduinoJson/Data/ListNode.hpp
index d3b65ae94..712e15e1f 100644
--- a/lib/ArduinoJson/include/ArduinoJson/Data/ListNode.hpp
+++ b/lib/ArduinoJson-5.11.2/src/ArduinoJson/Data/ListNode.hpp
@@ -2,7 +2,7 @@
// MIT License
//
// Arduino JSON library
-// https://github.com/bblanchon/ArduinoJson
+// https://bblanchon.github.io/ArduinoJson/
// If you like this project, please add a star!
#pragma once
@@ -18,7 +18,7 @@ namespace Internals {
// Used by List and its iterators.
template
struct ListNode : public Internals::JsonBufferAllocated {
- ListNode() : next(NULL) {}
+ ListNode() throw() : next(NULL) {}
ListNode *next;
T content;
diff --git a/lib/ArduinoJson-5.11.2/src/ArduinoJson/Data/NonCopyable.hpp b/lib/ArduinoJson-5.11.2/src/ArduinoJson/Data/NonCopyable.hpp
new file mode 100644
index 000000000..98ebd8fb3
--- /dev/null
+++ b/lib/ArduinoJson-5.11.2/src/ArduinoJson/Data/NonCopyable.hpp
@@ -0,0 +1,26 @@
+// Copyright Benoit Blanchon 2014-2017
+// MIT License
+//
+// Arduino JSON library
+// https://bblanchon.github.io/ArduinoJson/
+// If you like this project, please add a star!
+
+#pragma once
+
+namespace ArduinoJson {
+namespace Internals {
+
+// A type that cannot be copied
+class NonCopyable {
+ protected:
+ NonCopyable() {}
+
+ private:
+ // copy constructor is private
+ NonCopyable(const NonCopyable&);
+
+ // copy operator is private
+ NonCopyable& operator=(const NonCopyable&);
+};
+}
+}
diff --git a/lib/ArduinoJson/include/ArduinoJson/Data/ReferenceType.hpp b/lib/ArduinoJson-5.11.2/src/ArduinoJson/Data/ReferenceType.hpp
similarity index 70%
rename from lib/ArduinoJson/include/ArduinoJson/Data/ReferenceType.hpp
rename to lib/ArduinoJson-5.11.2/src/ArduinoJson/Data/ReferenceType.hpp
index 9ffbbd9bd..bbc9046be 100644
--- a/lib/ArduinoJson/include/ArduinoJson/Data/ReferenceType.hpp
+++ b/lib/ArduinoJson-5.11.2/src/ArduinoJson/Data/ReferenceType.hpp
@@ -2,7 +2,7 @@
// MIT License
//
// Arduino JSON library
-// https://github.com/bblanchon/ArduinoJson
+// https://bblanchon.github.io/ArduinoJson/
// If you like this project, please add a star!
#pragma once
@@ -22,16 +22,6 @@ class ReferenceType {
bool operator!=(const ReferenceType& other) const {
return this != &other;
}
-
- protected:
- ReferenceType() {}
-
- private:
- // copy constructor is private
- ReferenceType(const ReferenceType&);
-
- // copy operator is private
- ReferenceType& operator=(const ReferenceType&);
};
}
}
diff --git a/lib/ArduinoJson/include/ArduinoJson/Data/ValueSetter.hpp b/lib/ArduinoJson-5.11.2/src/ArduinoJson/Data/ValueSetter.hpp
similarity index 54%
rename from lib/ArduinoJson/include/ArduinoJson/Data/ValueSetter.hpp
rename to lib/ArduinoJson-5.11.2/src/ArduinoJson/Data/ValueSetter.hpp
index 81be5839f..7eb3ed63b 100644
--- a/lib/ArduinoJson/include/ArduinoJson/Data/ValueSetter.hpp
+++ b/lib/ArduinoJson-5.11.2/src/ArduinoJson/Data/ValueSetter.hpp
@@ -2,7 +2,7 @@
// MIT License
//
// Arduino JSON library
-// https://github.com/bblanchon/ArduinoJson
+// https://bblanchon.github.io/ArduinoJson/
// If you like this project, please add a star!
#pragma once
@@ -15,22 +15,21 @@
namespace ArduinoJson {
namespace Internals {
-template
+template
struct ValueSetter {
template
- static bool set(JsonBuffer*, TDestination& destination,
- const TSource& source) {
+ static bool set(JsonBuffer*, TDestination& destination, TSourceRef source) {
destination = source;
return true;
}
};
-template
-struct ValueSetter::should_duplicate>::type> {
+template
+struct ValueSetter::should_duplicate>::type> {
template
static bool set(JsonBuffer* buffer, TDestination& destination,
- const TSource& source) {
+ TSourceRef source) {
const char* copy = buffer->strdup(source);
if (!copy) return false;
destination = copy;
@@ -38,12 +37,11 @@ struct ValueSetter
-struct ValueSetter::should_duplicate>::type> {
+template
+struct ValueSetter::should_duplicate>::type> {
template
- static bool set(JsonBuffer*, TDestination& destination,
- const TSource& source) {
+ static bool set(JsonBuffer*, TDestination& destination, TSourceRef source) {
// unsigned char* -> char*
destination = reinterpret_cast(source);
return true;
diff --git a/lib/ArduinoJson/include/ArduinoJson/Deserialization/Comments.hpp b/lib/ArduinoJson-5.11.2/src/ArduinoJson/Deserialization/Comments.hpp
similarity index 96%
rename from lib/ArduinoJson/include/ArduinoJson/Deserialization/Comments.hpp
rename to lib/ArduinoJson-5.11.2/src/ArduinoJson/Deserialization/Comments.hpp
index 10e8d1164..9f281da49 100644
--- a/lib/ArduinoJson/include/ArduinoJson/Deserialization/Comments.hpp
+++ b/lib/ArduinoJson-5.11.2/src/ArduinoJson/Deserialization/Comments.hpp
@@ -2,7 +2,7 @@
// MIT License
//
// Arduino JSON library
-// https://github.com/bblanchon/ArduinoJson
+// https://bblanchon.github.io/ArduinoJson/
// If you like this project, please add a star!
#pragma once
diff --git a/lib/ArduinoJson/include/ArduinoJson/Deserialization/JsonParser.hpp b/lib/ArduinoJson-5.11.2/src/ArduinoJson/Deserialization/JsonParser.hpp
similarity index 98%
rename from lib/ArduinoJson/include/ArduinoJson/Deserialization/JsonParser.hpp
rename to lib/ArduinoJson-5.11.2/src/ArduinoJson/Deserialization/JsonParser.hpp
index 5448bfc3f..3e605ef25 100644
--- a/lib/ArduinoJson/include/ArduinoJson/Deserialization/JsonParser.hpp
+++ b/lib/ArduinoJson-5.11.2/src/ArduinoJson/Deserialization/JsonParser.hpp
@@ -2,7 +2,7 @@
// MIT License
//
// Arduino JSON library
-// https://github.com/bblanchon/ArduinoJson
+// https://bblanchon.github.io/ArduinoJson/
// If you like this project, please add a star!
#pragma once
diff --git a/lib/ArduinoJson/include/ArduinoJson/Deserialization/JsonParserImpl.hpp b/lib/ArduinoJson-5.11.2/src/ArduinoJson/Deserialization/JsonParserImpl.hpp
similarity index 94%
rename from lib/ArduinoJson/include/ArduinoJson/Deserialization/JsonParserImpl.hpp
rename to lib/ArduinoJson-5.11.2/src/ArduinoJson/Deserialization/JsonParserImpl.hpp
index f1c7d6152..1c41bdaac 100644
--- a/lib/ArduinoJson/include/ArduinoJson/Deserialization/JsonParserImpl.hpp
+++ b/lib/ArduinoJson-5.11.2/src/ArduinoJson/Deserialization/JsonParserImpl.hpp
@@ -2,7 +2,7 @@
// MIT License
//
// Arduino JSON library
-// https://github.com/bblanchon/ArduinoJson
+// https://bblanchon.github.io/ArduinoJson/
// If you like this project, please add a star!
#pragma once
@@ -20,9 +20,8 @@ inline bool ArduinoJson::Internals::JsonParser::eat(
}
template
-inline bool
-ArduinoJson::Internals::JsonParser::parseAnythingTo(
- JsonVariant *destination) {
+inline bool ArduinoJson::Internals::JsonParser<
+ TReader, TWriter>::parseAnythingTo(JsonVariant *destination) {
if (_nestingLimit == 0) return false;
_nestingLimit--;
bool success = parseAnythingToUnsafe(destination);
@@ -31,9 +30,8 @@ ArduinoJson::Internals::JsonParser::parseAnythingTo(
}
template
-inline bool
-ArduinoJson::Internals::JsonParser::parseAnythingToUnsafe(
- JsonVariant *destination) {
+inline bool ArduinoJson::Internals::JsonParser<
+ TReader, TWriter>::parseAnythingToUnsafe(JsonVariant *destination) {
skipSpacesAndComments(_reader);
switch (_reader.current()) {
diff --git a/lib/ArduinoJson/include/ArduinoJson/Deserialization/StringWriter.hpp b/lib/ArduinoJson-5.11.2/src/ArduinoJson/Deserialization/StringWriter.hpp
similarity index 86%
rename from lib/ArduinoJson/include/ArduinoJson/Deserialization/StringWriter.hpp
rename to lib/ArduinoJson-5.11.2/src/ArduinoJson/Deserialization/StringWriter.hpp
index 7ebfabaa6..42ee640d8 100644
--- a/lib/ArduinoJson/include/ArduinoJson/Deserialization/StringWriter.hpp
+++ b/lib/ArduinoJson-5.11.2/src/ArduinoJson/Deserialization/StringWriter.hpp
@@ -2,7 +2,7 @@
// MIT License
//
// Arduino JSON library
-// https://github.com/bblanchon/ArduinoJson
+// https://bblanchon.github.io/ArduinoJson/
// If you like this project, please add a star!
#pragma once
@@ -17,8 +17,8 @@ class StringWriter {
public:
String(TChar** ptr) : _writePtr(ptr), _startPtr(*ptr) {}
- void append(TChar c) {
- *(*_writePtr)++ = c;
+ void append(char c) {
+ *(*_writePtr)++ = TChar(c);
}
const char* c_str() const {
diff --git a/lib/ArduinoJson/include/ArduinoJson/DynamicJsonBuffer.hpp b/lib/ArduinoJson-5.11.2/src/ArduinoJson/DynamicJsonBuffer.hpp
similarity index 88%
rename from lib/ArduinoJson/include/ArduinoJson/DynamicJsonBuffer.hpp
rename to lib/ArduinoJson-5.11.2/src/ArduinoJson/DynamicJsonBuffer.hpp
index 64de7f03c..65e744bf2 100644
--- a/lib/ArduinoJson/include/ArduinoJson/DynamicJsonBuffer.hpp
+++ b/lib/ArduinoJson-5.11.2/src/ArduinoJson/DynamicJsonBuffer.hpp
@@ -2,7 +2,7 @@
// MIT License
//
// Arduino JSON library
-// https://github.com/bblanchon/ArduinoJson
+// https://bblanchon.github.io/ArduinoJson/
// If you like this project, please add a star!
#pragma once
@@ -46,30 +46,41 @@ class DynamicJsonBufferBase
};
public:
+ enum { EmptyBlockSize = sizeof(EmptyBlock) };
+
DynamicJsonBufferBase(size_t initialSize = 256)
: _head(NULL), _nextBlockCapacity(initialSize) {}
~DynamicJsonBufferBase() {
- Block* currentBlock = _head;
-
- while (currentBlock != NULL) {
- Block* nextBlock = currentBlock->next;
- _allocator.deallocate(currentBlock);
- currentBlock = nextBlock;
- }
+ clear();
}
+ // Gets the number of bytes occupied in the buffer
size_t size() const {
size_t total = 0;
for (const Block* b = _head; b; b = b->next) total += b->size;
return total;
}
+ // Allocates the specified amount of bytes in the buffer
virtual void* alloc(size_t bytes) {
alignNextAlloc();
return canAllocInHead(bytes) ? allocInHead(bytes) : allocInNewBlock(bytes);
}
+ // Resets the buffer.
+ // USE WITH CAUTION: this invalidates all previously allocated data
+ void clear() {
+ Block* currentBlock = _head;
+ while (currentBlock != NULL) {
+ _nextBlockCapacity = currentBlock->capacity;
+ Block* nextBlock = currentBlock->next;
+ _allocator.deallocate(currentBlock);
+ currentBlock = nextBlock;
+ }
+ _head = 0;
+ }
+
class String {
public:
String(DynamicJsonBufferBase* parent)
@@ -98,7 +109,7 @@ class DynamicJsonBufferBase
private:
DynamicJsonBufferBase* _parent;
char* _start;
- int _length;
+ size_t _length;
};
String startString() {
@@ -129,7 +140,7 @@ class DynamicJsonBufferBase
}
bool addNewBlock(size_t capacity) {
- size_t bytes = sizeof(EmptyBlock) + capacity;
+ size_t bytes = EmptyBlockSize + capacity;
Block* block = static_cast(_allocator.allocate(bytes));
if (block == NULL) return false;
block->capacity = capacity;
diff --git a/lib/ArduinoJson/include/ArduinoJson/JsonArray.hpp b/lib/ArduinoJson-5.11.2/src/ArduinoJson/JsonArray.hpp
similarity index 85%
rename from lib/ArduinoJson/include/ArduinoJson/JsonArray.hpp
rename to lib/ArduinoJson-5.11.2/src/ArduinoJson/JsonArray.hpp
index 413653512..27404fb7b 100644
--- a/lib/ArduinoJson/include/ArduinoJson/JsonArray.hpp
+++ b/lib/ArduinoJson-5.11.2/src/ArduinoJson/JsonArray.hpp
@@ -2,7 +2,7 @@
// MIT License
//
// Arduino JSON library
-// https://github.com/bblanchon/ArduinoJson
+// https://bblanchon.github.io/ArduinoJson/
// If you like this project, please add a star!
#pragma once
@@ -39,13 +39,14 @@ class JsonArraySubscript;
// It can also be deserialized from a JSON string via JsonBuffer::parseArray().
class JsonArray : public Internals::JsonPrintable,
public Internals::ReferenceType,
+ public Internals::NonCopyable,
public Internals::List,
public Internals::JsonBufferAllocated {
public:
// Create an empty JsonArray attached to the specified JsonBuffer.
// You should not call this constructor directly.
// Instead, use JsonBuffer::createArray() or JsonBuffer::parseArray().
- explicit JsonArray(JsonBuffer *buffer)
+ explicit JsonArray(JsonBuffer *buffer) throw()
: Internals::List(buffer) {}
// Gets the value at the specified index
@@ -76,8 +77,9 @@ class JsonArray : public Internals::JsonPrintable,
// bool add(TValue value, uint8_t decimals);
// TValue = float, double
template
- bool add(T value, uint8_t decimals) {
- return add_impl(JsonVariant(value, decimals));
+ DEPRECATED("Second argument is not supported anymore")
+ bool add(T value, uint8_t) {
+ return add_impl(JsonVariant(value));
}
// Sets the value at specified index.
@@ -111,16 +113,15 @@ class JsonArray : public Internals::JsonPrintable,
// Gets the value at the specified index.
template
typename Internals::JsonVariantAs::type get(size_t index) const {
- node_type *node = findNode(index);
- return node ? node->content.as()
- : Internals::JsonVariantDefault::get();
+ const_iterator it = begin() += index;
+ return it != end() ? it->as() : Internals::JsonVariantDefault::get();
}
// Check the type of the value at specified index.
template
bool is(size_t index) const {
- node_type *node = findNode(index);
- return node ? node->content.is() : false;
+ const_iterator it = begin() += index;
+ return it != end() ? it->is() : false;
}
// Creates a JsonArray and adds a reference at the end of the array.
@@ -132,9 +133,10 @@ class JsonArray : public Internals::JsonPrintable,
JsonObject &createNestedObject();
// Removes element at specified index.
- void removeAt(size_t index) {
- removeNode(findNode(index));
+ void remove(size_t index) {
+ remove(begin() += index);
}
+ using Internals::List::remove;
// Returns a reference an invalid JsonArray.
// This object is meant to replace a NULL pointer.
@@ -197,29 +199,26 @@ class JsonArray : public Internals::JsonPrintable,
}
}
- private:
- node_type *findNode(size_t index) const {
- node_type *node = _firstNode;
- while (node && index--) node = node->next;
- return node;
+#if ARDUINOJSON_ENABLE_DEPRECATED
+ DEPRECATED("use remove() instead")
+ FORCE_INLINE void removeAt(size_t index) {
+ return remove(index);
}
+#endif
+ private:
template
bool set_impl(size_t index, TValueRef value) {
- node_type *node = findNode(index);
- if (!node) return false;
-
- return Internals::ValueSetter::set(_buffer, node->content,
- value);
+ iterator it = begin() += index;
+ if (it == end()) return false;
+ return Internals::ValueSetter::set(_buffer, *it, value);
}
template
bool add_impl(TValueRef value) {
- node_type *node = addNewNode();
- if (!node) return false;
-
- return Internals::ValueSetter::set(_buffer, node->content,
- value);
+ iterator it = Internals::List::add();
+ if (it == end()) return false;
+ return Internals::ValueSetter::set(_buffer, *it, value);
}
};
diff --git a/lib/ArduinoJson/include/ArduinoJson/JsonArrayImpl.hpp b/lib/ArduinoJson-5.11.2/src/ArduinoJson/JsonArrayImpl.hpp
similarity index 93%
rename from lib/ArduinoJson/include/ArduinoJson/JsonArrayImpl.hpp
rename to lib/ArduinoJson-5.11.2/src/ArduinoJson/JsonArrayImpl.hpp
index d065d1d03..6ebd39baa 100644
--- a/lib/ArduinoJson/include/ArduinoJson/JsonArrayImpl.hpp
+++ b/lib/ArduinoJson-5.11.2/src/ArduinoJson/JsonArrayImpl.hpp
@@ -2,7 +2,7 @@
// MIT License
//
// Arduino JSON library
-// https://github.com/bblanchon/ArduinoJson
+// https://bblanchon.github.io/ArduinoJson/
// If you like this project, please add a star!
#pragma once
diff --git a/lib/ArduinoJson/include/ArduinoJson/JsonArraySubscript.hpp b/lib/ArduinoJson-5.11.2/src/ArduinoJson/JsonArraySubscript.hpp
similarity index 83%
rename from lib/ArduinoJson/include/ArduinoJson/JsonArraySubscript.hpp
rename to lib/ArduinoJson-5.11.2/src/ArduinoJson/JsonArraySubscript.hpp
index 1deda0750..5bd6208a5 100644
--- a/lib/ArduinoJson/include/ArduinoJson/JsonArraySubscript.hpp
+++ b/lib/ArduinoJson-5.11.2/src/ArduinoJson/JsonArraySubscript.hpp
@@ -2,7 +2,7 @@
// MIT License
//
// Arduino JSON library
-// https://github.com/bblanchon/ArduinoJson
+// https://bblanchon.github.io/ArduinoJson/
// If you like this project, please add a star!
#pragma once
@@ -81,8 +81,9 @@ class JsonArraySubscript : public JsonVariantBase {
// bool set(TValue, uint8_t decimals);
// TValue = float, double
template
- FORCE_INLINE bool set(const TValue& value, uint8_t decimals) {
- return _array.set(_index, value, decimals);
+ DEPRECATED("Second argument is not supported anymore")
+ FORCE_INLINE bool set(const TValue& value, uint8_t) {
+ return _array.set(_index, value);
}
private:
@@ -105,15 +106,16 @@ inline const JsonArraySubscript JsonArray::operator[](size_t index) const {
return JsonArraySubscript(*const_cast(this), index);
}
-template
-inline JsonArraySubscript JsonVariantBase::operator[](int index) {
- return as()[index];
+template
+inline JsonArraySubscript JsonVariantSubscripts::operator[](
+ size_t index) {
+ return impl()->template as()[index];
}
-template
-inline const JsonArraySubscript JsonVariantBase::operator[](
- int index) const {
- return as()[index];
+template
+inline const JsonArraySubscript JsonVariantSubscripts::operator[](
+ size_t index) const {
+ return impl()->template as()[index];
}
} // namespace ArduinoJson
diff --git a/lib/ArduinoJson/include/ArduinoJson/JsonBuffer.hpp b/lib/ArduinoJson-5.11.2/src/ArduinoJson/JsonBuffer.hpp
similarity index 76%
rename from lib/ArduinoJson/include/ArduinoJson/JsonBuffer.hpp
rename to lib/ArduinoJson-5.11.2/src/ArduinoJson/JsonBuffer.hpp
index 30b18a2eb..06bda0ef4 100644
--- a/lib/ArduinoJson/include/ArduinoJson/JsonBuffer.hpp
+++ b/lib/ArduinoJson-5.11.2/src/ArduinoJson/JsonBuffer.hpp
@@ -2,7 +2,7 @@
// MIT License
//
// Arduino JSON library
-// https://github.com/bblanchon/ArduinoJson
+// https://bblanchon.github.io/ArduinoJson/
// If you like this project, please add a star!
#pragma once
@@ -11,20 +11,11 @@
#include // for uint8_t
#include
+#include "Data/NonCopyable.hpp"
#include "JsonVariant.hpp"
#include "TypeTraits/EnableIf.hpp"
#include "TypeTraits/IsArray.hpp"
-#if defined(__clang__)
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wnon-virtual-dtor"
-#elif defined(__GNUC__)
-#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
-#pragma GCC diagnostic push
-#endif
-#pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
-#endif
-
namespace ArduinoJson {
class JsonArray;
class JsonObject;
@@ -34,13 +25,8 @@ class JsonObject;
// Handle the memory management (done in derived classes) and calls the parser.
// This abstract class is implemented by StaticJsonBuffer which implements a
// fixed memory allocation.
-class JsonBuffer {
+class JsonBuffer : Internals::NonCopyable {
public:
- // CAUTION: NO VIRTUAL DESTRUCTOR!
- // If we add a virtual constructor the Arduino compiler will add malloc() and
- // free() to the binary, adding 706 useless bytes.
- // virtual ~JsonBuffer() {}
-
// Allocates an empty JsonArray.
//
// Returns a reference to the new JsonArray or JsonArray::invalid() if the
@@ -76,6 +62,11 @@ class JsonBuffer {
virtual void *alloc(size_t size) = 0;
protected:
+ // CAUTION: NO VIRTUAL DESTRUCTOR!
+ // If we add a virtual constructor the Arduino compiler will add malloc()
+ // and free() to the binary, adding 706 useless bytes.
+ ~JsonBuffer() {}
+
// Preserve aligment if necessary
static FORCE_INLINE size_t round_size_up(size_t bytes) {
#if ARDUINOJSON_ENABLE_ALIGNMENT
@@ -87,11 +78,3 @@ class JsonBuffer {
}
};
}
-
-#if defined(__clang__)
-#pragma clang diagnostic pop
-#elif defined(__GNUC__)
-#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
-#pragma GCC diagnostic pop
-#endif
-#endif
diff --git a/lib/ArduinoJson/include/ArduinoJson/JsonBufferBase.hpp b/lib/ArduinoJson-5.11.2/src/ArduinoJson/JsonBufferBase.hpp
similarity index 89%
rename from lib/ArduinoJson/include/ArduinoJson/JsonBufferBase.hpp
rename to lib/ArduinoJson-5.11.2/src/ArduinoJson/JsonBufferBase.hpp
index 7c3937190..480cd8307 100644
--- a/lib/ArduinoJson/include/ArduinoJson/JsonBufferBase.hpp
+++ b/lib/ArduinoJson-5.11.2/src/ArduinoJson/JsonBufferBase.hpp
@@ -2,23 +2,13 @@
// MIT License
//
// Arduino JSON library
-// https://github.com/bblanchon/ArduinoJson
+// https://bblanchon.github.io/ArduinoJson/
// If you like this project, please add a star!
#pragma once
#include "Deserialization/JsonParser.hpp"
-#if defined(__clang__)
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wnon-virtual-dtor"
-#elif defined(__GNUC__)
-#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
-#pragma GCC diagnostic push
-#endif
-#pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
-#endif
-
namespace ArduinoJson {
template
class JsonBufferBase : public JsonBuffer {
@@ -127,17 +117,12 @@ class JsonBufferBase : public JsonBuffer {
return Internals::makeParser(that(), json, nestingLimit).parseVariant();
}
+ protected:
+ ~JsonBufferBase() {}
+
private:
TDerived *that() {
return static_cast(this);
}
};
}
-
-#if defined(__clang__)
-#pragma clang diagnostic pop
-#elif defined(__GNUC__)
-#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
-#pragma GCC diagnostic pop
-#endif
-#endif
diff --git a/lib/ArduinoJson/include/ArduinoJson/JsonBufferImpl.hpp b/lib/ArduinoJson-5.11.2/src/ArduinoJson/JsonBufferImpl.hpp
similarity index 92%
rename from lib/ArduinoJson/include/ArduinoJson/JsonBufferImpl.hpp
rename to lib/ArduinoJson-5.11.2/src/ArduinoJson/JsonBufferImpl.hpp
index fab8eeff8..98d5de595 100644
--- a/lib/ArduinoJson/include/ArduinoJson/JsonBufferImpl.hpp
+++ b/lib/ArduinoJson-5.11.2/src/ArduinoJson/JsonBufferImpl.hpp
@@ -2,7 +2,7 @@
// MIT License
//
// Arduino JSON library
-// https://github.com/bblanchon/ArduinoJson
+// https://bblanchon.github.io/ArduinoJson/
// If you like this project, please add a star!
#pragma once
diff --git a/lib/ArduinoJson/include/ArduinoJson/JsonObject.hpp b/lib/ArduinoJson-5.11.2/src/ArduinoJson/JsonObject.hpp
similarity index 85%
rename from lib/ArduinoJson/include/ArduinoJson/JsonObject.hpp
rename to lib/ArduinoJson-5.11.2/src/ArduinoJson/JsonObject.hpp
index 0a4c80aac..a3e30ab27 100644
--- a/lib/ArduinoJson/include/ArduinoJson/JsonObject.hpp
+++ b/lib/ArduinoJson-5.11.2/src/ArduinoJson/JsonObject.hpp
@@ -2,7 +2,7 @@
// MIT License
//
// Arduino JSON library
-// https://github.com/bblanchon/ArduinoJson
+// https://bblanchon.github.io/ArduinoJson/
// If you like this project, please add a star!
#pragma once
@@ -38,13 +38,15 @@ class JsonBuffer;
// It can also be deserialized from a JSON string via JsonBuffer::parseObject().
class JsonObject : public Internals::JsonPrintable,
public Internals::ReferenceType,
+ public Internals::NonCopyable,
public Internals::List,
public Internals::JsonBufferAllocated {
public:
// Create an empty JsonArray attached to the specified JsonBuffer.
// You should not use this constructor directly.
// Instead, use JsonBuffer::createObject() or JsonBuffer.parseObject().
- explicit JsonObject(JsonBuffer* buffer) : Internals::List(buffer) {}
+ explicit JsonObject(JsonBuffer* buffer) throw()
+ : Internals::List(buffer) {}
// Gets or sets the value associated with the specified key.
//
@@ -134,23 +136,25 @@ class JsonObject : public Internals::JsonPrintable,
// TKey = const std::string&, const String&
// TValue = float, double
template
+ DEPRECATED("Second argument is not supported anymore")
typename TypeTraits::EnableIf::value &&
!TypeTraits::IsArray::value,
bool>::type
- set(const TString& key, TValue value, uint8_t decimals) {
- return set_impl(
- key, JsonVariant(value, decimals));
+ set(const TString& key, TValue value, uint8_t) {
+ return set_impl(key,
+ JsonVariant(value));
}
//
// bool set(TKey, TValue, uint8_t decimals);
// TKey = const char*, const char[N], const FlashStringHelper*
// TValue = float, double
template
+ DEPRECATED("Second argument is not supported anymore")
typename TypeTraits::EnableIf::value,
bool>::type
- set(const TString* key, TValue value, uint8_t decimals) {
- return set_impl(
- key, JsonVariant(value, decimals));
+ set(const TString* key, TValue value, uint8_t) {
+ return set_impl(key,
+ JsonVariant(value));
}
// Gets the value associated with the specified key.
@@ -247,14 +251,14 @@ class JsonObject : public Internals::JsonPrintable,
typename TypeTraits::EnableIf::value,
bool>::type
containsKey(const TString& key) const {
- return findNode(key) != NULL;
+ return findKey(key) != end();
}
//
// bool containsKey(TKey);
// TKey = const char*, const char[N], const FlashStringHelper*
template
bool containsKey(const TString* key) const {
- return findNode(key) != NULL;
+ return findKey(key) != end();
}
// Removes the specified key and the associated value.
@@ -265,15 +269,18 @@ class JsonObject : public Internals::JsonPrintable,
typename TypeTraits::EnableIf::value,
void>::type
remove(const TString& key) {
- removeNode(findNode(key));
+ remove(findKey(key));
}
//
// void remove(TKey);
// TKey = const char*, const char[N], const FlashStringHelper*
template
void remove(const TString* key) {
- removeNode(findNode(key));
+ remove(findKey(key));
}
+ //
+ // void remove(iterator)
+ using Internals::List::remove;
// Returns a reference an invalid JsonObject.
// This object is meant to replace a NULL pointer.
@@ -286,41 +293,44 @@ class JsonObject : public Internals::JsonPrintable,
private:
// Returns the list node that matches the specified key.
template
- node_type* findNode(TStringRef key) const {
- for (node_type* node = _firstNode; node; node = node->next) {
- if (Internals::StringTraits::equals(key, node->content.key))
- return node;
+ iterator findKey(TStringRef key) {
+ iterator it;
+ for (it = begin(); it != end(); ++it) {
+ if (Internals::StringTraits::equals(key, it->key)) break;
}
- return NULL;
+ return it;
+ }
+ template
+ const_iterator findKey(TStringRef key) const {
+ return const_cast(this)->findKey(key);
}
template
typename Internals::JsonVariantAs::type get_impl(
TStringRef key) const {
- node_type* node = findNode(key);
- return node ? node->content.value.as()
- : Internals::JsonVariantDefault::get();
+ const_iterator it = findKey(key);
+ return it != end() ? it->value.as()
+ : Internals::JsonVariantDefault::get();
}
template
bool set_impl(TStringRef key, TValueRef value) {
- node_type* node = findNode(key);
- if (!node) {
- node = addNewNode();
- if (!node) return false;
+ iterator it = findKey(key);
+ if (it == end()) {
+ it = Internals::List::add();
+ if (it == end()) return false;
- bool key_ok = Internals::ValueSetter::set(
- _buffer, node->content.key, key);
+ bool key_ok =
+ Internals::ValueSetter::set(_buffer, it->key, key);
if (!key_ok) return false;
}
- return Internals::ValueSetter::set(_buffer, node->content.value,
- value);
+ return Internals::ValueSetter::set(_buffer, it->value, value);
}
template
bool is_impl(TStringRef key) const {
- node_type* node = findNode(key);
- return node ? node->content.value.is() : false;
+ const_iterator it = findKey(key);
+ return it != end() ? it->value.is() : false;
}
template
diff --git a/lib/ArduinoJson/include/ArduinoJson/JsonObjectImpl.hpp b/lib/ArduinoJson-5.11.2/src/ArduinoJson/JsonObjectImpl.hpp
similarity index 94%
rename from lib/ArduinoJson/include/ArduinoJson/JsonObjectImpl.hpp
rename to lib/ArduinoJson-5.11.2/src/ArduinoJson/JsonObjectImpl.hpp
index 5f336dd77..9741bfadd 100644
--- a/lib/ArduinoJson/include/ArduinoJson/JsonObjectImpl.hpp
+++ b/lib/ArduinoJson-5.11.2/src/ArduinoJson/JsonObjectImpl.hpp
@@ -2,7 +2,7 @@
// MIT License
//
// Arduino JSON library
-// https://github.com/bblanchon/ArduinoJson
+// https://bblanchon.github.io/ArduinoJson/
// If you like this project, please add a star!
#pragma once
diff --git a/lib/ArduinoJson/include/ArduinoJson/JsonObjectSubscript.hpp b/lib/ArduinoJson-5.11.2/src/ArduinoJson/JsonObjectSubscript.hpp
similarity index 93%
rename from lib/ArduinoJson/include/ArduinoJson/JsonObjectSubscript.hpp
rename to lib/ArduinoJson-5.11.2/src/ArduinoJson/JsonObjectSubscript.hpp
index 6c62cbac8..99dfe7cd0 100644
--- a/lib/ArduinoJson/include/ArduinoJson/JsonObjectSubscript.hpp
+++ b/lib/ArduinoJson-5.11.2/src/ArduinoJson/JsonObjectSubscript.hpp
@@ -2,7 +2,7 @@
// MIT License
//
// Arduino JSON library
-// https://github.com/bblanchon/ArduinoJson
+// https://bblanchon.github.io/ArduinoJson/
// If you like this project, please add a star!
#pragma once
@@ -93,8 +93,9 @@ class JsonObjectSubscript
// bool set(TValue, uint8_t decimals);
// TValue = float, double
template
- FORCE_INLINE bool set(const TValue& value, uint8_t decimals) {
- return _object.set(_key, value, decimals);
+ DEPRECATED("Second argument is not supported anymore")
+ FORCE_INLINE bool set(const TValue& value, uint8_t) {
+ return _object.set(_key, value);
}
private:
diff --git a/lib/ArduinoJson/include/ArduinoJson/JsonPair.hpp b/lib/ArduinoJson-5.11.2/src/ArduinoJson/JsonPair.hpp
similarity index 87%
rename from lib/ArduinoJson/include/ArduinoJson/JsonPair.hpp
rename to lib/ArduinoJson-5.11.2/src/ArduinoJson/JsonPair.hpp
index 09fa4e8dc..5a32601c0 100644
--- a/lib/ArduinoJson/include/ArduinoJson/JsonPair.hpp
+++ b/lib/ArduinoJson-5.11.2/src/ArduinoJson/JsonPair.hpp
@@ -2,7 +2,7 @@
// MIT License
//
// Arduino JSON library
-// https://github.com/bblanchon/ArduinoJson
+// https://bblanchon.github.io/ArduinoJson/
// If you like this project, please add a star!
#pragma once
diff --git a/lib/ArduinoJson/include/ArduinoJson/JsonVariant.hpp b/lib/ArduinoJson-5.11.2/src/ArduinoJson/JsonVariant.hpp
similarity index 75%
rename from lib/ArduinoJson/include/ArduinoJson/JsonVariant.hpp
rename to lib/ArduinoJson-5.11.2/src/ArduinoJson/JsonVariant.hpp
index 31a3151de..9037d54d1 100644
--- a/lib/ArduinoJson/include/ArduinoJson/JsonVariant.hpp
+++ b/lib/ArduinoJson-5.11.2/src/ArduinoJson/JsonVariant.hpp
@@ -2,7 +2,7 @@
// MIT License
//
// Arduino JSON library
-// https://github.com/bblanchon/ArduinoJson
+// https://bblanchon.github.io/ArduinoJson/
// If you like this project, please add a star!
#pragma once
@@ -40,8 +40,8 @@ class JsonObject;
// - a string (const char*)
// - a reference to a JsonArray or JsonObject
class JsonVariant : public JsonVariantBase {
- friend void Internals::JsonSerializer::serialize(const JsonVariant &,
- JsonWriter &);
+ template
+ friend class Internals::JsonSerializer;
public:
// Creates an uninitialized JsonVariant
@@ -52,31 +52,39 @@ class JsonVariant : public JsonVariantBase {
JsonVariant(bool value) {
using namespace Internals;
_type = JSON_BOOLEAN;
- _content.asInteger = static_cast(value);
+ _content.asInteger = static_cast(value);
}
// Create a JsonVariant containing a floating point value.
- // The second argument specifies the number of decimal digits to write in
- // the JSON string.
- // JsonVariant(double value, uint8_t decimals);
- // JsonVariant(float value, uint8_t decimals);
+ // JsonVariant(double value);
+ // JsonVariant(float value);
template
- JsonVariant(T value, uint8_t decimals = 2,
+ JsonVariant(T value, typename TypeTraits::EnableIf<
+ TypeTraits::IsFloatingPoint::value>::type * = 0) {
+ using namespace Internals;
+ _type = JSON_FLOAT;
+ _content.asFloat = static_cast(value);
+ }
+ template
+ DEPRECATED("Second argument is not supported anymore")
+ JsonVariant(T value, uint8_t,
typename TypeTraits::EnableIf<
TypeTraits::IsFloatingPoint::value>::type * = 0) {
using namespace Internals;
- _type = static_cast(JSON_FLOAT_0_DECIMALS + decimals);
+ _type = JSON_FLOAT;
_content.asFloat = static_cast(value);
}
// Create a JsonVariant containing an integer value.
+ // JsonVariant(char)
// JsonVariant(signed short)
// JsonVariant(signed int)
// JsonVariant(signed long)
+ // JsonVariant(signed char)
template
- JsonVariant(T value,
- typename TypeTraits::EnableIf<
- TypeTraits::IsSignedIntegral::value>::type * = 0) {
+ JsonVariant(T value, typename TypeTraits::EnableIf<
+ TypeTraits::IsSignedIntegral::value ||
+ TypeTraits::IsSame::value>::type * = 0) {
using namespace Internals;
if (value >= 0) {
_type = JSON_POSITIVE_INTEGER;
@@ -129,24 +137,26 @@ class JsonVariant : public JsonVariantBase {
// Get the variant as the specified type.
//
- // short as() const;
- // int as() const;
- // long as() const;
+ // char as() const;
+ // signed char as() const;
+ // signed short as() const;
+ // signed int as() const;
+ // signed long as() const;
+ // unsigned char as() const;
+ // unsigned short as() const;
+ // unsigned int as() const;
+ // unsigned long as() const;
template
- const typename TypeTraits::EnableIf::value,
- T>::type
+ const typename TypeTraits::EnableIf::value, T>::type
as() const {
- return static_cast(variantAsInteger());
+ return variantAsInteger();
}
- //
- // short as() const;
- // int as() const;
- // long as() const;
+ // bool as() const
template
- const typename TypeTraits::EnableIf::value,
+ const typename TypeTraits::EnableIf::value,
T>::type
as() const {
- return static_cast(asUnsignedInteger());
+ return variantAsInteger() != 0;
}
//
// double as() const;
@@ -155,7 +165,7 @@ class JsonVariant : public JsonVariantBase {
const typename TypeTraits::EnableIf::value,
T>::type
as() const {
- return static_cast(variantAsFloat());
+ return variantAsFloat();
}
//
// const char* as() const;
@@ -180,14 +190,6 @@ class JsonVariant : public JsonVariantBase {
return s;
}
//
- // const bool as() const
- template
- const typename TypeTraits::EnableIf::value,
- T>::type
- as() const {
- return variantAsInteger() != 0;
- }
- //
// JsonArray& as const;
// JsonArray& as const;
template
@@ -242,32 +244,35 @@ class JsonVariant : public JsonVariantBase {
// Tells weither the variant has the specified type.
// Returns true if the variant has type type T, false otherwise.
//
- // short as() const;
- // int as() const;
- // long as() const;
+ // bool is() const;
+ // bool is() const;
+ // bool is() const;
+ // bool is() const;
+ // bool is() const;
+ // bool is() const;
+ // bool is() const;
+ // bool is() const;
+ // bool is() const;
template
- const typename TypeTraits::EnableIf::value &&
- !TypeTraits::IsSame::value,
- bool>::type
+ typename TypeTraits::EnableIf::value, bool>::type
is() const {
- return isInteger();
+ return variantIsInteger();
}
//
- // double is() const;
- // float is() const;
+ // bool is() const;
+ // bool is() const;
template
- const typename TypeTraits::EnableIf::value,
- bool>::type
+ typename TypeTraits::EnableIf::value,
+ bool>::type
is() const {
- return isFloat();
+ return variantIsFloat();
}
//
- // const bool is() const
+ // bool is() const
template
- const typename TypeTraits::EnableIf::value,
- bool>::type
+ typename TypeTraits::EnableIf::value, bool>::type
is() const {
- return isBoolean();
+ return variantIsBoolean();
}
//
// bool is() const;
@@ -277,7 +282,7 @@ class JsonVariant : public JsonVariantBase {
TypeTraits::IsSame::value,
bool>::type
is() const {
- return isString();
+ return variantIsString();
}
//
// bool is const;
@@ -291,7 +296,7 @@ class JsonVariant : public JsonVariantBase {
JsonArray>::value,
bool>::type
is() const {
- return isArray();
+ return variantIsArray();
}
//
// bool is const;
@@ -305,7 +310,7 @@ class JsonVariant : public JsonVariantBase {
JsonObject>::value,
bool>::type
is() const {
- return isObject();
+ return variantIsObject();
}
// Returns true if the variant has a value
@@ -314,27 +319,23 @@ class JsonVariant : public JsonVariantBase {
}
private:
- // It's not allowed to store a char
- template
- JsonVariant(T value, typename TypeTraits::EnableIf<
- TypeTraits::IsSame::value>::type * = 0);
-
JsonArray &variantAsArray() const;
JsonObject &variantAsObject() const;
const char *variantAsString() const;
- Internals::JsonFloat variantAsFloat() const;
- Internals::JsonInteger variantAsInteger() const;
- Internals::JsonUInt asUnsignedInteger() const;
- bool isBoolean() const;
- bool isFloat() const;
- bool isInteger() const;
- bool isArray() const {
+ template
+ T variantAsFloat() const;
+ template
+ T variantAsInteger() const;
+ bool variantIsBoolean() const;
+ bool variantIsFloat() const;
+ bool variantIsInteger() const;
+ bool variantIsArray() const {
return _type == Internals::JSON_ARRAY;
}
- bool isObject() const {
+ bool variantIsObject() const {
return _type == Internals::JSON_OBJECT;
}
- bool isString() const {
+ bool variantIsString() const {
return _type == Internals::JSON_STRING ||
(_type == Internals::JSON_UNPARSED && _content.asString &&
!strcmp("null", _content.asString));
@@ -347,11 +348,13 @@ class JsonVariant : public JsonVariantBase {
Internals::JsonVariantContent _content;
};
-inline JsonVariant float_with_n_digits(float value, uint8_t digits) {
- return JsonVariant(value, digits);
+DEPRECATED("Decimal places are ignored, use the float value instead")
+inline JsonVariant float_with_n_digits(float value, uint8_t) {
+ return JsonVariant(value);
}
-inline JsonVariant double_with_n_digits(double value, uint8_t digits) {
- return JsonVariant(value, digits);
+DEPRECATED("Decimal places are ignored, use the double value instead")
+inline JsonVariant double_with_n_digits(double value, uint8_t) {
+ return JsonVariant(value);
}
}
diff --git a/lib/ArduinoJson-5.11.2/src/ArduinoJson/JsonVariantBase.hpp b/lib/ArduinoJson-5.11.2/src/ArduinoJson/JsonVariantBase.hpp
new file mode 100644
index 000000000..a010e253f
--- /dev/null
+++ b/lib/ArduinoJson-5.11.2/src/ArduinoJson/JsonVariantBase.hpp
@@ -0,0 +1,23 @@
+// Copyright Benoit Blanchon 2014-2017
+// MIT License
+//
+// Arduino JSON library
+// https://bblanchon.github.io/ArduinoJson/
+// If you like this project, please add a star!
+
+#pragma once
+
+#include "JsonVariantCasts.hpp"
+#include "JsonVariantComparisons.hpp"
+#include "JsonVariantSubscripts.hpp"
+#include "Serialization/JsonPrintable.hpp"
+
+namespace ArduinoJson {
+
+template