diff --git a/.gitignore b/.gitignore index 6e2501700..f4d65ff09 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.pio/ .pioenvs .piolibdeps .clang_complete diff --git a/.pio/build/structure.hash b/.pio/build/structure.hash new file mode 100644 index 000000000..a842b977a --- /dev/null +++ b/.pio/build/structure.hash @@ -0,0 +1 @@ +bef09d0221417c7fa970df5de6bc979deed767c9 \ No newline at end of file diff --git a/.pio/libdeps/development/ArduinoJson_ID64/.clang-format b/.pio/libdeps/development/ArduinoJson_ID64/.clang-format new file mode 100644 index 000000000..368093632 --- /dev/null +++ b/.pio/libdeps/development/ArduinoJson_ID64/.clang-format @@ -0,0 +1,5 @@ +# http://clang.llvm.org/docs/ClangFormatStyleOptions.html + +BasedOnStyle: Google +Standard: Cpp03 +AllowShortFunctionsOnASingleLine: Empty diff --git a/.pio/libdeps/development/ArduinoJson_ID64/.gitattributes b/.pio/libdeps/development/ArduinoJson_ID64/.gitattributes new file mode 100644 index 000000000..526c8a38d --- /dev/null +++ b/.pio/libdeps/development/ArduinoJson_ID64/.gitattributes @@ -0,0 +1 @@ +*.sh text eol=lf \ No newline at end of file diff --git a/.pio/libdeps/development/ArduinoJson_ID64/.github/ISSUE_TEMPLATE.md b/.pio/libdeps/development/ArduinoJson_ID64/.github/ISSUE_TEMPLATE.md new file mode 100644 index 000000000..cddc522f4 --- /dev/null +++ b/.pio/libdeps/development/ArduinoJson_ID64/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,14 @@ + diff --git a/.pio/libdeps/development/ArduinoJson_ID64/.gitignore b/.pio/libdeps/development/ArduinoJson_ID64/.gitignore new file mode 100644 index 000000000..1071ea6b1 --- /dev/null +++ b/.pio/libdeps/development/ArduinoJson_ID64/.gitignore @@ -0,0 +1,12 @@ +.DS_Store +/.idea +/build +/bin +/lib +/sftp-config.json +.tags +.tags_sorted_by_file +/fuzzing/*_fuzzer +/fuzzing/*_fuzzer.options +/fuzzing/*_fuzzer_seed_corpus.zip +.vs/ diff --git a/.pio/libdeps/development/ArduinoJson_ID64/.library.json b/.pio/libdeps/development/ArduinoJson_ID64/.library.json new file mode 100644 index 000000000..6f254161a --- /dev/null +++ b/.pio/libdeps/development/ArduinoJson_ID64/.library.json @@ -0,0 +1,50 @@ +{ + "name": "ArduinoJson", + "keywords": [ + "json", + "rest", + "http", + "web" + ], + "description": "An elegant and efficient JSON library for embedded systems", + "homepage": "https://arduinojson.org/?utm_source=meta&utm_medium=library.json", + "repository": { + "type": "git", + "url": "https://github.com/bblanchon/ArduinoJson.git" + }, + "version": "6.10.0", + "authors": [ + { + "email": null, + "url": "https://blog.benoitblanchon.fr", + "maintainer": false, + "name": "Benoit Blanchon" + } + ], + "frameworks": [ + "arduino" + ], + "platforms": [ + "atmelavr", + "atmelsam", + "espressif32", + "espressif8266", + "intel_arc32", + "microchippic32", + "nordicnrf51", + "nordicnrf52", + "ststm32", + "ststm8", + "teensy", + "timsp430" + ], + "export": { + "exclude": [ + "fuzzing", + "scripts", + "test", + "third-party" + ] + }, + "id": 64 +} \ No newline at end of file diff --git a/.pio/libdeps/development/ArduinoJson_ID64/.mbedignore b/.pio/libdeps/development/ArduinoJson_ID64/.mbedignore new file mode 100644 index 000000000..b52329d15 --- /dev/null +++ b/.pio/libdeps/development/ArduinoJson_ID64/.mbedignore @@ -0,0 +1,6 @@ +.github/ +examples/ +fuzzing/ +scripts/ +test/ +third-party/ diff --git a/.pio/libdeps/development/ArduinoJson_ID64/.travis.yml b/.pio/libdeps/development/ArduinoJson_ID64/.travis.yml new file mode 100644 index 000000000..643afb2bd --- /dev/null +++ b/.pio/libdeps/development/ArduinoJson_ID64/.travis.yml @@ -0,0 +1,117 @@ +sudo: false +language: cpp +matrix: + include: + - addons: + apt: + sources: ['ubuntu-toolchain-r-test'] + packages: ['g++-4.4'] + env: SCRIPT=test _CC=gcc-4.4 _CXX=g++-4.4 + - addons: + apt: + sources: ['ubuntu-toolchain-r-test'] + packages: ['g++-4.6'] + env: SCRIPT=test _CC=gcc-4.6 _CXX=g++-4.6 + - addons: + apt: + sources: ['ubuntu-toolchain-r-test'] + packages: ['g++-4.7'] + env: SCRIPT=test _CC=gcc-4.7 _CXX=g++-4.7 + - addons: + apt: + sources: ['ubuntu-toolchain-r-test'] + packages: ['g++-4.8'] + env: SCRIPT=test _CC=gcc-4.8 _CXX=g++-4.8 SANITIZE=address + - addons: + apt: + sources: ['ubuntu-toolchain-r-test'] + packages: ['g++-4.9'] + env: SCRIPT=test _CC=gcc-4.9 _CXX=g++-4.9 SANITIZE=leak + - addons: + apt: + sources: ['ubuntu-toolchain-r-test'] + packages: ['g++-5'] + env: SCRIPT=test _CC=gcc-5 _CXX=g++-5 # SANITIZE=undefined + - addons: + apt: + sources: ['ubuntu-toolchain-r-test'] + packages: ['g++-6'] + env: SCRIPT=test _CC=gcc-6 _CXX=g++-6 + - addons: + apt: + sources: ['ubuntu-toolchain-r-test'] + packages: ['g++-7'] + env: SCRIPT=test _CC=gcc-7 _CXX=g++-7 + - addons: + apt: + packages: ['g++-arm-linux-gnueabihf'] + env: SCRIPT=build _CC=arm-linux-gnueabihf-gcc _CXX=arm-linux-gnueabihf-g++ + - env: SCRIPT=test _CC=clang _CXX=clang++ + - addons: + apt: + sources: ['ubuntu-toolchain-r-test','llvm-toolchain-precise-3.5'] + packages: ['clang-3.5'] + env: SCRIPT=test _CC=clang-3.5 _CXX=clang++-3.5 SANITIZE=address + - addons: + apt: + sources: ['ubuntu-toolchain-r-test','llvm-toolchain-precise-3.6'] + packages: ['clang-3.6'] + env: SCRIPT=test _CC=clang-3.6 _CXX=clang++-3.6 SANITIZE=leak + - addons: + apt: + sources: ['ubuntu-toolchain-r-test','llvm-toolchain-precise-3.7'] + packages: ['clang-3.7'] + env: SCRIPT=test _CC=clang-3.7 _CXX=clang++-3.7 + - addons: + apt: + sources: ['ubuntu-toolchain-r-test','llvm-toolchain-precise-3.8'] + packages: ['clang-3.8'] + env: SCRIPT=test _CC=clang-3.8 _CXX=clang++-3.8 SANITIZE=undefined + - addons: + apt: + sources: ['ubuntu-toolchain-r-test','llvm-toolchain-trusty-3.9'] + packages: ['clang-3.9'] + env: SCRIPT=test _CC=clang-3.9 _CXX=clang++-3.9 + - addons: + apt: + sources: ['ubuntu-toolchain-r-test','llvm-toolchain-trusty-4.0'] + packages: ['clang-4.0'] + env: SCRIPT=test _CC=clang-4.0 _CXX=clang++-4.0 + - addons: + apt: + sources: ['ubuntu-toolchain-r-test','llvm-toolchain-trusty-5.0'] + packages: ['clang-5.0'] + env: SCRIPT=test _CC=clang-5.0 _CXX=clang++-5.0 + - addons: + apt: + sources: ['ubuntu-toolchain-r-test','llvm-toolchain-trusty-6.0'] + packages: ['clang-6.0'] + env: SCRIPT=test _CC=clang-6.0 _CXX=clang++-6.0 + - env: SCRIPT=coverage + - os: osx + osx_image: xcode7.3 + env: SCRIPT=test + - os: osx + osx_image: xcode8.3 + env: SCRIPT=test + - os: osx + osx_image: xcode9.4 + env: SCRIPT=test + - os: osx + osx_image: xcode10 + env: SCRIPT=test SANITIZE=address + - env: SCRIPT=arduino VERSION=1.6.7 BOARD=arduino:avr:uno + - env: SCRIPT=arduino VERSION=1.8.2 BOARD=arduino:samd:mkr1000 + - env: SCRIPT=platformio BOARD=uno + - env: SCRIPT=platformio BOARD=esp01 + - addons: + apt: + sources: ['ubuntu-toolchain-r-test','llvm-toolchain-trusty-6.0'] + packages: ['clang-6.0','llvm-6.0'] + env: SCRIPT=fuzz CLANG=6.0 +cache: + directories: + - "~/.platformio" + - "fuzzing/json_corpus" + - "fuzzing/msgpack_corpus" +script: scripts/travis/$SCRIPT.sh diff --git a/.pio/libdeps/development/ArduinoJson_ID64/ArduinoJson.h b/.pio/libdeps/development/ArduinoJson_ID64/ArduinoJson.h new file mode 100644 index 000000000..d69f47910 --- /dev/null +++ b/.pio/libdeps/development/ArduinoJson_ID64/ArduinoJson.h @@ -0,0 +1,5 @@ +// ArduinoJson - arduinojson.org +// Copyright Benoit Blanchon 2014-2019 +// MIT License + +#include "src/ArduinoJson.h" diff --git a/.pio/libdeps/development/ArduinoJson_ID64/CHANGELOG.md b/.pio/libdeps/development/ArduinoJson_ID64/CHANGELOG.md new file mode 100644 index 000000000..088e7f6d3 --- /dev/null +++ b/.pio/libdeps/development/ArduinoJson_ID64/CHANGELOG.md @@ -0,0 +1,760 @@ +ArduinoJson: change log +======================= + +v6.10.0 (2019-03-22) +------- + +* Fixed an integer overflow in the JSON deserializer +* Added overflow handling in `JsonVariant::as()` and `JsonVariant::is()`. + - `as()` returns `0` if the integer `T` overflows + - `is()` returns `false` if the integer `T` overflows +* Added `BasicJsonDocument` to support custom allocator (issue #876) +* Added `JsonDocument::containsKey()` (issue #938) +* Added `JsonVariant::containsKey()` + +v6.9.1 (2019-03-01) +------ + +* Fixed warning "unused variable" with GCC 4.4 (issue #912) +* Fixed warning "cast increases required alignment" (issue #914) +* Fixed warning "conversion may alter value" (issue #914) +* Fixed naming conflict with "CAPACITY" (issue #839) +* Muted warning "will change in GCC 7.1" (issue #914) +* Added a clear error message for `StaticJsonBuffer` and `DynamicJsonBuffer` +* Marked ArduinoJson.h as a "system header" + +v6.9.0 (2019-02-26) +------ + +* Decode escaped Unicode characters like \u00DE (issue #304, PR #791) + Many thanks to Daniel Schulte (aka @trilader) who implemented this feature. +* Added option ARDUINOJSON_DECODE_UNICODE to enable it +* Converted `JsonArray::copyFrom()/copyTo()` to free functions `copyArray()` +* Renamed `JsonArray::copyFrom()` and `JsonObject::copyFrom()` to `set()` +* Renamed `JsonArray::get()` to `getElement()` +* Renamed `JsonArray::add()` (without arg) to `addElement()` +* Renamed `JsonObject::get()` to `getMember()` +* Renamed `JsonObject::getOrCreate()` to `getOrAddMember()` +* Fixed `JsonVariant::isNull()` not returning `true` after `set((char*)0)` +* Fixed segfault after `variant.set(serialized((char*)0))` +* Detect `IncompleteInput` in `false`, `true`, and `null` +* Added `JsonDocument::size()` +* Added `JsonDocument::remove()` +* Added `JsonVariant::clear()` +* Added `JsonVariant::remove()` + +v6.8.0-beta (2019-01-30) +----------- + +* Import functions in the ArduinoJson namespace to get clearer errors +* Improved syntax highlighting in Arduino IDE +* Removed default capacity of `DynamicJsonDocument` +* `JsonArray::copyFrom()` accepts `JsonArrayConst` +* `JsonVariant::set()` accepts `JsonArrayConst` and `JsonObjectConst` +* `JsonDocument` was missing in the ArduinoJson namespace +* Added `memoryUsage()` to `JsonArray`, `JsonObject`, and `JsonVariant` +* Added `nesting()` to `JsonArray`, `JsonDocument`, `JsonObject`, and `JsonVariant` +* Replaced `JsonDocument::nestingLimit` with an additional parameter + to `deserializeJson()` and `deserializeMsgPack()` +* Fixed uninitialized variant in `JsonDocument` +* Fixed `StaticJsonDocument` copy constructor and copy assignment +* The copy constructor of `DynamicJsonDocument` chooses the capacity according to the memory usage of the source, not from the capacity of the source. +* Added the ability to create/assign a `StaticJsonDocument`/`DynamicJsonDocument` from a `JsonArray`/`JsonObject`/`JsonVariant` +* Added `JsonDocument::isNull()` +* Added `JsonDocument::operator[]` +* Added `ARDUINOJSON_TAB` to configure the indentation character +* Reduced the size of the pretty JSON serializer +* Added `add()`, `createNestedArray()` and `createNestedObject()` to `JsonVariant` +* `JsonVariant` automatically promotes to `JsonObject` or `JsonArray` on write. + Calling `JsonVariant::to()` is not required anymore. +* `JsonDocument` now support the same operations as `JsonVariant`. + Calling `JsonDocument::as()` is not required anymore. +* Fixed example `JsonHttpClient.ino` +* User can now use a `JsonString` as a key or a value + +> ### BREAKING CHANGES +> +> #### `DynamicJsonDocument`'s constructor +> +> The parameter to the constructor of `DynamicJsonDocument` is now mandatory +> +> Old code: +> +> ```c++ +> DynamicJsonDocument doc; +> ``` +> +> New code: +> +> ```c++ +> DynamicJsonDocument doc(1024); +> ``` +> +> #### Nesting limit +> +> `JsonDocument::nestingLimit` was replaced with a new parameter to `deserializeJson()` and `deserializeMsgPack()`. +> +> Old code: +> +> ```c++ +> doc.nestingLimit = 15; +> deserializeJson(doc, input); +> ``` +> +> New code: +> +> ```c++ +> deserializeJson(doc, input, DeserializationOption::NestingLimit(15)); +> ``` + +v6.7.0-beta (2018-12-07) +----------- + +* Removed the automatic expansion of `DynamicJsonDocument`, it now has a fixed capacity. +* Restored the monotonic allocator because the code was getting too big +* Reduced the memory usage +* Reduced the code size +* Renamed `JsonKey` to `JsonString` +* Removed spurious files in the Particle library + +v6.6.0-beta (2018-11-13) +----------- + +* Removed `JsonArray::is(i)` and `JsonArray::set(i,v)` +* Removed `JsonObject::is(k)` and `JsonObject::set(k,v)` +* Replaced `T JsonArray::get(i)` with `JsonVariant JsonArray::get(i)` +* Replaced `T JsonObject::get(k)` with `JsonVariant JsonObject::get(k)` +* Added `JSON_STRING_SIZE()` +* ~~Replacing or removing a value now releases the memory~~ +* Added `DeserializationError::code()` to be used in switch statements (issue #846) + +v6.5.0-beta (2018-10-13) +----------- + +* Added implicit conversion from `JsonArray` and `JsonObject` to `JsonVariant` +* Allow mixed configuration in compilation units (issue #809) +* Fixed object keys not being duplicated +* `JsonPair::key()` now returns a `JsonKey` +* Increased the default capacity of `DynamicJsonDocument` +* Fixed `JsonVariant::is()` (closes #763) +* Added `JsonArrayConst`, `JsonObjectConst`, and `JsonVariantConst` +* Added copy-constructor and copy-assignment-operator for `JsonDocument` (issue #827) + +v6.4.0-beta (2018-09-11) +----------- + +* Copy `JsonArray` and `JsonObject`, instead of storing pointers (issue #780) +* Added `JsonVariant::to()` and `JsonVariant::to()` + +v6.3.0-beta (2018-08-31) +----------- + +* Implemented reference semantics for `JsonVariant` +* Replaced `JsonPair`'s `key` and `value` with `key()` and `value()` +* Fixed `serializeJson(obj[key], dst)` (issue #794) + +> ### BREAKING CHANGES +> +> #### JsonVariant +> +> `JsonVariant` now has a semantic similar to `JsonObject` and `JsonArray`. +> It's a reference to a value stored in the `JsonDocument`. +> As a consequence, a `JsonVariant` cannot be used as a standalone variable anymore. +> +> Old code: +> +> ```c++ +> JsonVariant myValue = 42; +> ``` +> +> New code: +> +> ```c++ +> DynamicJsonDocument doc; +> JsonVariant myValue = doc.to(); +> myValue.set(42); +> ``` +> +> #### JsonPair +> +> Old code: +> +> ```c++ +> for(JsonPair p : myObject) { +> Serial.println(p.key); +> Serial.println(p.value.as()); +> } +> ``` +> +> New code: +> +> ```c++ +> for(JsonPair p : myObject) { +> Serial.println(p.key()); +> Serial.println(p.value().as()); +> } +> ``` +> +> CAUTION: the key is now read only! + +v6.2.3-beta (2018-07-19) +----------- + +* Fixed exception when using Flash strings as object keys (issue #784) + +v6.2.2-beta (2018-07-18) +----------- + +* Fixed `invalid application of 'sizeof' to incomplete type '__FlashStringHelper'` (issue #783) +* Fixed `char[]` not duplicated when passed to `JsonVariant::operator[]` + +v6.2.1-beta (2018-07-17) +----------- + +* Fixed `JsonObject` not inserting keys of type `String` (issue #782) + +v6.2.0-beta (2018-07-12) +----------- + +* Disabled lazy number deserialization (issue #772) +* Fixed `JsonVariant::is()` that returned true for empty strings +* Improved float serialization when `-fsingle-precision-constant` is used +* Renamed function `RawJson()` to `serialized()` +* `serializeMsgPack()` now supports values marked with `serialized()` + +> ### BREAKING CHANGES +> +> #### Non quoted strings +> +> Non quoted strings are now forbidden in values, but they are still allowed in keys. +> For example, `{key:"value"}` is accepted, but `{key:value}` is not. +> +> #### Preformatted values +> +> Old code: +> +> ```c++ +> object["values"] = RawJson("[1,2,3,4]"); +> ``` +> +> New code: +> +> ```c++ +> object["values"] = serialized("[1,2,3,4]"); +> ``` + +v6.1.0-beta (2018-07-02) +----------- + +* Return `JsonArray` and `JsonObject` by value instead of reference (issue #309) +* Replaced `success()` with `isNull()` + +> ### BREAKING CHANGES +> +> Old code: +> +> ```c++ +> JsonObject& obj = doc.to(); +> JsonArray& arr = obj.createNestedArray("key"); +> if (!arr.success()) { +> Serial.println("Not enough memory"); +> return; +> } +> ``` +> +> New code: +> +> ```c++ +> JsonObject obj = doc.to(); +> JsonArray arr = obj.createNestedArray("key"); +> if (arr.isNull()) { +> Serial.println("Not enough memory"); +> return; +> } +> ``` + +v6.0.1-beta (2018-06-11) +----------- + +* Fixed conflicts with `isnan()` and `isinf()` macros (issue #752) + +v6.0.0-beta (2018-06-07) +----------- + +* Added `DynamicJsonDocument` and `StaticJsonDocument` +* Added `deserializeJson()` +* Added `serializeJson()` and `serializeJsonPretty()` +* Added `measureJson()` and `measureJsonPretty()` +* Added `serializeMsgPack()`, `deserializeMsgPack()` and `measureMsgPack()` (issue #358) +* Added example `MsgPackParser.ino` (issue #358) +* Added support for non zero-terminated strings (issue #704) +* Removed `JsonBuffer::parseArray()`, `parseObject()` and `parse()` +* Removed `JsonBuffer::createArray()` and `createObject()` +* Removed `printTo()` and `prettyPrintTo()` +* Removed `measureLength()` and `measurePrettyLength()` +* Removed all deprecated features + +> ### BREAKING CHANGES +> +> #### Deserialization +> +> Old code: +> +> ```c++ +> DynamicJsonBuffer jb; +> JsonObject& obj = jb.parseObject(json); +> if (obj.success()) { +> +> } +> ``` +> +> New code: +> +> ```c++ +> DynamicJsonDocument doc; +> DeserializationError error = deserializeJson(doc, json); +> if (error) { +> +> } +> JsonObject& obj = doc.as(); +> ``` +> +> #### Serialization +> +> Old code: +> +> ```c++ +> DynamicJsonBuffer jb; +> JsonObject& obj = jb.createObject(); +> obj["key"] = "value"; +> obj.printTo(Serial); +> ``` +> +> New code: +> +> ```c++ +> DynamicJsonDocument obj; +> JsonObject& obj = doc.to(); +> obj["key"] = "value"; +> serializeJson(doc, Serial); +> ``` + +v5.13.2 +------- + +* Fixed `JsonBuffer::parse()` not respecting nesting limit correctly (issue #693) +* Fixed inconsistencies in nesting level counting (PR #695 from Zhenyu Wu) +* Fixed null values that could be pass to `strcmp()` (PR #745 from Mike Karlesky) +* Added macros `ARDUINOJSON_VERSION`, `ARDUINOJSON_VERSION_MAJOR`... + +v5.13.1 +------- + +* Fixed `JsonVariant::operator|(int)` that returned the default value if the variant contained a double (issue #675) +* Allowed non-quoted key to contain underscores (issue #665) + +v5.13.0 +------- + +* Changed the rules of string duplication (issue #658) +* `RawJson()` accepts any kind of string and obeys to the same rules for duplication +* Changed the return type of `strdup()` to `const char*` to prevent double duplication +* Marked `strdup()` as deprecated + +> ### New rules for string duplication +> +> | type | duplication | +> |:---------------------------|:------------| +> | const char* | no | +> | char* | ~~no~~ yes | +> | String | yes | +> | std::string | yes | +> | const __FlashStringHelper* | yes | +> +> These new rules make `JsonBuffer::strdup()` useless. + +v5.12.0 +------- + +* Added `JsonVariant::operator|` to return a default value (see below) +* Added a clear error message when compiled as C instead of C++ (issue #629) +* Added detection of MPLAB XC compiler (issue #629) +* Added detection of Keil ARM Compiler (issue #629) +* Added an example that shows how to save and load a configuration file +* Reworked all other examples + +> ### How to use the new feature? +> +> If you have a block like this: +> +> ```c++ +> const char* ssid = root["ssid"]; +> if (!ssid) +> ssid = "default ssid"; +> ``` +> +> You can simplify like that: +> +> ```c++ +> const char* ssid = root["ssid"] | "default ssid"; +> ``` + +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 +------ + +* Fixed an access violation in `DynamicJsonBuffer` when memory allocation fails (issue #433) +* Added operators `==` and `!=` for two `JsonVariant`s (issue #436) +* Fixed `JsonVariant::operator[const FlashStringHelper*]` (issue #441) + +v5.8.2 +------ + +* Fixed parsing of comments (issue #421) +* Fixed ignored `Stream` timeout (issue #422) +* Made sure we don't read more that necessary (issue #422) +* Fixed error when the key of a `JsonObject` is a `char[]` (issue #423) +* Reduced code size when using `const` references +* Fixed error with string of type `unsigned char*` (issue #428) +* Added `deprecated` attribute on `asArray()`, `asObject()` and `asString()` (issue #420) + +v5.8.1 +------ + +* Fixed error when assigning a `volatile int` to a `JsonVariant` (issue #415) +* Fixed errors with Variable Length Arrays (issue #416) +* Fixed error when both `ARDUINOJSON_ENABLE_STD_STREAM` and `ARDUINOJSON_ENABLE_ARDUINO_STREAM` are set to `1` +* Fixed error "Stream does not name a type" (issue #412) + +v5.8.0 +------ + +* Added operator `==` to compare `JsonVariant` and strings (issue #402) +* Added support for `Stream` (issue #300) +* Reduced memory consumption by not duplicating spaces and comments + +> ### BREAKING CHANGES :warning: +> +> `JsonBuffer::parseObject()` and `JsonBuffer::parseArray()` have been pulled down to the derived classes `DynamicJsonBuffer` and `StaticJsonBufferBase`. +> +> This means that if you have code like: +> +> ```c++ +> void myFunction(JsonBuffer& jsonBuffer); +> ``` +> +> you need to replace it with one of the following: +> +> ```c++ +> void myFunction(DynamicJsonBuffer& jsonBuffer); +> void myFunction(StaticJsonBufferBase& jsonBuffer); +> template void myFunction(TJsonBuffer& jsonBuffer); +> ``` + +v5.7.3 +------ + +* Added an `printTo(char[N])` and `prettyPrintTo(char[N])` (issue #292) +* Added ability to set a nested value like this: `root["A"]["B"] = "C"` (issue #352) +* Renamed `*.ipp` to `*Impl.hpp` because they were ignored by Arduino IDE (issue #396) + +v5.7.2 +------ + +* Made PROGMEM available on more platforms (issue #381) +* Fixed PROGMEM causing an exception on ESP8266 (issue #383) + +v5.7.1 +------ + +* Added support for PROGMEM (issue #76) +* Fixed compilation error when index is not an `int` (issue #381) + +v5.7.0 +------ + +* Templatized all functions using `String` or `std::string` +* Removed `ArduinoJson::String` +* Removed `JsonVariant::defaultValue()` +* Removed non-template `JsonObject::get()` and `JsonArray.get()` +* Fixed support for `StringSumHelper` (issue #184) +* Replaced `ARDUINOJSON_USE_ARDUINO_STRING` by `ARDUINOJSON_ENABLE_STD_STRING` and `ARDUINOJSON_ENABLE_ARDUINO_STRING` (issue #378) +* 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 :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. +> +> Old code: +> +> ```c++ +> #define ARDUINOJSON_USE_ARDUINO_STRING 0 +> JsonVariant value1 = myObject.get("myKey"); +> JsonVariant value2 = myArray.get(0); +> ``` +> +> New code: +> +> ```c++ +> #define ARDUINOJSON_ENABLE_ARDUINO_STRING 0 +> #define ARDUINOJSON_ENABLE_STD_STRING 1 +> JsonVariant value1 = myObject.get("myKey"); +> JsonVariant value2 = myArray.get(0); +> ``` + +v5.6.7 +------ + +* Fixed `array[idx].as()` and `object[key].as()` +* Fixed return value of `JsonObject::set()` (issue #350) +* Fixed undefined behavior in `Prettyfier` and `Print` (issue #354) +* Fixed parser that incorrectly rejected floats containing a `+` (issue #349) + +v5.6.6 +------ + +* Fixed `-Wparentheses` warning introduced in v5.6.5 (PR #335 by @nuket) +* Added `.mbedignore` for ARM mbdeb (PR #334 by @nuket) +* Fixed `JsonVariant::success()` which didn't propagate `JsonArray::success()` nor `JsonObject::success()` (issue #342). + +v5.6.5 +------ + +* `as()` now returns `true` when input is `null` (issue #330) + +v5.6.4 +------ + +* Fixed error in float serialization (issue #324) + +v5.6.3 +------ + +* Improved speed of float serialization (about twice faster) +* Added `as()` as a synonym for `as()`... (issue #291) +* Fixed `call of overloaded isinf(double&) is ambiguous` (issue #284) + +v5.6.2 +------ + +* Fixed build when another lib does `#undef isnan` (issue #284) + +v5.6.1 +------ + +* Added missing `#pragma once` (issue #310) + +v5.6.0 +------ + +* ArduinoJson is now a header-only library (issue #199) + +v5.5.1 +------ + +* Fixed compilation error with Intel Galileo (issue #299) + +v5.5.0 +------ + +* Added `JsonVariant::success()` (issue #279) +* Renamed `JsonVariant::invalid()` to `JsonVariant::defaultValue()` + +v5.4.0 +------ + +* Changed `::String` to `ArduinoJson::String` (issue #275) +* Changed `::Print` to `ArduinoJson::Print` too + +v5.3.0 +------ + +* Added custom implementation of `ftoa` (issues #266, #267, #269 and #270) +* Added `JsonVariant JsonBuffer::parse()` (issue #265) +* Fixed `unsigned long` printed as `signed long` (issue #170) + +v5.2.0 +------ + +* Added `JsonVariant::as()` as a synonym for `JsonVariant::as()` (issue #257) +* Added example `JsonHttpClient` (issue #256) +* Added `JsonArray::copyTo()` and `JsonArray::copyFrom()` (issue #254) +* Added `RawJson()` to insert pregenerated JSON portions (issue #259) + +v5.1.1 +------ + +* Removed `String` duplication when one replaces a value in a `JsonObject` (PR #232 by @ulion) + +v5.1.0 +------ + +* Added support of `long long` (issue #171) +* Moved all build settings to `ArduinoJson/Configuration.hpp` + +> ### BREAKING CHANGE :warning: +> +> If you defined `ARDUINOJSON_ENABLE_STD_STREAM`, you now need to define it to `1`. + +v5.0.8 +------ + +* Made the library compatible with [PlatformIO](http://platformio.org/) (issue #181) +* Fixed `JsonVariant::is()` that was incorrectly returning false (issue #214) + +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 :warning: +> +> - `JsonVariant(true).as()` now returns `"true"` instead of `"1"` +> - `JsonVariant(false).as()` now returns `"false"` instead of `"0"` + +v5.0.6 +------ + +* Added parameter to `DynamicJsonBuffer` constructor to set initial size (issue #152) +* Fixed warning about library category in Arduino 1.6.6 (issue #147) +* Examples: Added a loop to wait for serial port to be ready (issue #156) + +v5.0.5 +------ + +* Added overload `JsonObjectSuscript::set(value, decimals)` (issue #143) +* Use `float` instead of `double` to reduce the size of `JsonVariant` (issue #134) + +v5.0.4 +------ + +* Fixed ambiguous overload with `JsonArraySubscript` and `JsonObjectSubscript` (issue #122) + +v5.0.3 +------ + +* Fixed `printTo(String)` which wrote numbers instead of strings (issue #120) +* Fixed return type of `JsonArray::is()` and some others (issue #121) + +v5.0.2 +------ + +* Fixed segmentation fault in `parseObject(String)` and `parseArray(String)`, when the + `StaticJsonBuffer` is too small to hold a copy of the string +* Fixed Clang warning "register specifier is deprecated" (issue #102) +* Fixed GCC warning "declaration shadows a member" (issue #103) +* Fixed memory alignment, which made ESP8266 crash (issue #104) +* Fixed compilation on Visual Studio 2010 and 2012 (issue #107) + +v5.0.1 +------ + +* Fixed compilation with Arduino 1.0.6 (issue #99) + +v5.0.0 +------ + +* Added support of `String` class (issues #55, #56, #70, #77) +* Added `JsonBuffer::strdup()` to make a copy of a string (issues #10, #57) +* Implicitly call `strdup()` for `String` but not for `char*` (issues #84, #87) +* Added support of non standard JSON input (issue #44) +* Added support of comments in JSON input (issue #88) +* Added implicit cast between numerical types (issues #64, #69, #93) +* Added ability to read number values as string (issue #90) +* 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 :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()` + +**Personal note about the `String` class**: +Support of the `String` class has been added to the library because many people use it in their programs. +However, you should not see this as an invitation to use the `String` class. +The `String` class is **bad** because it uses dynamic memory allocation. +Compared to static allocation, it compiles to a bigger, slower program, and is less predictable. +You certainly don't want that in an embedded environment! diff --git a/.pio/libdeps/development/ArduinoJson_ID64/CMakeLists.txt b/.pio/libdeps/development/ArduinoJson_ID64/CMakeLists.txt new file mode 100644 index 000000000..1ef4459f9 --- /dev/null +++ b/.pio/libdeps/development/ArduinoJson_ID64/CMakeLists.txt @@ -0,0 +1,22 @@ +# ArduinoJson - arduinojson.org +# Copyright Benoit Blanchon 2014-2019 +# MIT License + +cmake_minimum_required(VERSION 3.0) +project(ArduinoJson) + +enable_testing() + +add_definitions(-DARDUINOJSON_DEBUG) +if(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang)") + add_compile_options(-g -O0) +endif() + +if(${COVERAGE}) + set(CMAKE_CXX_FLAGS "-fprofile-arcs -ftest-coverage") +endif() + +include_directories(${CMAKE_CURRENT_LIST_DIR}/src) +add_subdirectory(third-party/catch) +add_subdirectory(test) +add_subdirectory(fuzzing) diff --git a/.pio/libdeps/development/ArduinoJson_ID64/CONTRIBUTING.md b/.pio/libdeps/development/ArduinoJson_ID64/CONTRIBUTING.md new file mode 100644 index 000000000..5d4b96cf9 --- /dev/null +++ b/.pio/libdeps/development/ArduinoJson_ID64/CONTRIBUTING.md @@ -0,0 +1,11 @@ +# Contribution to ArduinoJson + +First, thank you for taking the time to contribute to this project. + +You can submit changes via GitHub Pull Requests. + +Please: + +1. Unit test every change in behavior +2. Use clang-format in "file" mode to format the code +3. Consider using the Continuous Integration (Travis and AppVeyor) diff --git a/.pio/libdeps/development/ArduinoJson_ID64/LICENSE.md b/.pio/libdeps/development/ArduinoJson_ID64/LICENSE.md new file mode 100644 index 000000000..b5c35fc44 --- /dev/null +++ b/.pio/libdeps/development/ArduinoJson_ID64/LICENSE.md @@ -0,0 +1,10 @@ +The MIT License (MIT) +--------------------- + +Copyright © 2014-2019 Benoit BLANCHON + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/.pio/libdeps/development/ArduinoJson_ID64/README.md b/.pio/libdeps/development/ArduinoJson_ID64/README.md new file mode 100644 index 000000000..e5600796d --- /dev/null +++ b/.pio/libdeps/development/ArduinoJson_ID64/README.md @@ -0,0 +1,115 @@ +![ArduinoJson](banner.svg) + +--- + +[![arduino-library-badge](https://www.ardu-badge.com/badge/ArduinoJson.svg?version=6.10.0)](https://www.ardu-badge.com/ArduinoJson/6.10.0) +[![Build Status](https://ci.appveyor.com/api/projects/status/m7s53wav1l0abssg/branch/6.x?svg=true)](https://ci.appveyor.com/project/bblanchon/arduinojson/branch/6.x) +[![Build Status](https://travis-ci.org/bblanchon/ArduinoJson.svg?branch=6.x)](https://travis-ci.org/bblanchon/ArduinoJson) +[![Coverage Status](https://coveralls.io/repos/github/bblanchon/ArduinoJson/badge.svg?branch=6.x)](https://coveralls.io/github/bblanchon/ArduinoJson?branch=6.x) +[![Star this project](http://githubbadges.com/star.svg?user=bblanchon&repo=ArduinoJson&style=flat&color=fff&background=007ec6)](https://github.com/bblanchon/ArduinoJson) + +ArduinoJson is a C++ JSON library for Arduino and IoT (Internet Of Things). + +## Features + +* JSON decoding (comments are supported) +* JSON encoding (with optional indentation) +* MessagePack +* Elegant API, easy to use +* Fixed memory allocation (zero malloc) +* No data duplication (zero copy) +* Portable (written in C++98, can be used in any C++ project) +* Self-contained (no external dependency) +* Small footprint +* Input and output streams +* [100% code coverage](https://coveralls.io/github/bblanchon/ArduinoJson) +* [Header-only library](https://en.wikipedia.org/wiki/Header-only) +* [MIT License](https://en.wikipedia.org/wiki/MIT_License) +* [Comprehensive documentation](https://arduinojson.org?utm_source=github&utm_medium=readme) + +## Compatibility + +ArduinoJson works on the following hardware: + +* Arduino boards: [Uno](https://www.arduino.cc/en/Main/ArduinoBoardUno), [Due](https://www.arduino.cc/en/Main/ArduinoBoardDue), [Mini](https://www.arduino.cc/en/Main/ArduinoBoardMini), [Micro](https://www.arduino.cc/en/Main/ArduinoBoardMicro), [Yun](https://www.arduino.cc/en/Main/ArduinoBoardYun)... +* Espressif chips: [ESP8266](https://en.wikipedia.org/wiki/ESP8266), [ESP32](https://en.wikipedia.org/wiki/ESP32) +* WeMos boards: [D1](https://wiki.wemos.cc/products:d1:d1), [D1 mini](https://wiki.wemos.cc/products:d1:d1_mini), ... +* RedBearLab boards: [BLE Nano](http://redbearlab.com/blenano/), [BLE Mini](http://redbearlab.com/blemini/), [WiFi Micro](https://redbear.cc/product/wifi/wifi-micro.html), [LOLIN32](https://wiki.wemos.cc/products:lolin32:lolin32)... +* [Teensy](https://www.pjrc.com/teensy/) boards +* Intel boards: Edison, Galileo... +* Particle boards: [Photon](https://www.particle.io/products/hardware/photon-wifi-dev-kit), [Electron](https://www.particle.io/products/hardware/electron-cellular-dev-kit)... +* Texas Instruments boards: [MSP430](http://www.ti.com/microcontrollers/msp430-ultra-low-power-mcus/overview/overview.html)... + +ArduinoJson compiles with zero warning on the following compilers, IDEs, and platforms: + +* [Arduino IDE](https://www.arduino.cc/en/Main/Software) +* [PlatformIO](http://platformio.org/) +* [Energia](http://energia.nu/) +* [Visual Micro](http://www.visualmicro.com/) +* [Atmel Studio](http://www.atmel.com/microsite/atmel-studio/) +* [IAR Embedded Workbench](https://www.iar.com/iar-embedded-workbench/) +* [Atollic TrueSTUDIO](https://atollic.com/truestudio/) +* [Keil uVision](http://www.keil.com/) +* [MPLAB X IDE](http://www.microchip.com/mplab/mplab-x-ide) +* [GCC](https://gcc.gnu.org/) +* [Clang](https://clang.llvm.org/) +* [Visual Studio](https://www.visualstudio.com/) + +## Quickstart + +### Deserialization + +Here is a program that parses a JSON document with ArduinoJson. + +```c++ +char json[] = "{\"sensor\":\"gps\",\"time\":1351824120,\"data\":[48.756080,2.302038]}"; + +DynamicJsonDocument doc(1024); +deserializeJson(doc, json); + +JsonObjectRef root = doc.as(); +const char* sensor = root["sensor"]; +long time = root["time"]; +double latitude = root["data"][0]; +double longitude = root["data"][1]; +``` + +See the [tutorial on arduinojson.org](https://arduinojson.org/doc/decoding/?utm_source=github&utm_medium=readme) + +### Serialization + +Here is a program that generates a JSON document with ArduinoJson: + +```c++ +DynamicJsonDocument doc(1024); + +JsonObject root = doc.to(); +root["sensor"] = "gps"; +root["time"] = 1351824120; + +JsonArray data = root.createNestedArray("data"); +data.add(48.756080); +data.add(2.302038); + +serializeJson(doc, Serial); +// This prints: +// {"sensor":"gps","time":1351824120,"data":[48.756080,2.302038]} +``` + +See the [tutorial on arduinojson.org](https://arduinojson.org/doc/encoding/?utm_source=github&utm_medium=readme) + +## Documentation + +The documentation is available on [arduinojson.org](https://arduinojson.org/?utm_source=github&utm_medium=readme), here are some shortcuts: + +* The [Examples](https://arduinojson.org/example/?utm_source=github&utm_medium=readme) show how to use the library in various situations. +* The [API Reference](https://arduinojson.org/api/?utm_source=github&utm_medium=readme) contains the description of each class and function. +* The [FAQ](https://arduinojson.org/faq/?utm_source=github&utm_medium=readme) has the answer to virtually every question. +* The [ArduinoJson Assistant](https://arduinojson.org/assistant/?utm_source=github&utm_medium=readme) writes programs for you! + +--- + +Do you like this library? Please [star this project on GitHub](https://github.com/bblanchon/ArduinoJson/stargazers)! + +What? You don't like it but you *love* it? +We don't take donations anymore, but [we sell a book](https://arduinojson.org/book/?utm_source=github&utm_medium=readme), so you can help and learn at the same time! diff --git a/.pio/libdeps/development/ArduinoJson_ID64/SUPPORT.md b/.pio/libdeps/development/ArduinoJson_ID64/SUPPORT.md new file mode 100644 index 000000000..c47e1b1ba --- /dev/null +++ b/.pio/libdeps/development/ArduinoJson_ID64/SUPPORT.md @@ -0,0 +1,27 @@ +# ArduinoJson Support + +First off, thank you very much for using ArduinoJson. + +We'll be very happy to help you, but first please read the following. + +## Before asking for help + +1. Read the [FAQ](https://arduinojson.org/faq/?utm_source=github&utm_medium=support) +2. Search in the [API Reference](https://arduinojson.org/api/?utm_source=github&utm_medium=support) + +If you did not find the answer, please create a [new issue on GitHub](https://github.com/bblanchon/ArduinoJson/issues/new). + +It is OK to add a comment to a currently opened issue, but please avoid adding comments to a closed issue. + +## Before hitting the Submit button + +Please provide all the relevant information: + +* Good title +* Short description of the problem +* Target platform +* Compiler model and version +* [MVCE](https://stackoverflow.com/help/mcve) +* Compiler output + +Good questions get fast answers! diff --git a/.pio/libdeps/development/ArduinoJson_ID64/appveyor.yml b/.pio/libdeps/development/ArduinoJson_ID64/appveyor.yml new file mode 100644 index 000000000..35c80d77b --- /dev/null +++ b/.pio/libdeps/development/ArduinoJson_ID64/appveyor.yml @@ -0,0 +1,20 @@ +version: 6.9.1.{build} +environment: + matrix: + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 + CMAKE_GENERATOR: Visual Studio 15 2017 + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 + CMAKE_GENERATOR: Visual Studio 14 2015 + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013 + CMAKE_GENERATOR: Visual Studio 12 2013 + - CMAKE_GENERATOR: Visual Studio 11 2012 + - CMAKE_GENERATOR: Visual Studio 10 2010 + - CMAKE_GENERATOR: MinGW Makefiles +configuration: Debug +before_build: +- set PATH=C:\MinGW\bin;%PATH:C:\Program Files\Git\usr\bin;=% # Workaround for CMake not wanting sh.exe on PATH for MinGW +- cmake -DCMAKE_BUILD_TYPE=%CONFIGURATION% -G "%CMAKE_GENERATOR%" . +build_script: +- cmake --build . --config %CONFIGURATION% +test_script: +- ctest --output-on-failure . diff --git a/.pio/libdeps/development/ArduinoJson_ID64/banner.svg b/.pio/libdeps/development/ArduinoJson_ID64/banner.svg new file mode 100644 index 000000000..517609625 --- /dev/null +++ b/.pio/libdeps/development/ArduinoJson_ID64/banner.svg @@ -0,0 +1,367 @@ + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.pio/libdeps/development/ArduinoJson_ID64/examples/JsonConfigFile/JsonConfigFile.ino b/.pio/libdeps/development/ArduinoJson_ID64/examples/JsonConfigFile/JsonConfigFile.ino new file mode 100644 index 000000000..39c96ab89 --- /dev/null +++ b/.pio/libdeps/development/ArduinoJson_ID64/examples/JsonConfigFile/JsonConfigFile.ino @@ -0,0 +1,146 @@ +// ArduinoJson - arduinojson.org +// Copyright Benoit Blanchon 2014-2019 +// MIT License +// +// This example shows how to store your project configuration in a file. +// It uses the SD library but can be easily modified for any other file-system. +// +// The file contains a JSON document with the following content: +// { +// "hostname": "examples.com", +// "port": 2731 +// } +// +// https://arduinojson.org/v6/example/config/ + +#include +#include +#include + +// Our configuration structure. +// +// Never use a JsonDocument to store the configuration! +// A JsonDocument is *not* a permanent storage; it's only a temporary storage +// used during the serialization phase. +struct Config { + char hostname[64]; + int port; +}; + +const char *filename = "/config.txt"; // <- SD library uses 8.3 filenames +Config config; // <- global configuration object + +// Loads the configuration from a file +void loadConfiguration(const char *filename, Config &config) { + // Open file for reading + File file = SD.open(filename); + + // Allocate a temporary JsonDocument + // Don't forget to change the capacity to match your requirements. + // Use arduinojson.org/v6/assistant to compute the capacity. + StaticJsonDocument<512> doc; + + // Deserialize the JSON document + DeserializationError error = deserializeJson(doc, file); + if (error) + Serial.println(F("Failed to read file, using default configuration")); + + // Copy values from the JsonDocument to the Config + config.port = doc["port"] | 2731; + strlcpy(config.hostname, // <- destination + doc["hostname"] | "example.com", // <- source + sizeof(config.hostname)); // <- destination's capacity + + // Close the file (Curiously, File's destructor doesn't close the file) + file.close(); +} + +// Saves the configuration to a file +void saveConfiguration(const char *filename, const Config &config) { + // Delete existing file, otherwise the configuration is appended to the file + SD.remove(filename); + + // Open file for writing + File file = SD.open(filename, FILE_WRITE); + if (!file) { + Serial.println(F("Failed to create file")); + return; + } + + // Allocate a temporary JsonDocument + // Don't forget to change the capacity to match your requirements. + // Use arduinojson.org/assistant to compute the capacity. + StaticJsonDocument<256> doc; + + // Set the values in the document + doc["hostname"] = config.hostname; + doc["port"] = config.port; + + // Serialize JSON to file + if (serializeJson(doc, file) == 0) { + Serial.println(F("Failed to write to file")); + } + + // Close the file + file.close(); +} + +// Prints the content of a file to the Serial +void printFile(const char *filename) { + // Open file for reading + File file = SD.open(filename); + if (!file) { + Serial.println(F("Failed to read file")); + return; + } + + // Extract each characters by one by one + while (file.available()) { + Serial.print((char)file.read()); + } + Serial.println(); + + // Close the file + file.close(); +} + +void setup() { + // Initialize serial port + Serial.begin(9600); + while (!Serial) continue; + + // Initialize SD library + while (!SD.begin()) { + Serial.println(F("Failed to initialize SD library")); + delay(1000); + } + + // Should load default config if run for the first time + Serial.println(F("Loading configuration...")); + loadConfiguration(filename, config); + + // Create configuration file + Serial.println(F("Saving configuration...")); + saveConfiguration(filename, config); + + // Dump config file + Serial.println(F("Print config file...")); + printFile(filename); +} + +void loop() { + // not used in this example +} + +// See also +// -------- +// +// https://arduinojson.org/ contains the documentation for all the functions +// used above. It also includes an FAQ that will help you solve any +// serialization or deserialization problem. +// +// The book "Mastering ArduinoJson" contains a case study of a project that has +// a complex configuration with nested members. +// Contrary to this example, the project in the book uses the SPIFFS filesystem. +// Learn more at https://arduinojson.org/book/ +// Use the coupon code TWENTY for a 20% discount ❤❤❤❤❤ diff --git a/.pio/libdeps/development/ArduinoJson_ID64/examples/JsonGeneratorExample/JsonGeneratorExample.ino b/.pio/libdeps/development/ArduinoJson_ID64/examples/JsonGeneratorExample/JsonGeneratorExample.ino new file mode 100644 index 000000000..a86be835d --- /dev/null +++ b/.pio/libdeps/development/ArduinoJson_ID64/examples/JsonGeneratorExample/JsonGeneratorExample.ino @@ -0,0 +1,77 @@ +// ArduinoJson - arduinojson.org +// Copyright Benoit Blanchon 2014-2019 +// MIT License +// +// This example shows how to generate a JSON document with ArduinoJson. +// +// https://arduinojson.org/v6/example/generator/ + +#include + +void setup() { + // Initialize Serial port + Serial.begin(9600); + while (!Serial) continue; + + // Allocate the JSON document + // + // Inside the brackets, 200 is the RAM allocated to this document. + // Don't forget to change this value to match your requirement. + // Use arduinojson.org/v6/assistant to compute the capacity. + StaticJsonDocument<200> doc; + + // StaticJsonObject allocates memory on the stack, it can be + // replaced by DynamicJsonDocument which allocates in the heap. + // + // DynamicJsonDocument doc(200); + + // Add values in the document + // + doc["sensor"] = "gps"; + doc["time"] = 1351824120; + + // Add an array. + // + JsonArray data = doc.createNestedArray("data"); + data.add(48.756080); + data.add(2.302038); + + // Generate the minified JSON and send it to the Serial port. + // + serializeJson(doc, Serial); + // The above line prints: + // {"sensor":"gps","time":1351824120,"data":[48.756080,2.302038]} + + // Start a new line + Serial.println(); + + // Generate the prettified JSON and send it to the Serial port. + // + serializeJsonPretty(doc, Serial); + // The above line prints: + // { + // "sensor": "gps", + // "time": 1351824120, + // "data": [ + // 48.756080, + // 2.302038 + // ] + // } +} + +void loop() { + // not used in this example +} + +// See also +// -------- +// +// https://arduinojson.org/ contains the documentation for all the functions +// used above. It also includes an FAQ that will help you solve any +// serialization problem. +// +// The book "Mastering ArduinoJson" contains a tutorial on serialization. +// It begins with a simple example, like the one above, and then adds more +// features like serializing directly to a file or an HTTP request. +// Learn more at https://arduinojson.org/book/ +// Use the coupon code TWENTY for a 20% discount ❤❤❤❤❤ diff --git a/.pio/libdeps/development/ArduinoJson_ID64/examples/JsonHttpClient/JsonHttpClient.ino b/.pio/libdeps/development/ArduinoJson_ID64/examples/JsonHttpClient/JsonHttpClient.ino new file mode 100644 index 000000000..0af6188c2 --- /dev/null +++ b/.pio/libdeps/development/ArduinoJson_ID64/examples/JsonHttpClient/JsonHttpClient.ino @@ -0,0 +1,115 @@ +// ArduinoJson - arduinojson.org +// Copyright Benoit Blanchon 2014-2019 +// MIT License +// +// This example shows how to parse a JSON document in an HTTP response. +// It uses the Ethernet library, but can be easily adapted for Wifi. +// +// It performs a GET resquest on arduinojson.org/example.json +// Here is the expected response: +// { +// "sensor": "gps", +// "time": 1351824120, +// "data": [ +// 48.756080, +// 2.302038 +// ] +// } +// +// https://arduinojson.org/v6/example/http-client/ + +#include +#include +#include + +void setup() { + // Initialize Serial port + Serial.begin(9600); + while (!Serial) continue; + + // Initialize Ethernet library + byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED}; + if (!Ethernet.begin(mac)) { + Serial.println(F("Failed to configure Ethernet")); + return; + } + delay(1000); + + Serial.println(F("Connecting...")); + + // Connect to HTTP server + EthernetClient client; + client.setTimeout(10000); + if (!client.connect("arduinojson.org", 80)) { + Serial.println(F("Connection failed")); + return; + } + + Serial.println(F("Connected!")); + + // Send HTTP request + client.println(F("GET /example.json HTTP/1.0")); + client.println(F("Host: arduinojson.org")); + client.println(F("Connection: close")); + if (client.println() == 0) { + Serial.println(F("Failed to send request")); + return; + } + + // Check HTTP status + char status[32] = {0}; + client.readBytesUntil('\r', status, sizeof(status)); + if (strcmp(status, "HTTP/1.1 200 OK") != 0) { + Serial.print(F("Unexpected response: ")); + Serial.println(status); + return; + } + + // Skip HTTP headers + char endOfHeaders[] = "\r\n\r\n"; + if (!client.find(endOfHeaders)) { + Serial.println(F("Invalid response")); + return; + } + + // Allocate the JSON document + // Use arduinojson.org/v6/assistant to compute the capacity. + const size_t capacity = JSON_OBJECT_SIZE(3) + JSON_ARRAY_SIZE(2) + 60; + DynamicJsonDocument doc(capacity); + + // Parse JSON object + DeserializationError error = deserializeJson(doc, client); + if (error) { + Serial.print(F("deserializeJson() failed: ")); + Serial.println(error.c_str()); + return; + } + + // Extract values + Serial.println(F("Response:")); + Serial.println(doc["sensor"].as()); + Serial.println(doc["time"].as()); + Serial.println(doc["data"][0].as(), 6); + Serial.println(doc["data"][1].as(), 6); + + // Disconnect + client.stop(); +} + +void loop() { + // not used in this example +} + +// See also +// -------- +// +// https://arduinojson.org/ contains the documentation for all the functions +// used above. It also includes an FAQ that will help you solve any +// serialization problem. +// +// The book "Mastering ArduinoJson" contains a tutorial on deserialization +// showing how to parse the response from GitHub's API. In the last chapter, +// it shows how to parse the huge documents from OpenWeatherMap +// and Reddit. +// Learn more at https://arduinojson.org/book/ +// Use the coupon code TWENTY for a 20% discount ❤❤❤❤❤ diff --git a/.pio/libdeps/development/ArduinoJson_ID64/examples/JsonParserExample/JsonParserExample.ino b/.pio/libdeps/development/ArduinoJson_ID64/examples/JsonParserExample/JsonParserExample.ino new file mode 100644 index 000000000..5ef26cff4 --- /dev/null +++ b/.pio/libdeps/development/ArduinoJson_ID64/examples/JsonParserExample/JsonParserExample.ino @@ -0,0 +1,80 @@ +// ArduinoJson - arduinojson.org +// Copyright Benoit Blanchon 2014-2019 +// MIT License +// +// This example shows how to deserialize a JSON document with ArduinoJson. +// +// https://arduinojson.org/v6/example/parser/ + +#include + +void setup() { + // Initialize serial port + Serial.begin(9600); + while (!Serial) continue; + + // Allocate the JSON document + // + // Inside the brackets, 200 is the capacity of the memory pool in bytes. + // Don't forget to change this value to match your JSON document. + // Use arduinojson.org/v6/assistant to compute the capacity. + StaticJsonDocument<200> doc; + + // StaticJsonDocument allocates memory on the stack, it can be + // replaced by DynamicJsonDocument which allocates in the heap. + // + // DynamicJsonDocument doc(200); + + // JSON input string. + // + // Using a char[], as shown here, enables the "zero-copy" mode. This mode uses + // the minimal amount of memory because the JsonDocument stores pointers to + // the input buffer. + // If you use another type of input, ArduinoJson must copy the strings from + // the input to the JsonDocument, so you need to increase the capacity of the + // JsonDocument. + char json[] = + "{\"sensor\":\"gps\",\"time\":1351824120,\"data\":[48.756080,2.302038]}"; + + // Deserialize the JSON document + DeserializationError error = deserializeJson(doc, json); + + // Test if parsing succeeds. + if (error) { + Serial.print(F("deserializeJson() failed: ")); + Serial.println(error.c_str()); + return; + } + + // Fetch values. + // + // Most of the time, you can rely on the implicit casts. + // In other case, you can do doc["time"].as(); + const char* sensor = doc["sensor"]; + long time = doc["time"]; + double latitude = doc["data"][0]; + double longitude = doc["data"][1]; + + // Print values. + Serial.println(sensor); + Serial.println(time); + Serial.println(latitude, 6); + Serial.println(longitude, 6); +} + +void loop() { + // not used in this example +} + +// See also +// -------- +// +// https://arduinojson.org/ contains the documentation for all the functions +// used above. It also includes an FAQ that will help you solve any +// deserialization problem. +// +// The book "Mastering ArduinoJson" contains a tutorial on deserialization. +// It begins with a simple example, like the one above, and then adds more +// features like deserializing directly from a file or an HTTP request. +// Learn more at https://arduinojson.org/book/ +// Use the coupon code TWENTY for a 20% discount ❤❤❤❤❤ diff --git a/.pio/libdeps/development/ArduinoJson_ID64/examples/JsonServer/JsonServer.ino b/.pio/libdeps/development/ArduinoJson_ID64/examples/JsonServer/JsonServer.ino new file mode 100644 index 000000000..9d2cc58a4 --- /dev/null +++ b/.pio/libdeps/development/ArduinoJson_ID64/examples/JsonServer/JsonServer.ino @@ -0,0 +1,110 @@ +// ArduinoJson - arduinojson.org +// Copyright Benoit Blanchon 2014-2019 +// MIT License +// +// This example shows how to implement an HTTP server that sends a JSON document +// in the response. +// It uses the Ethernet library but can be easily adapted for Wifi. +// +// The JSON document contains the values of the analog and digital pins. +// It looks like that: +// { +// "analog": [0, 76, 123, 158, 192, 205], +// "digital": [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0] +// } +// +// https://arduinojson.org/v6/example/http-server/ + +#include +#include +#include + +byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED}; +EthernetServer server(80); + +void setup() { + // Initialize serial port + Serial.begin(9600); + while (!Serial) continue; + + // Initialize Ethernet libary + if (!Ethernet.begin(mac)) { + Serial.println(F("Failed to initialize Ethernet library")); + return; + } + + // Start to listen + server.begin(); + + Serial.println(F("Server is ready.")); + Serial.print(F("Please connect to http://")); + Serial.println(Ethernet.localIP()); +} + +void loop() { + // Wait for an incomming connection + EthernetClient client = server.available(); + + // Do we have a client? + if (!client) return; + + Serial.println(F("New client")); + + // Read the request (we ignore the content in this example) + while (client.available()) client.read(); + + // Allocate a temporary JsonDocument + // Use arduinojson.org/v6/assistant to compute the capacity. + StaticJsonDocument<500> doc; + + // Create the "analog" array + JsonArray analogValues = doc.createNestedArray("analog"); + for (int pin = 0; pin < 6; pin++) { + // Read the analog input + int value = analogRead(pin); + + // Add the value at the end of the array + analogValues.add(value); + } + + // Create the "digital" array + JsonArray digitalValues = doc.createNestedArray("digital"); + for (int pin = 0; pin < 14; pin++) { + // Read the digital input + int value = digitalRead(pin); + + // Add the value at the end of the array + digitalValues.add(value); + } + + Serial.print(F("Sending: ")); + serializeJson(doc, Serial); + Serial.println(); + + // Write response headers + client.println(F("HTTP/1.0 200 OK")); + client.println(F("Content-Type: application/json")); + client.println(F("Connection: close")); + client.print(F("Content-Length: ")); + client.println(measureJsonPretty(doc)); + client.println(); + + // Write JSON document + serializeJsonPretty(doc, client); + + // Disconnect + client.stop(); +} + +// See also +// -------- +// +// https://arduinojson.org/ contains the documentation for all the functions +// used above. It also includes an FAQ that will help you solve any +// serialization problem. +// +// The book "Mastering ArduinoJson" contains a tutorial on serialization. +// It begins with a simple example, then adds more features like serializing +// directly to a file or an HTTP client. +// Learn more at https://arduinojson.org/book/ +// Use the coupon code TWENTY for a 20% discount ❤❤❤❤❤ diff --git a/.pio/libdeps/development/ArduinoJson_ID64/examples/JsonUdpBeacon/JsonUdpBeacon.ino b/.pio/libdeps/development/ArduinoJson_ID64/examples/JsonUdpBeacon/JsonUdpBeacon.ino new file mode 100644 index 000000000..0514fe4b7 --- /dev/null +++ b/.pio/libdeps/development/ArduinoJson_ID64/examples/JsonUdpBeacon/JsonUdpBeacon.ino @@ -0,0 +1,100 @@ +// ArduinoJson - arduinojson.org +// Copyright Benoit Blanchon 2014-2019 +// MIT License +// +// This example shows how to send a JSON document to a UDP socket. +// At regular interval, it sends a UDP packet that contains the status of +// analog and digital pins. +// It looks like that: +// { +// "analog": [0, 76, 123, 158, 192, 205], +// "digital": [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0] +// } +// +// If you want to test this program, you need to be able to receive the UDP +// packets. +// For example, you can run netcat on your computer +// $ ncat -ulp 8888 +// See https://nmap.org/ncat/ +// +// https://arduinojson.org/v6/example/udp-beacon/ + +#include +#include +#include + +byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED}; +IPAddress remoteIp(192, 168, 0, 108); // <- EDIT!!!! +unsigned short remotePort = 8888; +unsigned short localPort = 8888; +EthernetUDP udp; + +void setup() { + // Initialize serial port + Serial.begin(9600); + while (!Serial) continue; + + // Initialize Ethernet libary + if (!Ethernet.begin(mac)) { + Serial.println(F("Failed to initialize Ethernet library")); + return; + } + + // Enable UDP + udp.begin(localPort); +} + +void loop() { + // Allocate a temporary JsonDocument + // Use arduinojson.org/v6/assistant to compute the capacity. + StaticJsonDocument<500> doc; + + // Create the "analog" array + JsonArray analogValues = doc.createNestedArray("analog"); + for (int pin = 0; pin < 6; pin++) { + // Read the analog input + int value = analogRead(pin); + + // Add the value at the end of the array + analogValues.add(value); + } + + // Create the "digital" array + JsonArray digitalValues = doc.createNestedArray("digital"); + for (int pin = 0; pin < 14; pin++) { + // Read the digital input + int value = digitalRead(pin); + + // Add the value at the end of the array + digitalValues.add(value); + } + + // Log + Serial.print(F("Sending to ")); + Serial.print(remoteIp); + Serial.print(F(" on port ")); + Serial.println(remotePort); + serializeJson(doc, Serial); + + // Send UDP packet + udp.beginPacket(remoteIp, remotePort); + serializeJson(doc, udp); + udp.println(); + udp.endPacket(); + + // Wait + delay(10000); +} + +// See also +// -------- +// +// https://arduinojson.org/ contains the documentation for all the functions +// used above. It also includes an FAQ that will help you solve any +// serialization problem. +// +// The book "Mastering ArduinoJson" contains a tutorial on serialization. +// It begins with a simple example, then adds more features like serializing +// directly to a file or any stream. +// Learn more at https://arduinojson.org/book/ +// Use the coupon code TWENTY for a 20% discount ❤❤❤❤❤ diff --git a/.pio/libdeps/development/ArduinoJson_ID64/examples/MsgPackParser/MsgPackParser.ino b/.pio/libdeps/development/ArduinoJson_ID64/examples/MsgPackParser/MsgPackParser.ino new file mode 100644 index 000000000..d149e3977 --- /dev/null +++ b/.pio/libdeps/development/ArduinoJson_ID64/examples/MsgPackParser/MsgPackParser.ino @@ -0,0 +1,75 @@ +// ArduinoJson - arduinojson.org +// Copyright Benoit Blanchon 2014-2019 +// MIT License +// +// This example shows how to deserialize a MessagePack document with +// ArduinoJson. +// +// https://arduinojson.org/v6/example/msgpack-parser/ + +#include + +void setup() { + // Initialize serial port + Serial.begin(9600); + while (!Serial) continue; + + // Allocate the JSON document + // + // Inside the brackets, 200 is the capacity of the memory pool in bytes. + // Don't forget to change this value to match your JSON document. + // Use arduinojson.org/v6/assistant to compute the capacity. + StaticJsonDocument<200> doc; + + // StaticJsonObject allocates memory on the stack, it can be + // replaced by DynamicJsonObject which allocates in the heap. + // + // DynamicJsonObject doc(200); + + // MessagePack input string. + // + // Using a char[], as shown here, enables the "zero-copy" mode. This mode uses + // the minimal amount of memory because the JsonDocument stores pointers to + // the input buffer. + // If you use another type of input, ArduinoJson must copy the strings from + // the input to the JsonDocument, so you need to increase the capacity of the + // JsonDocument. + uint8_t input[] = {131, 166, 115, 101, 110, 115, 111, 114, 163, 103, 112, 115, + 164, 116, 105, 109, 101, 206, 80, 147, 50, 248, 164, 100, + 97, 116, 97, 146, 203, 64, 72, 96, 199, 58, 188, 148, + 112, 203, 64, 2, 106, 146, 230, 33, 49, 169}; + // This MessagePack document contains: + // { + // "sensor": "gps", + // "time": 1351824120, + // "data": [48.75608, 2.302038] + // } + + DeserializationError error = deserializeMsgPack(doc, input); + + // Test if parsing succeeded. + if (error) { + Serial.print("deserializeMsgPack() failed: "); + Serial.println(error.c_str()); + return; + } + + // Fetch values. + // + // Most of the time, you can rely on the implicit casts. + // In other case, you can do doc["time"].as(); + const char* sensor = doc["sensor"]; + long time = doc["time"]; + double latitude = doc["data"][0]; + double longitude = doc["data"][1]; + + // Print values. + Serial.println(sensor); + Serial.println(time); + Serial.println(latitude, 6); + Serial.println(longitude, 6); +} + +void loop() { + // not used in this example +} diff --git a/.pio/libdeps/development/ArduinoJson_ID64/examples/ProgmemExample/ProgmemExample.ino b/.pio/libdeps/development/ArduinoJson_ID64/examples/ProgmemExample/ProgmemExample.ino new file mode 100644 index 000000000..310a820cc --- /dev/null +++ b/.pio/libdeps/development/ArduinoJson_ID64/examples/ProgmemExample/ProgmemExample.ino @@ -0,0 +1,72 @@ +// ArduinoJson - arduinojson.org +// Copyright Benoit Blanchon 2014-2019 +// MIT License +// +// This example shows the different ways you can use Flash strings with +// ArduinoJson. +// +// Use Flash strings sparingly, because ArduinoJson duplicates them in the +// JsonDocument. Prefer plain old char*, as they are more efficient in term of +// code size, speed, and memory usage. +// +// https://arduinojson.org/v6/example/progmem/ + +#include + +void setup() { +#ifdef PROGMEM // <- check that Flash strings are supported + + DynamicJsonDocument doc(1024); + + // You can use a Flash String as your JSON input. + // WARNING: the strings in the input will be duplicated in the JsonDocument. + deserializeJson(doc, F("{\"sensor\":\"gps\",\"time\":1351824120," + "\"data\":[48.756080,2.302038]}")); + JsonObject obj = doc.as(); + + // You can use a Flash String to get an element of a JsonObject + // No duplication is done. + long time = obj[F("time")]; + + // You can use a Flash String to set an element of a JsonObject + // WARNING: the content of the Flash String will be duplicated in the + // JsonDocument. + obj[F("time")] = time; + + // You can set a Flash String to a JsonObject or JsonArray: + // WARNING: the content of the Flash String will be duplicated in the + // JsonDocument. + obj["sensor"] = F("gps"); + + // It works with serialized() too: + obj["sensor"] = serialized(F("\"gps\"")); + obj["sensor"] = serialized(F("\xA3gps"), 3); + + // You can compare the content of a JsonVariant to a Flash String + if (obj["sensor"] == F("gps")) { + // ... + } + +#else + +#warning PROGMEM is not supported on this platform + +#endif +} + +void loop() { + // not used in this example +} + +// See also +// -------- +// +// https://arduinojson.org/ contains the documentation for all the functions +// used above. It also includes an FAQ that will help you solve any memory +// problem. +// +// The book "Mastering ArduinoJson" contains a quick C++ course that explains +// how your microcontroller stores strings in memory. It also tells why you +// should not abuse Flash strings with ArduinoJson. +// Learn more at https://arduinojson.org/book/ +// Use the coupon code TWENTY for a 20% discount ❤❤❤❤❤ diff --git a/.pio/libdeps/development/ArduinoJson_ID64/examples/StringExample/StringExample.ino b/.pio/libdeps/development/ArduinoJson_ID64/examples/StringExample/StringExample.ino new file mode 100644 index 000000000..040f8e463 --- /dev/null +++ b/.pio/libdeps/development/ArduinoJson_ID64/examples/StringExample/StringExample.ino @@ -0,0 +1,77 @@ +// ArduinoJson - arduinojson.org +// Copyright Benoit Blanchon 2014-2019 +// MIT License +// +// This example shows the different ways you can use String with ArduinoJson. +// +// Use String objects sparingly, because ArduinoJson duplicates them in the +// JsonDocument. Prefer plain old char[], as they are more efficient in term of +// code size, speed, and memory usage. +// +// https://arduinojson.org/v6/example/string/ + +#include + +void setup() { + DynamicJsonDocument doc(1024); + + // You can use a String as your JSON input. + // WARNING: the string in the input will be duplicated in the JsonDocument. + String input = + "{\"sensor\":\"gps\",\"time\":1351824120,\"data\":[48.756080,2.302038]}"; + deserializeJson(doc, input); + JsonObject obj = doc.as(); + + // You can use a String to get an element of a JsonObject + // No duplication is done. + long time = obj[String("time")]; + + // You can use a String to set an element of a JsonObject + // WARNING: the content of the String will be duplicated in the JsonDocument. + obj[String("time")] = time; + + // You can get a String from a JsonObject or JsonArray: + // No duplication is done, at least not in the JsonDocument. + String sensor = obj["sensor"]; + + // Unfortunately, the following doesn't work (issue #118): + // sensor = obj["sensor"]; // <- error "ambiguous overload for 'operator='" + // As a workaround, you need to replace by: + sensor = obj["sensor"].as(); + + // You can set a String to a JsonObject or JsonArray: + // WARNING: the content of the String will be duplicated in the JsonDocument. + obj["sensor"] = sensor; + + // It works with serialized() too: + obj["sensor"] = serialized(sensor); + + // You can also concatenate strings + // WARNING: the content of the String will be duplicated in the JsonDocument. + obj[String("sen") + "sor"] = String("gp") + "s"; + + // You can compare the content of a JsonObject with a String + if (obj["sensor"] == sensor) { + // ... + } + + // Lastly, you can print the resulting JSON to a String + String output; + serializeJson(doc, output); +} + +void loop() { + // not used in this example +} + +// See also +// -------- +// +// https://arduinojson.org/ contains the documentation for all the functions +// used above. It also includes an FAQ that will help you solve any problem. +// +// The book "Mastering ArduinoJson" contains a quick C++ course that explains +// how your microcontroller stores strings in memory. On several occasions, it +// shows how you can avoid String in your program. +// Learn more at https://arduinojson.org/book/ +// Use the coupon code TWENTY for a 20% discount ❤❤❤❤❤ diff --git a/.pio/libdeps/development/ArduinoJson_ID64/keywords.txt b/.pio/libdeps/development/ArduinoJson_ID64/keywords.txt new file mode 100644 index 000000000..7dc2b8073 --- /dev/null +++ b/.pio/libdeps/development/ArduinoJson_ID64/keywords.txt @@ -0,0 +1,36 @@ +# Macros +JSON_ARRAY_SIZE KEYWORD2 +JSON_OBJECT_SIZE KEYWORD2 +JSON_STRING_SIZE KEYWORD2 + +# Free functions +deserializeJson KEYWORD2 +deserializeMsgPack KEYWORD2 +serialized KEYWORD2 +serializeJson KEYWORD2 +serializeJsonPretty KEYWORD2 +serializeMsgPack KEYWORD2 + +# Methods +add KEYWORD2 +as KEYWORD2 +createNestedArray KEYWORD2 +createNestedObject KEYWORD2 +get KEYWORD2 +set KEYWORD2 +to KEYWORD2 + +# Type names +DeserializationError KEYWORD1 DATA_TYPE +DynamicJsonDocument KEYWORD1 DATA_TYPE +JsonArray KEYWORD1 DATA_TYPE +JsonArrayConst KEYWORD1 DATA_TYPE +JsonFloat KEYWORD1 DATA_TYPE +JsonInteger KEYWORD1 DATA_TYPE +JsonObject KEYWORD1 DATA_TYPE +JsonObjectConst KEYWORD1 DATA_TYPE +JsonString KEYWORD1 DATA_TYPE +JsonUInt KEYWORD1 DATA_TYPE +JsonVariant KEYWORD1 DATA_TYPE +JsonVariantConst KEYWORD1 DATA_TYPE +StaticJsonDocument KEYWORD1 DATA_TYPE diff --git a/.pio/libdeps/development/ArduinoJson_ID64/library.json b/.pio/libdeps/development/ArduinoJson_ID64/library.json new file mode 100644 index 000000000..3ce67a39b --- /dev/null +++ b/.pio/libdeps/development/ArduinoJson_ID64/library.json @@ -0,0 +1,23 @@ +{ + "name": "ArduinoJson", + "keywords": "json, rest, http, web", + "description": "An elegant and efficient JSON library for embedded systems", + "homepage": "https://arduinojson.org/?utm_source=meta&utm_medium=library.json", + "repository": { + "type": "git", + "url": "https://github.com/bblanchon/ArduinoJson.git" + }, + "version": "6.10.0", + "authors": { + "name": "Benoit Blanchon", + "url": "https://blog.benoitblanchon.fr" + }, + "exclude": [ + "fuzzing", + "scripts", + "test", + "third-party" + ], + "frameworks": "arduino", + "platforms": "*" +} diff --git a/.pio/libdeps/development/ArduinoJson_ID64/library.properties b/.pio/libdeps/development/ArduinoJson_ID64/library.properties new file mode 100644 index 000000000..549f0b8b6 --- /dev/null +++ b/.pio/libdeps/development/ArduinoJson_ID64/library.properties @@ -0,0 +1,11 @@ +name=ArduinoJson +version=6.10.0 +author=Benoit Blanchon +maintainer=Benoit Blanchon +sentence=An efficient and elegant JSON library for Arduino. +paragraph=ArduinoJson supports ✔ serialization, ✔ deserialization, ✔ MessagePack, ✔ fixed allocation, ✔ zero-copy, ✔ streams, and more. It is the most popular Arduino library on GitHub ❤❤❤❤❤. Check out arduinojson.org for a comprehensive documentation. +category=Data Processing +url=https://arduinojson.org/?utm_source=meta&utm_medium=library.properties +architectures=* +repository=https://github.com/bblanchon/ArduinoJson.git +license=MIT diff --git a/.pio/libdeps/development/ArduinoJson_ID64/src/ArduinoJson.h b/.pio/libdeps/development/ArduinoJson_ID64/src/ArduinoJson.h new file mode 100644 index 000000000..3e29f397c --- /dev/null +++ b/.pio/libdeps/development/ArduinoJson_ID64/src/ArduinoJson.h @@ -0,0 +1,17 @@ +// ArduinoJson - arduinojson.org +// Copyright Benoit Blanchon 2014-2019 +// MIT License + +#pragma once + +#ifdef __cplusplus + +#include "ArduinoJson.hpp" + +using namespace ArduinoJson; + +#else + +#error ArduinoJson requires a C++ compiler, please change file extension to .cc or .cpp + +#endif diff --git a/.pio/libdeps/development/ArduinoJson_ID64/src/ArduinoJson.hpp b/.pio/libdeps/development/ArduinoJson_ID64/src/ArduinoJson.hpp new file mode 100644 index 000000000..cb3704ee6 --- /dev/null +++ b/.pio/libdeps/development/ArduinoJson_ID64/src/ArduinoJson.hpp @@ -0,0 +1,69 @@ +// ArduinoJson - arduinojson.org +// Copyright Benoit Blanchon 2014-2019 +// MIT License + +#pragma once + +#ifndef ARDUINOJSON_DEBUG +#ifdef __clang__ +#pragma clang system_header +#elif defined __GNUC__ +#pragma GCC system_header +#endif +#endif + +#include "ArduinoJson/Namespace.hpp" + +#include "ArduinoJson/Array/ArrayRef.hpp" +#include "ArduinoJson/Object/ObjectRef.hpp" +#include "ArduinoJson/Variant/VariantRef.hpp" + +#include "ArduinoJson/Document/DynamicJsonDocument.hpp" +#include "ArduinoJson/Document/StaticJsonDocument.hpp" + +#include "ArduinoJson/Array/ArrayImpl.hpp" +#include "ArduinoJson/Array/ElementProxy.hpp" +#include "ArduinoJson/Array/Utilities.hpp" +#include "ArduinoJson/Collection/CollectionImpl.hpp" +#include "ArduinoJson/Object/MemberProxy.hpp" +#include "ArduinoJson/Object/ObjectImpl.hpp" +#include "ArduinoJson/Variant/VariantAsImpl.hpp" +#include "ArduinoJson/Variant/VariantImpl.hpp" + +#include "ArduinoJson/Json/JsonDeserializer.hpp" +#include "ArduinoJson/Json/JsonSerializer.hpp" +#include "ArduinoJson/Json/PrettyJsonSerializer.hpp" +#include "ArduinoJson/MsgPack/MsgPackDeserializer.hpp" +#include "ArduinoJson/MsgPack/MsgPackSerializer.hpp" + +#include "ArduinoJson/compatibility.hpp" + +namespace ArduinoJson { +typedef ARDUINOJSON_NAMESPACE::ArrayConstRef JsonArrayConst; +typedef ARDUINOJSON_NAMESPACE::ArrayRef JsonArray; +typedef ARDUINOJSON_NAMESPACE::Float JsonFloat; +typedef ARDUINOJSON_NAMESPACE::Integer JsonInteger; +typedef ARDUINOJSON_NAMESPACE::ObjectConstRef JsonObjectConst; +typedef ARDUINOJSON_NAMESPACE::ObjectRef JsonObject; +typedef ARDUINOJSON_NAMESPACE::Pair JsonPair; +typedef ARDUINOJSON_NAMESPACE::String JsonString; +typedef ARDUINOJSON_NAMESPACE::UInt JsonUInt; +typedef ARDUINOJSON_NAMESPACE::VariantConstRef JsonVariantConst; +typedef ARDUINOJSON_NAMESPACE::VariantRef JsonVariant; +using ARDUINOJSON_NAMESPACE::BasicJsonDocument; +using ARDUINOJSON_NAMESPACE::copyArray; +using ARDUINOJSON_NAMESPACE::DeserializationError; +using ARDUINOJSON_NAMESPACE::deserializeJson; +using ARDUINOJSON_NAMESPACE::deserializeMsgPack; +using ARDUINOJSON_NAMESPACE::DynamicJsonDocument; +using ARDUINOJSON_NAMESPACE::JsonDocument; +using ARDUINOJSON_NAMESPACE::serialized; +using ARDUINOJSON_NAMESPACE::serializeJson; +using ARDUINOJSON_NAMESPACE::serializeJsonPretty; +using ARDUINOJSON_NAMESPACE::serializeMsgPack; +using ARDUINOJSON_NAMESPACE::StaticJsonDocument; + +namespace DeserializationOption { +using ARDUINOJSON_NAMESPACE::NestingLimit; +} +} // namespace ArduinoJson diff --git a/.pio/libdeps/development/ArduinoJson_ID64/src/ArduinoJson/Array/ArrayFunctions.hpp b/.pio/libdeps/development/ArduinoJson_ID64/src/ArduinoJson/Array/ArrayFunctions.hpp new file mode 100644 index 000000000..ec0dedd4b --- /dev/null +++ b/.pio/libdeps/development/ArduinoJson_ID64/src/ArduinoJson/Array/ArrayFunctions.hpp @@ -0,0 +1,29 @@ +// ArduinoJson - arduinojson.org +// Copyright Benoit Blanchon 2014-2019 +// MIT License + +#pragma once + +#include "../Collection/CollectionData.hpp" + +namespace ARDUINOJSON_NAMESPACE { + +inline VariantData *arrayAdd(CollectionData *arr, MemoryPool *pool) { + return arr ? arr->add(pool) : 0; +} + +template +inline void arrayAccept(const CollectionData *arr, Visitor &visitor) { + if (arr) + visitor.visitArray(*arr); + else + visitor.visitNull(); +} + +inline bool arrayEquals(const CollectionData *lhs, const CollectionData *rhs) { + if (lhs == rhs) return true; + if (!lhs || !rhs) return false; + + return lhs->equalsArray(*rhs); +} +} // namespace ARDUINOJSON_NAMESPACE diff --git a/.pio/libdeps/development/ArduinoJson_ID64/src/ArduinoJson/Array/ArrayImpl.hpp b/.pio/libdeps/development/ArduinoJson_ID64/src/ArduinoJson/Array/ArrayImpl.hpp new file mode 100644 index 000000000..df0149277 --- /dev/null +++ b/.pio/libdeps/development/ArduinoJson_ID64/src/ArduinoJson/Array/ArrayImpl.hpp @@ -0,0 +1,22 @@ +// ArduinoJson - arduinojson.org +// Copyright Benoit Blanchon 2014-2019 +// MIT License + +#pragma once + +#include "../Object/ObjectRef.hpp" +#include "ArrayRef.hpp" + +namespace ARDUINOJSON_NAMESPACE { + +template +inline ArrayRef ArrayShortcuts::createNestedArray() const { + return impl()->addElement().template to(); +} + +template +inline ObjectRef ArrayShortcuts::createNestedObject() const { + return impl()->addElement().template to(); +} + +} // namespace ARDUINOJSON_NAMESPACE diff --git a/.pio/libdeps/development/ArduinoJson_ID64/src/ArduinoJson/Array/ArrayIterator.hpp b/.pio/libdeps/development/ArduinoJson_ID64/src/ArduinoJson/Array/ArrayIterator.hpp new file mode 100644 index 000000000..c1d6096ff --- /dev/null +++ b/.pio/libdeps/development/ArduinoJson_ID64/src/ArduinoJson/Array/ArrayIterator.hpp @@ -0,0 +1,121 @@ +// ArduinoJson - arduinojson.org +// Copyright Benoit Blanchon 2014-2019 +// MIT License + +#pragma once + +#include "../Variant/SlotFunctions.hpp" +#include "../Variant/VariantRef.hpp" + +namespace ARDUINOJSON_NAMESPACE { + +class VariantPtr { + public: + VariantPtr(MemoryPool *pool, VariantData *data) : _variant(pool, data) {} + + VariantRef *operator->() { + return &_variant; + } + + VariantRef &operator*() { + return _variant; + } + + private: + VariantRef _variant; +}; + +class ArrayIterator { + public: + ArrayIterator() : _slot(0) {} + explicit ArrayIterator(MemoryPool *pool, VariantSlot *slot) + : _pool(pool), _slot(slot) {} + + VariantRef operator*() const { + return VariantRef(_pool, _slot->data()); + } + VariantPtr operator->() { + return VariantPtr(_pool, _slot->data()); + } + + bool operator==(const ArrayIterator &other) const { + return _slot == other._slot; + } + + bool operator!=(const ArrayIterator &other) const { + return _slot != other._slot; + } + + ArrayIterator &operator++() { + _slot = _slot->next(); + return *this; + } + + ArrayIterator &operator+=(size_t distance) { + _slot = _slot->next(distance); + return *this; + } + + VariantSlot *internal() { + return _slot; + } + + private: + MemoryPool *_pool; + VariantSlot *_slot; +}; + +class VariantConstPtr { + public: + VariantConstPtr(const VariantData *data) : _variant(data) {} + + VariantConstRef *operator->() { + return &_variant; + } + + VariantConstRef &operator*() { + return _variant; + } + + private: + VariantConstRef _variant; +}; + +class ArrayConstRefIterator { + public: + ArrayConstRefIterator() : _slot(0) {} + explicit ArrayConstRefIterator(const VariantSlot *slot) : _slot(slot) {} + + VariantConstRef operator*() const { + return VariantConstRef(_slot->data()); + } + VariantConstPtr operator->() { + return VariantConstPtr(_slot->data()); + } + + bool operator==(const ArrayConstRefIterator &other) const { + return _slot == other._slot; + } + + bool operator!=(const ArrayConstRefIterator &other) const { + return _slot != other._slot; + } + + ArrayConstRefIterator &operator++() { + _slot = _slot->next(); + return *this; + } + + ArrayConstRefIterator &operator+=(size_t distance) { + _slot = _slot->next(distance); + return *this; + } + + const VariantSlot *internal() { + return _slot; + } + + private: + const VariantSlot *_slot; +}; +} // namespace ARDUINOJSON_NAMESPACE diff --git a/.pio/libdeps/development/ArduinoJson_ID64/src/ArduinoJson/Array/ArrayRef.hpp b/.pio/libdeps/development/ArduinoJson_ID64/src/ArduinoJson/Array/ArrayRef.hpp new file mode 100644 index 000000000..e34b62335 --- /dev/null +++ b/.pio/libdeps/development/ArduinoJson_ID64/src/ArduinoJson/Array/ArrayRef.hpp @@ -0,0 +1,153 @@ +// ArduinoJson - arduinojson.org +// Copyright Benoit Blanchon 2014-2019 +// MIT License + +#pragma once + +#include "../Variant/VariantData.hpp" +#include "ArrayFunctions.hpp" +#include "ArrayIterator.hpp" + +// Returns the size (in bytes) of an array with n elements. +// Can be very handy to determine the size of a StaticMemoryPool. +#define JSON_ARRAY_SIZE(NUMBER_OF_ELEMENTS) \ + ((NUMBER_OF_ELEMENTS) * sizeof(ARDUINOJSON_NAMESPACE::VariantSlot)) + +namespace ARDUINOJSON_NAMESPACE { + +class ObjectRef; +template +class ElementProxy; + +template +class ArrayRefBase { + public: + operator VariantConstRef() const { + const void* data = _data; // prevent warning cast-align + return VariantConstRef(reinterpret_cast(data)); + } + + template + FORCE_INLINE void accept(Visitor& visitor) const { + arrayAccept(_data, visitor); + } + + FORCE_INLINE bool isNull() const { + return _data == 0; + } + + FORCE_INLINE size_t memoryUsage() const { + return _data ? _data->memoryUsage() : 0; + } + + FORCE_INLINE size_t nesting() const { + return _data ? _data->nesting() : 0; + } + + FORCE_INLINE size_t size() const { + return _data ? _data->size() : 0; + } + + protected: + ArrayRefBase(TData* data) : _data(data) {} + TData* _data; +}; + +class ArrayConstRef : public ArrayRefBase, + public Visitable { + friend class ArrayRef; + typedef ArrayRefBase base_type; + + public: + typedef ArrayConstRefIterator iterator; + + FORCE_INLINE iterator begin() const { + if (!_data) return iterator(); + return iterator(_data->head()); + } + + FORCE_INLINE iterator end() const { + return iterator(); + } + + FORCE_INLINE ArrayConstRef() : base_type(0) {} + FORCE_INLINE ArrayConstRef(const CollectionData* data) : base_type(data) {} + + FORCE_INLINE bool operator==(ArrayConstRef rhs) const { + return arrayEquals(_data, rhs._data); + } + + FORCE_INLINE VariantConstRef operator[](size_t index) const { + return getElement(index); + } + + FORCE_INLINE VariantConstRef getElement(size_t index) const { + return VariantConstRef(_data ? _data->get(index) : 0); + } +}; + +class ArrayRef : public ArrayRefBase, + public ArrayShortcuts, + public Visitable { + typedef ArrayRefBase base_type; + + public: + typedef ArrayIterator iterator; + + FORCE_INLINE ArrayRef() : base_type(0), _pool(0) {} + FORCE_INLINE ArrayRef(MemoryPool* pool, CollectionData* data) + : base_type(data), _pool(pool) {} + + operator VariantRef() { + void* data = _data; // prevent warning cast-align + return VariantRef(_pool, reinterpret_cast(data)); + } + + operator ArrayConstRef() const { + return ArrayConstRef(_data); + } + + VariantRef addElement() const { + return VariantRef(_pool, arrayAdd(_data, _pool)); + } + + FORCE_INLINE iterator begin() const { + if (!_data) return iterator(); + return iterator(_pool, _data->head()); + } + + FORCE_INLINE iterator end() const { + return iterator(); + } + + // Copy a ArrayRef + FORCE_INLINE bool set(ArrayConstRef src) const { + if (!_data || !src._data) return false; + return _data->copyFrom(*src._data, _pool); + } + + FORCE_INLINE bool operator==(ArrayRef rhs) const { + return arrayEquals(_data, rhs._data); + } + + // Gets the value at the specified index. + FORCE_INLINE VariantRef getElement(size_t index) const { + return VariantRef(_pool, _data ? _data->get(index) : 0); + } + + // Removes element at specified position. + FORCE_INLINE void remove(iterator it) const { + if (!_data) return; + _data->remove(it.internal()); + } + + // Removes element at specified index. + FORCE_INLINE void remove(size_t index) const { + if (!_data) return; + _data->remove(index); + } + + private: + MemoryPool* _pool; +}; +} // namespace ARDUINOJSON_NAMESPACE diff --git a/.pio/libdeps/development/ArduinoJson_ID64/src/ArduinoJson/Array/ArrayShortcuts.hpp b/.pio/libdeps/development/ArduinoJson_ID64/src/ArduinoJson/Array/ArrayShortcuts.hpp new file mode 100644 index 000000000..221f3fd1a --- /dev/null +++ b/.pio/libdeps/development/ArduinoJson_ID64/src/ArduinoJson/Array/ArrayShortcuts.hpp @@ -0,0 +1,47 @@ +// ArduinoJson - arduinojson.org +// Copyright Benoit Blanchon 2014-2019 +// MIT License + +#pragma once + +#include "../Polyfills/attributes.hpp" +#include "../Polyfills/type_traits.hpp" + +namespace ARDUINOJSON_NAMESPACE { +// Forward declarations. +template +class ElementProxy; + +template +class ArrayShortcuts { + public: + // Returns the element at specified index if the variant is an array. + FORCE_INLINE ElementProxy operator[](size_t index) const; + + FORCE_INLINE ObjectRef createNestedObject() const; + + FORCE_INLINE ArrayRef createNestedArray() const; + + // Adds the specified value at the end of the array. + // + // bool add(TValue); + // TValue = bool, long, int, short, float, double, serialized, VariantRef, + // std::string, String, ObjectRef + template + FORCE_INLINE bool add(const T &value) const { + return impl()->addElement().set(value); + } + // + // bool add(TValue); + // TValue = char*, const char*, const __FlashStringHelper* + template + FORCE_INLINE bool add(T *value) const { + return impl()->addElement().set(value); + } + + private: + const TArray *impl() const { + return static_cast(this); + } +}; +} // namespace ARDUINOJSON_NAMESPACE diff --git a/.pio/libdeps/development/ArduinoJson_ID64/src/ArduinoJson/Array/ElementProxy.hpp b/.pio/libdeps/development/ArduinoJson_ID64/src/ArduinoJson/Array/ElementProxy.hpp new file mode 100644 index 000000000..e1c784add --- /dev/null +++ b/.pio/libdeps/development/ArduinoJson_ID64/src/ArduinoJson/Array/ElementProxy.hpp @@ -0,0 +1,165 @@ +// ArduinoJson - arduinojson.org +// Copyright Benoit Blanchon 2014-2019 +// MIT License + +#pragma once + +#include "../Configuration.hpp" +#include "../Operators/VariantOperators.hpp" + +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable : 4522) +#endif + +namespace ARDUINOJSON_NAMESPACE { + +template +class ElementProxy : public VariantOperators >, + public Visitable { + typedef ElementProxy this_type; + + public: + FORCE_INLINE ElementProxy(TArray array, size_t index) + : _array(array), _index(index) {} + + FORCE_INLINE this_type& operator=(const this_type& src) { + getUpstreamElement().set(src.as()); + return *this; + } + + // Replaces the value + // + // operator=(const TValue&) + // TValue = bool, long, int, short, float, double, serialized, VariantRef, + // std::string, String, ArrayRef, ObjectRef + template + FORCE_INLINE this_type& operator=(const T& src) { + getUpstreamElement().set(src); + return *this; + } + // + // operator=(TValue) + // TValue = char*, const char*, const __FlashStringHelper* + template + FORCE_INLINE this_type& operator=(T* src) { + getUpstreamElement().set(src); + return *this; + } + + FORCE_INLINE void clear() const { + getUpstreamElement().clear(); + } + + FORCE_INLINE bool isNull() const { + return getUpstreamElement().isNull(); + } + + template + FORCE_INLINE typename VariantAs::type as() const { + return getUpstreamElement().template as(); + } + + template + FORCE_INLINE bool is() const { + return getUpstreamElement().template is(); + } + + template + FORCE_INLINE typename VariantTo::type to() const { + return getUpstreamElement().template to(); + } + + // Replaces the value + // + // bool set(const TValue&) + // TValue = bool, long, int, short, float, double, serialized, VariantRef, + // std::string, String, ArrayRef, ObjectRef + template + FORCE_INLINE bool set(const TValue& value) const { + return getUpstreamElement().set(value); + } + // + // bool set(TValue) + // TValue = char*, const char*, const __FlashStringHelper* + template + FORCE_INLINE bool set(TValue* value) const { + return getUpstreamElement().set(value); + } + + template + void accept(Visitor& visitor) const { + return getUpstreamElement().accept(visitor); + } + + FORCE_INLINE size_t size() const { + return getUpstreamElement().size(); + } + + template + VariantRef getMember(TNestedKey* key) const { + return getUpstreamElement().getMember(key); + } + + template + VariantRef getMember(const TNestedKey& key) const { + return getUpstreamElement().getMember(key); + } + + template + VariantRef getOrAddMember(TNestedKey* key) const { + return getUpstreamElement().getOrAddMember(key); + } + + template + VariantRef getOrAddMember(const TNestedKey& key) const { + return getUpstreamElement().getOrAddMember(key); + } + + VariantRef addElement() const { + return getUpstreamElement().addElement(); + } + + VariantRef getElement(size_t index) const { + return getUpstreamElement().getElement(index); + } + + FORCE_INLINE void remove(size_t index) const { + getUpstreamElement().remove(index); + } + // remove(char*) const + // remove(const char*) const + // remove(const __FlashStringHelper*) const + template + FORCE_INLINE typename enable_if::value>::type remove( + TChar* key) const { + getUpstreamElement().remove(key); + } + // remove(const std::string&) const + // remove(const String&) const + template + FORCE_INLINE typename enable_if::value>::type remove( + const TString& key) const { + getUpstreamElement().remove(key); + } + + private: + FORCE_INLINE VariantRef getUpstreamElement() const { + return _array.getElement(_index); + } + + TArray _array; + const size_t _index; +}; + +template +inline ElementProxy ArrayShortcuts::operator[]( + size_t index) const { + return ElementProxy(*impl(), index); +} + +} // namespace ARDUINOJSON_NAMESPACE + +#ifdef _MSC_VER +#pragma warning(pop) +#endif diff --git a/.pio/libdeps/development/ArduinoJson_ID64/src/ArduinoJson/Array/Utilities.hpp b/.pio/libdeps/development/ArduinoJson_ID64/src/ArduinoJson/Array/Utilities.hpp new file mode 100644 index 000000000..495991604 --- /dev/null +++ b/.pio/libdeps/development/ArduinoJson_ID64/src/ArduinoJson/Array/Utilities.hpp @@ -0,0 +1,66 @@ +// ArduinoJson - arduinojson.org +// Copyright Benoit Blanchon 2014-2019 +// MIT License + +#pragma once + +#include "ArrayRef.hpp" + +namespace ARDUINOJSON_NAMESPACE { + +// Copy a 1D array to a JsonArray +template +inline bool copyArray(T (&src)[N], ArrayRef dst) { + return copyArray(src, N, dst); +} + +// Copy a 1D array to a JsonArray +template +inline bool copyArray(T* src, size_t len, ArrayRef dst) { + bool ok = true; + for (size_t i = 0; i < len; i++) { + ok &= dst.add(src[i]); + } + return ok; +} + +// Copy a 2D array to a JsonArray +template +inline bool copyArray(T (&src)[N1][N2], ArrayRef dst) { + bool ok = true; + for (size_t i = 0; i < N1; i++) { + ArrayRef nestedArray = dst.createNestedArray(); + for (size_t j = 0; j < N2; j++) { + ok &= nestedArray.add(src[i][j]); + } + } + return ok; +} + +// Copy a JsonArray to a 1D array +template +inline size_t copyArray(ArrayConstRef src, T (&dst)[N]) { + return copyArray(src, dst, N); +} + +// Copy a JsonArray to a 1D array +template +inline size_t copyArray(ArrayConstRef src, T* dst, size_t len) { + size_t i = 0; + for (ArrayConstRef::iterator it = src.begin(); it != src.end() && i < len; + ++it) + dst[i++] = *it; + return i; +} + +// Copy a JsonArray to a 2D array +template +inline void copyArray(ArrayConstRef src, T (&dst)[N1][N2]) { + size_t i = 0; + for (ArrayConstRef::iterator it = src.begin(); it != src.end() && i < N1; + ++it) { + copyArray(it->as(), dst[i++]); + } +} + +} // namespace ARDUINOJSON_NAMESPACE diff --git a/.pio/libdeps/development/ArduinoJson_ID64/src/ArduinoJson/Collection/CollectionData.hpp b/.pio/libdeps/development/ArduinoJson_ID64/src/ArduinoJson/Collection/CollectionData.hpp new file mode 100644 index 000000000..6b37d533a --- /dev/null +++ b/.pio/libdeps/development/ArduinoJson_ID64/src/ArduinoJson/Collection/CollectionData.hpp @@ -0,0 +1,70 @@ +// ArduinoJson - arduinojson.org +// Copyright Benoit Blanchon 2014-2019 +// MIT License + +#pragma once + +namespace ARDUINOJSON_NAMESPACE { + +class MemoryPool; +class VariantData; +class VariantSlot; + +class CollectionData { + VariantSlot *_head; + VariantSlot *_tail; + + public: + // Must be a POD! + // - no constructor + // - no destructor + // - no virtual + // - no inheritance + VariantSlot *addSlot(MemoryPool *); + + VariantData *add(MemoryPool *pool); + + template + VariantData *add(TAdaptedString key, MemoryPool *pool); + + void clear(); + + template + bool containsKey(const TAdaptedString &key) const; + + bool copyFrom(const CollectionData &src, MemoryPool *pool); + + bool equalsArray(const CollectionData &other) const; + bool equalsObject(const CollectionData &other) const; + + VariantData *get(size_t index) const; + + template + VariantData *get(TAdaptedString key) const; + + VariantSlot *head() const { + return _head; + } + + void remove(size_t index); + + template + void remove(TAdaptedString key) { + remove(getSlot(key)); + } + + void remove(VariantSlot *slot); + + size_t memoryUsage() const; + size_t nesting() const; + size_t size() const; + + private: + VariantSlot *getSlot(size_t index) const; + + template + VariantSlot *getSlot(TAdaptedString key) const; + + VariantSlot *getPreviousSlot(VariantSlot *) const; +}; +} // namespace ARDUINOJSON_NAMESPACE diff --git a/.pio/libdeps/development/ArduinoJson_ID64/src/ArduinoJson/Collection/CollectionImpl.hpp b/.pio/libdeps/development/ArduinoJson_ID64/src/ArduinoJson/Collection/CollectionImpl.hpp new file mode 100644 index 000000000..c6097e474 --- /dev/null +++ b/.pio/libdeps/development/ArduinoJson_ID64/src/ArduinoJson/Collection/CollectionImpl.hpp @@ -0,0 +1,163 @@ +// ArduinoJson - arduinojson.org +// Copyright Benoit Blanchon 2014-2019 +// MIT License + +#pragma once + +#include "../Variant/VariantData.hpp" +#include "CollectionData.hpp" + +namespace ARDUINOJSON_NAMESPACE { + +inline VariantSlot* CollectionData::addSlot(MemoryPool* pool) { + VariantSlot* slot = pool->allocVariant(); + if (!slot) return 0; + + if (_tail) { + _tail->setNextNotNull(slot); + _tail = slot; + } else { + _head = slot; + _tail = slot; + } + + slot->clear(); + return slot; +} + +inline VariantData* CollectionData::add(MemoryPool* pool) { + return slotData(addSlot(pool)); +} + +template +inline VariantData* CollectionData::add(TAdaptedString key, MemoryPool* pool) { + VariantSlot* slot = addSlot(pool); + if (!slotSetKey(slot, key, pool)) return 0; + return slot->data(); +} + +inline void CollectionData::clear() { + _head = 0; + _tail = 0; +} + +template +inline bool CollectionData::containsKey(const TAdaptedString& key) const { + return getSlot(key) != 0; +} + +inline bool CollectionData::copyFrom(const CollectionData& src, + MemoryPool* pool) { + clear(); + for (VariantSlot* s = src._head; s; s = s->next()) { + VariantData* var; + if (s->key() != 0) { + if (s->ownsKey()) + var = add(RamStringAdapter(s->key()), pool); + else + var = add(ConstRamStringAdapter(s->key()), pool); + } else { + var = add(pool); + } + if (!var) return false; + if (!var->copyFrom(*s->data(), pool)) return false; + } + return true; +} + +inline bool CollectionData::equalsObject(const CollectionData& other) const { + size_t count = 0; + for (VariantSlot* slot = _head; slot; slot = slot->next()) { + VariantData* v1 = slot->data(); + VariantData* v2 = other.get(adaptString(slot->key())); + if (!variantEquals(v1, v2)) return false; + count++; + } + return count == other.size(); +} + +inline bool CollectionData::equalsArray(const CollectionData& other) const { + VariantSlot* s1 = _head; + VariantSlot* s2 = other._head; + for (;;) { + if (s1 == s2) return true; + if (!s1 || !s2) return false; + if (!variantEquals(s1->data(), s2->data())) return false; + s1 = s1->next(); + s2 = s2->next(); + } +} + +template +inline VariantSlot* CollectionData::getSlot(TAdaptedString key) const { + VariantSlot* slot = _head; + while (slot) { + if (key.equals(slot->key())) break; + slot = slot->next(); + } + return slot; +} + +inline VariantSlot* CollectionData::getSlot(size_t index) const { + return _head->next(index); +} + +inline VariantSlot* CollectionData::getPreviousSlot(VariantSlot* target) const { + VariantSlot* current = _head; + while (current) { + VariantSlot* next = current->next(); + if (next == target) return current; + current = next; + } + return 0; +} + +template +inline VariantData* CollectionData::get(TAdaptedString key) const { + VariantSlot* slot = getSlot(key); + return slot ? slot->data() : 0; +} + +inline VariantData* CollectionData::get(size_t index) const { + VariantSlot* slot = getSlot(index); + return slot ? slot->data() : 0; +} + +inline void CollectionData::remove(VariantSlot* slot) { + if (!slot) return; + VariantSlot* prev = getPreviousSlot(slot); + VariantSlot* next = slot->next(); + if (prev) + prev->setNext(next); + else + _head = next; + if (!next) _tail = prev; +} + +inline void CollectionData::remove(size_t index) { + remove(getSlot(index)); +} + +inline size_t CollectionData::memoryUsage() const { + size_t total = 0; + for (VariantSlot* s = _head; s; s = s->next()) { + total += sizeof(VariantSlot) + s->data()->memoryUsage(); + if (s->ownsKey()) total += strlen(s->key()) + 1; + } + return total; +} + +inline size_t CollectionData::nesting() const { + size_t maxChildNesting = 0; + for (VariantSlot* s = _head; s; s = s->next()) { + size_t childNesting = s->data()->nesting(); + if (childNesting > maxChildNesting) maxChildNesting = childNesting; + } + return maxChildNesting + 1; +} + +inline size_t CollectionData::size() const { + return slotSize(_head); +} + +} // namespace ARDUINOJSON_NAMESPACE diff --git a/.pio/libdeps/development/ArduinoJson_ID64/src/ArduinoJson/Configuration.hpp b/.pio/libdeps/development/ArduinoJson_ID64/src/ArduinoJson/Configuration.hpp new file mode 100644 index 000000000..c34264bd5 --- /dev/null +++ b/.pio/libdeps/development/ArduinoJson_ID64/src/ArduinoJson/Configuration.hpp @@ -0,0 +1,151 @@ +// ArduinoJson - arduinojson.org +// Copyright Benoit Blanchon 2014-2019 +// MIT License + +#pragma once + +#if defined(_MSC_VER) +#define ARDUINOJSON_HAS_INT64 1 +#else +#define ARDUINOJSON_HAS_INT64 0 +#endif + +#if __cplusplus >= 201103L +#define ARDUINOJSON_HAS_LONG_LONG 1 +#else +#define ARDUINOJSON_HAS_LONG_LONG 0 +#endif + +// Small or big machine? +#ifndef ARDUINOJSON_EMBEDDED_MODE +#if defined(ARDUINO) || defined(__IAR_SYSTEMS_ICC__) || defined(__XC) || \ + defined(__ARMCC_VERSION) +#define ARDUINOJSON_EMBEDDED_MODE 1 +#else +#define ARDUINOJSON_EMBEDDED_MODE 0 +#endif +#endif + +#if ARDUINOJSON_EMBEDDED_MODE + +// Store floats by default to reduce the memory usage (issue #134) +#ifndef ARDUINOJSON_USE_DOUBLE +#define ARDUINOJSON_USE_DOUBLE 0 +#endif + +// 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 + +// Embedded systems usually don't have std::string +#ifndef ARDUINOJSON_ENABLE_STD_STRING +#define ARDUINOJSON_ENABLE_STD_STRING 0 +#endif + +// Embedded systems usually don't have std::stream +#ifndef ARDUINOJSON_ENABLE_STD_STREAM +#define ARDUINOJSON_ENABLE_STD_STREAM 0 +#endif + +// Limit nesting as the stack is likely to be small +#ifndef ARDUINOJSON_DEFAULT_NESTING_LIMIT +#define ARDUINOJSON_DEFAULT_NESTING_LIMIT 10 +#endif + +#else // ARDUINOJSON_EMBEDDED_MODE + +// 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 +#ifndef ARDUINOJSON_USE_LONG_LONG +#if ARDUINOJSON_HAS_LONG_LONG || ARDUINOJSON_HAS_INT64 +#define ARDUINOJSON_USE_LONG_LONG 1 +#else +#define ARDUINOJSON_USE_LONG_LONG 0 +#endif +#endif + +// On a computer, we can use std::string +#ifndef ARDUINOJSON_ENABLE_STD_STRING +#define ARDUINOJSON_ENABLE_STD_STRING 1 +#endif + +// On a computer, we can assume std::stream +#ifndef ARDUINOJSON_ENABLE_STD_STREAM +#define ARDUINOJSON_ENABLE_STD_STREAM 1 +#endif + +// 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 + +// Convert unicode escape sequence (\u0123) to UTF-8 +#ifndef ARDUINOJSON_DECODE_UNICODE +#define ARDUINOJSON_DECODE_UNICODE 0 +#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 + +#ifndef ARDUINOJSON_LITTLE_ENDIAN +#if defined(_MSC_VER) || \ + (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) || \ + defined(__LITTLE_ENDIAN__) || defined(__i386) || defined(__x86_64) +#define ARDUINOJSON_LITTLE_ENDIAN 1 +#else +#define ARDUINOJSON_LITTLE_ENDIAN 0 +#endif +#endif + +#ifndef ARDUINOJSON_TAB +#define ARDUINOJSON_TAB " " +#endif diff --git a/.pio/libdeps/development/ArduinoJson_ID64/src/ArduinoJson/Deserialization/ArduinoStreamReader.hpp b/.pio/libdeps/development/ArduinoJson_ID64/src/ArduinoJson/Deserialization/ArduinoStreamReader.hpp new file mode 100644 index 000000000..e3591c98b --- /dev/null +++ b/.pio/libdeps/development/ArduinoJson_ID64/src/ArduinoJson/Deserialization/ArduinoStreamReader.hpp @@ -0,0 +1,39 @@ +// ArduinoJson - arduinojson.org +// Copyright Benoit Blanchon 2014-2019 +// MIT License + +#pragma once + +#if ARDUINOJSON_ENABLE_ARDUINO_STREAM + +#include + +namespace ARDUINOJSON_NAMESPACE { + +struct ArduinoStreamReader { + Stream& _stream; + char _current; + bool _ended; + + public: + explicit ArduinoStreamReader(Stream& stream) + : _stream(stream), _current(0), _ended(false) {} + + char read() { + // don't use _stream.read() as it ignores the timeout + char c = 0; + _ended = _stream.readBytes(&c, 1) == 0; + return c; + } + + bool ended() const { + return _ended; + } +}; + +inline ArduinoStreamReader makeReader(Stream& input) { + return ArduinoStreamReader(input); +} +} // namespace ARDUINOJSON_NAMESPACE + +#endif diff --git a/.pio/libdeps/development/ArduinoJson_ID64/src/ArduinoJson/Deserialization/CharPointerReader.hpp b/.pio/libdeps/development/ArduinoJson_ID64/src/ArduinoJson/Deserialization/CharPointerReader.hpp new file mode 100644 index 000000000..6a35153c9 --- /dev/null +++ b/.pio/libdeps/development/ArduinoJson_ID64/src/ArduinoJson/Deserialization/CharPointerReader.hpp @@ -0,0 +1,59 @@ +// ArduinoJson - arduinojson.org +// Copyright Benoit Blanchon 2014-2019 +// MIT License + +#pragma once + +namespace ARDUINOJSON_NAMESPACE { + +class UnsafeCharPointerReader { + const char* _ptr; + + public: + explicit UnsafeCharPointerReader(const char* ptr) + : _ptr(ptr ? ptr : reinterpret_cast("")) {} + + char read() { + return static_cast(*_ptr++); + } + + bool ended() const { + // we cannot know, that's why it's unsafe + return false; + } +}; + +class SafeCharPointerReader { + const char* _ptr; + const char* _end; + + public: + explicit SafeCharPointerReader(const char* ptr, size_t len) + : _ptr(ptr ? ptr : reinterpret_cast("")), _end(_ptr + len) {} + + char read() { + return static_cast(*_ptr++); + } + + bool ended() const { + return _ptr == _end; + } +}; + +template +inline UnsafeCharPointerReader makeReader(TChar* input) { + return UnsafeCharPointerReader(reinterpret_cast(input)); +} + +template +inline SafeCharPointerReader makeReader(TChar* input, size_t n) { + return SafeCharPointerReader(reinterpret_cast(input), n); +} + +#if ARDUINOJSON_ENABLE_ARDUINO_STRING +inline SafeCharPointerReader makeReader(const ::String& input) { + return SafeCharPointerReader(input.c_str(), input.length()); +} +#endif + +} // namespace ARDUINOJSON_NAMESPACE diff --git a/.pio/libdeps/development/ArduinoJson_ID64/src/ArduinoJson/Deserialization/DeserializationError.hpp b/.pio/libdeps/development/ArduinoJson_ID64/src/ArduinoJson/Deserialization/DeserializationError.hpp new file mode 100644 index 000000000..8707b3b04 --- /dev/null +++ b/.pio/libdeps/development/ArduinoJson_ID64/src/ArduinoJson/Deserialization/DeserializationError.hpp @@ -0,0 +1,113 @@ +// ArduinoJson - arduinojson.org +// Copyright Benoit Blanchon 2014-2019 +// MIT License + +#pragma once + +#if ARDUINOJSON_ENABLE_STD_STREAM +#include +#endif + +namespace ARDUINOJSON_NAMESPACE { + +class DeserializationError { + // safe bool idiom + typedef void (DeserializationError::*bool_type)() const; + void safeBoolHelper() const {} + + public: + enum Code { + Ok, + IncompleteInput, + InvalidInput, + NoMemory, + NotSupported, + TooDeep + }; + + DeserializationError() {} + DeserializationError(Code c) : _code(c) {} + + // Compare with DeserializationError + friend bool operator==(const DeserializationError& lhs, + const DeserializationError& rhs) { + return lhs._code == rhs._code; + } + friend bool operator!=(const DeserializationError& lhs, + const DeserializationError& rhs) { + return lhs._code != rhs._code; + } + + // Compare with Code + friend bool operator==(const DeserializationError& lhs, Code rhs) { + return lhs._code == rhs; + } + friend bool operator==(Code lhs, const DeserializationError& rhs) { + return lhs == rhs._code; + } + friend bool operator!=(const DeserializationError& lhs, Code rhs) { + return lhs._code != rhs; + } + friend bool operator!=(Code lhs, const DeserializationError& rhs) { + return lhs != rhs._code; + } + + // Behaves like a bool + operator bool_type() const { + return _code != Ok ? &DeserializationError::safeBoolHelper : 0; + } + friend bool operator==(bool value, const DeserializationError& err) { + return static_cast(err) == value; + } + friend bool operator==(const DeserializationError& err, bool value) { + return static_cast(err) == value; + } + friend bool operator!=(bool value, const DeserializationError& err) { + return static_cast(err) != value; + } + friend bool operator!=(const DeserializationError& err, bool value) { + return static_cast(err) != value; + } + + // Returns internal enum, useful for switch statement + Code code() const { + return _code; + } + + const char* c_str() const { + switch (_code) { + case Ok: + return "Ok"; + case TooDeep: + return "TooDeep"; + case NoMemory: + return "NoMemory"; + case InvalidInput: + return "InvalidInput"; + case IncompleteInput: + return "IncompleteInput"; + case NotSupported: + return "NotSupported"; + default: + return "???"; + } + } + + private: + Code _code; +}; + +#if ARDUINOJSON_ENABLE_STD_STREAM +inline std::ostream& operator<<(std::ostream& s, + const DeserializationError& e) { + s << e.c_str(); + return s; +} + +inline std::ostream& operator<<(std::ostream& s, DeserializationError::Code c) { + s << DeserializationError(c).c_str(); + return s; +} +#endif + +} // namespace ARDUINOJSON_NAMESPACE diff --git a/.pio/libdeps/development/ArduinoJson_ID64/src/ArduinoJson/Deserialization/FlashStringReader.hpp b/.pio/libdeps/development/ArduinoJson_ID64/src/ArduinoJson/Deserialization/FlashStringReader.hpp new file mode 100644 index 000000000..015b4806c --- /dev/null +++ b/.pio/libdeps/development/ArduinoJson_ID64/src/ArduinoJson/Deserialization/FlashStringReader.hpp @@ -0,0 +1,54 @@ +// ArduinoJson - arduinojson.org +// Copyright Benoit Blanchon 2014-2019 +// MIT License + +#pragma once + +#if ARDUINOJSON_ENABLE_PROGMEM + +namespace ARDUINOJSON_NAMESPACE { +class UnsafeFlashStringReader { + const char* _ptr; + + public: + explicit UnsafeFlashStringReader(const __FlashStringHelper* ptr) + : _ptr(reinterpret_cast(ptr)) {} + + char read() { + return pgm_read_byte_near(_ptr++); + } + + bool ended() const { + // this reader cannot detect the end + return false; + } +}; + +class SafeFlashStringReader { + const char* _ptr; + const char* _end; + + public: + explicit SafeFlashStringReader(const __FlashStringHelper* ptr, size_t size) + : _ptr(reinterpret_cast(ptr)), _end(_ptr + size) {} + + char read() { + return pgm_read_byte_near(_ptr++); + } + + bool ended() const { + return _ptr == _end; + } +}; + +inline UnsafeFlashStringReader makeReader(const __FlashStringHelper* input) { + return UnsafeFlashStringReader(input); +} + +inline SafeFlashStringReader makeReader(const __FlashStringHelper* input, + size_t size) { + return SafeFlashStringReader(input, size); +} +} // namespace ARDUINOJSON_NAMESPACE + +#endif diff --git a/.pio/libdeps/development/ArduinoJson_ID64/src/ArduinoJson/Deserialization/IteratorReader.hpp b/.pio/libdeps/development/ArduinoJson_ID64/src/ArduinoJson/Deserialization/IteratorReader.hpp new file mode 100644 index 000000000..a8d425da1 --- /dev/null +++ b/.pio/libdeps/development/ArduinoJson_ID64/src/ArduinoJson/Deserialization/IteratorReader.hpp @@ -0,0 +1,32 @@ +// ArduinoJson - arduinojson.org +// Copyright Benoit Blanchon 2014-2019 +// MIT License + +#pragma once + +namespace ARDUINOJSON_NAMESPACE { + +template +class IteratorReader { + TIterator _ptr, _end; + + public: + explicit IteratorReader(TIterator begin, TIterator end) + : _ptr(begin), _end(end) {} + + bool ended() const { + return _ptr == _end; + } + + char read() { + return char(*_ptr++); + } +}; + +template +inline IteratorReader makeReader( + const TInput& input) { + return IteratorReader(input.begin(), + input.end()); +} +} // namespace ARDUINOJSON_NAMESPACE diff --git a/.pio/libdeps/development/ArduinoJson_ID64/src/ArduinoJson/Deserialization/NestingLimit.hpp b/.pio/libdeps/development/ArduinoJson_ID64/src/ArduinoJson/Deserialization/NestingLimit.hpp new file mode 100644 index 000000000..f1f4a5bc1 --- /dev/null +++ b/.pio/libdeps/development/ArduinoJson_ID64/src/ArduinoJson/Deserialization/NestingLimit.hpp @@ -0,0 +1,17 @@ +// ArduinoJson - arduinojson.org +// Copyright Benoit Blanchon 2014-2019 +// MIT License + +#pragma once + +#include "../Configuration.hpp" + +namespace ARDUINOJSON_NAMESPACE { + +struct NestingLimit { + NestingLimit() : value(ARDUINOJSON_DEFAULT_NESTING_LIMIT) {} + explicit NestingLimit(uint8_t n) : value(n) {} + + uint8_t value; +}; +} // namespace ARDUINOJSON_NAMESPACE diff --git a/.pio/libdeps/development/ArduinoJson_ID64/src/ArduinoJson/Deserialization/StdStreamReader.hpp b/.pio/libdeps/development/ArduinoJson_ID64/src/ArduinoJson/Deserialization/StdStreamReader.hpp new file mode 100644 index 000000000..b1187c116 --- /dev/null +++ b/.pio/libdeps/development/ArduinoJson_ID64/src/ArduinoJson/Deserialization/StdStreamReader.hpp @@ -0,0 +1,38 @@ +// ArduinoJson - arduinojson.org +// Copyright Benoit Blanchon 2014-2019 +// MIT License + +#pragma once + +#if ARDUINOJSON_ENABLE_STD_STREAM + +#include + +namespace ARDUINOJSON_NAMESPACE { + +class StdStreamReader { + std::istream& _stream; + char _current; + + public: + explicit StdStreamReader(std::istream& stream) + : _stream(stream), _current(0) {} + + bool ended() const { + return _stream.eof(); + } + + char read() { + return static_cast(_stream.get()); + } + + private: + StdStreamReader& operator=(const StdStreamReader&); // Visual Studio C4512 +}; + +inline StdStreamReader makeReader(std::istream& input) { + return StdStreamReader(input); +} +} // namespace ARDUINOJSON_NAMESPACE + +#endif diff --git a/.pio/libdeps/development/ArduinoJson_ID64/src/ArduinoJson/Deserialization/deserialize.hpp b/.pio/libdeps/development/ArduinoJson_ID64/src/ArduinoJson/Deserialization/deserialize.hpp new file mode 100644 index 000000000..112d0823d --- /dev/null +++ b/.pio/libdeps/development/ArduinoJson_ID64/src/ArduinoJson/Deserialization/deserialize.hpp @@ -0,0 +1,76 @@ +// ArduinoJson - arduinojson.org +// Copyright Benoit Blanchon 2014-2019 +// MIT License + +#pragma once + +#include "../StringStorage/StringStorage.hpp" +#include "ArduinoStreamReader.hpp" +#include "CharPointerReader.hpp" +#include "DeserializationError.hpp" +#include "FlashStringReader.hpp" +#include "IteratorReader.hpp" +#include "NestingLimit.hpp" +#include "StdStreamReader.hpp" + +namespace ARDUINOJSON_NAMESPACE { + +template