├── .gitignore ├── .travis.yml ├── LICENSE ├── README.md ├── README_zh.md ├── include └── README ├── lib ├── ArduinoJson_ID64 │ ├── .clang-format │ ├── .gitattributes │ ├── .github │ │ ├── FUNDING.yml │ │ ├── ISSUE_TEMPLATE.md │ │ └── lock.yml │ ├── .gitignore │ ├── .library.json │ ├── .mbedignore │ ├── .travis.yml │ ├── ArduinoJson.h │ ├── CHANGELOG.md │ ├── CMakeLists.txt │ ├── CONTRIBUTING.md │ ├── LICENSE.md │ ├── README.md │ ├── SUPPORT.md │ ├── appveyor.yml │ ├── banner.svg │ ├── component.mk │ ├── examples │ │ ├── JsonConfigFile │ │ │ └── JsonConfigFile.ino │ │ ├── JsonGeneratorExample │ │ │ └── JsonGeneratorExample.ino │ │ ├── JsonHttpClient │ │ │ └── JsonHttpClient.ino │ │ ├── JsonParserExample │ │ │ └── JsonParserExample.ino │ │ ├── JsonServer │ │ │ └── JsonServer.ino │ │ ├── JsonUdpBeacon │ │ │ └── JsonUdpBeacon.ino │ │ ├── MsgPackParser │ │ │ └── MsgPackParser.ino │ │ ├── ProgmemExample │ │ │ └── ProgmemExample.ino │ │ └── StringExample │ │ │ └── StringExample.ino │ ├── extras │ │ ├── ci │ │ │ ├── arduino.sh │ │ │ ├── build.sh │ │ │ ├── coverage.sh │ │ │ ├── fuzz.sh │ │ │ ├── platformio.sh │ │ │ └── test.sh │ │ ├── fuzzing │ │ │ ├── CMakeLists.txt │ │ │ ├── Makefile │ │ │ ├── fuzzer_main.cpp │ │ │ ├── json_corpus │ │ │ │ └── .gitignore │ │ │ ├── json_fuzzer.cpp │ │ │ ├── json_seed_corpus │ │ │ │ ├── Comments.json │ │ │ │ ├── EmptyArray.json │ │ │ │ ├── EmptyObject.json │ │ │ │ ├── ExcessiveNesting.json │ │ │ │ ├── IntegerOverflow.json │ │ │ │ ├── Numbers.json │ │ │ │ ├── OpenWeatherMap.json │ │ │ │ ├── Strings.json │ │ │ │ └── WeatherUnderground.json │ │ │ ├── msgpack_corpus │ │ │ │ └── .gitignore │ │ │ ├── msgpack_fuzzer.cpp │ │ │ └── msgpack_seed_corpus │ │ │ │ ├── array16 │ │ │ │ ├── array32 │ │ │ │ ├── false │ │ │ │ ├── fixarray │ │ │ │ ├── fixint_negative │ │ │ │ ├── fixint_positive │ │ │ │ ├── fixmap │ │ │ │ ├── fixstr │ │ │ │ ├── float32 │ │ │ │ ├── float64 │ │ │ │ ├── int16 │ │ │ │ ├── int32 │ │ │ │ ├── int64 │ │ │ │ ├── int8 │ │ │ │ ├── map16 │ │ │ │ ├── map32 │ │ │ │ ├── nil │ │ │ │ ├── str16 │ │ │ │ ├── str32 │ │ │ │ ├── str8 │ │ │ │ ├── true │ │ │ │ ├── uint16 │ │ │ │ ├── uint32 │ │ │ │ ├── uint64 │ │ │ │ └── uint8 │ │ ├── scripts │ │ │ ├── build-arduino-package.sh │ │ │ ├── build-single-header.sh │ │ │ ├── create-build-envs.sh │ │ │ ├── publish-particle-library.sh │ │ │ ├── publish.sh │ │ │ └── wandbox │ │ │ │ ├── JsonGeneratorExample.cpp │ │ │ │ ├── JsonParserExample.cpp │ │ │ │ ├── MsgPackParserExample.cpp │ │ │ │ └── publish.sh │ │ └── tests │ │ │ ├── CMakeLists.txt │ │ │ ├── ElementProxy │ │ │ ├── CMakeLists.txt │ │ │ ├── add.cpp │ │ │ ├── clear.cpp │ │ │ ├── compare.cpp │ │ │ ├── remove.cpp │ │ │ ├── set.cpp │ │ │ └── size.cpp │ │ │ ├── Helpers │ │ │ ├── CustomReader.hpp │ │ │ ├── Stream.h │ │ │ └── WString.h │ │ │ ├── IntegrationTests │ │ │ ├── CMakeLists.txt │ │ │ ├── gbathree.cpp │ │ │ ├── issue772.cpp │ │ │ └── round_trip.cpp │ │ │ ├── JsonArray │ │ │ ├── CMakeLists.txt │ │ │ ├── add.cpp │ │ │ ├── copyArray.cpp │ │ │ ├── createNested.cpp │ │ │ ├── equals.cpp │ │ │ ├── get.cpp │ │ │ ├── isNull.cpp │ │ │ ├── iterator.cpp │ │ │ ├── memoryUsage.cpp │ │ │ ├── nesting.cpp │ │ │ ├── remove.cpp │ │ │ ├── size.cpp │ │ │ ├── std_string.cpp │ │ │ ├── subscript.cpp │ │ │ └── undefined.cpp │ │ │ ├── JsonDeserializer │ │ │ ├── CMakeLists.txt │ │ │ ├── DeserializationError.cpp │ │ │ ├── array.cpp │ │ │ ├── array_static.cpp │ │ │ ├── incomplete_input.cpp │ │ │ ├── input_types.cpp │ │ │ ├── invalid_input.cpp │ │ │ ├── misc.cpp │ │ │ ├── nestingLimit.cpp │ │ │ ├── number.cpp │ │ │ ├── object.cpp │ │ │ ├── object_static.cpp │ │ │ └── string.cpp │ │ │ ├── JsonDocument │ │ │ ├── BasicJsonDocument.cpp │ │ │ ├── CMakeLists.txt │ │ │ ├── DynamicJsonDocument.cpp │ │ │ ├── StaticJsonDocument.cpp │ │ │ ├── add.cpp │ │ │ ├── compare.cpp │ │ │ ├── containsKey.cpp │ │ │ ├── createNested.cpp │ │ │ ├── isNull.cpp │ │ │ ├── nesting.cpp │ │ │ ├── remove.cpp │ │ │ ├── shrinkToFit.cpp │ │ │ ├── size.cpp │ │ │ └── subscript.cpp │ │ │ ├── JsonObject │ │ │ ├── CMakeLists.txt │ │ │ ├── containsKey.cpp │ │ │ ├── copy.cpp │ │ │ ├── createNestedArray.cpp │ │ │ ├── createNestedObject.cpp │ │ │ ├── equals.cpp │ │ │ ├── invalid.cpp │ │ │ ├── isNull.cpp │ │ │ ├── iterator.cpp │ │ │ ├── memoryUsage.cpp │ │ │ ├── nesting.cpp │ │ │ ├── remove.cpp │ │ │ ├── size.cpp │ │ │ ├── std_string.cpp │ │ │ └── subscript.cpp │ │ │ ├── JsonSerializer │ │ │ ├── CMakeLists.txt │ │ │ ├── CustomWriter.cpp │ │ │ ├── JsonArray.cpp │ │ │ ├── JsonArrayPretty.cpp │ │ │ ├── JsonObject.cpp │ │ │ ├── JsonObjectPretty.cpp │ │ │ ├── JsonVariant.cpp │ │ │ ├── misc.cpp │ │ │ ├── std_stream.cpp │ │ │ └── std_string.cpp │ │ │ ├── JsonVariant │ │ │ ├── CMakeLists.txt │ │ │ ├── add.cpp │ │ │ ├── as.cpp │ │ │ ├── clear.cpp │ │ │ ├── compare.cpp │ │ │ ├── containsKey.cpp │ │ │ ├── copy.cpp │ │ │ ├── createNested.cpp │ │ │ ├── is.cpp │ │ │ ├── isnull.cpp │ │ │ ├── memoryUsage.cpp │ │ │ ├── misc.cpp │ │ │ ├── nesting.cpp │ │ │ ├── or.cpp │ │ │ ├── overflow.cpp │ │ │ ├── remove.cpp │ │ │ ├── set.cpp │ │ │ ├── subscript.cpp │ │ │ ├── types.cpp │ │ │ └── undefined.cpp │ │ │ ├── MemberProxy │ │ │ ├── CMakeLists.txt │ │ │ ├── add.cpp │ │ │ ├── clear.cpp │ │ │ ├── compare.cpp │ │ │ ├── containsKey.cpp │ │ │ ├── remove.cpp │ │ │ ├── set.cpp │ │ │ ├── size.cpp │ │ │ └── subscript.cpp │ │ │ ├── MemoryPool │ │ │ ├── CMakeLists.txt │ │ │ ├── StringBuilder.cpp │ │ │ ├── allocString.cpp │ │ │ ├── allocVariant.cpp │ │ │ ├── clear.cpp │ │ │ └── size.cpp │ │ │ ├── Misc │ │ │ ├── CMakeLists.txt │ │ │ ├── FloatParts.cpp │ │ │ ├── Issue978.cpp │ │ │ ├── Readers.cpp │ │ │ ├── StringAdapters.cpp │ │ │ ├── StringWriter.cpp │ │ │ ├── TypeTraits.cpp │ │ │ ├── Utf16.cpp │ │ │ ├── Utf8.cpp │ │ │ ├── conflicts.cpp │ │ │ ├── custom_string.hpp │ │ │ ├── unsigned_char.cpp │ │ │ └── version.cpp │ │ │ ├── MixedConfiguration │ │ │ ├── CMakeLists.txt │ │ │ ├── cpp11.cpp │ │ │ ├── decode_unicode_0.cpp │ │ │ ├── decode_unicode_1.cpp │ │ │ ├── enable_comments_0.cpp │ │ │ ├── enable_comments_1.cpp │ │ │ ├── enable_infinity_0.cpp │ │ │ ├── enable_infinity_1.cpp │ │ │ ├── enable_nan_0.cpp │ │ │ ├── enable_nan_1.cpp │ │ │ ├── enable_progmem_1.cpp │ │ │ ├── progmem_emulation.hpp │ │ │ ├── use_double_0.cpp │ │ │ ├── use_double_1.cpp │ │ │ ├── use_long_long_0.cpp │ │ │ └── use_long_long_1.cpp │ │ │ ├── MsgPackDeserializer │ │ │ ├── CMakeLists.txt │ │ │ ├── deserializeArray.cpp │ │ │ ├── deserializeObject.cpp │ │ │ ├── deserializeStaticVariant.cpp │ │ │ ├── deserializeVariant.cpp │ │ │ ├── doubleToFloat.cpp │ │ │ ├── incompleteInput.cpp │ │ │ ├── input_types.cpp │ │ │ ├── nestingLimit.cpp │ │ │ └── notSupported.cpp │ │ │ ├── MsgPackSerializer │ │ │ ├── CMakeLists.txt │ │ │ ├── destination_types.cpp │ │ │ ├── measure.cpp │ │ │ ├── misc.cpp │ │ │ ├── serializeArray.cpp │ │ │ ├── serializeObject.cpp │ │ │ └── serializeVariant.cpp │ │ │ ├── Numbers │ │ │ ├── CMakeLists.txt │ │ │ ├── parseFloat.cpp │ │ │ ├── parseInteger.cpp │ │ │ └── parseNumber.cpp │ │ │ ├── TextFormatter │ │ │ ├── CMakeLists.txt │ │ │ ├── writeFloat.cpp │ │ │ └── writeString.cpp │ │ │ └── catch │ │ │ ├── CMakeLists.txt │ │ │ ├── catch.cpp │ │ │ └── catch.hpp │ ├── keywords.txt │ ├── library.json │ ├── library.properties │ └── src │ │ ├── ArduinoJson.h │ │ ├── ArduinoJson.hpp │ │ └── ArduinoJson │ │ ├── Array │ │ ├── ArrayFunctions.hpp │ │ ├── ArrayImpl.hpp │ │ ├── ArrayIterator.hpp │ │ ├── ArrayRef.hpp │ │ ├── ArrayShortcuts.hpp │ │ ├── ElementProxy.hpp │ │ └── Utilities.hpp │ │ ├── Collection │ │ ├── CollectionData.hpp │ │ └── CollectionImpl.hpp │ │ ├── Configuration.hpp │ │ ├── Deserialization │ │ ├── DeserializationError.hpp │ │ ├── NestingLimit.hpp │ │ ├── Reader.hpp │ │ ├── Readers │ │ │ ├── ArduinoStreamReader.hpp │ │ │ ├── ArduinoStringReader.hpp │ │ │ ├── FlashReader.hpp │ │ │ ├── IteratorReader.hpp │ │ │ ├── RamReader.hpp │ │ │ └── StdStreamReader.hpp │ │ └── deserialize.hpp │ │ ├── Document │ │ ├── BasicJsonDocument.hpp │ │ ├── DynamicJsonDocument.hpp │ │ ├── JsonDocument.hpp │ │ └── StaticJsonDocument.hpp │ │ ├── Json │ │ ├── EscapeSequence.hpp │ │ ├── JsonDeserializer.hpp │ │ ├── JsonSerializer.hpp │ │ ├── PrettyJsonSerializer.hpp │ │ ├── TextFormatter.hpp │ │ ├── Utf16.hpp │ │ └── Utf8.hpp │ │ ├── Memory │ │ ├── Alignment.hpp │ │ ├── MemoryPool.hpp │ │ ├── StringBuilder.hpp │ │ └── StringSlot.hpp │ │ ├── Misc │ │ ├── SerializedValue.hpp │ │ └── Visitable.hpp │ │ ├── MsgPack │ │ ├── MsgPackDeserializer.hpp │ │ ├── MsgPackSerializer.hpp │ │ ├── endianess.hpp │ │ └── ieee754.hpp │ │ ├── Namespace.hpp │ │ ├── Numbers │ │ ├── Float.hpp │ │ ├── FloatParts.hpp │ │ ├── FloatTraits.hpp │ │ ├── Integer.hpp │ │ ├── convertNumber.hpp │ │ ├── parseFloat.hpp │ │ ├── parseInteger.hpp │ │ └── parseNumber.hpp │ │ ├── Object │ │ ├── MemberProxy.hpp │ │ ├── ObjectFunctions.hpp │ │ ├── ObjectImpl.hpp │ │ ├── ObjectIterator.hpp │ │ ├── ObjectRef.hpp │ │ ├── ObjectShortcuts.hpp │ │ └── Pair.hpp │ │ ├── Operators │ │ ├── VariantCasts.hpp │ │ ├── VariantComparisons.hpp │ │ ├── VariantOperators.hpp │ │ ├── VariantOr.hpp │ │ └── VariantShortcuts.hpp │ │ ├── Polyfills │ │ ├── alias_cast.hpp │ │ ├── assert.hpp │ │ ├── attributes.hpp │ │ ├── ctype.hpp │ │ ├── gsl │ │ │ └── not_null.hpp │ │ ├── limits.hpp │ │ ├── math.hpp │ │ ├── mpl │ │ │ └── max.hpp │ │ ├── pgmspace.hpp │ │ ├── safe_strcmp.hpp │ │ ├── type_traits.hpp │ │ ├── type_traits │ │ │ ├── conditional.hpp │ │ │ ├── enable_if.hpp │ │ │ ├── integral_constant.hpp │ │ │ ├── is_array.hpp │ │ │ ├── is_base_of.hpp │ │ │ ├── is_const.hpp │ │ │ ├── is_floating_point.hpp │ │ │ ├── is_integral.hpp │ │ │ ├── is_same.hpp │ │ │ ├── is_signed.hpp │ │ │ ├── is_unsigned.hpp │ │ │ ├── make_unsigned.hpp │ │ │ ├── remove_const.hpp │ │ │ ├── remove_reference.hpp │ │ │ └── type_identity.hpp │ │ └── utility.hpp │ │ ├── Serialization │ │ ├── Writer.hpp │ │ ├── Writers │ │ │ ├── ArduinoStringWriter.hpp │ │ │ ├── DummyWriter.hpp │ │ │ ├── PrintWriter.hpp │ │ │ ├── StaticStringWriter.hpp │ │ │ ├── StdStreamWriter.hpp │ │ │ └── StdStringWriter.hpp │ │ ├── measure.hpp │ │ └── serialize.hpp │ │ ├── StringStorage │ │ ├── StringCopier.hpp │ │ ├── StringMover.hpp │ │ └── StringStorage.hpp │ │ ├── Strings │ │ ├── ArduinoStringAdapter.hpp │ │ ├── ConstRamStringAdapter.hpp │ │ ├── FlashStringAdapter.hpp │ │ ├── IsWriteableString.hpp │ │ ├── RamStringAdapter.hpp │ │ ├── SizedFlashStringAdapter.hpp │ │ ├── SizedRamStringAdapter.hpp │ │ ├── StlStringAdapter.hpp │ │ ├── String.hpp │ │ └── StringAdapters.hpp │ │ ├── Variant │ │ ├── SlotFunctions.hpp │ │ ├── VariantAs.hpp │ │ ├── VariantAsImpl.hpp │ │ ├── VariantContent.hpp │ │ ├── VariantData.hpp │ │ ├── VariantFunctions.hpp │ │ ├── VariantImpl.hpp │ │ ├── VariantRef.hpp │ │ ├── VariantSlot.hpp │ │ └── VariantTo.hpp │ │ ├── compatibility.hpp │ │ └── version.hpp ├── IRremoteESP8266_ID1089 │ ├── .github │ │ ├── CONTRIBUTING.md │ │ ├── Contributors.md │ │ └── issue_template.md │ ├── .gitignore │ ├── .gitmodules │ ├── .library.json │ ├── .style.yapf │ ├── .travis.yml │ ├── CPPLINT.cfg │ ├── LICENSE.txt │ ├── README.md │ ├── ReleaseNotes.md │ ├── examples │ │ ├── IRGCSendDemo │ │ │ ├── IRGCSendDemo.ino │ │ │ └── platformio.ini │ │ ├── IRGCTCPServer │ │ │ ├── IRGCTCPServer.ino │ │ │ └── platformio.ini │ │ ├── IRMQTTServer │ │ │ ├── IRMQTTServer.ino │ │ │ └── platformio.ini │ │ ├── IRServer │ │ │ ├── IRServer.ino │ │ │ └── platformio.ini │ │ ├── IRrecvDemo │ │ │ ├── IRrecvDemo.ino │ │ │ └── platformio.ini │ │ ├── IRrecvDump │ │ │ ├── IRrecvDump.ino │ │ │ └── platformio.ini │ │ ├── IRrecvDumpV2 │ │ │ ├── IRrecvDumpV2.ino │ │ │ └── platformio.ini │ │ ├── IRsendDemo │ │ │ ├── IRsendDemo.ino │ │ │ └── platformio.ini │ │ ├── IRsendProntoDemo │ │ │ ├── IRsendProntoDemo.ino │ │ │ └── platformio.ini │ │ ├── JVCPanasonicSendDemo │ │ │ ├── JVCPanasonicSendDemo.ino │ │ │ └── platformio.ini │ │ ├── LGACSend │ │ │ ├── LGACSend.ino │ │ │ └── platformio.ini │ │ ├── TurnOnArgoAC │ │ │ ├── TurnOnArgoAC.ino │ │ │ └── platformio.ini │ │ ├── TurnOnDaikinAC │ │ │ ├── TurnOnDaikinAC.ino │ │ │ └── platformio.ini │ │ ├── TurnOnFujitsuAC │ │ │ ├── TurnOnFujitsuAC.ino │ │ │ └── platformio.ini │ │ ├── TurnOnKelvinatorAC │ │ │ ├── TurnOnKelvinatorAC.ino │ │ │ └── platformio.ini │ │ ├── TurnOnMitsubishiAC │ │ │ ├── TurnOnMitsubishiAC.ino │ │ │ └── platformio.ini │ │ ├── TurnOnToshibaAC │ │ │ ├── TurnOnToshibaAC.ino │ │ │ └── platformio.ini │ │ └── TurnOnTrotecAC │ │ │ ├── TurnOnTrotecAC.ino │ │ │ └── platformio.ini │ ├── keywords.txt │ ├── library.json │ ├── library.properties │ ├── platformio.ini │ ├── pylintrc │ ├── src │ │ ├── CPPLINT.cfg │ │ ├── IRrecv.cpp │ │ ├── IRrecv.h │ │ ├── IRremoteESP8266.h │ │ ├── IRsend.cpp │ │ ├── IRsend.h │ │ ├── IRtimer.cpp │ │ ├── IRtimer.h │ │ ├── IRutils.cpp │ │ └── IRutils.h │ ├── test │ │ ├── IRrecv_test.cpp │ │ ├── IRrecv_test.h │ │ ├── IRsend_test.cpp │ │ ├── IRsend_test.h │ │ ├── IRutils_test.cpp │ │ ├── Makefile │ │ ├── ir_Aiwa_test.cpp │ │ ├── ir_Carrier_test.cpp │ │ ├── ir_Coolix_test.cpp │ │ ├── ir_Daikin_test.cpp │ │ ├── ir_Denon_test.cpp │ │ ├── ir_Dish_test.cpp │ │ ├── ir_Electra_test.cpp │ │ ├── ir_Fujitsu_test.cpp │ │ ├── ir_GICable_test.cpp │ │ ├── ir_GlobalCache_test.cpp │ │ ├── ir_Gree_test.cpp │ │ ├── ir_Haier_test.cpp │ │ ├── ir_Hitachi_test.cpp │ │ ├── ir_JVC_test.cpp │ │ ├── ir_Kelvinator_test.cpp │ │ ├── ir_LG_test.cpp │ │ ├── ir_Lasertag_test.cpp │ │ ├── ir_Lutron_test.cpp │ │ ├── ir_MWM_test.cpp │ │ ├── ir_Magiquest_test.cpp │ │ ├── ir_Midea_test.cpp │ │ ├── ir_Mitsubishi_test.cpp │ │ ├── ir_NEC_test.cpp │ │ ├── ir_Nikai_test.cpp │ │ ├── ir_Panasonic_test.cpp │ │ ├── ir_Pioneer_test.cpp │ │ ├── ir_Pronto_test.cpp │ │ ├── ir_RC5_RC6_test.cpp │ │ ├── ir_RCMM_test.cpp │ │ ├── ir_Samsung_test.cpp │ │ ├── ir_Sanyo_test.cpp │ │ ├── ir_Sharp_test.cpp │ │ ├── ir_Sherwood_test.cpp │ │ ├── ir_Sony_test.cpp │ │ ├── ir_Toshiba_test.cpp │ │ ├── ir_Whirlpool_test.cpp │ │ └── ir_Whynter_test.cpp │ └── tools │ │ ├── Makefile │ │ ├── RawToGlobalCache.sh │ │ ├── auto_analyse_raw_data.py │ │ ├── auto_analyse_raw_data_test.py │ │ ├── gc_decode.cpp │ │ ├── mkkeywords │ │ └── mode2_decode.cpp ├── Irext │ ├── include │ │ ├── ir_ac_apply.h │ │ ├── ir_ac_binary_parse.h │ │ ├── ir_ac_build_frame.h │ │ ├── ir_ac_control.h │ │ ├── ir_ac_parse_forbidden_info.h │ │ ├── ir_ac_parse_frame_info.h │ │ ├── ir_ac_parse_parameter.h │ │ ├── ir_decode.h │ │ ├── ir_defs.h │ │ ├── ir_tv_control.h │ │ └── ir_utils.h │ ├── ir_ac_apply.c │ ├── ir_ac_binary_parse.c │ ├── ir_ac_build_frame.c │ ├── ir_ac_control.c │ ├── ir_ac_parse_forbidden_info.c │ ├── ir_ac_parse_frame_info.c │ ├── ir_ac_parse_parameter.c │ ├── ir_decode.c │ ├── ir_tv_control.c │ └── ir_utils.c ├── PubSubClient_ID89 │ ├── .gitignore │ ├── .library.json │ ├── .travis.yml │ ├── CHANGES.txt │ ├── LICENSE.txt │ ├── README.md │ ├── examples │ │ ├── mqtt_auth │ │ │ └── mqtt_auth.ino │ │ ├── mqtt_basic │ │ │ └── mqtt_basic.ino │ │ ├── mqtt_esp8266 │ │ │ └── mqtt_esp8266.ino │ │ ├── mqtt_large_message │ │ │ └── mqtt_large_message.ino │ │ ├── mqtt_publish_in_callback │ │ │ └── mqtt_publish_in_callback.ino │ │ ├── mqtt_reconnect_nonblocking │ │ │ └── mqtt_reconnect_nonblocking.ino │ │ └── mqtt_stream │ │ │ └── mqtt_stream.ino │ ├── keywords.txt │ ├── library.json │ ├── library.properties │ └── src │ │ ├── PubSubClient.cpp │ │ └── PubSubClient.h ├── README ├── WifiManager_ID567 │ ├── .github │ │ ├── CONTRIBUTING.md │ │ └── ISSUE_TEMPLATE.md │ ├── .library.json │ ├── .travis.yml │ ├── LICENSE │ ├── README.md │ ├── WiFiManager.cpp │ ├── WiFiManager.h │ ├── examples │ │ ├── AutoConnect │ │ │ └── AutoConnect.ino │ │ ├── AutoConnectWithFSParameters │ │ │ └── AutoConnectWithFSParameters.ino │ │ ├── AutoConnectWithFSParametersAndCustomIP │ │ │ └── AutoConnectWithFSParametersAndCustomIP.ino │ │ ├── AutoConnectWithFeedback │ │ │ └── AutoConnectWithFeedback.ino │ │ ├── AutoConnectWithFeedbackLED │ │ │ └── AutoConnectWithFeedbackLED.ino │ │ ├── AutoConnectWithReset │ │ │ └── AutoConnectWithReset.ino │ │ ├── AutoConnectWithStaticIP │ │ │ └── AutoConnectWithStaticIP.ino │ │ ├── AutoConnectWithTimeout │ │ │ └── AutoConnectWithTimeout.ino │ │ └── OnDemandConfigPortal │ │ │ └── OnDemandConfigPortal.ino │ ├── extras │ │ ├── WiFiManager.template.html │ │ ├── parse.js │ │ └── template.h │ ├── keywords.txt │ ├── library.json │ ├── library.properties │ └── travis │ │ └── common.sh └── rc-switch │ ├── RCSwitch.cpp │ ├── RCSwitch.h │ ├── README.md │ ├── library.json │ └── library.properties ├── platformio.ini └── src ├── IRbaby.cpp ├── IRbabyBinarySensor.cpp ├── IRbabyBinarySensor.h ├── IRbabyGlobal.cpp ├── IRbabyGlobal.h ├── IRbabyIR.cpp ├── IRbabyIR.h ├── IRbabyMQTT.cpp ├── IRbabyMQTT.h ├── IRbabyMsgHandler.cpp ├── IRbabyMsgHandler.h ├── IRbabyOTA.cpp ├── IRbabyOTA.h ├── IRbabyRF.cpp ├── IRbabyRF.h ├── IRbabySerial.h ├── IRbabyUDP.cpp ├── IRbabyUDP.h ├── IRbabyUserSettings.cpp ├── IRbabyUserSettings.h ├── IRbabyha.cpp ├── IRbabyha.h └── defines.h /.gitignore: -------------------------------------------------------------------------------- 1 | .pio 2 | .pioenvs 3 | .piolibdeps 4 | .vscode 5 | 6 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Caffreyfans 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # IRbaby-Firmware 2 | ## Build State 3 | [![Build Status](https://www.travis-ci.org/Caffreyfans/IRbaby-firmware.svg?branch=master)](https://www.travis-ci.org/Caffreyfans/IRbaby-firmware) 4 | 5 | [English doc](README.md) | [中文文档](README_zh.md) 6 | 7 | ## Feature 8 | - [x] OTA 9 | - [x] MQTT 10 | - [x] IRsend 11 | - [x] IRreceive 12 | - [x] LED 13 | - [x] KEY -------------------------------------------------------------------------------- /README_zh.md: -------------------------------------------------------------------------------- 1 | # IRbaby-Firmware 2 | 3 | ## 编译状态 4 | [![Build Status](https://www.travis-ci.org/Caffreyfans/IRbaby-firmware.svg?branch=master)](https://www.travis-ci.org/Caffreyfans/IRbaby-firmware) 5 | 6 | [English doc](README.md) | [中文文档](README_zh.md) 7 | 8 | ## 特性 9 | - [x] OTA 10 | - [x] MQTT 11 | - [x] UDP 12 | - [x] IRext 13 | - [x] IRsend 14 | - [x] IRreceive -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/.clang-format: -------------------------------------------------------------------------------- 1 | # http://clang.llvm.org/docs/ClangFormatStyleOptions.html 2 | 3 | BasedOnStyle: Google 4 | Standard: Cpp03 5 | AllowShortFunctionsOnASingleLine: Empty 6 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/.gitattributes: -------------------------------------------------------------------------------- 1 | *.sh text eol=lf -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | custom: https://arduinojson.org/book/ 2 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 15 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/.github/lock.yml: -------------------------------------------------------------------------------- 1 | # Configuration for Lock Threads - https://github.com/dessant/lock-threads 2 | 3 | # Number of days of inactivity before a closed issue or pull request is locked 4 | daysUntilLock: 30 5 | 6 | # Comment to post before locking. Set to `false` to disable 7 | lockComment: false 8 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.idea 3 | /build 4 | /bin 5 | /lib 6 | /sftp-config.json 7 | .tags 8 | .tags_sorted_by_file 9 | /extras/fuzzing/*_fuzzer 10 | /extras/fuzzing/*_fuzzer.options 11 | /extras/fuzzing/*_fuzzer_seed_corpus.zip 12 | .vs/ 13 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/.mbedignore: -------------------------------------------------------------------------------- 1 | .github/ 2 | examples/ 3 | fuzzing/ 4 | scripts/ 5 | test/ 6 | third-party/ 7 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/ArduinoJson.h: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #include "src/ArduinoJson.h" 6 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ArduinoJson - arduinojson.org 2 | # Copyright Benoit Blanchon 2014-2020 3 | # MIT License 4 | 5 | cmake_minimum_required(VERSION 3.0) 6 | project(ArduinoJson) 7 | 8 | enable_testing() 9 | 10 | add_definitions(-DARDUINOJSON_DEBUG) 11 | if(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang)") 12 | add_compile_options(-g -O0) 13 | endif() 14 | 15 | if(${COVERAGE}) 16 | set(CMAKE_CXX_FLAGS "-fprofile-arcs -ftest-coverage") 17 | endif() 18 | 19 | include_directories(${CMAKE_CURRENT_LIST_DIR}/src) 20 | add_subdirectory(extras/tests) 21 | add_subdirectory(extras/fuzzing) 22 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contribution to ArduinoJson 2 | 3 | First, thank you for taking the time to contribute to this project. 4 | 5 | You can submit changes via GitHub Pull Requests. 6 | 7 | Please: 8 | 9 | 1. Unit test every change in behavior 10 | 2. Use clang-format in "file" mode to format the code 11 | 3. Consider using the Continuous Integration (Travis and AppVeyor) 12 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | --------------------- 3 | 4 | Copyright © 2014-2019 Benoit BLANCHON 5 | 6 | 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: 7 | 8 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 9 | 10 | 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. 11 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/SUPPORT.md: -------------------------------------------------------------------------------- 1 | # ArduinoJson Support 2 | 3 | First off, thank you very much for using ArduinoJson. 4 | 5 | We'll be very happy to help you, but first please read the following. 6 | 7 | ## Before asking for help 8 | 9 | 1. Read the [FAQ](https://arduinojson.org/faq/?utm_source=github&utm_medium=support) 10 | 2. Search in the [API Reference](https://arduinojson.org/api/?utm_source=github&utm_medium=support) 11 | 12 | If you did not find the answer, please create a [new issue on GitHub](https://github.com/bblanchon/ArduinoJson/issues/new). 13 | 14 | It is OK to add a comment to a currently opened issue, but please avoid adding comments to a closed issue. 15 | 16 | ## Before hitting the Submit button 17 | 18 | Please provide all the relevant information: 19 | 20 | * Good title 21 | * Short description of the problem 22 | * Target platform 23 | * Compiler model and version 24 | * [MVCE](https://stackoverflow.com/help/mcve) 25 | * Compiler output 26 | 27 | Good questions get fast answers! 28 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/appveyor.yml: -------------------------------------------------------------------------------- 1 | version: 6.14.1.{build} 2 | environment: 3 | matrix: 4 | - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 5 | CMAKE_GENERATOR: Visual Studio 16 2019 6 | - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 7 | CMAKE_GENERATOR: Visual Studio 15 2017 8 | - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 9 | CMAKE_GENERATOR: Visual Studio 14 2015 10 | - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013 11 | CMAKE_GENERATOR: Visual Studio 12 2013 12 | - CMAKE_GENERATOR: Visual Studio 11 2012 13 | - CMAKE_GENERATOR: Visual Studio 10 2010 14 | - CMAKE_GENERATOR: MinGW Makefiles 15 | configuration: Debug 16 | before_build: 17 | - set PATH=C:\MinGW\bin;%PATH:C:\Program Files\Git\usr\bin;=% # Workaround for CMake not wanting sh.exe on PATH for MinGW 18 | - cmake -DCMAKE_BUILD_TYPE=%CONFIGURATION% -G "%CMAKE_GENERATOR%" . 19 | build_script: 20 | - cmake --build . --config %CONFIGURATION% 21 | test_script: 22 | - ctest -C %CONFIGURATION% --output-on-failure . 23 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/component.mk: -------------------------------------------------------------------------------- 1 | COMPONENT_ADD_INCLUDEDIRS := src 2 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/ci/arduino.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -eux 2 | 3 | /sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_1.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :1 -ac -screen 0 1280x1024x16 4 | sleep 3 5 | export DISPLAY=:1.0 6 | 7 | mkdir -p /tmp/arduino 8 | curl -sS http://downloads.arduino.cc/arduino-$VERSION-linux64.tar.xz | tar xJ -C /tmp/arduino --strip 1 || 9 | curl -sS http://downloads.arduino.cc/arduino-$VERSION-linux64.tgz | tar xz -C /tmp/arduino --strip 1 10 | export PATH=$PATH:/tmp/arduino/ 11 | 12 | if [[ "$BOARD" =~ "arduino:samd:" ]]; then 13 | arduino --install-boards arduino:samd 14 | fi 15 | 16 | ln -s $PWD /tmp/arduino/libraries/ArduinoJson 17 | 18 | for EXAMPLE in $PWD/examples/*/*.ino; do 19 | arduino --verify --board $BOARD $EXAMPLE 20 | done 21 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/ci/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -ex 2 | 3 | export CC="$_CC" 4 | export CXX="$_CXX" 5 | 6 | if [ -n "$SANITIZE" ]; then 7 | export CXXFLAGS="-fsanitize=$SANITIZE" 8 | BUILD_TYPE="Debug" 9 | else 10 | BUILD_TYPE="Release" 11 | fi 12 | 13 | cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE . 14 | cmake --build . 15 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/ci/coverage.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -eux 2 | 3 | cmake -DCOVERAGE=true . 4 | make 5 | make test 6 | 7 | pip install --user cpp-coveralls 'requests[security]' 8 | pwd 9 | coveralls --include 'src' --gcov-options '\-lp' 10 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/ci/fuzz.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -eux 2 | 3 | ROOT_DIR=$(dirname $0)/../../ 4 | INCLUDE_DIR=${ROOT_DIR}/src/ 5 | FUZZING_DIR=${ROOT_DIR}/extras/fuzzing/ 6 | CXXFLAGS="-g -fprofile-instr-generate -fcoverage-mapping -fsanitize=address,undefined,fuzzer -fno-sanitize-recover=all" 7 | 8 | fuzz() { 9 | NAME="$1" 10 | FUZZER="${NAME}_fuzzer" 11 | FUZZER_CPP="${FUZZING_DIR}/${NAME}_fuzzer.cpp" 12 | CORPUS_DIR="${FUZZING_DIR}/${NAME}_corpus" 13 | SEED_CORPUS_DIR="${FUZZING_DIR}/${NAME}_seed_corpus" 14 | 15 | clang++-${CLANG} ${CXXFLAGS} -o ${FUZZER} -I$INCLUDE_DIR ${FUZZER_CPP} 16 | 17 | export ASAN_OPTIONS="detect_leaks=0" 18 | export LLVM_PROFILE_FILE="${FUZZER}.profraw" 19 | ./${FUZZER} "$CORPUS_DIR" "$SEED_CORPUS_DIR" -max_total_time=30 -timeout=1 20 | 21 | llvm-profdata-${CLANG} merge -sparse ${LLVM_PROFILE_FILE} -o ${FUZZER}.profdata 22 | llvm-cov-${CLANG} report ./${FUZZER} -instr-profile=${FUZZER}.profdata 23 | } 24 | 25 | fuzz json 26 | fuzz msgpack 27 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/ci/platformio.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -eux 2 | 3 | pip install --user platformio 4 | 5 | case $BOARD in 6 | uno) 7 | platformio lib install 868 # SD library 8 | platformio lib install 872 # Ethernet library 9 | ;; 10 | esp01) 11 | platformio lib uninstall 161 || true 12 | platformio lib uninstall 868 || true 13 | platformio lib uninstall 872 || true 14 | ;; 15 | esac 16 | 17 | for EXAMPLE in $PWD/examples/*/*.ino; 18 | do 19 | platformio ci $EXAMPLE -l '.' -b $BOARD 20 | done 21 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/ci/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -ex 2 | 3 | "$(dirname "$0")/build.sh" 4 | ctest --output-on-failure . 5 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/fuzzing/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ArduinoJson - arduinojson.org 2 | # Copyright Benoit Blanchon 2014-2020 3 | # MIT License 4 | 5 | if(MSVC) 6 | add_compile_options(-D_CRT_SECURE_NO_WARNINGS) 7 | endif() 8 | 9 | add_executable(msgpack_fuzzer 10 | msgpack_fuzzer.cpp 11 | fuzzer_main.cpp 12 | ) 13 | 14 | add_executable(json_fuzzer 15 | json_fuzzer.cpp 16 | fuzzer_main.cpp 17 | ) 18 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/fuzzing/Makefile: -------------------------------------------------------------------------------- 1 | # CAUTION: this file is invoked by https://github.com/google/oss-fuzz 2 | 3 | CXXFLAGS += -I../../src -DARDUINOJSON_DEBUG 4 | 5 | all: \ 6 | $(OUT)/json_fuzzer \ 7 | $(OUT)/json_fuzzer_seed_corpus.zip \ 8 | $(OUT)/json_fuzzer.options \ 9 | $(OUT)/msgpack_fuzzer \ 10 | $(OUT)/msgpack_fuzzer_seed_corpus.zip \ 11 | $(OUT)/msgpack_fuzzer.options 12 | 13 | $(OUT)/%_fuzzer: %_fuzzer.cpp $(shell find ../../src -type f) 14 | $(CXX) $(CXXFLAGS) $< -o$@ $(LIB_FUZZING_ENGINE) 15 | 16 | $(OUT)/%_fuzzer_seed_corpus.zip: %_seed_corpus/* 17 | zip -j $@ $? 18 | 19 | $(OUT)/%_fuzzer.options: 20 | @echo "[libfuzzer]" > $@ 21 | @echo "max_len = 256" >> $@ 22 | @echo "timeout = 10" >> $@ 23 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/fuzzing/json_corpus/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/fuzzing/json_fuzzer.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { 4 | DynamicJsonDocument doc(4096); 5 | DeserializationError error = deserializeJson(doc, data, size); 6 | if (!error) { 7 | std::string json; 8 | serializeJson(doc, json); 9 | } 10 | return 0; 11 | } 12 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/fuzzing/json_seed_corpus/Comments.json: -------------------------------------------------------------------------------- 1 | //comment 2 | /*comment*/ 3 | [ //comment 4 | /*comment*/"comment"/*comment*/,//comment 5 | /*comment*/{//comment 6 | /* comment*/"key"//comment 7 | : //comment 8 | "value"//comment 9 | }/*comment*/ 10 | ]//comment -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/fuzzing/json_seed_corpus/EmptyArray.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/fuzzing/json_seed_corpus/EmptyObject.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/fuzzing/json_seed_corpus/ExcessiveNesting.json: -------------------------------------------------------------------------------- 1 | [1,[2,[3,[4,[5,[6,[7,[8,[9,[10,[11,[12,[13,[14,[15,[16,[17,[18,[19,[20,[21,[22,[23,[24,[25,[26,[27,[28,[29,[30,[31,[32,[33,[34,[35,[36,[37,[38,[39,[40,[41,[42,[43,[44,[45,[46,[47,[48,[49,[50,[51,[52,[53,[54,[55,[56,[57,[58,[59,[60,[61,[62,[63,[64,[65,[66,[67,[68,[69,[70,[71,[72,[73,[74,[75,[76,[77,[78,[79,[80,[81,[82,[83,[84,[85,[86,[87,[88,[89,[90,[91,[92,[93,[94,[95,[96,[97,[98,[99,[100,[101,[102,[103,[104,[105,[106,[107,[108,[109,[110,[111,[112,[113,[114,[115,[116,[117,[118,[119,[120]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]] -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/fuzzing/json_seed_corpus/IntegerOverflow.json: -------------------------------------------------------------------------------- 1 | 9720730739393920739 2 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/fuzzing/json_seed_corpus/Numbers.json: -------------------------------------------------------------------------------- 1 | [ 2 | 123, 3 | -123, 4 | 123.456, 5 | -123.456, 6 | 12e34, 7 | 12e-34, 8 | 12e+34, 9 | 12E34, 10 | 12E-34, 11 | 12E+34, 12 | 12.34e56, 13 | 12.34e-56, 14 | 12.34e+56, 15 | 12.34E56, 16 | 12.34E-56, 17 | 12.34E+56, 18 | NaN, 19 | -NaN, 20 | +NaN, 21 | Infinity, 22 | +Infinity, 23 | -Infinity 24 | ] -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/fuzzing/json_seed_corpus/OpenWeatherMap.json: -------------------------------------------------------------------------------- 1 | { 2 | "coord": { 3 | "lon": -0.13, 4 | "lat": 51.51 5 | }, 6 | "weather": [ 7 | { 8 | "id": 301, 9 | "main": "Drizzle", 10 | "description": "drizzle", 11 | "icon": "09n" 12 | }, 13 | { 14 | "id": 701, 15 | "main": "Mist", 16 | "description": "mist", 17 | "icon": "50n" 18 | }, 19 | { 20 | "id": 741, 21 | "main": "Fog", 22 | "description": "fog", 23 | "icon": "50n" 24 | } 25 | ], 26 | "base": "stations", 27 | "main": { 28 | "temp": 281.87, 29 | "pressure": 1032, 30 | "humidity": 100, 31 | "temp_min": 281.15, 32 | "temp_max": 283.15 33 | }, 34 | "visibility": 2900, 35 | "wind": { 36 | "speed": 1.5 37 | }, 38 | "clouds": { 39 | "all": 90 40 | }, 41 | "dt": 1483820400, 42 | "sys": { 43 | "type": 1, 44 | "id": 5091, 45 | "message": 0.0226, 46 | "country": "GB", 47 | "sunrise": 1483776245, 48 | "sunset": 1483805443 49 | }, 50 | "id": 2643743, 51 | "name": "London", 52 | "cod": 200 53 | } 54 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/fuzzing/json_seed_corpus/Strings.json: -------------------------------------------------------------------------------- 1 | [ 2 | "hello", 3 | 'hello', 4 | hello, 5 | {"hello":"world"}, 6 | {'hello':'world'}, 7 | {hello:world} 8 | ] -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/fuzzing/msgpack_corpus/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/fuzzing/msgpack_fuzzer.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { 4 | DynamicJsonDocument doc(4096); 5 | DeserializationError error = deserializeMsgPack(doc, data, size); 6 | if (!error) { 7 | std::string json; 8 | serializeMsgPack(doc, json); 9 | } 10 | return 0; 11 | } 12 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/fuzzing/msgpack_seed_corpus/array16: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Caffreyfans/IRbaby-firmware/b7886bf56e6812f4b9dd9e8436194d8b49bc8fb6/lib/ArduinoJson_ID64/extras/fuzzing/msgpack_seed_corpus/array16 -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/fuzzing/msgpack_seed_corpus/array32: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Caffreyfans/IRbaby-firmware/b7886bf56e6812f4b9dd9e8436194d8b49bc8fb6/lib/ArduinoJson_ID64/extras/fuzzing/msgpack_seed_corpus/array32 -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/fuzzing/msgpack_seed_corpus/false: -------------------------------------------------------------------------------- 1 | � -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/fuzzing/msgpack_seed_corpus/fixarray: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Caffreyfans/IRbaby-firmware/b7886bf56e6812f4b9dd9e8436194d8b49bc8fb6/lib/ArduinoJson_ID64/extras/fuzzing/msgpack_seed_corpus/fixarray -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/fuzzing/msgpack_seed_corpus/fixint_negative: -------------------------------------------------------------------------------- 1 | � -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/fuzzing/msgpack_seed_corpus/fixint_positive: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/fuzzing/msgpack_seed_corpus/fixmap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Caffreyfans/IRbaby-firmware/b7886bf56e6812f4b9dd9e8436194d8b49bc8fb6/lib/ArduinoJson_ID64/extras/fuzzing/msgpack_seed_corpus/fixmap -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/fuzzing/msgpack_seed_corpus/fixstr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Caffreyfans/IRbaby-firmware/b7886bf56e6812f4b9dd9e8436194d8b49bc8fb6/lib/ArduinoJson_ID64/extras/fuzzing/msgpack_seed_corpus/fixstr -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/fuzzing/msgpack_seed_corpus/float32: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Caffreyfans/IRbaby-firmware/b7886bf56e6812f4b9dd9e8436194d8b49bc8fb6/lib/ArduinoJson_ID64/extras/fuzzing/msgpack_seed_corpus/float32 -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/fuzzing/msgpack_seed_corpus/float64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Caffreyfans/IRbaby-firmware/b7886bf56e6812f4b9dd9e8436194d8b49bc8fb6/lib/ArduinoJson_ID64/extras/fuzzing/msgpack_seed_corpus/float64 -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/fuzzing/msgpack_seed_corpus/int16: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Caffreyfans/IRbaby-firmware/b7886bf56e6812f4b9dd9e8436194d8b49bc8fb6/lib/ArduinoJson_ID64/extras/fuzzing/msgpack_seed_corpus/int16 -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/fuzzing/msgpack_seed_corpus/int32: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Caffreyfans/IRbaby-firmware/b7886bf56e6812f4b9dd9e8436194d8b49bc8fb6/lib/ArduinoJson_ID64/extras/fuzzing/msgpack_seed_corpus/int32 -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/fuzzing/msgpack_seed_corpus/int64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Caffreyfans/IRbaby-firmware/b7886bf56e6812f4b9dd9e8436194d8b49bc8fb6/lib/ArduinoJson_ID64/extras/fuzzing/msgpack_seed_corpus/int64 -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/fuzzing/msgpack_seed_corpus/int8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Caffreyfans/IRbaby-firmware/b7886bf56e6812f4b9dd9e8436194d8b49bc8fb6/lib/ArduinoJson_ID64/extras/fuzzing/msgpack_seed_corpus/int8 -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/fuzzing/msgpack_seed_corpus/map16: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Caffreyfans/IRbaby-firmware/b7886bf56e6812f4b9dd9e8436194d8b49bc8fb6/lib/ArduinoJson_ID64/extras/fuzzing/msgpack_seed_corpus/map16 -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/fuzzing/msgpack_seed_corpus/map32: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Caffreyfans/IRbaby-firmware/b7886bf56e6812f4b9dd9e8436194d8b49bc8fb6/lib/ArduinoJson_ID64/extras/fuzzing/msgpack_seed_corpus/map32 -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/fuzzing/msgpack_seed_corpus/nil: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Caffreyfans/IRbaby-firmware/b7886bf56e6812f4b9dd9e8436194d8b49bc8fb6/lib/ArduinoJson_ID64/extras/fuzzing/msgpack_seed_corpus/nil -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/fuzzing/msgpack_seed_corpus/str16: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Caffreyfans/IRbaby-firmware/b7886bf56e6812f4b9dd9e8436194d8b49bc8fb6/lib/ArduinoJson_ID64/extras/fuzzing/msgpack_seed_corpus/str16 -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/fuzzing/msgpack_seed_corpus/str32: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Caffreyfans/IRbaby-firmware/b7886bf56e6812f4b9dd9e8436194d8b49bc8fb6/lib/ArduinoJson_ID64/extras/fuzzing/msgpack_seed_corpus/str32 -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/fuzzing/msgpack_seed_corpus/str8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Caffreyfans/IRbaby-firmware/b7886bf56e6812f4b9dd9e8436194d8b49bc8fb6/lib/ArduinoJson_ID64/extras/fuzzing/msgpack_seed_corpus/str8 -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/fuzzing/msgpack_seed_corpus/true: -------------------------------------------------------------------------------- 1 | � -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/fuzzing/msgpack_seed_corpus/uint16: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Caffreyfans/IRbaby-firmware/b7886bf56e6812f4b9dd9e8436194d8b49bc8fb6/lib/ArduinoJson_ID64/extras/fuzzing/msgpack_seed_corpus/uint16 -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/fuzzing/msgpack_seed_corpus/uint32: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Caffreyfans/IRbaby-firmware/b7886bf56e6812f4b9dd9e8436194d8b49bc8fb6/lib/ArduinoJson_ID64/extras/fuzzing/msgpack_seed_corpus/uint32 -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/fuzzing/msgpack_seed_corpus/uint64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Caffreyfans/IRbaby-firmware/b7886bf56e6812f4b9dd9e8436194d8b49bc8fb6/lib/ArduinoJson_ID64/extras/fuzzing/msgpack_seed_corpus/uint64 -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/fuzzing/msgpack_seed_corpus/uint8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Caffreyfans/IRbaby-firmware/b7886bf56e6812f4b9dd9e8436194d8b49bc8fb6/lib/ArduinoJson_ID64/extras/fuzzing/msgpack_seed_corpus/uint8 -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/scripts/build-arduino-package.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | TAG=$(git describe) 4 | OUTPUT="ArduinoJson-$TAG.zip" 5 | 6 | cd $(dirname $0)/../../.. 7 | 8 | # remove existing file 9 | rm -f $OUTPUT 10 | 11 | # create zip 12 | 7z a $OUTPUT \ 13 | ArduinoJson/CHANGELOG.md \ 14 | ArduinoJson/examples \ 15 | ArduinoJson/src \ 16 | ArduinoJson/keywords.txt \ 17 | ArduinoJson/library.properties \ 18 | ArduinoJson/LICENSE.md \ 19 | ArduinoJson/README.md \ 20 | ArduinoJson/ArduinoJson.h 21 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/scripts/create-build-envs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | export PATH="$PATH:/Applications/CMake.app/Contents/bin/" 4 | 5 | cd $(dirname $0)/../.. 6 | ROOT=$(pwd) 7 | 8 | mkdir "build" 9 | cd build 10 | BUILD=$(pwd) 11 | 12 | build-env() 13 | { 14 | cd $BUILD 15 | mkdir "$1" 16 | cd "$1" 17 | cmake "$ROOT" -G "$2" 18 | } 19 | 20 | if [[ $(uname) == MINGW* ]] 21 | then 22 | build-env "Make" "MinGW Makefiles" 23 | build-env "SublimeText" "Sublime Text 2 - Ninja" 24 | build-env "VisualStudio" "Visual Studio 14 2015" 25 | else 26 | build-env "SublimeText" "Sublime Text 2 - Ninja" 27 | build-env "Make" "Unix Makefiles" 28 | build-env "Xcode" "Xcode" 29 | fi 30 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/scripts/publish-particle-library.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -eu 4 | 5 | SOURCE_DIR="$(dirname "$0")/../.." 6 | WORK_DIR=$(mktemp -d) 7 | trap 'rm -rf "$WORK_DIR"' EXIT 8 | 9 | cp "$SOURCE_DIR/README.md" "$WORK_DIR/README.md" 10 | cp "$SOURCE_DIR/CHANGELOG.md" "$WORK_DIR/CHANGELOG.md" 11 | cp "$SOURCE_DIR/library.properties" "$WORK_DIR/library.properties" 12 | cp "$SOURCE_DIR/LICENSE.md" "$WORK_DIR/LICENSE.txt" 13 | cp -r "$SOURCE_DIR/src" "$WORK_DIR/" 14 | cp -r "$SOURCE_DIR/examples" "$WORK_DIR/" 15 | 16 | cd "$WORK_DIR" 17 | particle library upload 18 | particle library publish 19 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/scripts/wandbox/publish.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -eu 4 | 5 | ARDUINOJSON_H="$1" 6 | 7 | read_string() { 8 | jq --slurp --raw-input '.' "$1" 9 | } 10 | 11 | compile() { 12 | FILE_PATH="$(dirname $0)/$1.cpp" 13 | cat >parameters.json < 6 | #include 7 | 8 | using namespace ARDUINOJSON_NAMESPACE; 9 | 10 | TEST_CASE("ElementProxy::add()") { 11 | DynamicJsonDocument doc(4096); 12 | doc.addElement(); 13 | ElementProxy ep = doc[0]; 14 | 15 | SECTION("add(int)") { 16 | ep.add(42); 17 | 18 | REQUIRE(doc.as() == "[[42]]"); 19 | } 20 | 21 | SECTION("add(const char*)") { 22 | ep.add("world"); 23 | 24 | REQUIRE(doc.as() == "[[\"world\"]]"); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/ElementProxy/clear.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | using namespace ARDUINOJSON_NAMESPACE; 9 | 10 | TEST_CASE("ElementProxy::clear()") { 11 | DynamicJsonDocument doc(4096); 12 | doc.addElement(); 13 | ElementProxy ep = doc[0]; 14 | 15 | SECTION("size goes back to zero") { 16 | ep.add(42); 17 | ep.clear(); 18 | 19 | REQUIRE(ep.size() == 0); 20 | } 21 | 22 | SECTION("isNull() return true") { 23 | ep.add("hello"); 24 | ep.clear(); 25 | 26 | REQUIRE(ep.isNull() == true); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/ElementProxy/compare.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | using namespace ARDUINOJSON_NAMESPACE; 9 | 10 | TEST_CASE("ElementProxy::operator==()") { 11 | DynamicJsonDocument doc(4096); 12 | 13 | SECTION("same value") { 14 | doc.add(1); 15 | doc.add(1); 16 | 17 | REQUIRE(doc[0] == doc[1]); 18 | REQUIRE_FALSE(doc[0] != doc[1]); 19 | } 20 | 21 | SECTION("different values") { 22 | doc.add(1); 23 | doc.add(2); 24 | 25 | REQUIRE_FALSE(doc[0] == doc[1]); 26 | REQUIRE(doc[0] != doc[1]); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/ElementProxy/remove.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | using namespace ARDUINOJSON_NAMESPACE; 9 | 10 | TEST_CASE("ElementProxy::remove()") { 11 | DynamicJsonDocument doc(4096); 12 | doc.addElement(); 13 | ElementProxy ep = doc[0]; 14 | 15 | SECTION("remove(int)") { 16 | ep.add(1); 17 | ep.add(2); 18 | ep.add(3); 19 | 20 | ep.remove(1); 21 | 22 | REQUIRE(ep.as() == "[1,3]"); 23 | } 24 | 25 | SECTION("remove(const char *)") { 26 | ep["a"] = 1; 27 | ep["b"] = 2; 28 | 29 | ep.remove("a"); 30 | 31 | REQUIRE(ep.as() == "{\"b\":2}"); 32 | } 33 | 34 | SECTION("remove(std::string)") { 35 | ep["a"] = 1; 36 | ep["b"] = 2; 37 | 38 | ep.remove(std::string("b")); 39 | 40 | REQUIRE(ep.as() == "{\"a\":1}"); 41 | } 42 | 43 | #ifdef HAS_VARIABLE_LENGTH_ARRAY 44 | SECTION("remove(vla)") { 45 | ep["a"] = 1; 46 | ep["b"] = 2; 47 | 48 | int i = 4; 49 | char vla[i]; 50 | strcpy(vla, "b"); 51 | ep.remove(vla); 52 | 53 | REQUIRE(ep.as() == "{\"a\":1}"); 54 | } 55 | #endif 56 | } 57 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/ElementProxy/set.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | using namespace ARDUINOJSON_NAMESPACE; 9 | 10 | TEST_CASE("ElementProxy::set()") { 11 | DynamicJsonDocument doc(4096); 12 | doc.addElement(); 13 | ElementProxy ep = doc[0]; 14 | 15 | SECTION("set(int)") { 16 | ep.set(42); 17 | 18 | REQUIRE(doc.as() == "[42]"); 19 | } 20 | 21 | SECTION("set(const char*)") { 22 | ep.set("world"); 23 | 24 | REQUIRE(doc.as() == "[\"world\"]"); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/ElementProxy/size.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | using namespace ARDUINOJSON_NAMESPACE; 9 | 10 | TEST_CASE("ElementProxy::size()") { 11 | DynamicJsonDocument doc(4096); 12 | doc.addElement(); 13 | ElementProxy ep = doc[0]; 14 | 15 | SECTION("returns 0") { 16 | REQUIRE(ep.size() == 0); 17 | } 18 | 19 | SECTION("as an array, returns 2") { 20 | ep.add(1); 21 | ep.add(2); 22 | REQUIRE(ep.size() == 2); 23 | } 24 | 25 | SECTION("as an object, returns 2") { 26 | ep["a"] = 1; 27 | ep["b"] = 2; 28 | REQUIRE(ep.size() == 2); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/Helpers/CustomReader.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | class CustomReader { 10 | std::stringstream _stream; 11 | 12 | public: 13 | CustomReader(const char* input) : _stream(input) {} 14 | 15 | int read() { 16 | return _stream.get(); 17 | } 18 | 19 | size_t readBytes(char* buffer, size_t length) { 20 | _stream.read(buffer, static_cast(length)); 21 | return static_cast(_stream.gcount()); 22 | } 23 | 24 | private: 25 | CustomReader(const CustomReader&); 26 | }; 27 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/Helpers/Stream.h: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | // Reproduces Arduino's Stream class 8 | class Stream // : public Print 9 | { 10 | public: 11 | virtual ~Stream() {} 12 | virtual int read() = 0; 13 | virtual size_t readBytes(char *buffer, size_t length) = 0; 14 | }; 15 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/Helpers/WString.h: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | // Reproduces Arduino's String class 10 | class String { 11 | public: 12 | String& operator+=(const char* rhs) { 13 | _str += rhs; 14 | return *this; 15 | } 16 | 17 | size_t length() const { 18 | return _str.size(); 19 | } 20 | 21 | const char* c_str() const { 22 | return _str.c_str(); 23 | } 24 | 25 | bool operator==(const char* s) const { 26 | return _str == s; 27 | } 28 | 29 | friend std::ostream& operator<<(std::ostream& lhs, const ::String& rhs) { 30 | lhs << rhs._str; 31 | return lhs; 32 | } 33 | 34 | private: 35 | std::string _str; 36 | }; 37 | 38 | class StringSumHelper; 39 | 40 | inline bool operator==(const std::string& lhs, const ::String& rhs) { 41 | return lhs == rhs.c_str(); 42 | } 43 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/IntegrationTests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ArduinoJson - arduinojson.org 2 | # Copyright Benoit Blanchon 2014-2020 3 | # MIT License 4 | 5 | add_executable(IntegrationTests 6 | gbathree.cpp 7 | issue772.cpp 8 | round_trip.cpp 9 | ) 10 | 11 | if(CMAKE_CXX_COMPILER_ID MATCHES "GNU") 12 | target_compile_options(IntegrationTests 13 | PUBLIC 14 | -fsingle-precision-constant # issue 544 15 | ) 16 | endif() 17 | 18 | target_link_libraries(IntegrationTests catch) 19 | add_test(IntegrationTests IntegrationTests) 20 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/IntegrationTests/issue772.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | // https://github.com/bblanchon/ArduinoJson/issues/772 9 | 10 | TEST_CASE("Issue772") { 11 | DynamicJsonDocument doc1(4096); 12 | DynamicJsonDocument doc2(4096); 13 | DeserializationError err; 14 | std::string data = 15 | "{\"state\":{\"reported\":{\"timestamp\":\"2018-07-02T09:40:12Z\"," 16 | "\"mac\":\"2C3AE84FC076\",\"firmwareVersion\":\"v0.2.7-5-gf4d4d78\"," 17 | "\"visibleLight\":261,\"infraRed\":255,\"ultraViolet\":0.02," 18 | "\"Temperature\":26.63,\"Pressure\":101145.7,\"Humidity\":54.79883," 19 | "\"Vbat\":4.171261,\"soilMoisture\":0,\"ActB\":0}}}"; 20 | err = deserializeJson(doc1, data); 21 | REQUIRE(err == DeserializationError::Ok); 22 | 23 | data = ""; 24 | serializeMsgPack(doc1, data); 25 | err = deserializeMsgPack(doc2, data); 26 | 27 | REQUIRE(err == DeserializationError::Ok); 28 | } 29 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/JsonArray/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ArduinoJson - arduinojson.org 2 | # Copyright Benoit Blanchon 2014-2020 3 | # MIT License 4 | 5 | add_executable(JsonArrayTests 6 | add.cpp 7 | copyArray.cpp 8 | createNested.cpp 9 | equals.cpp 10 | get.cpp 11 | isNull.cpp 12 | iterator.cpp 13 | memoryUsage.cpp 14 | nesting.cpp 15 | remove.cpp 16 | size.cpp 17 | std_string.cpp 18 | subscript.cpp 19 | undefined.cpp 20 | ) 21 | 22 | target_link_libraries(JsonArrayTests catch) 23 | add_test(JsonArray JsonArrayTests) 24 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/JsonArray/createNested.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | TEST_CASE("JsonArray basics") { 9 | DynamicJsonDocument doc(4096); 10 | JsonArray array = doc.to(); 11 | 12 | SECTION("CreateNestedArray") { 13 | JsonArray arr = array.createNestedArray(); 14 | REQUIRE(arr == array[0].as()); 15 | } 16 | 17 | SECTION("CreateNestedObject") { 18 | JsonObject obj = array.createNestedObject(); 19 | REQUIRE(obj == array[0].as()); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/JsonArray/get.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | TEST_CASE("JsonArray::get()") { 9 | DynamicJsonDocument doc(4096); 10 | deserializeJson(doc, "[1,2,3]"); 11 | JsonArray array = doc.as(); 12 | 13 | SECTION("Overflow") { 14 | REQUIRE(array.getElement(3).isNull()); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/JsonArray/iterator.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | template 9 | static void run_iterator_test() { 10 | StaticJsonDocument doc; 11 | JsonArray tmp = doc.to(); 12 | tmp.add(12); 13 | tmp.add(34); 14 | 15 | TArray array = tmp; 16 | typename TArray::iterator it = array.begin(); 17 | typename TArray::iterator end = array.end(); 18 | 19 | REQUIRE(end != it); 20 | REQUIRE(12 == it->template as()); 21 | REQUIRE(12 == static_cast(*it)); 22 | ++it; 23 | REQUIRE(end != it); 24 | REQUIRE(34 == it->template as()); 25 | REQUIRE(34 == static_cast(*it)); 26 | ++it; 27 | REQUIRE(end == it); 28 | } 29 | 30 | TEST_CASE("JsonArray::begin()/end()") { 31 | run_iterator_test(); 32 | } 33 | 34 | TEST_CASE("JsonArrayConst::begin()/end()") { 35 | run_iterator_test(); 36 | } 37 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/JsonArray/nesting.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | TEST_CASE("JsonArray::nesting()") { 9 | DynamicJsonDocument doc(4096); 10 | JsonArray arr = doc.to(); 11 | 12 | SECTION("return 0 if uninitialized") { 13 | JsonArray unitialized; 14 | REQUIRE(unitialized.nesting() == 0); 15 | } 16 | 17 | SECTION("returns 1 for empty array") { 18 | REQUIRE(arr.nesting() == 1); 19 | } 20 | 21 | SECTION("returns 1 for flat array") { 22 | arr.add("hello"); 23 | REQUIRE(arr.nesting() == 1); 24 | } 25 | 26 | SECTION("returns 2 with nested array") { 27 | arr.createNestedArray(); 28 | REQUIRE(arr.nesting() == 2); 29 | } 30 | 31 | SECTION("returns 2 with nested object") { 32 | arr.createNestedObject(); 33 | REQUIRE(arr.nesting() == 2); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/JsonArray/size.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | TEST_CASE("JsonArray::size()") { 9 | DynamicJsonDocument doc(4096); 10 | JsonArray array = doc.to(); 11 | 12 | SECTION("returns 0 is empty") { 13 | REQUIRE(0U == array.size()); 14 | } 15 | 16 | SECTION("increases after add()") { 17 | array.add("hello"); 18 | REQUIRE(1U == array.size()); 19 | 20 | array.add("world"); 21 | REQUIRE(2U == array.size()); 22 | } 23 | 24 | SECTION("remains the same after replacing an element") { 25 | array.add("hello"); 26 | REQUIRE(1U == array.size()); 27 | 28 | array[0] = "hello"; 29 | REQUIRE(1U == array.size()); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/JsonArray/std_string.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | static void eraseString(std::string &str) { 9 | char *p = const_cast(str.c_str()); 10 | while (*p) *p++ = '*'; 11 | } 12 | 13 | TEST_CASE("std::string") { 14 | DynamicJsonDocument doc(4096); 15 | JsonArray array = doc.to(); 16 | 17 | SECTION("add()") { 18 | std::string value("hello"); 19 | array.add(value); 20 | eraseString(value); 21 | REQUIRE(std::string("hello") == array[0]); 22 | } 23 | 24 | SECTION("operator[]") { 25 | std::string value("world"); 26 | array.add("hello"); 27 | array[0] = value; 28 | eraseString(value); 29 | REQUIRE(std::string("world") == array[0]); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/JsonArray/undefined.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | using namespace Catch::Matchers; 9 | 10 | TEST_CASE("Undefined JsonArray") { 11 | JsonArray array; 12 | 13 | SECTION("SubscriptFails") { 14 | REQUIRE(array[0].isNull()); 15 | } 16 | 17 | SECTION("AddFails") { 18 | array.add(1); 19 | REQUIRE(0 == array.size()); 20 | } 21 | 22 | SECTION("CreateNestedArrayFails") { 23 | REQUIRE(array.createNestedArray().isNull()); 24 | } 25 | 26 | SECTION("CreateNestedObjectFails") { 27 | REQUIRE(array.createNestedObject().isNull()); 28 | } 29 | 30 | SECTION("PrintToWritesBrackets") { 31 | char buffer[32]; 32 | serializeJson(array, buffer, sizeof(buffer)); 33 | REQUIRE_THAT(buffer, Equals("null")); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/JsonDeserializer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ArduinoJson - arduinojson.org 2 | # Copyright Benoit Blanchon 2014-2020 3 | # MIT License 4 | 5 | add_executable(JsonDeserializerTests 6 | array.cpp 7 | array_static.cpp 8 | DeserializationError.cpp 9 | incomplete_input.cpp 10 | input_types.cpp 11 | number.cpp 12 | invalid_input.cpp 13 | misc.cpp 14 | nestingLimit.cpp 15 | object.cpp 16 | object_static.cpp 17 | string.cpp 18 | ) 19 | 20 | target_link_libraries(JsonDeserializerTests catch) 21 | set_target_properties(JsonDeserializerTests PROPERTIES UNITY_BUILD OFF) 22 | 23 | add_test(JsonDeserializer JsonDeserializerTests) 24 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/JsonDeserializer/incomplete_input.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #define ARDUINOJSON_DECODE_UNICODE 1 6 | #include 7 | #include 8 | 9 | TEST_CASE("Truncated JSON input") { 10 | const char* testCases[] = {"\"hello", "\'hello", "'\\u", "'\\u00", "'\\u000", 11 | // false 12 | "f", "fa", "fal", "fals", 13 | // true 14 | "t", "tr", "tru", 15 | // null 16 | "n", "nu", "nul"}; 17 | const size_t testCount = sizeof(testCases) / sizeof(testCases[0]); 18 | 19 | DynamicJsonDocument doc(4096); 20 | 21 | for (size_t i = 0; i < testCount; i++) { 22 | const char* input = testCases[i]; 23 | CAPTURE(input); 24 | REQUIRE(deserializeJson(doc, input) == 25 | DeserializationError::IncompleteInput); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/JsonDocument/BasicJsonDocument.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #include 6 | #include // malloc, free 7 | #include 8 | #include 9 | 10 | using ARDUINOJSON_NAMESPACE::addPadding; 11 | 12 | class SpyingAllocator { 13 | public: 14 | SpyingAllocator(std::ostream& log) : _log(log) {} 15 | 16 | void* allocate(size_t n) { 17 | _log << "A" << n; 18 | return malloc(n); 19 | } 20 | void deallocate(void* p) { 21 | _log << "F"; 22 | free(p); 23 | } 24 | 25 | private: 26 | SpyingAllocator& operator=(const SpyingAllocator& src); 27 | 28 | std::ostream& _log; 29 | }; 30 | 31 | typedef BasicJsonDocument MyJsonDocument; 32 | 33 | TEST_CASE("BasicJsonDocument") { 34 | std::stringstream log; 35 | 36 | SECTION("Construct/Destruct") { 37 | { MyJsonDocument doc(4096, log); } 38 | REQUIRE(log.str() == "A4096F"); 39 | } 40 | 41 | SECTION("Copy construct") { 42 | { 43 | MyJsonDocument doc1(4096, log); 44 | doc1.set(std::string("The size of this string is 32!!")); 45 | MyJsonDocument doc2(doc1); 46 | } 47 | REQUIRE(log.str() == "A4096A32FF"); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/JsonDocument/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ArduinoJson - arduinojson.org 2 | # Copyright Benoit Blanchon 2014-2020 3 | # MIT License 4 | 5 | add_executable(JsonDocumentTests 6 | add.cpp 7 | BasicJsonDocument.cpp 8 | compare.cpp 9 | containsKey.cpp 10 | createNested.cpp 11 | DynamicJsonDocument.cpp 12 | isNull.cpp 13 | nesting.cpp 14 | remove.cpp 15 | shrinkToFit.cpp 16 | size.cpp 17 | StaticJsonDocument.cpp 18 | subscript.cpp 19 | ) 20 | 21 | target_link_libraries(JsonDocumentTests catch) 22 | add_test(JsonDocument JsonDocumentTests) 23 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/JsonDocument/add.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | TEST_CASE("JsonDocument::add()") { 9 | DynamicJsonDocument doc(4096); 10 | 11 | SECTION("integer") { 12 | doc.add(42); 13 | 14 | REQUIRE(doc.as() == "[42]"); 15 | } 16 | 17 | SECTION("const char*") { 18 | doc.add("hello"); 19 | 20 | REQUIRE(doc.as() == "[\"hello\"]"); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/JsonDocument/containsKey.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | TEST_CASE("JsonDocument::containsKey()") { 9 | DynamicJsonDocument doc(4096); 10 | 11 | SECTION("returns true on object") { 12 | doc["hello"] = "world"; 13 | 14 | REQUIRE(doc.containsKey("hello") == true); 15 | } 16 | 17 | SECTION("returns true when value is null") { 18 | doc["hello"] = static_cast(0); 19 | 20 | REQUIRE(doc.containsKey("hello") == true); 21 | } 22 | 23 | SECTION("returns true when key is a std::string") { 24 | doc["hello"] = "world"; 25 | 26 | REQUIRE(doc.containsKey(std::string("hello")) == true); 27 | } 28 | 29 | SECTION("returns false on object") { 30 | doc["world"] = "hello"; 31 | 32 | REQUIRE(doc.containsKey("hello") == false); 33 | } 34 | 35 | SECTION("returns false on array") { 36 | doc.add("hello"); 37 | 38 | REQUIRE(doc.containsKey("hello") == false); 39 | } 40 | 41 | SECTION("returns false on null") { 42 | REQUIRE(doc.containsKey("hello") == false); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/JsonDocument/isNull.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | TEST_CASE("JsonDocument::isNull()") { 9 | DynamicJsonDocument doc(4096); 10 | 11 | SECTION("returns true if uninitialized") { 12 | REQUIRE(doc.isNull() == true); 13 | } 14 | 15 | SECTION("returns false after to()") { 16 | doc.to(); 17 | REQUIRE(doc.isNull() == false); 18 | } 19 | 20 | SECTION("returns false after to()") { 21 | doc.to(); 22 | REQUIRE(doc.isNull() == false); 23 | } 24 | 25 | SECTION("returns true after to()") { 26 | REQUIRE(doc.isNull() == true); 27 | } 28 | 29 | SECTION("returns false after set()") { 30 | doc.to().set(42); 31 | REQUIRE(doc.isNull() == false); 32 | } 33 | 34 | SECTION("returns true after clear()") { 35 | doc.to(); 36 | doc.clear(); 37 | REQUIRE(doc.isNull() == true); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/JsonDocument/nesting.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | TEST_CASE("JsonDocument::nesting()") { 9 | DynamicJsonDocument doc(4096); 10 | 11 | SECTION("return 0 if uninitialized") { 12 | REQUIRE(doc.nesting() == 0); 13 | } 14 | 15 | SECTION("returns 0 for string") { 16 | JsonVariant var = doc.to(); 17 | var.set("hello"); 18 | REQUIRE(doc.nesting() == 0); 19 | } 20 | 21 | SECTION("returns 1 for empty object") { 22 | doc.to(); 23 | REQUIRE(doc.nesting() == 1); 24 | } 25 | 26 | SECTION("returns 1 for empty array") { 27 | doc.to(); 28 | REQUIRE(doc.nesting() == 1); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/JsonDocument/remove.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | TEST_CASE("JsonDocument::remove()") { 9 | DynamicJsonDocument doc(4096); 10 | 11 | SECTION("remove(int)") { 12 | doc.add(1); 13 | doc.add(2); 14 | doc.add(3); 15 | 16 | doc.remove(1); 17 | 18 | REQUIRE(doc.as() == "[1,3]"); 19 | } 20 | 21 | SECTION("remove(const char *)") { 22 | doc["a"] = 1; 23 | doc["b"] = 2; 24 | 25 | doc.remove("a"); 26 | 27 | REQUIRE(doc.as() == "{\"b\":2}"); 28 | } 29 | 30 | SECTION("remove(std::string)") { 31 | doc["a"] = 1; 32 | doc["b"] = 2; 33 | 34 | doc.remove(std::string("b")); 35 | 36 | REQUIRE(doc.as() == "{\"a\":1}"); 37 | } 38 | 39 | #ifdef HAS_VARIABLE_LENGTH_ARRAY 40 | SECTION("remove(vla)") { 41 | doc["a"] = 1; 42 | doc["b"] = 2; 43 | 44 | int i = 4; 45 | char vla[i]; 46 | strcpy(vla, "b"); 47 | doc.remove(vla); 48 | 49 | REQUIRE(doc.as() == "{\"a\":1}"); 50 | } 51 | #endif 52 | } 53 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/JsonDocument/size.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | TEST_CASE("JsonDocument::size()") { 9 | DynamicJsonDocument doc(4096); 10 | 11 | SECTION("returns 0") { 12 | REQUIRE(doc.size() == 0); 13 | } 14 | 15 | SECTION("as an array, return 2") { 16 | doc.add(1); 17 | doc.add(2); 18 | 19 | REQUIRE(doc.size() == 2); 20 | } 21 | 22 | SECTION("as an object, return 2") { 23 | doc["a"] = 1; 24 | doc["b"] = 2; 25 | 26 | REQUIRE(doc.size() == 2); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/JsonObject/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ArduinoJson - arduinojson.org 2 | # Copyright Benoit Blanchon 2014-2020 3 | # MIT License 4 | 5 | add_executable(JsonObjectTests 6 | containsKey.cpp 7 | copy.cpp 8 | createNestedArray.cpp 9 | createNestedObject.cpp 10 | equals.cpp 11 | invalid.cpp 12 | isNull.cpp 13 | iterator.cpp 14 | memoryUsage.cpp 15 | nesting.cpp 16 | remove.cpp 17 | size.cpp 18 | std_string.cpp 19 | subscript.cpp 20 | ) 21 | 22 | target_link_libraries(JsonObjectTests catch) 23 | add_test(JsonObject JsonObjectTests) 24 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/JsonObject/containsKey.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | TEST_CASE("JsonObject::containsKey()") { 9 | DynamicJsonDocument doc(4096); 10 | JsonObject obj = doc.to(); 11 | obj["hello"] = 42; 12 | 13 | SECTION("returns true only if key is present") { 14 | REQUIRE(false == obj.containsKey("world")); 15 | REQUIRE(true == obj.containsKey("hello")); 16 | } 17 | 18 | SECTION("works with JsonObjectConst") { 19 | JsonObjectConst cobj = obj; 20 | REQUIRE(false == cobj.containsKey("world")); 21 | REQUIRE(true == cobj.containsKey("hello")); 22 | } 23 | 24 | SECTION("returns false after remove()") { 25 | obj.remove("hello"); 26 | 27 | REQUIRE(false == obj.containsKey("hello")); 28 | } 29 | 30 | #ifdef HAS_VARIABLE_LENGTH_ARRAY 31 | SECTION("key is a VLA") { 32 | int i = 16; 33 | char vla[i]; 34 | strcpy(vla, "hello"); 35 | 36 | REQUIRE(true == obj.containsKey(vla)); 37 | } 38 | #endif 39 | } 40 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/JsonObject/createNestedArray.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | TEST_CASE("JsonObject::createNestedArray()") { 9 | DynamicJsonDocument doc(4096); 10 | JsonObject obj = doc.to(); 11 | 12 | SECTION("key is a const char*") { 13 | JsonArray arr = obj.createNestedArray("hello"); 14 | REQUIRE(arr.isNull() == false); 15 | } 16 | 17 | #ifdef HAS_VARIABLE_LENGTH_ARRAY 18 | SECTION("key is a VLA") { 19 | int i = 16; 20 | char vla[i]; 21 | strcpy(vla, "hello"); 22 | 23 | JsonArray arr = obj.createNestedArray(vla); 24 | REQUIRE(arr.isNull() == false); 25 | } 26 | #endif 27 | } 28 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/JsonObject/createNestedObject.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | TEST_CASE("JsonObject::createNestedObject()") { 9 | DynamicJsonDocument doc(4096); 10 | JsonObject obj = doc.to(); 11 | 12 | SECTION("key is a const char*") { 13 | obj.createNestedObject("hello"); 14 | } 15 | 16 | #ifdef HAS_VARIABLE_LENGTH_ARRAY 17 | SECTION("key is a VLA") { 18 | int i = 16; 19 | char vla[i]; 20 | strcpy(vla, "hello"); 21 | 22 | obj.createNestedObject(vla); 23 | } 24 | #endif 25 | } 26 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/JsonObject/invalid.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | using namespace Catch::Matchers; 9 | 10 | TEST_CASE("JsonObject::invalid()") { 11 | JsonObject obj; 12 | 13 | SECTION("SubscriptFails") { 14 | REQUIRE(obj["key"].isNull()); 15 | } 16 | 17 | SECTION("AddFails") { 18 | obj["hello"] = "world"; 19 | REQUIRE(0 == obj.size()); 20 | } 21 | 22 | SECTION("CreateNestedArrayFails") { 23 | REQUIRE(obj.createNestedArray("hello").isNull()); 24 | } 25 | 26 | SECTION("CreateNestedObjectFails") { 27 | REQUIRE(obj.createNestedObject("world").isNull()); 28 | } 29 | 30 | SECTION("serialize to 'null'") { 31 | char buffer[32]; 32 | serializeJson(obj, buffer, sizeof(buffer)); 33 | REQUIRE_THAT(buffer, Equals("null")); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/JsonObject/nesting.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | TEST_CASE("JsonObject::nesting()") { 9 | DynamicJsonDocument doc(4096); 10 | JsonObject obj = doc.to(); 11 | 12 | SECTION("return 0 if uninitialized") { 13 | JsonObject unitialized; 14 | REQUIRE(unitialized.nesting() == 0); 15 | } 16 | 17 | SECTION("returns 1 for empty object") { 18 | REQUIRE(obj.nesting() == 1); 19 | } 20 | 21 | SECTION("returns 1 for flat object") { 22 | obj["hello"] = "world"; 23 | REQUIRE(obj.nesting() == 1); 24 | } 25 | 26 | SECTION("returns 2 with nested array") { 27 | obj.createNestedArray("nested"); 28 | REQUIRE(obj.nesting() == 2); 29 | } 30 | 31 | SECTION("returns 2 with nested object") { 32 | obj.createNestedObject("nested"); 33 | REQUIRE(obj.nesting() == 2); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/JsonObject/size.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | TEST_CASE("JsonObject::size()") { 10 | DynamicJsonDocument doc(4096); 11 | JsonObject obj = doc.to(); 12 | 13 | SECTION("initial size is zero") { 14 | REQUIRE(0 == obj.size()); 15 | } 16 | 17 | SECTION("increases when values are added") { 18 | obj["hello"] = 42; 19 | REQUIRE(1 == obj.size()); 20 | } 21 | 22 | SECTION("decreases when values are removed") { 23 | obj["hello"] = 42; 24 | obj.remove("hello"); 25 | REQUIRE(0 == obj.size()); 26 | } 27 | 28 | SECTION("doesn't increase when the same key is added twice") { 29 | obj["hello"] = 1; 30 | obj["hello"] = 2; 31 | REQUIRE(1 == obj.size()); 32 | } 33 | 34 | SECTION("doesn't decrease when another key is removed") { 35 | obj["hello"] = 1; 36 | obj.remove("world"); 37 | REQUIRE(1 == obj.size()); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/JsonSerializer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ArduinoJson - arduinojson.org 2 | # Copyright Benoit Blanchon 2014-2020 3 | # MIT License 4 | 5 | add_executable(JsonSerializerTests 6 | CustomWriter.cpp 7 | JsonArray.cpp 8 | JsonArrayPretty.cpp 9 | JsonObject.cpp 10 | JsonObjectPretty.cpp 11 | JsonVariant.cpp 12 | misc.cpp 13 | std_stream.cpp 14 | std_string.cpp 15 | ) 16 | 17 | target_link_libraries(JsonSerializerTests catch) 18 | add_test(JsonSerializer JsonSerializerTests) 19 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/JsonSerializer/CustomWriter.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | class CustomWriter { 9 | public: 10 | CustomWriter() {} 11 | 12 | size_t write(uint8_t c) { 13 | _str.append(1, static_cast(c)); 14 | return 1; 15 | } 16 | 17 | size_t write(const uint8_t *s, size_t n) { 18 | _str.append(reinterpret_cast(s), n); 19 | return n; 20 | } 21 | 22 | const std::string &str() const { 23 | return _str; 24 | } 25 | 26 | private: 27 | CustomWriter(const CustomWriter &); // non-copiable 28 | CustomWriter &operator=(const CustomWriter &); 29 | 30 | std::string _str; 31 | }; 32 | 33 | TEST_CASE("CustomWriter") { 34 | DynamicJsonDocument doc(4096); 35 | JsonArray array = doc.to(); 36 | array.add(4); 37 | array.add(2); 38 | 39 | SECTION("serializeJson()") { 40 | CustomWriter writer; 41 | serializeJson(array, writer); 42 | 43 | REQUIRE("[4,2]" == writer.str()); 44 | } 45 | 46 | SECTION("serializeJsonPretty") { 47 | CustomWriter writer; 48 | serializeJsonPretty(array, writer); 49 | 50 | REQUIRE("[\r\n 4,\r\n 2\r\n]" == writer.str()); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/JsonSerializer/misc.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | TEST_CASE("serializeJson(MemberProxy)") { 6 | DynamicJsonDocument doc(4096); 7 | deserializeJson(doc, "{\"hello\":42}"); 8 | JsonObject obj = doc.as(); 9 | std::string result; 10 | 11 | serializeJson(obj["hello"], result); 12 | 13 | REQUIRE(result == "42"); 14 | } 15 | 16 | TEST_CASE("serializeJson(ElementProxy)") { 17 | DynamicJsonDocument doc(4096); 18 | deserializeJson(doc, "[42]"); 19 | JsonArray arr = doc.as(); 20 | std::string result; 21 | 22 | serializeJson(arr[0], result); 23 | 24 | REQUIRE(result == "42"); 25 | } 26 | 27 | TEST_CASE("serializeJson(JsonVariantSubscript)") { 28 | DynamicJsonDocument doc(4096); 29 | deserializeJson(doc, "[42]"); 30 | JsonVariant var = doc.as(); 31 | std::string result; 32 | 33 | serializeJson(var[0], result); 34 | 35 | REQUIRE(result == "42"); 36 | } 37 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/JsonSerializer/std_string.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | TEST_CASE("serialize JsonArray to std::string") { 9 | DynamicJsonDocument doc(4096); 10 | JsonArray array = doc.to(); 11 | array.add(4); 12 | array.add(2); 13 | 14 | SECTION("serializeJson()") { 15 | std::string json; 16 | serializeJson(array, json); 17 | 18 | REQUIRE("[4,2]" == json); 19 | } 20 | 21 | SECTION("serializeJsonPretty") { 22 | std::string json; 23 | serializeJsonPretty(array, json); 24 | 25 | REQUIRE("[\r\n 4,\r\n 2\r\n]" == json); 26 | } 27 | } 28 | 29 | TEST_CASE("serialize JsonObject to std::string") { 30 | DynamicJsonDocument doc(4096); 31 | JsonObject obj = doc.to(); 32 | obj["key"] = "value"; 33 | 34 | SECTION("object") { 35 | std::string json; 36 | serializeJson(doc, json); 37 | 38 | REQUIRE("{\"key\":\"value\"}" == json); 39 | } 40 | 41 | SECTION("serializeJsonPretty") { 42 | std::string json; 43 | serializeJsonPretty(doc, json); 44 | 45 | REQUIRE("{\r\n \"key\": \"value\"\r\n}" == json); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/JsonVariant/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ArduinoJson - arduinojson.org 2 | # Copyright Benoit Blanchon 2014-2020 3 | # MIT License 4 | 5 | add_executable(JsonVariantTests 6 | add.cpp 7 | as.cpp 8 | clear.cpp 9 | compare.cpp 10 | containsKey.cpp 11 | copy.cpp 12 | createNested.cpp 13 | is.cpp 14 | isnull.cpp 15 | memoryUsage.cpp 16 | misc.cpp 17 | nesting.cpp 18 | or.cpp 19 | overflow.cpp 20 | remove.cpp 21 | set.cpp 22 | subscript.cpp 23 | types.cpp 24 | undefined.cpp 25 | ) 26 | 27 | target_link_libraries(JsonVariantTests catch) 28 | add_test(JsonVariant JsonVariantTests) 29 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/JsonVariant/add.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | TEST_CASE("JsonVariant::add()") { 10 | DynamicJsonDocument doc(4096); 11 | JsonVariant var = doc.to(); 12 | 13 | SECTION("integer") { 14 | var.add(42); 15 | 16 | REQUIRE(var.as() == "[42]"); 17 | } 18 | 19 | SECTION("const char*") { 20 | var.add("hello"); 21 | 22 | REQUIRE(var.as() == "[\"hello\"]"); 23 | } 24 | 25 | SECTION("std::string") { 26 | var.add(std::string("hello")); 27 | 28 | REQUIRE(var.as() == "[\"hello\"]"); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/JsonVariant/clear.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | TEST_CASE("JsonVariant::clear()") { 10 | DynamicJsonDocument doc(4096); 11 | JsonVariant var = doc.to(); 12 | 13 | SECTION("size goes back to zero") { 14 | var.add(42); 15 | var.clear(); 16 | 17 | REQUIRE(var.size() == 0); 18 | } 19 | 20 | SECTION("isNull() return true") { 21 | var.add("hello"); 22 | var.clear(); 23 | 24 | REQUIRE(var.isNull() == true); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/JsonVariant/memoryUsage.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | TEST_CASE("JsonVariant::memoryUsage()") { 10 | DynamicJsonDocument doc(4096); 11 | JsonVariant var = doc.to(); 12 | 13 | SECTION("returns 0 if uninitialized") { 14 | JsonVariant unitialized; 15 | REQUIRE(unitialized.memoryUsage() == 0); 16 | } 17 | 18 | SECTION("returns size of object") { 19 | JsonObject obj = var.to(); 20 | obj["hello"] = 42; 21 | REQUIRE(var.memoryUsage() == JSON_OBJECT_SIZE(1)); 22 | } 23 | 24 | SECTION("returns size of array") { 25 | JsonArray arr = var.to(); 26 | arr.add(42); 27 | REQUIRE(var.memoryUsage() == JSON_ARRAY_SIZE(1)); 28 | } 29 | 30 | SECTION("returns size of owned string") { 31 | var.set(std::string("hello")); 32 | REQUIRE(var.memoryUsage() == 6); 33 | } 34 | 35 | SECTION("returns size of owned raw") { 36 | var.set(serialized(std::string("hello"))); 37 | REQUIRE(var.memoryUsage() == 5); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/JsonVariant/nesting.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | TEST_CASE("JsonVariant::nesting()") { 9 | DynamicJsonDocument doc(4096); 10 | JsonVariant var = doc.to(); 11 | 12 | SECTION("return 0 if uninitialized") { 13 | JsonVariant unitialized; 14 | REQUIRE(unitialized.nesting() == 0); 15 | } 16 | 17 | SECTION("returns 0 for string") { 18 | var.set("hello"); 19 | REQUIRE(var.nesting() == 0); 20 | } 21 | 22 | SECTION("returns 1 for empty object") { 23 | var.to(); 24 | REQUIRE(var.nesting() == 1); 25 | } 26 | 27 | SECTION("returns 1 for empty array") { 28 | var.to(); 29 | REQUIRE(var.nesting() == 1); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/JsonVariant/remove.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | static const char* null = 0; 10 | 11 | TEST_CASE("JsonVariant::remove()") { 12 | DynamicJsonDocument doc(4096); 13 | JsonVariant var = doc.to(); 14 | 15 | SECTION("remove(int)") { 16 | var.add(1); 17 | var.add(2); 18 | var.add(3); 19 | 20 | var.remove(1); 21 | 22 | REQUIRE(var.as() == "[1,3]"); 23 | } 24 | 25 | SECTION("remove(const char *)") { 26 | var["a"] = 1; 27 | var["b"] = 2; 28 | 29 | var.remove("a"); 30 | 31 | REQUIRE(var.as() == "{\"b\":2}"); 32 | } 33 | 34 | SECTION("remove(std::string)") { 35 | var["a"] = 1; 36 | var["b"] = 2; 37 | 38 | var.remove(std::string("b")); 39 | 40 | REQUIRE(var.as() == "{\"a\":1}"); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/MemberProxy/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ArduinoJson - arduinojson.org 2 | # Copyright Benoit Blanchon 2014-2020 3 | # MIT License 4 | 5 | add_executable(MemberProxyTests 6 | add.cpp 7 | clear.cpp 8 | compare.cpp 9 | containsKey.cpp 10 | remove.cpp 11 | set.cpp 12 | size.cpp 13 | subscript.cpp 14 | ) 15 | 16 | target_link_libraries(MemberProxyTests catch) 17 | add_test(MemberProxy MemberProxyTests) 18 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/MemberProxy/add.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | using namespace ARDUINOJSON_NAMESPACE; 9 | 10 | TEST_CASE("MemberProxy::add()") { 11 | DynamicJsonDocument doc(4096); 12 | MemberProxy mp = doc["hello"]; 13 | 14 | SECTION("add(int)") { 15 | mp.add(42); 16 | 17 | REQUIRE(doc.as() == "{\"hello\":[42]}"); 18 | } 19 | 20 | SECTION("add(const char*)") { 21 | mp.add("world"); 22 | 23 | REQUIRE(doc.as() == "{\"hello\":[\"world\"]}"); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/MemberProxy/clear.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | using namespace ARDUINOJSON_NAMESPACE; 9 | 10 | TEST_CASE("MemberProxy::clear()") { 11 | DynamicJsonDocument doc(4096); 12 | MemberProxy mp = doc["hello"]; 13 | 14 | SECTION("size goes back to zero") { 15 | mp.add(42); 16 | mp.clear(); 17 | 18 | REQUIRE(mp.size() == 0); 19 | } 20 | 21 | SECTION("isNull() return true") { 22 | mp.add("hello"); 23 | mp.clear(); 24 | 25 | REQUIRE(mp.isNull() == true); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/MemberProxy/compare.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | using namespace ARDUINOJSON_NAMESPACE; 9 | 10 | TEST_CASE("MemberProxy::operator==()") { 11 | DynamicJsonDocument doc(4096); 12 | 13 | SECTION("same values") { 14 | doc["key1"] = "value"; 15 | doc["key2"] = "value"; 16 | REQUIRE(doc["key1"] == doc["key2"]); 17 | REQUIRE_FALSE(doc["key1"] != doc["key2"]); 18 | } 19 | 20 | SECTION("different values") { 21 | doc["key1"] = "value1"; 22 | doc["key2"] = "value2"; 23 | REQUIRE_FALSE(doc["key1"] == doc["key2"]); 24 | REQUIRE(doc["key1"] != doc["key2"]); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/MemberProxy/containsKey.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | using namespace ARDUINOJSON_NAMESPACE; 9 | 10 | TEST_CASE("MemberProxy::containsKey()") { 11 | DynamicJsonDocument doc(4096); 12 | MemberProxy mp = doc["hello"]; 13 | 14 | SECTION("containsKey(const char*)") { 15 | mp["key"] = "value"; 16 | 17 | REQUIRE(mp.containsKey("key") == true); 18 | REQUIRE(mp.containsKey("key") == true); 19 | } 20 | 21 | SECTION("containsKey(std::string)") { 22 | mp["key"] = "value"; 23 | 24 | REQUIRE(mp.containsKey(std::string("key")) == true); 25 | REQUIRE(mp.containsKey(std::string("key")) == true); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/MemberProxy/remove.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | using namespace ARDUINOJSON_NAMESPACE; 9 | 10 | TEST_CASE("MemberProxy::remove()") { 11 | DynamicJsonDocument doc(4096); 12 | MemberProxy mp = doc["hello"]; 13 | 14 | SECTION("remove(int)") { 15 | mp.add(1); 16 | mp.add(2); 17 | mp.add(3); 18 | 19 | mp.remove(1); 20 | 21 | REQUIRE(mp.as() == "[1,3]"); 22 | } 23 | 24 | SECTION("remove(const char *)") { 25 | mp["a"] = 1; 26 | mp["b"] = 2; 27 | 28 | mp.remove("a"); 29 | 30 | REQUIRE(mp.as() == "{\"b\":2}"); 31 | } 32 | 33 | SECTION("remove(std::string)") { 34 | mp["a"] = 1; 35 | mp["b"] = 2; 36 | 37 | mp.remove(std::string("b")); 38 | 39 | REQUIRE(mp.as() == "{\"a\":1}"); 40 | } 41 | 42 | #ifdef HAS_VARIABLE_LENGTH_ARRAY 43 | SECTION("remove(vla)") { 44 | mp["a"] = 1; 45 | mp["b"] = 2; 46 | 47 | int i = 4; 48 | char vla[i]; 49 | strcpy(vla, "b"); 50 | mp.remove(vla); 51 | 52 | REQUIRE(mp.as() == "{\"a\":1}"); 53 | } 54 | #endif 55 | } 56 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/MemberProxy/set.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | using namespace ARDUINOJSON_NAMESPACE; 9 | 10 | TEST_CASE("MemberProxy::set()") { 11 | DynamicJsonDocument doc(4096); 12 | MemberProxy mp = doc["hello"]; 13 | 14 | SECTION("set(int)") { 15 | mp.set(42); 16 | 17 | REQUIRE(doc.as() == "{\"hello\":42}"); 18 | } 19 | 20 | SECTION("set(const char*)") { 21 | mp.set("world"); 22 | 23 | REQUIRE(doc.as() == "{\"hello\":\"world\"}"); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/MemberProxy/size.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | using namespace ARDUINOJSON_NAMESPACE; 9 | 10 | TEST_CASE("MemberProxy::size()") { 11 | DynamicJsonDocument doc(4096); 12 | MemberProxy mp = doc["hello"]; 13 | 14 | SECTION("returns 0") { 15 | REQUIRE(mp.size() == 0); 16 | } 17 | 18 | SECTION("as an array, return 2") { 19 | mp.add(1); 20 | mp.add(2); 21 | 22 | REQUIRE(mp.size() == 2); 23 | } 24 | 25 | SECTION("as an object, return 2") { 26 | mp["a"] = 1; 27 | mp["b"] = 2; 28 | 29 | REQUIRE(mp.size() == 2); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/MemberProxy/subscript.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | using namespace ARDUINOJSON_NAMESPACE; 9 | 10 | TEST_CASE("MemberProxy::operator[]") { 11 | DynamicJsonDocument doc(4096); 12 | MemberProxy mp = doc["hello"]; 13 | 14 | SECTION("set integer") { 15 | mp["world"] = 42; 16 | 17 | REQUIRE(doc.as() == "{\"hello\":{\"world\":42}}"); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/MemoryPool/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ArduinoJson - arduinojson.org 2 | # Copyright Benoit Blanchon 2014-2020 3 | # MIT License 4 | 5 | add_executable(MemoryPoolTests 6 | allocVariant.cpp 7 | allocString.cpp 8 | clear.cpp 9 | size.cpp 10 | StringBuilder.cpp 11 | ) 12 | 13 | target_link_libraries(MemoryPoolTests catch) 14 | add_test(MemoryPool MemoryPoolTests) 15 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/MemoryPool/StringBuilder.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | using namespace ARDUINOJSON_NAMESPACE; 10 | 11 | TEST_CASE("StringBuilder") { 12 | char buffer[4096]; 13 | 14 | SECTION("Works when buffer is big enough") { 15 | MemoryPool pool(buffer, addPadding(JSON_STRING_SIZE(6))); 16 | 17 | StringBuilder str(&pool); 18 | str.append("hello"); 19 | 20 | REQUIRE(str.complete() == std::string("hello")); 21 | } 22 | 23 | SECTION("Returns null when too small") { 24 | MemoryPool pool(buffer, sizeof(void*)); 25 | 26 | StringBuilder str(&pool); 27 | str.append("hello world!"); 28 | 29 | REQUIRE(str.complete() == 0); 30 | } 31 | 32 | SECTION("Increases size of memory pool") { 33 | MemoryPool pool(buffer, addPadding(JSON_STRING_SIZE(6))); 34 | 35 | StringBuilder str(&pool); 36 | str.append('h'); 37 | str.complete(); 38 | 39 | REQUIRE(JSON_STRING_SIZE(2) == pool.size()); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/MemoryPool/clear.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | using namespace ARDUINOJSON_NAMESPACE; 9 | 10 | static const size_t poolCapacity = 512; 11 | 12 | TEST_CASE("MemoryPool::clear()") { 13 | char buffer[poolCapacity]; 14 | MemoryPool pool(buffer, sizeof(buffer)); 15 | 16 | SECTION("Discards allocated variants") { 17 | pool.allocVariant(); 18 | 19 | pool.clear(); 20 | REQUIRE(pool.size() == 0); 21 | } 22 | 23 | SECTION("Discards allocated strings") { 24 | pool.allocFrozenString(10); 25 | REQUIRE(pool.size() > 0); 26 | 27 | pool.clear(); 28 | 29 | REQUIRE(pool.size() == 0); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/Misc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ArduinoJson - arduinojson.org 2 | # Copyright Benoit Blanchon 2014-2020 3 | # MIT License 4 | 5 | add_executable(MiscTests 6 | conflicts.cpp 7 | FloatParts.cpp 8 | Readers.cpp 9 | StringAdapters.cpp 10 | StringWriter.cpp 11 | TypeTraits.cpp 12 | unsigned_char.cpp 13 | Utf8.cpp 14 | Utf16.cpp 15 | version.cpp 16 | ) 17 | 18 | target_link_libraries(MiscTests catch) 19 | set_target_properties(MiscTests PROPERTIES UNITY_BUILD OFF) 20 | 21 | add_test(Misc MiscTests) 22 | 23 | 24 | add_executable(Issue978 25 | Issue978.cpp 26 | ) 27 | set_target_properties(Issue978 28 | PROPERTIES 29 | EXCLUDE_FROM_ALL TRUE 30 | EXCLUDE_FROM_DEFAULT_BUILD TRUE 31 | ) 32 | add_test( 33 | NAME 34 | Issue978 35 | COMMAND 36 | ${CMAKE_COMMAND} --build . --target Issue978 --config $ 37 | WORKING_DIRECTORY 38 | ${CMAKE_BINARY_DIR} 39 | ) 40 | set_tests_properties(Issue978 41 | PROPERTIES 42 | WILL_FAIL TRUE) 43 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/Misc/Issue978.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #include 6 | 7 | struct Stream {}; 8 | 9 | int main() { 10 | Stream* stream = 0; 11 | DynamicJsonDocument doc(1024); 12 | deserializeJson(doc, stream); 13 | } 14 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/Misc/conflicts.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | // Include any header that might use the conflicting macros 6 | #include 7 | #include 8 | #include 9 | 10 | // All cores 11 | #define bit() 12 | #define constrain() 13 | #define DEFAULT 14 | #define DISABLED 15 | #define HIGH 16 | #define INPUT 17 | #define LOW 18 | #define max() 19 | #define min() 20 | #define OUTPUT 21 | #define round() 22 | #define sq() 23 | #define word() 24 | #define bitRead() 25 | #define bitSet() 26 | #define bitClear() 27 | #define bitWrite() 28 | #define interrupts() 29 | #define lowByte() 30 | #define highByte() 31 | #define DEC 32 | #define HEX 33 | #define OCT 34 | #define BIN 35 | #define cbi() 36 | #define sbi() 37 | 38 | // ESP8266 39 | #define _max() 40 | #define _min() 41 | 42 | // issue #839 43 | #define BLOCKSIZE 44 | #define CAPACITY 45 | 46 | // catch.hpp mutes several warnings, this file also allows to detect them 47 | #include "ArduinoJson.h" 48 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/Misc/custom_string.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | using namespace ARDUINOJSON_NAMESPACE; 10 | 11 | struct custom_char_traits : std::char_traits {}; 12 | struct custom_allocator : std::allocator {}; 13 | typedef std::basic_string 14 | custom_string; 15 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/Misc/version.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | using Catch::Matchers::StartsWith; 10 | 11 | TEST_CASE("ARDUINOJSON_VERSION") { 12 | std::stringstream version; 13 | 14 | version << ARDUINOJSON_VERSION_MAJOR << "." << ARDUINOJSON_VERSION_MINOR 15 | << "." << ARDUINOJSON_VERSION_REVISION; 16 | 17 | REQUIRE_THAT(ARDUINOJSON_VERSION, StartsWith(version.str())); 18 | } 19 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/MixedConfiguration/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ArduinoJson - arduinojson.org 2 | # Copyright Benoit Blanchon 2014-2020 3 | # MIT License 4 | 5 | # we need C++11 for 'long long' 6 | set(CMAKE_CXX_STANDARD 11) 7 | 8 | add_executable(MixedConfigurationTests 9 | cpp11.cpp 10 | decode_unicode_0.cpp 11 | decode_unicode_1.cpp 12 | enable_infinity_0.cpp 13 | enable_infinity_1.cpp 14 | enable_nan_0.cpp 15 | enable_nan_1.cpp 16 | use_double_0.cpp 17 | use_double_1.cpp 18 | use_long_long_0.cpp 19 | use_long_long_1.cpp 20 | enable_progmem_1.cpp 21 | enable_comments_1.cpp 22 | enable_comments_0.cpp 23 | ) 24 | 25 | target_link_libraries(MixedConfigurationTests catch) 26 | set_target_properties(MixedConfigurationTests PROPERTIES UNITY_BUILD OFF) 27 | 28 | add_test(MixedConfiguration MixedConfigurationTests) 29 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/MixedConfiguration/decode_unicode_0.cpp: -------------------------------------------------------------------------------- 1 | #define ARDUINOJSON_DECODE_UNICODE 0 2 | #include 3 | 4 | #include 5 | 6 | TEST_CASE("ARDUINOJSON_DECODE_UNICODE == 0") { 7 | DynamicJsonDocument doc(2048); 8 | DeserializationError err = deserializeJson(doc, "\"\\uD834\\uDD1E\""); 9 | 10 | REQUIRE(err == DeserializationError::NotSupported); 11 | } 12 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/MixedConfiguration/decode_unicode_1.cpp: -------------------------------------------------------------------------------- 1 | #define ARDUINOJSON_DECODE_UNICODE 1 2 | #include 3 | 4 | #include 5 | 6 | TEST_CASE("ARDUINOJSON_DECODE_UNICODE == 1") { 7 | DynamicJsonDocument doc(2048); 8 | DeserializationError err = deserializeJson(doc, "\"\\uD834\\uDD1E\""); 9 | 10 | REQUIRE(err == DeserializationError::Ok); 11 | } 12 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/MixedConfiguration/enable_infinity_0.cpp: -------------------------------------------------------------------------------- 1 | #define ARDUINOJSON_ENABLE_INFINITY 0 2 | #include 3 | 4 | #include 5 | #include 6 | 7 | static void assertParseFails(const char* json) { 8 | DynamicJsonDocument doc(4096); 9 | auto err = deserializeJson(doc, json); 10 | 11 | REQUIRE(err == DeserializationError::InvalidInput); 12 | } 13 | 14 | static void assertJsonEquals(const JsonDocument& doc, 15 | std::string expectedJson) { 16 | std::string actualJson; 17 | serializeJson(doc, actualJson); 18 | REQUIRE(actualJson == expectedJson); 19 | } 20 | 21 | TEST_CASE("ARDUINOJSON_ENABLE_INFINITY == 0") { 22 | SECTION("serializeJson()") { 23 | DynamicJsonDocument doc(4096); 24 | doc.add(std::numeric_limits::infinity()); 25 | doc.add(-std::numeric_limits::infinity()); 26 | 27 | assertJsonEquals(doc, "[null,null]"); 28 | } 29 | 30 | SECTION("deserializeJson()") { 31 | assertParseFails("{\"X\":Infinity}"); 32 | assertParseFails("{\"X\":-Infinity}"); 33 | assertParseFails("{\"X\":+Infinity}"); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/MixedConfiguration/enable_infinity_1.cpp: -------------------------------------------------------------------------------- 1 | #define ARDUINOJSON_ENABLE_INFINITY 1 2 | #include 3 | 4 | #include 5 | #include 6 | 7 | namespace my { 8 | using ARDUINOJSON_NAMESPACE::isinf; 9 | } // namespace my 10 | 11 | TEST_CASE("ARDUINOJSON_ENABLE_INFINITY == 1") { 12 | DynamicJsonDocument doc(4096); 13 | 14 | SECTION("serializeJson()") { 15 | doc.add(std::numeric_limits::infinity()); 16 | doc.add(-std::numeric_limits::infinity()); 17 | 18 | std::string json; 19 | serializeJson(doc, json); 20 | 21 | REQUIRE(json == "[Infinity,-Infinity]"); 22 | } 23 | 24 | SECTION("deserializeJson()") { 25 | auto err = deserializeJson(doc, "[Infinity,-Infinity,+Infinity]"); 26 | float a = doc[0]; 27 | float b = doc[1]; 28 | float c = doc[2]; 29 | 30 | REQUIRE(err == DeserializationError::Ok); 31 | REQUIRE(my::isinf(a)); 32 | REQUIRE(a > 0); 33 | REQUIRE(my::isinf(b)); 34 | REQUIRE(b < 0); 35 | REQUIRE(my::isinf(c)); 36 | REQUIRE(c > 0); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/MixedConfiguration/enable_nan_0.cpp: -------------------------------------------------------------------------------- 1 | #define ARDUINOJSON_ENABLE_NAN 0 2 | #include 3 | 4 | #include 5 | #include 6 | 7 | TEST_CASE("ARDUINOJSON_ENABLE_NAN == 0") { 8 | DynamicJsonDocument doc(4096); 9 | JsonObject root = doc.to(); 10 | 11 | SECTION("serializeJson()") { 12 | root["X"] = std::numeric_limits::signaling_NaN(); 13 | 14 | std::string json; 15 | serializeJson(doc, json); 16 | 17 | REQUIRE(json == "{\"X\":null}"); 18 | } 19 | 20 | SECTION("deserializeJson()") { 21 | auto err = deserializeJson(doc, "{\"X\":NaN}"); 22 | 23 | REQUIRE(err == DeserializationError::InvalidInput); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/MixedConfiguration/enable_nan_1.cpp: -------------------------------------------------------------------------------- 1 | #define ARDUINOJSON_ENABLE_NAN 1 2 | #include 3 | 4 | #include 5 | #include 6 | 7 | namespace my { 8 | using ARDUINOJSON_NAMESPACE::isnan; 9 | } // namespace my 10 | 11 | TEST_CASE("ARDUINOJSON_ENABLE_NAN == 1") { 12 | DynamicJsonDocument doc(4096); 13 | JsonObject root = doc.to(); 14 | 15 | SECTION("serializeJson()") { 16 | root["X"] = std::numeric_limits::signaling_NaN(); 17 | 18 | std::string json; 19 | serializeJson(doc, json); 20 | 21 | REQUIRE(json == "{\"X\":NaN}"); 22 | } 23 | 24 | SECTION("deserializeJson()") { 25 | auto err = deserializeJson(doc, "{\"X\":NaN}"); 26 | float x = doc["X"]; 27 | 28 | REQUIRE(err == DeserializationError::Ok); 29 | REQUIRE(my::isnan(x)); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/MixedConfiguration/progmem_emulation.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #include // uint8_t 6 | #include // strcmp, strlen... 7 | 8 | class __FlashStringHelper; 9 | 10 | inline const void* convertPtrToFlash(const void* s) { 11 | return reinterpret_cast(s) + 42; 12 | } 13 | 14 | inline const void* convertFlashToPtr(const void* s) { 15 | return reinterpret_cast(s) - 42; 16 | } 17 | 18 | #define F(X) reinterpret_cast(convertPtrToFlash(X)) 19 | #define FC(X) reinterpret_cast(convertPtrToFlash(X)) 20 | 21 | inline uint8_t pgm_read_byte(const void* p) { 22 | return *reinterpret_cast(convertFlashToPtr(p)); 23 | } 24 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/MixedConfiguration/use_double_0.cpp: -------------------------------------------------------------------------------- 1 | #define ARDUINOJSON_USE_DOUBLE 0 2 | #include 3 | 4 | #include 5 | 6 | TEST_CASE("ARDUINOJSON_USE_DOUBLE == 0") { 7 | DynamicJsonDocument doc(4096); 8 | JsonObject root = doc.to(); 9 | 10 | root["pi"] = 3.14; 11 | root["e"] = 2.72; 12 | 13 | std::string json; 14 | serializeJson(doc, json); 15 | 16 | REQUIRE(json == "{\"pi\":3.14,\"e\":2.72}"); 17 | } 18 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/MixedConfiguration/use_double_1.cpp: -------------------------------------------------------------------------------- 1 | #define ARDUINOJSON_USE_DOUBLE 1 2 | #include 3 | 4 | #include 5 | 6 | TEST_CASE("ARDUINOJSON_USE_DOUBLE == 1") { 7 | DynamicJsonDocument doc(4096); 8 | JsonObject root = doc.to(); 9 | 10 | root["pi"] = 3.14; 11 | root["e"] = 2.72; 12 | 13 | std::string json; 14 | serializeJson(doc, json); 15 | 16 | REQUIRE(json == "{\"pi\":3.14,\"e\":2.72}"); 17 | } 18 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/MixedConfiguration/use_long_long_0.cpp: -------------------------------------------------------------------------------- 1 | #define ARDUINOJSON_USE_LONG_LONG 0 2 | #include 3 | 4 | #include 5 | 6 | template 7 | std::string get_expected_json(); 8 | 9 | template <> 10 | std::string get_expected_json<4>() { 11 | return "{\"A\":2899336981,\"B\":2129924785}"; 12 | } 13 | 14 | template <> 15 | std::string get_expected_json<8>() { 16 | return "{\"A\":123456789123456789,\"B\":987654321987654321}"; 17 | } 18 | 19 | TEST_CASE("ARDUINOJSON_USE_LONG_LONG == 0") { 20 | DynamicJsonDocument doc(4096); 21 | JsonObject root = doc.to(); 22 | 23 | root["A"] = 123456789123456789; 24 | root["B"] = 987654321987654321; 25 | 26 | std::string json; 27 | serializeJson(doc, json); 28 | 29 | REQUIRE(json == get_expected_json()); 30 | } 31 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/MixedConfiguration/use_long_long_1.cpp: -------------------------------------------------------------------------------- 1 | #define ARDUINOJSON_USE_LONG_LONG 1 2 | #include 3 | 4 | #include 5 | 6 | TEST_CASE("ARDUINOJSON_USE_LONG_LONG == 1") { 7 | DynamicJsonDocument doc(4096); 8 | JsonObject root = doc.to(); 9 | 10 | root["A"] = 123456789123456789; 11 | root["B"] = 987654321987654321; 12 | 13 | std::string json; 14 | serializeJson(doc, json); 15 | 16 | REQUIRE(json == "{\"A\":123456789123456789,\"B\":987654321987654321}"); 17 | } 18 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/MsgPackDeserializer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ArduinoJson - arduinojson.org 2 | # Copyright Benoit Blanchon 2014-2020 3 | # MIT License 4 | 5 | add_executable(MsgPackDeserializerTests 6 | deserializeArray.cpp 7 | deserializeObject.cpp 8 | deserializeStaticVariant.cpp 9 | deserializeVariant.cpp 10 | doubleToFloat.cpp 11 | incompleteInput.cpp 12 | input_types.cpp 13 | nestingLimit.cpp 14 | notSupported.cpp 15 | ) 16 | 17 | target_link_libraries(MsgPackDeserializerTests catch) 18 | add_test(MsgPackDeserializer MsgPackDeserializerTests) 19 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/MsgPackDeserializer/doubleToFloat.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | using namespace ARDUINOJSON_NAMESPACE; 9 | 10 | template 11 | static void check(const char* input, T expected) { 12 | T actual; 13 | uint8_t* f = reinterpret_cast(&actual); 14 | const uint8_t* d = reinterpret_cast(input); 15 | doubleToFloat(d, f); 16 | fixEndianess(actual); 17 | CHECK(actual == expected); 18 | } 19 | 20 | TEST_CASE("doubleToFloat()") { 21 | check("\x40\x09\x21\xCA\xC0\x83\x12\x6F", 3.1415f); 22 | check("\x00\x00\x00\x00\x00\x00\x00\x00", 0.0f); 23 | check("\x80\x00\x00\x00\x00\x00\x00\x00", -0.0f); 24 | check("\xC0\x5E\xDC\xCC\xCC\xCC\xCC\xCD", -123.45f); 25 | } 26 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/MsgPackSerializer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ArduinoJson - arduinojson.org 2 | # Copyright Benoit Blanchon 2014-2020 3 | # MIT License 4 | 5 | add_executable(MsgPackSerializerTests 6 | destination_types.cpp 7 | measure.cpp 8 | misc.cpp 9 | serializeArray.cpp 10 | serializeObject.cpp 11 | serializeVariant.cpp 12 | ) 13 | 14 | target_link_libraries(MsgPackSerializerTests catch) 15 | add_test(MsgPackSerializer MsgPackSerializerTests) 16 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/MsgPackSerializer/measure.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | TEST_CASE("measureMsgPack()") { 9 | DynamicJsonDocument doc(4096); 10 | JsonObject object = doc.to(); 11 | object["hello"] = "world"; 12 | 13 | REQUIRE(measureMsgPack(doc) == 13); 14 | } 15 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/Numbers/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ArduinoJson - arduinojson.org 2 | # Copyright Benoit Blanchon 2014-2020 3 | # MIT License 4 | 5 | add_executable(NumbersTests 6 | parseFloat.cpp 7 | parseInteger.cpp 8 | parseNumber.cpp 9 | ) 10 | 11 | target_link_libraries(NumbersTests catch) 12 | 13 | add_test(Numbers NumbersTests) 14 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/Numbers/parseNumber.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | using namespace ARDUINOJSON_NAMESPACE; 9 | 10 | TEST_CASE("Test uint32_t overflow") { 11 | ParsedNumber first = 12 | parseNumber("4294967295"); 13 | ParsedNumber second = 14 | parseNumber("4294967296"); 15 | 16 | REQUIRE(first.type() == uint8_t(VALUE_IS_POSITIVE_INTEGER)); 17 | REQUIRE(second.type() == uint8_t(VALUE_IS_FLOAT)); 18 | } 19 | 20 | TEST_CASE("Invalid value") { 21 | ParsedNumber result = parseNumber("6a3"); 22 | 23 | REQUIRE(result.type() == uint8_t(VALUE_IS_NULL)); 24 | } 25 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/TextFormatter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ArduinoJson - arduinojson.org 2 | # Copyright Benoit Blanchon 2014-2020 3 | # MIT License 4 | 5 | add_executable(TextFormatterTests 6 | writeFloat.cpp 7 | writeString.cpp 8 | ) 9 | 10 | target_link_libraries(TextFormatterTests catch) 11 | set_target_properties(TextFormatterTests PROPERTIES UNITY_BUILD OFF) 12 | 13 | add_test(TextFormatter TextFormatterTests) 14 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/catch/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ArduinoJson - arduinojson.org 2 | # Copyright Benoit Blanchon 2014-2020 3 | # MIT License 4 | 5 | add_library(catch 6 | catch.hpp 7 | catch.cpp 8 | ) 9 | 10 | target_include_directories(catch 11 | PUBLIC 12 | ${CMAKE_CURRENT_SOURCE_DIR} 13 | ) 14 | 15 | if(CMAKE_CXX_COMPILER_ID MATCHES "GNU") 16 | # prevent "xxx will change in GCC x.x" with arm-linux-gnueabihf-gcc 17 | target_compile_options(catch PRIVATE -Wno-psabi) 18 | endif() 19 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/extras/tests/catch/catch.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #define CATCH_CONFIG_MAIN 6 | #include "catch.hpp" 7 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/keywords.txt: -------------------------------------------------------------------------------- 1 | # Macros 2 | JSON_ARRAY_SIZE KEYWORD2 3 | JSON_OBJECT_SIZE KEYWORD2 4 | JSON_STRING_SIZE KEYWORD2 5 | 6 | # Free functions 7 | deserializeJson KEYWORD2 8 | deserializeMsgPack KEYWORD2 9 | serialized KEYWORD2 10 | serializeJson KEYWORD2 11 | serializeJsonPretty KEYWORD2 12 | serializeMsgPack KEYWORD2 13 | measureJson KEYWORD2 14 | measureJsonPretty KEYWORD2 15 | measureMsgPack KEYWORD2 16 | 17 | # Methods 18 | add KEYWORD2 19 | as KEYWORD2 20 | createNestedArray KEYWORD2 21 | createNestedObject KEYWORD2 22 | get KEYWORD2 23 | set KEYWORD2 24 | to KEYWORD2 25 | 26 | # Type names 27 | DeserializationError KEYWORD1 DATA_TYPE 28 | DynamicJsonDocument KEYWORD1 DATA_TYPE 29 | JsonArray KEYWORD1 DATA_TYPE 30 | JsonArrayConst KEYWORD1 DATA_TYPE 31 | JsonFloat KEYWORD1 DATA_TYPE 32 | JsonInteger KEYWORD1 DATA_TYPE 33 | JsonObject KEYWORD1 DATA_TYPE 34 | JsonObjectConst KEYWORD1 DATA_TYPE 35 | JsonString KEYWORD1 DATA_TYPE 36 | JsonUInt KEYWORD1 DATA_TYPE 37 | JsonVariant KEYWORD1 DATA_TYPE 38 | JsonVariantConst KEYWORD1 DATA_TYPE 39 | StaticJsonDocument KEYWORD1 DATA_TYPE 40 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/library.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ArduinoJson", 3 | "keywords": "json, rest, http, web", 4 | "description": "An elegant and efficient JSON library for embedded systems", 5 | "homepage": "https://arduinojson.org/?utm_source=meta&utm_medium=library.json", 6 | "repository": { 7 | "type": "git", 8 | "url": "https://github.com/bblanchon/ArduinoJson.git" 9 | }, 10 | "version": "6.14.1", 11 | "authors": { 12 | "name": "Benoit Blanchon", 13 | "url": "https://blog.benoitblanchon.fr" 14 | }, 15 | "exclude": [ 16 | "fuzzing", 17 | "scripts", 18 | "test", 19 | "third-party" 20 | ], 21 | "frameworks": "arduino", 22 | "platforms": "*" 23 | } 24 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/library.properties: -------------------------------------------------------------------------------- 1 | name=ArduinoJson 2 | version=6.14.1 3 | author=Benoit Blanchon 4 | maintainer=Benoit Blanchon 5 | sentence=An efficient and elegant JSON library for Arduino. 6 | 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. 7 | category=Data Processing 8 | url=https://arduinojson.org/?utm_source=meta&utm_medium=library.properties 9 | architectures=* 10 | repository=https://github.com/bblanchon/ArduinoJson.git 11 | license=MIT 12 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/src/ArduinoJson.h: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #ifdef __cplusplus 8 | 9 | #include "ArduinoJson.hpp" 10 | 11 | using namespace ArduinoJson; 12 | 13 | #else 14 | 15 | #error ArduinoJson requires a C++ compiler, please change file extension to .cc or .cpp 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/src/ArduinoJson/Array/ArrayFunctions.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | 11 | inline VariantData *arrayAdd(CollectionData *arr, MemoryPool *pool) { 12 | return arr ? arr->add(pool) : 0; 13 | } 14 | 15 | template 16 | inline void arrayAccept(const CollectionData *arr, Visitor &visitor) { 17 | if (arr) 18 | visitor.visitArray(*arr); 19 | else 20 | visitor.visitNull(); 21 | } 22 | 23 | inline bool arrayEquals(const CollectionData *lhs, const CollectionData *rhs) { 24 | if (lhs == rhs) return true; 25 | if (!lhs || !rhs) return false; 26 | 27 | return lhs->equalsArray(*rhs); 28 | } 29 | } // namespace ARDUINOJSON_NAMESPACE 30 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/src/ArduinoJson/Array/ArrayImpl.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | #include 9 | 10 | namespace ARDUINOJSON_NAMESPACE { 11 | 12 | template 13 | inline ArrayRef ArrayShortcuts::createNestedArray() const { 14 | return impl()->addElement().template to(); 15 | } 16 | 17 | template 18 | inline ObjectRef ArrayShortcuts::createNestedObject() const { 19 | return impl()->addElement().template to(); 20 | } 21 | 22 | template 23 | inline ElementProxy ArrayShortcuts::operator[]( 24 | size_t index) const { 25 | return ElementProxy(*impl(), index); 26 | } 27 | 28 | } // namespace ARDUINOJSON_NAMESPACE 29 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/src/ArduinoJson/Deserialization/NestingLimit.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | 11 | struct NestingLimit { 12 | NestingLimit() : value(ARDUINOJSON_DEFAULT_NESTING_LIMIT) {} 13 | explicit NestingLimit(uint8_t n) : value(n) {} 14 | 15 | uint8_t value; 16 | }; 17 | } // namespace ARDUINOJSON_NAMESPACE 18 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/src/ArduinoJson/Deserialization/Readers/ArduinoStreamReader.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | 11 | template 12 | struct Reader::value>::type> { 14 | public: 15 | explicit Reader(Stream& stream) : _stream(&stream) {} 16 | 17 | int read() { 18 | // don't use _stream.read() as it ignores the timeout 19 | char c; 20 | return _stream->readBytes(&c, 1) ? static_cast(c) : -1; 21 | } 22 | 23 | size_t readBytes(char* buffer, size_t length) { 24 | return _stream->readBytes(buffer, length); 25 | } 26 | 27 | private: 28 | Stream* _stream; 29 | }; 30 | 31 | } // namespace ARDUINOJSON_NAMESPACE 32 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/src/ArduinoJson/Deserialization/Readers/ArduinoStringReader.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | namespace ARDUINOJSON_NAMESPACE { 8 | 9 | template 10 | struct Reader::value>::type> 12 | : BoundedReader { 13 | explicit Reader(const ::String& s) 14 | : BoundedReader(s.c_str(), s.length()) {} 15 | }; 16 | 17 | } // namespace ARDUINOJSON_NAMESPACE 18 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/src/ArduinoJson/Deserialization/Readers/IteratorReader.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | namespace ARDUINOJSON_NAMESPACE { 8 | 9 | template 10 | class IteratorReader { 11 | TIterator _ptr, _end; 12 | 13 | public: 14 | explicit IteratorReader(TIterator begin, TIterator end) 15 | : _ptr(begin), _end(end) {} 16 | 17 | int read() { 18 | if (_ptr < _end) 19 | return static_cast(*_ptr++); 20 | else 21 | return -1; 22 | } 23 | 24 | size_t readBytes(char* buffer, size_t length) { 25 | size_t i = 0; 26 | while (i < length && _ptr < _end) buffer[i++] = *_ptr++; 27 | return i; 28 | } 29 | }; 30 | 31 | template 32 | struct void_ { 33 | typedef void type; 34 | }; 35 | 36 | template 37 | struct Reader::type> 38 | : IteratorReader { 39 | explicit Reader(const TSource& source) 40 | : IteratorReader(source.begin(), 41 | source.end()) {} 42 | }; 43 | } // namespace ARDUINOJSON_NAMESPACE 44 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/src/ArduinoJson/Deserialization/Readers/StdStreamReader.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | 11 | template 12 | struct Reader::value>::type> { 14 | public: 15 | explicit Reader(std::istream& stream) : _stream(&stream) {} 16 | 17 | int read() { 18 | return _stream->get(); 19 | } 20 | 21 | size_t readBytes(char* buffer, size_t length) { 22 | _stream->read(buffer, static_cast(length)); 23 | return static_cast(_stream->gcount()); 24 | } 25 | 26 | private: 27 | std::istream* _stream; 28 | }; 29 | } // namespace ARDUINOJSON_NAMESPACE 30 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/src/ArduinoJson/Document/DynamicJsonDocument.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | #include // malloc, free 10 | 11 | namespace ARDUINOJSON_NAMESPACE { 12 | 13 | struct DefaultAllocator { 14 | void* allocate(size_t size) { 15 | return malloc(size); 16 | } 17 | 18 | void deallocate(void* ptr) { 19 | free(ptr); 20 | } 21 | 22 | void* reallocate(void* ptr, size_t new_size) { 23 | return realloc(ptr, new_size); 24 | } 25 | }; 26 | 27 | typedef BasicJsonDocument DynamicJsonDocument; 28 | 29 | } // namespace ARDUINOJSON_NAMESPACE 30 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/src/ArduinoJson/Json/EscapeSequence.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | 11 | class EscapeSequence { 12 | public: 13 | // Optimized for code size on a 8-bit AVR 14 | static char escapeChar(char c) { 15 | const char *p = escapeTable(false); 16 | while (p[0] && p[1] != c) { 17 | p += 2; 18 | } 19 | return p[0]; 20 | } 21 | 22 | // Optimized for code size on a 8-bit AVR 23 | static char unescapeChar(char c) { 24 | const char *p = escapeTable(true); 25 | for (;;) { 26 | if (p[0] == '\0') return c; 27 | if (p[0] == c) return p[1]; 28 | p += 2; 29 | } 30 | } 31 | 32 | private: 33 | static const char *escapeTable(bool excludeIdenticals) { 34 | return &"\"\"\\\\b\bf\fn\nr\rt\t"[excludeIdenticals ? 4 : 0]; 35 | } 36 | }; 37 | } // namespace ARDUINOJSON_NAMESPACE 38 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/src/ArduinoJson/Json/Utf16.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | #include // uint16_t, uint32_t 10 | 11 | namespace ARDUINOJSON_NAMESPACE { 12 | 13 | namespace Utf16 { 14 | inline bool isHighSurrogate(uint16_t codeunit) { 15 | return codeunit >= 0xD800 && codeunit < 0xDC00; 16 | } 17 | 18 | inline bool isLowSurrogate(uint16_t codeunit) { 19 | return codeunit >= 0xDC00 && codeunit < 0xE000; 20 | } 21 | 22 | class Codepoint { 23 | public: 24 | bool append(uint16_t codeunit) { 25 | if (isHighSurrogate(codeunit)) { 26 | _highSurrogate = codeunit & 0x3FF; 27 | return false; 28 | } 29 | 30 | if (isLowSurrogate(codeunit)) { 31 | _codepoint = 32 | uint32_t(0x10000 + ((_highSurrogate << 10) | (codeunit & 0x3FF))); 33 | return true; 34 | } 35 | 36 | _codepoint = codeunit; 37 | return true; 38 | } 39 | 40 | uint32_t value() const { 41 | return _codepoint; 42 | } 43 | 44 | private: 45 | uint16_t _highSurrogate; 46 | uint32_t _codepoint; 47 | }; 48 | } // namespace Utf16 49 | } // namespace ARDUINOJSON_NAMESPACE 50 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/src/ArduinoJson/Memory/Alignment.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | #include // size_t 10 | 11 | namespace ARDUINOJSON_NAMESPACE { 12 | 13 | inline bool isAligned(void *ptr) { 14 | const size_t mask = sizeof(void *) - 1; 15 | size_t addr = reinterpret_cast(ptr); 16 | return (addr & mask) == 0; 17 | } 18 | 19 | inline size_t addPadding(size_t bytes) { 20 | const size_t mask = sizeof(void *) - 1; 21 | return (bytes + mask) & ~mask; 22 | } 23 | 24 | template 25 | inline T *addPadding(T *p) { 26 | size_t address = addPadding(reinterpret_cast(p)); 27 | return reinterpret_cast(address); 28 | } 29 | 30 | template 31 | struct AddPadding { 32 | static const size_t mask = sizeof(void *) - 1; 33 | static const size_t value = (bytes + mask) & ~mask; 34 | }; 35 | 36 | } // namespace ARDUINOJSON_NAMESPACE 37 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/src/ArduinoJson/Memory/StringBuilder.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | 11 | class StringBuilder { 12 | public: 13 | explicit StringBuilder(MemoryPool* parent) : _parent(parent), _size(0) { 14 | _slot = _parent->allocExpandableString(); 15 | } 16 | 17 | void append(const char* s) { 18 | while (*s) append(*s++); 19 | } 20 | 21 | void append(const char* s, size_t n) { 22 | while (n-- > 0) append(*s++); 23 | } 24 | 25 | void append(char c) { 26 | if (!_slot.value) return; 27 | 28 | if (_size >= _slot.size) { 29 | _slot.value = 0; 30 | return; 31 | } 32 | 33 | _slot.value[_size++] = c; 34 | } 35 | 36 | char* complete() { 37 | append('\0'); 38 | if (_slot.value) { 39 | _parent->freezeString(_slot, _size); 40 | } 41 | return _slot.value; 42 | } 43 | 44 | private: 45 | MemoryPool* _parent; 46 | size_t _size; 47 | StringSlot _slot; 48 | }; 49 | 50 | } // namespace ARDUINOJSON_NAMESPACE 51 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/src/ArduinoJson/Memory/StringSlot.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include // for size_t 8 | 9 | #include 10 | 11 | #define JSON_STRING_SIZE(SIZE) (SIZE) 12 | 13 | namespace ARDUINOJSON_NAMESPACE { 14 | 15 | struct StringSlot { 16 | char *value; 17 | size_t size; 18 | }; 19 | } // namespace ARDUINOJSON_NAMESPACE 20 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/src/ArduinoJson/Misc/Visitable.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | 11 | struct Visitable { 12 | // template 13 | // void accept(Visitor&) const; 14 | }; 15 | 16 | template 17 | struct IsVisitable : is_base_of {}; 18 | 19 | template 20 | struct IsVisitable : IsVisitable {}; 21 | } // namespace ARDUINOJSON_NAMESPACE 22 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/src/ArduinoJson/MsgPack/endianess.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | #include 9 | 10 | namespace ARDUINOJSON_NAMESPACE { 11 | 12 | #if ARDUINOJSON_LITTLE_ENDIAN 13 | inline void fixEndianess(uint8_t *p, integral_constant) { 14 | swap(p[0], p[7]); 15 | swap(p[1], p[6]); 16 | swap(p[2], p[5]); 17 | swap(p[3], p[4]); 18 | } 19 | 20 | inline void fixEndianess(uint8_t *p, integral_constant) { 21 | swap(p[0], p[3]); 22 | swap(p[1], p[2]); 23 | } 24 | 25 | inline void fixEndianess(uint8_t *p, integral_constant) { 26 | swap(p[0], p[1]); 27 | } 28 | 29 | inline void fixEndianess(uint8_t *, integral_constant) {} 30 | 31 | template 32 | inline void fixEndianess(T &value) { 33 | fixEndianess(reinterpret_cast(&value), 34 | integral_constant()); 35 | } 36 | #else 37 | template 38 | inline void fixEndianess(T &) {} 39 | #endif 40 | 41 | } // namespace ARDUINOJSON_NAMESPACE 42 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/src/ArduinoJson/MsgPack/ieee754.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | 11 | inline void doubleToFloat(const uint8_t d[8], uint8_t f[4]) { 12 | f[0] = uint8_t((d[0] & 0xC0) | (d[0] << 3 & 0x3f) | (d[1] >> 5)); 13 | f[1] = uint8_t((d[1] << 3) | (d[2] >> 5)); 14 | f[2] = uint8_t((d[2] << 3) | (d[3] >> 5)); 15 | f[3] = uint8_t((d[3] << 3) | (d[4] >> 5)); 16 | } 17 | 18 | } // namespace ARDUINOJSON_NAMESPACE 19 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/src/ArduinoJson/Numbers/Float.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | #include 9 | 10 | namespace ARDUINOJSON_NAMESPACE { 11 | 12 | #if ARDUINOJSON_USE_DOUBLE 13 | typedef double Float; 14 | #else 15 | typedef float Float; 16 | #endif 17 | } // namespace ARDUINOJSON_NAMESPACE 18 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/src/ArduinoJson/Numbers/Integer.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | #include 9 | 10 | #include // int64_t 11 | 12 | namespace ARDUINOJSON_NAMESPACE { 13 | 14 | #if ARDUINOJSON_USE_LONG_LONG 15 | typedef int64_t Integer; 16 | typedef uint64_t UInt; 17 | #else 18 | typedef long Integer; 19 | typedef unsigned long UInt; 20 | #endif 21 | } // namespace ARDUINOJSON_NAMESPACE 22 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/src/ArduinoJson/Numbers/parseFloat.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | #include 9 | 10 | namespace ARDUINOJSON_NAMESPACE { 11 | 12 | template 13 | inline T parseFloat(const char* s) { 14 | // try to reuse the same parameters as JsonDeserializer 15 | typedef typename choose_largest::type TFloat; 16 | return parseNumber(s).template as(); 17 | } 18 | } // namespace ARDUINOJSON_NAMESPACE 19 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/src/ArduinoJson/Numbers/parseInteger.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | namespace ARDUINOJSON_NAMESPACE { 12 | template 13 | T parseInteger(const char *s) { 14 | // try to reuse the same parameters as JsonDeserializer 15 | typedef typename choose_largest::type>::type 16 | TUInt; 17 | return parseNumber(s).template as(); 18 | } 19 | } // namespace ARDUINOJSON_NAMESPACE 20 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/src/ArduinoJson/Object/Pair.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | #include 9 | 10 | namespace ARDUINOJSON_NAMESPACE { 11 | // A key value pair for CollectionData. 12 | class Pair { 13 | public: 14 | Pair(MemoryPool* pool, VariantSlot* slot) { 15 | if (slot) { 16 | _key = String(slot->key(), !slot->ownsKey()); 17 | _value = VariantRef(pool, slot->data()); 18 | } 19 | } 20 | 21 | String key() const { 22 | return _key; 23 | } 24 | 25 | VariantRef value() const { 26 | return _value; 27 | } 28 | 29 | private: 30 | String _key; 31 | VariantRef _value; 32 | }; 33 | 34 | class PairConst { 35 | public: 36 | PairConst(const VariantSlot* slot) { 37 | if (slot) { 38 | _key = String(slot->key(), !slot->ownsKey()); 39 | _value = VariantConstRef(slot->data()); 40 | } 41 | } 42 | 43 | String key() const { 44 | return _key; 45 | } 46 | 47 | VariantConstRef value() const { 48 | return _value; 49 | } 50 | 51 | private: 52 | String _key; 53 | VariantConstRef _value; 54 | }; 55 | } // namespace ARDUINOJSON_NAMESPACE 56 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/src/ArduinoJson/Operators/VariantCasts.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | 11 | template 12 | class VariantCasts { 13 | public: 14 | template 15 | FORCE_INLINE operator T() const { 16 | return impl()->template as(); 17 | } 18 | 19 | private: 20 | const TImpl *impl() const { 21 | return static_cast(this); 22 | } 23 | }; 24 | } // namespace ARDUINOJSON_NAMESPACE 25 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/src/ArduinoJson/Operators/VariantOperators.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | namespace ARDUINOJSON_NAMESPACE { 13 | 14 | template 15 | class VariantOperators : public VariantCasts, 16 | public VariantComparisons, 17 | public VariantOr, 18 | public VariantShortcuts {}; 19 | } // namespace ARDUINOJSON_NAMESPACE 20 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/src/ArduinoJson/Operators/VariantOr.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | namespace ARDUINOJSON_NAMESPACE { 12 | 13 | template 14 | class VariantOr { 15 | public: 16 | // Returns the default value if the VariantRef is undefined of incompatible 17 | template 18 | T operator|(const T &defaultValue) const { 19 | if (impl()->template is()) 20 | return impl()->template as(); 21 | else 22 | return defaultValue; 23 | } 24 | 25 | // Returns the default value if the VariantRef is undefined of incompatible 26 | // Special case for string: null is treated as undefined 27 | const char *operator|(const char *defaultValue) const { 28 | const char *value = impl()->template as(); 29 | return value ? value : defaultValue; 30 | } 31 | 32 | private: 33 | const TImpl *impl() const { 34 | return static_cast(this); 35 | } 36 | }; 37 | } // namespace ARDUINOJSON_NAMESPACE 38 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/src/ArduinoJson/Operators/VariantShortcuts.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | #include 9 | 10 | namespace ARDUINOJSON_NAMESPACE { 11 | 12 | template 13 | class VariantShortcuts : public ObjectShortcuts, 14 | public ArrayShortcuts { 15 | public: 16 | using ArrayShortcuts::createNestedArray; 17 | using ArrayShortcuts::createNestedObject; 18 | using ArrayShortcuts::operator[]; 19 | using ObjectShortcuts::createNestedArray; 20 | using ObjectShortcuts::createNestedObject; 21 | using ObjectShortcuts::operator[]; 22 | }; 23 | } // namespace ARDUINOJSON_NAMESPACE 24 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/src/ArduinoJson/Polyfills/alias_cast.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | #include // for size_t 9 | 10 | #include 11 | #include "math.hpp" 12 | 13 | namespace ARDUINOJSON_NAMESPACE { 14 | 15 | template 16 | struct alias_cast_t { 17 | union { 18 | F raw; 19 | T data; 20 | }; 21 | }; 22 | 23 | template 24 | T alias_cast(F raw_data) { 25 | alias_cast_t ac; 26 | ac.raw = raw_data; 27 | return ac.data; 28 | } 29 | } // namespace ARDUINOJSON_NAMESPACE 30 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/src/ArduinoJson/Polyfills/assert.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #ifdef ARDUINOJSON_DEBUG 8 | #include 9 | #define ARDUINOJSON_ASSERT(X) assert(X) 10 | #else 11 | #define ARDUINOJSON_ASSERT(X) ((void)0) 12 | #endif 13 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/src/ArduinoJson/Polyfills/attributes.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #ifdef _MSC_VER // Visual Studio 8 | 9 | #define FORCE_INLINE // __forceinline causes C4714 when returning std::string 10 | #define NO_INLINE __declspec(noinline) 11 | #define DEPRECATED(msg) __declspec(deprecated(msg)) 12 | 13 | #elif defined(__GNUC__) // GCC or Clang 14 | 15 | #define FORCE_INLINE __attribute__((always_inline)) 16 | #define NO_INLINE __attribute__((noinline)) 17 | #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) 18 | #define DEPRECATED(msg) __attribute__((deprecated(msg))) 19 | #else 20 | #define DEPRECATED(msg) __attribute__((deprecated)) 21 | #endif 22 | 23 | #else // Other compilers 24 | 25 | #define FORCE_INLINE 26 | #define NO_INLINE 27 | #define DEPRECATED(msg) 28 | 29 | #endif 30 | 31 | #if __cplusplus >= 201103L 32 | #define NOEXCEPT noexcept 33 | #else 34 | #define NOEXCEPT throw() 35 | #endif 36 | 37 | #if defined(__has_attribute) 38 | #if __has_attribute(no_sanitize) 39 | #define ARDUINOJSON_NO_SANITIZE(check) __attribute__((no_sanitize(check))) 40 | #else 41 | #define ARDUINOJSON_NO_SANITIZE(check) 42 | #endif 43 | #else 44 | #define ARDUINOJSON_NO_SANITIZE(check) 45 | #endif 46 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/src/ArduinoJson/Polyfills/ctype.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | 11 | inline bool isdigit(char c) { 12 | return '0' <= c && c <= '9'; 13 | } 14 | 15 | inline bool issign(char c) { 16 | return '-' == c || c == '+'; 17 | } 18 | } // namespace ARDUINOJSON_NAMESPACE 19 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/src/ArduinoJson/Polyfills/gsl/not_null.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | #include 9 | 10 | namespace ARDUINOJSON_NAMESPACE { 11 | 12 | template 13 | class not_null { 14 | public: 15 | explicit not_null(T ptr) : _ptr(ptr) { 16 | ARDUINOJSON_ASSERT(ptr != NULL); 17 | } 18 | 19 | T get() const { 20 | ARDUINOJSON_ASSERT(_ptr != NULL); 21 | return _ptr; 22 | } 23 | 24 | private: 25 | T _ptr; 26 | }; 27 | 28 | template 29 | not_null make_not_null(T ptr) { 30 | ARDUINOJSON_ASSERT(ptr != NULL); 31 | return not_null(ptr); 32 | } 33 | 34 | } // namespace ARDUINOJSON_NAMESPACE 35 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/src/ArduinoJson/Polyfills/limits.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "type_traits.hpp" 8 | 9 | #ifdef _MSC_VER 10 | #pragma warning(push) 11 | #pragma warning(disable : 4310) 12 | #endif 13 | 14 | namespace ARDUINOJSON_NAMESPACE { 15 | 16 | // Differs from standard because we can't use the symbols "min" and "max" 17 | template 18 | struct numeric_limits; 19 | 20 | template 21 | struct numeric_limits::value>::type> { 22 | static T lowest() { 23 | return 0; 24 | } 25 | static T highest() { 26 | return T(-1); 27 | } 28 | }; 29 | 30 | template 31 | struct numeric_limits< 32 | T, typename enable_if::value && is_signed::value>::type> { 33 | static T lowest() { 34 | return T(T(1) << (sizeof(T) * 8 - 1)); 35 | } 36 | static T highest() { 37 | return T(~lowest()); 38 | } 39 | }; 40 | 41 | } // namespace ARDUINOJSON_NAMESPACE 42 | 43 | #ifdef _MSC_VER 44 | #pragma warning(pop) 45 | #endif 46 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/src/ArduinoJson/Polyfills/math.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | 11 | // Some libraries #define isnan() and isinf() so we need to check before 12 | // using this name 13 | 14 | #ifndef isnan 15 | template 16 | bool isnan(T x) { 17 | return x != x; 18 | } 19 | #endif 20 | 21 | #ifndef isinf 22 | template 23 | bool isinf(T x) { 24 | return x != 0.0 && x * 2 == x; 25 | } 26 | #endif 27 | } // namespace ARDUINOJSON_NAMESPACE 28 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/src/ArduinoJson/Polyfills/mpl/max.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | #include // for size_t 10 | 11 | namespace ARDUINOJSON_NAMESPACE { 12 | 13 | // A meta-function that returns the highest value 14 | template Y)> 15 | struct Max {}; 16 | 17 | template 18 | struct Max { 19 | static const size_t value = X; 20 | }; 21 | 22 | template 23 | struct Max { 24 | static const size_t value = Y; 25 | }; 26 | } // namespace ARDUINOJSON_NAMESPACE 27 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/src/ArduinoJson/Polyfills/safe_strcmp.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | 11 | inline int8_t safe_strcmp(const char* a, const char* b) { 12 | if (a == b) return 0; 13 | if (!a) return -1; 14 | if (!b) return 1; 15 | return static_cast(strcmp(a, b)); 16 | } 17 | 18 | inline int8_t safe_strncmp(const char* a, const char* b, size_t n) { 19 | if (a == b) return 0; 20 | if (!a) return -1; 21 | if (!b) return 1; 22 | return static_cast(strncmp(a, b, n)); 23 | } 24 | } // namespace ARDUINOJSON_NAMESPACE 25 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/src/ArduinoJson/Polyfills/type_traits.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "type_traits/conditional.hpp" 8 | #include "type_traits/enable_if.hpp" 9 | #include "type_traits/integral_constant.hpp" 10 | #include "type_traits/is_array.hpp" 11 | #include "type_traits/is_base_of.hpp" 12 | #include "type_traits/is_const.hpp" 13 | #include "type_traits/is_floating_point.hpp" 14 | #include "type_traits/is_integral.hpp" 15 | #include "type_traits/is_same.hpp" 16 | #include "type_traits/is_signed.hpp" 17 | #include "type_traits/is_unsigned.hpp" 18 | #include "type_traits/make_unsigned.hpp" 19 | #include "type_traits/remove_const.hpp" 20 | #include "type_traits/remove_reference.hpp" 21 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/src/ArduinoJson/Polyfills/type_traits/conditional.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | 11 | template 12 | struct conditional { 13 | typedef TrueType type; 14 | }; 15 | 16 | template 17 | struct conditional { 18 | typedef FalseType type; 19 | }; 20 | } // namespace ARDUINOJSON_NAMESPACE 21 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/src/ArduinoJson/Polyfills/type_traits/enable_if.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | 11 | // A meta-function that return the type T if Condition is true. 12 | template 13 | struct enable_if {}; 14 | 15 | template 16 | struct enable_if { 17 | typedef T type; 18 | }; 19 | } // namespace ARDUINOJSON_NAMESPACE 20 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/src/ArduinoJson/Polyfills/type_traits/integral_constant.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | 11 | template 12 | struct integral_constant { 13 | static const T value = v; 14 | }; 15 | 16 | typedef integral_constant true_type; 17 | typedef integral_constant false_type; 18 | 19 | } // namespace ARDUINOJSON_NAMESPACE 20 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/src/ArduinoJson/Polyfills/type_traits/is_array.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | #include // size_t 10 | 11 | namespace ARDUINOJSON_NAMESPACE { 12 | 13 | template 14 | struct is_array : false_type {}; 15 | 16 | template 17 | struct is_array : true_type {}; 18 | 19 | template 20 | struct is_array : true_type {}; 21 | } // namespace ARDUINOJSON_NAMESPACE 22 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/src/ArduinoJson/Polyfills/type_traits/is_base_of.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | 11 | // A meta-function that returns true if Derived inherits from TBase is an 12 | // integral type. 13 | template 14 | class is_base_of { 15 | protected: // <- to avoid GCC's "all member functions in class are private" 16 | typedef char Yes[1]; 17 | typedef char No[2]; 18 | 19 | static Yes &probe(const TBase *); 20 | static No &probe(...); 21 | 22 | public: 23 | static const bool value = 24 | sizeof(probe(reinterpret_cast(0))) == sizeof(Yes); 25 | }; 26 | } // namespace ARDUINOJSON_NAMESPACE 27 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/src/ArduinoJson/Polyfills/type_traits/is_const.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "integral_constant.hpp" 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | 11 | // A meta-function that return the type T without the const modifier 12 | template 13 | struct is_const : false_type {}; 14 | 15 | template 16 | struct is_const : true_type {}; 17 | } // namespace ARDUINOJSON_NAMESPACE 18 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/src/ArduinoJson/Polyfills/type_traits/is_floating_point.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "integral_constant.hpp" 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | 11 | template 12 | struct is_floating_point : false_type {}; 13 | 14 | template <> 15 | struct is_floating_point : true_type {}; 16 | 17 | template <> 18 | struct is_floating_point : true_type {}; 19 | } // namespace ARDUINOJSON_NAMESPACE 20 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/src/ArduinoJson/Polyfills/type_traits/is_integral.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | #include "is_same.hpp" 9 | 10 | namespace ARDUINOJSON_NAMESPACE { 11 | 12 | // A meta-function that returns true if T is an integral type. 13 | template 14 | struct is_integral { 15 | static const bool value = 16 | is_same::value || is_same::value || 17 | is_same::value || is_same::value || 18 | is_same::value || is_same::value || 19 | is_same::value || is_same::value || 20 | #if ARDUINOJSON_HAS_LONG_LONG 21 | is_same::value || 22 | is_same::value || 23 | #endif 24 | #if ARDUINOJSON_HAS_INT64 25 | is_same::value || 26 | is_same::value || 27 | #endif 28 | is_same::value; 29 | 30 | // CAUTION: differs from std::is_integral as it doesn't include bool 31 | }; 32 | 33 | template 34 | struct is_integral : is_integral {}; 35 | } // namespace ARDUINOJSON_NAMESPACE 36 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/src/ArduinoJson/Polyfills/type_traits/is_same.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "integral_constant.hpp" 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | 11 | // A meta-function that returns true if types T and U are the same. 12 | template 13 | struct is_same : false_type {}; 14 | 15 | template 16 | struct is_same : true_type {}; 17 | } // namespace ARDUINOJSON_NAMESPACE 18 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/src/ArduinoJson/Polyfills/type_traits/is_signed.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "integral_constant.hpp" 8 | namespace ARDUINOJSON_NAMESPACE { 9 | 10 | template 11 | struct is_signed : false_type {}; 12 | 13 | template <> 14 | struct is_signed : true_type {}; 15 | 16 | template <> 17 | struct is_signed : true_type {}; 18 | 19 | template <> 20 | struct is_signed : true_type {}; 21 | 22 | template <> 23 | struct is_signed : true_type {}; 24 | 25 | template <> 26 | struct is_signed : true_type {}; 27 | 28 | template <> 29 | struct is_signed : true_type {}; 30 | 31 | template <> 32 | struct is_signed : true_type {}; 33 | 34 | #if ARDUINOJSON_HAS_LONG_LONG 35 | template <> 36 | struct is_signed : true_type {}; 37 | #endif 38 | 39 | #if ARDUINOJSON_HAS_INT64 40 | template <> 41 | struct is_signed : true_type {}; 42 | #endif 43 | } // namespace ARDUINOJSON_NAMESPACE 44 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/src/ArduinoJson/Polyfills/type_traits/is_unsigned.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "integral_constant.hpp" 8 | namespace ARDUINOJSON_NAMESPACE { 9 | 10 | template 11 | struct is_unsigned : false_type {}; 12 | 13 | template <> 14 | struct is_unsigned : true_type {}; 15 | 16 | template <> 17 | struct is_unsigned : true_type {}; 18 | 19 | template <> 20 | struct is_unsigned : true_type {}; 21 | 22 | template <> 23 | struct is_unsigned : true_type {}; 24 | 25 | template <> 26 | struct is_unsigned : true_type {}; 27 | 28 | #if ARDUINOJSON_HAS_INT64 29 | template <> 30 | struct is_unsigned : true_type {}; 31 | #endif 32 | 33 | #if ARDUINOJSON_HAS_LONG_LONG 34 | template <> 35 | struct is_unsigned : true_type {}; 36 | #endif 37 | } // namespace ARDUINOJSON_NAMESPACE 38 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/src/ArduinoJson/Polyfills/type_traits/remove_const.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | 11 | // A meta-function that return the type T without the const modifier 12 | template 13 | struct remove_const { 14 | typedef T type; 15 | }; 16 | template 17 | struct remove_const { 18 | typedef T type; 19 | }; 20 | } // namespace ARDUINOJSON_NAMESPACE 21 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/src/ArduinoJson/Polyfills/type_traits/remove_reference.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | 11 | // A meta-function that return the type T without the reference modifier. 12 | template 13 | struct remove_reference { 14 | typedef T type; 15 | }; 16 | template 17 | struct remove_reference { 18 | typedef T type; 19 | }; 20 | } // namespace ARDUINOJSON_NAMESPACE 21 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/src/ArduinoJson/Polyfills/type_traits/type_identity.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "integral_constant.hpp" 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | 11 | template 12 | struct type_identity { 13 | typedef T type; 14 | }; 15 | } // namespace ARDUINOJSON_NAMESPACE 16 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/src/ArduinoJson/Polyfills/utility.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | template 11 | inline void swap(T& a, T& b) { 12 | T t(a); 13 | a = b; 14 | b = t; 15 | } 16 | } // namespace ARDUINOJSON_NAMESPACE 17 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/src/ArduinoJson/Serialization/Writers/ArduinoStringWriter.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | 11 | template <> 12 | class Writer< ::String, void> { 13 | static const size_t bufferCapacity = ARDUINOJSON_STRING_BUFFER_SIZE; 14 | 15 | public: 16 | explicit Writer(::String &str) : _destination(&str) { 17 | _size = 0; 18 | } 19 | 20 | ~Writer() { 21 | flush(); 22 | } 23 | 24 | size_t write(uint8_t c) { 25 | ARDUINOJSON_ASSERT(_size < bufferCapacity); 26 | _buffer[_size++] = static_cast(c); 27 | if (_size + 1 >= bufferCapacity) flush(); 28 | return 1; 29 | } 30 | 31 | size_t write(const uint8_t *s, size_t n) { 32 | for (size_t i = 0; i < n; i++) { 33 | write(s[i]); 34 | } 35 | return n; 36 | } 37 | 38 | private: 39 | void flush() { 40 | ARDUINOJSON_ASSERT(_size < bufferCapacity); 41 | _buffer[_size] = 0; 42 | *_destination += _buffer; 43 | _size = 0; 44 | } 45 | 46 | ::String *_destination; 47 | char _buffer[bufferCapacity]; 48 | size_t _size; 49 | }; 50 | 51 | } // namespace ARDUINOJSON_NAMESPACE 52 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/src/ArduinoJson/Serialization/Writers/DummyWriter.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | 11 | class DummyWriter { 12 | public: 13 | size_t write(uint8_t) { 14 | return 1; 15 | } 16 | 17 | size_t write(const uint8_t*, size_t n) { 18 | return n; 19 | } 20 | }; 21 | } // namespace ARDUINOJSON_NAMESPACE 22 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/src/ArduinoJson/Serialization/Writers/PrintWriter.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | namespace ARDUINOJSON_NAMESPACE { 8 | 9 | template 10 | class Writer< 11 | TDestination, 12 | typename enable_if::value>::type> { 13 | public: 14 | explicit Writer(::Print& print) : _print(&print) {} 15 | 16 | size_t write(uint8_t c) { 17 | return _print->write(c); 18 | } 19 | 20 | size_t write(const uint8_t* s, size_t n) { 21 | return _print->write(s, n); 22 | } 23 | 24 | private: 25 | ::Print* _print; 26 | }; 27 | 28 | } // namespace ARDUINOJSON_NAMESPACE 29 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/src/ArduinoJson/Serialization/Writers/StaticStringWriter.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | 11 | // A Print implementation that allows to write in a char[] 12 | class StaticStringWriter { 13 | public: 14 | StaticStringWriter(char *buf, size_t size) : end(buf + size - 1), p(buf) { 15 | *p = '\0'; 16 | } 17 | 18 | size_t write(uint8_t c) { 19 | if (p >= end) return 0; 20 | *p++ = static_cast(c); 21 | *p = '\0'; 22 | return 1; 23 | } 24 | 25 | size_t write(const uint8_t *s, size_t n) { 26 | char *begin = p; 27 | while (p < end && n > 0) { 28 | *p++ = static_cast(*s++); 29 | n--; 30 | } 31 | *p = '\0'; 32 | return size_t(p - begin); 33 | } 34 | 35 | private: 36 | char *end; 37 | char *p; 38 | }; 39 | } // namespace ARDUINOJSON_NAMESPACE 40 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/src/ArduinoJson/Serialization/Writers/StdStreamWriter.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | 11 | template 12 | class Writer< 13 | TDestination, 14 | typename enable_if::value>::type> { 15 | public: 16 | explicit Writer(std::ostream& os) : _os(&os) {} 17 | 18 | size_t write(uint8_t c) { 19 | _os->put(static_cast(c)); 20 | return 1; 21 | } 22 | 23 | size_t write(const uint8_t* s, size_t n) { 24 | _os->write(reinterpret_cast(s), 25 | static_cast(n)); 26 | return n; 27 | } 28 | 29 | private: 30 | std::ostream* _os; 31 | }; 32 | } // namespace ARDUINOJSON_NAMESPACE 33 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/src/ArduinoJson/Serialization/Writers/StdStringWriter.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | #include 9 | 10 | #include 11 | 12 | namespace ARDUINOJSON_NAMESPACE { 13 | 14 | template 15 | struct is_std_string : false_type {}; 16 | 17 | template 18 | struct is_std_string > 19 | : true_type {}; 20 | 21 | template 22 | class Writer::value>::type> { 24 | public: 25 | Writer(TDestination &str) : _str(&str) {} 26 | 27 | size_t write(uint8_t c) { 28 | _str->operator+=(static_cast(c)); 29 | return 1; 30 | } 31 | 32 | size_t write(const uint8_t *s, size_t n) { 33 | _str->append(reinterpret_cast(s), n); 34 | return n; 35 | } 36 | 37 | private: 38 | TDestination *_str; 39 | }; 40 | } // namespace ARDUINOJSON_NAMESPACE 41 | -------------------------------------------------------------------------------- /lib/ArduinoJson_ID64/src/ArduinoJson/Serialization/measure.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2020 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | 11 | template