├── 3D ├── SoilSens-V5W_Base.SLDPRT ├── SoilSens-V5W_Base.STL ├── SoilSens-V5W_Base_DIY.SLDPRT ├── SoilSens-V5W_Base_DIY.STL ├── SoilSens-V5W_Top.SLDPRT ├── SoilSens-V5W_Top.STL ├── SoilSens-V5W_Top_Vent.SLDPRT ├── SoilSens-V5W_Top_Vent.STL ├── Soile_Moisture_Sensor_Wireless.SLDASM └── Soile_Moisture_Sensor_Wireless.step ├── LICENSE.md ├── PCB ├── Gerber.zip ├── Interactive_bom │ └── Interactive_bom.html ├── Soilsens-V5W_Schematic.jpg └── bom_list.xlsx ├── README.md ├── code ├── SOILSENS-V5W │ └── SOILSENS-V5W.ino └── libraries │ ├── AHT20 │ ├── LICENSE │ ├── README.md │ ├── examples │ │ └── testAHT20 │ │ │ └── testAHT20.ino │ ├── keywords.txt │ ├── library.properties │ └── src │ │ ├── AHT20.cpp │ │ └── AHT20.h │ ├── ArduinoJson │ ├── ArduinoJson.h │ ├── CHANGELOG.md │ ├── CMakeLists.txt │ ├── CONTRIBUTING.md │ ├── LICENSE.txt │ ├── README.md │ ├── SUPPORT.md │ ├── appveyor.yml │ ├── component.mk │ ├── examples │ │ ├── JsonConfigFile │ │ │ └── JsonConfigFile.ino │ │ ├── JsonFilterExample │ │ │ └── JsonFilterExample.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 │ │ ├── ArduinoJsonConfig.cmake.in │ │ ├── CompileOptions.cmake │ │ ├── ci │ │ │ ├── espidf │ │ │ │ ├── CMakeLists.txt │ │ │ │ └── main │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ ├── component.mk │ │ │ │ │ └── main.cpp │ │ │ └── particle.sh │ │ ├── conf_test │ │ │ ├── avr.cpp │ │ │ ├── esp8266.cpp │ │ │ ├── x64.cpp │ │ │ └── x86.cpp │ │ ├── fuzzing │ │ │ ├── CMakeLists.txt │ │ │ ├── Makefile │ │ │ ├── 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_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 │ │ │ └── reproducer.cpp │ │ ├── particle │ │ │ ├── project.properties │ │ │ └── src │ │ │ │ └── smocktest.ino │ │ ├── scripts │ │ │ ├── build-single-header.sh │ │ │ ├── get-release-body.sh │ │ │ ├── get-release-page.sh │ │ │ ├── publish-particle-library.sh │ │ │ ├── publish.sh │ │ │ └── wandbox │ │ │ │ ├── JsonGeneratorExample.cpp │ │ │ │ ├── JsonParserExample.cpp │ │ │ │ ├── MsgPackParserExample.cpp │ │ │ │ └── publish.sh │ │ └── tests │ │ │ ├── CMakeLists.txt │ │ │ ├── Cpp17 │ │ │ ├── CMakeLists.txt │ │ │ └── string_view.cpp │ │ │ ├── Cpp20 │ │ │ ├── CMakeLists.txt │ │ │ └── smoke_test.cpp │ │ │ ├── Deprecated │ │ │ ├── BasicJsonDocument.cpp │ │ │ ├── CMakeLists.txt │ │ │ ├── DynamicJsonDocument.cpp │ │ │ ├── StaticJsonDocument.cpp │ │ │ ├── add.cpp │ │ │ ├── containsKey.cpp │ │ │ ├── createNestedArray.cpp │ │ │ ├── createNestedObject.cpp │ │ │ ├── macros.cpp │ │ │ ├── memoryUsage.cpp │ │ │ └── shallowCopy.cpp │ │ │ ├── FailingBuilds │ │ │ ├── CMakeLists.txt │ │ │ ├── Issue978.cpp │ │ │ ├── assign_char.cpp │ │ │ ├── read_long_long.cpp │ │ │ ├── variant_as_char.cpp │ │ │ └── write_long_long.cpp │ │ │ ├── Helpers │ │ │ ├── Allocators.hpp │ │ │ ├── Arduino.h │ │ │ ├── CustomReader.hpp │ │ │ ├── Literals.hpp │ │ │ ├── api │ │ │ │ ├── Print.h │ │ │ │ ├── Stream.h │ │ │ │ └── String.h │ │ │ └── avr │ │ │ │ └── pgmspace.h │ │ │ ├── IntegrationTests │ │ │ ├── CMakeLists.txt │ │ │ ├── gbathree.cpp │ │ │ ├── issue772.cpp │ │ │ ├── openweathermap.cpp │ │ │ └── round_trip.cpp │ │ │ ├── JsonArray │ │ │ ├── CMakeLists.txt │ │ │ ├── add.cpp │ │ │ ├── clear.cpp │ │ │ ├── compare.cpp │ │ │ ├── copyArray.cpp │ │ │ ├── equals.cpp │ │ │ ├── isNull.cpp │ │ │ ├── iterator.cpp │ │ │ ├── nesting.cpp │ │ │ ├── remove.cpp │ │ │ ├── size.cpp │ │ │ ├── std_string.cpp │ │ │ ├── subscript.cpp │ │ │ └── unbound.cpp │ │ │ ├── JsonArrayConst │ │ │ ├── CMakeLists.txt │ │ │ ├── equals.cpp │ │ │ ├── isNull.cpp │ │ │ ├── iterator.cpp │ │ │ ├── nesting.cpp │ │ │ ├── size.cpp │ │ │ └── subscript.cpp │ │ │ ├── JsonDeserializer │ │ │ ├── CMakeLists.txt │ │ │ ├── DeserializationError.cpp │ │ │ ├── array.cpp │ │ │ ├── destination_types.cpp │ │ │ ├── errors.cpp │ │ │ ├── filter.cpp │ │ │ ├── input_types.cpp │ │ │ ├── misc.cpp │ │ │ ├── nestingLimit.cpp │ │ │ ├── number.cpp │ │ │ ├── object.cpp │ │ │ └── string.cpp │ │ │ ├── JsonDocument │ │ │ ├── CMakeLists.txt │ │ │ ├── ElementProxy.cpp │ │ │ ├── MemberProxy.cpp │ │ │ ├── add.cpp │ │ │ ├── assignment.cpp │ │ │ ├── cast.cpp │ │ │ ├── clear.cpp │ │ │ ├── compare.cpp │ │ │ ├── constructor.cpp │ │ │ ├── isNull.cpp │ │ │ ├── issue1120.cpp │ │ │ ├── nesting.cpp │ │ │ ├── overflowed.cpp │ │ │ ├── remove.cpp │ │ │ ├── shrinkToFit.cpp │ │ │ ├── size.cpp │ │ │ ├── subscript.cpp │ │ │ └── swap.cpp │ │ │ ├── JsonObject │ │ │ ├── CMakeLists.txt │ │ │ ├── clear.cpp │ │ │ ├── compare.cpp │ │ │ ├── equals.cpp │ │ │ ├── isNull.cpp │ │ │ ├── iterator.cpp │ │ │ ├── nesting.cpp │ │ │ ├── remove.cpp │ │ │ ├── set.cpp │ │ │ ├── size.cpp │ │ │ ├── std_string.cpp │ │ │ ├── subscript.cpp │ │ │ └── unbound.cpp │ │ │ ├── JsonObjectConst │ │ │ ├── CMakeLists.txt │ │ │ ├── equals.cpp │ │ │ ├── isNull.cpp │ │ │ ├── iterator.cpp │ │ │ ├── nesting.cpp │ │ │ ├── size.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 │ │ │ ├── converters.cpp │ │ │ ├── copy.cpp │ │ │ ├── is.cpp │ │ │ ├── isnull.cpp │ │ │ ├── misc.cpp │ │ │ ├── nesting.cpp │ │ │ ├── nullptr.cpp │ │ │ ├── or.cpp │ │ │ ├── overflow.cpp │ │ │ ├── remove.cpp │ │ │ ├── set.cpp │ │ │ ├── size.cpp │ │ │ ├── stl_containers.cpp │ │ │ ├── subscript.cpp │ │ │ ├── types.cpp │ │ │ └── unbound.cpp │ │ │ ├── JsonVariantConst │ │ │ ├── CMakeLists.txt │ │ │ ├── as.cpp │ │ │ ├── is.cpp │ │ │ ├── isnull.cpp │ │ │ ├── nesting.cpp │ │ │ ├── size.cpp │ │ │ └── subscript.cpp │ │ │ ├── Misc │ │ │ ├── CMakeLists.txt │ │ │ ├── JsonString.cpp │ │ │ ├── NoArduinoHeader.cpp │ │ │ ├── Readers.cpp │ │ │ ├── StringAdapters.cpp │ │ │ ├── StringWriter.cpp │ │ │ ├── TypeTraits.cpp │ │ │ ├── Utf16.cpp │ │ │ ├── Utf8.cpp │ │ │ ├── arithmeticCompare.cpp │ │ │ ├── conflicts.cpp │ │ │ ├── custom_string.hpp │ │ │ ├── issue1967.cpp │ │ │ ├── printable.cpp │ │ │ ├── unsigned_char.cpp │ │ │ ├── version.cpp │ │ │ └── weird_strcmp.hpp │ │ │ ├── MixedConfiguration │ │ │ ├── CMakeLists.txt │ │ │ ├── decode_unicode_0.cpp │ │ │ ├── decode_unicode_1.cpp │ │ │ ├── enable_alignment_0.cpp │ │ │ ├── enable_alignment_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 │ │ │ ├── issue1707.cpp │ │ │ ├── string_length_size_1.cpp │ │ │ ├── string_length_size_2.cpp │ │ │ ├── string_length_size_4.cpp │ │ │ ├── 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 │ │ │ ├── deserializeVariant.cpp │ │ │ ├── destination_types.cpp │ │ │ ├── doubleToFloat.cpp │ │ │ ├── errors.cpp │ │ │ ├── filter.cpp │ │ │ ├── input_types.cpp │ │ │ └── nestingLimit.cpp │ │ │ ├── MsgPackSerializer │ │ │ ├── CMakeLists.txt │ │ │ ├── destination_types.cpp │ │ │ ├── measure.cpp │ │ │ ├── misc.cpp │ │ │ ├── serializeArray.cpp │ │ │ ├── serializeObject.cpp │ │ │ └── serializeVariant.cpp │ │ │ ├── Numbers │ │ │ ├── CMakeLists.txt │ │ │ ├── convertNumber.cpp │ │ │ ├── decomposeFloat.cpp │ │ │ ├── parseDouble.cpp │ │ │ ├── parseFloat.cpp │ │ │ ├── parseInteger.cpp │ │ │ └── parseNumber.cpp │ │ │ ├── ResourceManager │ │ │ ├── CMakeLists.txt │ │ │ ├── StringBuilder.cpp │ │ │ ├── allocVariant.cpp │ │ │ ├── clear.cpp │ │ │ ├── saveString.cpp │ │ │ ├── shrinkToFit.cpp │ │ │ ├── size.cpp │ │ │ └── swap.cpp │ │ │ ├── TextFormatter │ │ │ ├── CMakeLists.txt │ │ │ ├── writeFloat.cpp │ │ │ ├── writeInteger.cpp │ │ │ └── writeString.cpp │ │ │ └── catch │ │ │ ├── CMakeLists.txt │ │ │ ├── catch.cpp │ │ │ └── catch.hpp │ ├── idf_component.yml │ ├── keywords.txt │ ├── library.json │ ├── library.properties │ └── src │ │ ├── ArduinoJson.h │ │ ├── ArduinoJson.hpp │ │ ├── ArduinoJson │ │ ├── Array │ │ │ ├── ArrayData.hpp │ │ │ ├── ArrayImpl.hpp │ │ │ ├── ElementProxy.hpp │ │ │ ├── JsonArray.hpp │ │ │ ├── JsonArrayConst.hpp │ │ │ ├── JsonArrayIterator.hpp │ │ │ └── Utilities.hpp │ │ ├── Collection │ │ │ ├── CollectionData.hpp │ │ │ └── CollectionImpl.hpp │ │ ├── Configuration.hpp │ │ ├── Deserialization │ │ │ ├── DeserializationError.hpp │ │ │ ├── DeserializationOptions.hpp │ │ │ ├── Filter.hpp │ │ │ ├── NestingLimit.hpp │ │ │ ├── Reader.hpp │ │ │ ├── Readers │ │ │ │ ├── ArduinoStreamReader.hpp │ │ │ │ ├── ArduinoStringReader.hpp │ │ │ │ ├── FlashReader.hpp │ │ │ │ ├── IteratorReader.hpp │ │ │ │ ├── RamReader.hpp │ │ │ │ ├── StdStreamReader.hpp │ │ │ │ └── VariantReader.hpp │ │ │ └── deserialize.hpp │ │ ├── Document │ │ │ └── JsonDocument.hpp │ │ ├── Json │ │ │ ├── EscapeSequence.hpp │ │ │ ├── JsonDeserializer.hpp │ │ │ ├── JsonSerializer.hpp │ │ │ ├── Latch.hpp │ │ │ ├── PrettyJsonSerializer.hpp │ │ │ ├── TextFormatter.hpp │ │ │ ├── Utf16.hpp │ │ │ └── Utf8.hpp │ │ ├── Memory │ │ │ ├── Alignment.hpp │ │ │ ├── Allocator.hpp │ │ │ ├── MemoryPool.hpp │ │ │ ├── MemoryPoolList.hpp │ │ │ ├── ResourceManager.hpp │ │ │ ├── ResourceManagerImpl.hpp │ │ │ ├── StringBuffer.hpp │ │ │ ├── StringBuilder.hpp │ │ │ ├── StringNode.hpp │ │ │ └── StringPool.hpp │ │ ├── Misc │ │ │ └── SerializedValue.hpp │ │ ├── MsgPack │ │ │ ├── MsgPackBinary.hpp │ │ │ ├── MsgPackDeserializer.hpp │ │ │ ├── MsgPackExtension.hpp │ │ │ ├── MsgPackSerializer.hpp │ │ │ ├── endianness.hpp │ │ │ └── ieee754.hpp │ │ ├── Namespace.hpp │ │ ├── Numbers │ │ │ ├── FloatParts.hpp │ │ │ ├── FloatTraits.hpp │ │ │ ├── JsonFloat.hpp │ │ │ ├── JsonInteger.hpp │ │ │ ├── arithmeticCompare.hpp │ │ │ ├── convertNumber.hpp │ │ │ └── parseNumber.hpp │ │ ├── Object │ │ │ ├── JsonObject.hpp │ │ │ ├── JsonObjectConst.hpp │ │ │ ├── JsonObjectIterator.hpp │ │ │ ├── JsonPair.hpp │ │ │ ├── MemberProxy.hpp │ │ │ ├── ObjectData.hpp │ │ │ └── ObjectImpl.hpp │ │ ├── Polyfills │ │ │ ├── alias_cast.hpp │ │ │ ├── assert.hpp │ │ │ ├── attributes.hpp │ │ │ ├── ctype.hpp │ │ │ ├── integer.hpp │ │ │ ├── limits.hpp │ │ │ ├── math.hpp │ │ │ ├── mpl │ │ │ │ └── max.hpp │ │ │ ├── pgmspace.hpp │ │ │ ├── pgmspace_generic.hpp │ │ │ ├── preprocessor.hpp │ │ │ ├── type_traits.hpp │ │ │ ├── type_traits │ │ │ │ ├── conditional.hpp │ │ │ │ ├── declval.hpp │ │ │ │ ├── enable_if.hpp │ │ │ │ ├── function_traits.hpp │ │ │ │ ├── integral_constant.hpp │ │ │ │ ├── is_array.hpp │ │ │ │ ├── is_base_of.hpp │ │ │ │ ├── is_class.hpp │ │ │ │ ├── is_const.hpp │ │ │ │ ├── is_convertible.hpp │ │ │ │ ├── is_enum.hpp │ │ │ │ ├── is_floating_point.hpp │ │ │ │ ├── is_integral.hpp │ │ │ │ ├── is_pointer.hpp │ │ │ │ ├── is_same.hpp │ │ │ │ ├── is_signed.hpp │ │ │ │ ├── is_unsigned.hpp │ │ │ │ ├── make_unsigned.hpp │ │ │ │ ├── remove_const.hpp │ │ │ │ ├── remove_cv.hpp │ │ │ │ ├── remove_reference.hpp │ │ │ │ ├── type_identity.hpp │ │ │ │ └── void_t.hpp │ │ │ └── utility.hpp │ │ ├── Serialization │ │ │ ├── CountingDecorator.hpp │ │ │ ├── Writer.hpp │ │ │ ├── Writers │ │ │ │ ├── ArduinoStringWriter.hpp │ │ │ │ ├── DummyWriter.hpp │ │ │ │ ├── PrintWriter.hpp │ │ │ │ ├── StaticStringWriter.hpp │ │ │ │ ├── StdStreamWriter.hpp │ │ │ │ └── StdStringWriter.hpp │ │ │ ├── measure.hpp │ │ │ └── serialize.hpp │ │ ├── Strings │ │ │ ├── Adapters │ │ │ │ ├── FlashString.hpp │ │ │ │ ├── JsonString.hpp │ │ │ │ ├── RamString.hpp │ │ │ │ └── StringObject.hpp │ │ │ ├── IsString.hpp │ │ │ ├── JsonString.hpp │ │ │ ├── StringAdapter.hpp │ │ │ ├── StringAdapters.hpp │ │ │ └── StringTraits.hpp │ │ ├── Variant │ │ │ ├── Converter.hpp │ │ │ ├── ConverterImpl.hpp │ │ │ ├── JsonVariant.hpp │ │ │ ├── JsonVariantConst.hpp │ │ │ ├── JsonVariantCopier.hpp │ │ │ ├── JsonVariantVisitor.hpp │ │ │ ├── VariantAttorney.hpp │ │ │ ├── VariantCompare.hpp │ │ │ ├── VariantContent.hpp │ │ │ ├── VariantData.hpp │ │ │ ├── VariantDataVisitor.hpp │ │ │ ├── VariantImpl.hpp │ │ │ ├── VariantOperators.hpp │ │ │ ├── VariantRefBase.hpp │ │ │ ├── VariantRefBaseImpl.hpp │ │ │ ├── VariantTag.hpp │ │ │ └── VariantTo.hpp │ │ ├── compatibility.hpp │ │ └── version.hpp │ │ └── CMakeLists.txt │ ├── PubSubClient │ ├── 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 │ └── tests │ │ ├── Makefile │ │ ├── README.md │ │ ├── src │ │ ├── connect_spec.cpp │ │ ├── keepalive_spec.cpp │ │ ├── lib │ │ │ ├── Arduino.h │ │ │ ├── BDDTest.cpp │ │ │ ├── BDDTest.h │ │ │ ├── Buffer.cpp │ │ │ ├── Buffer.h │ │ │ ├── Client.h │ │ │ ├── IPAddress.cpp │ │ │ ├── IPAddress.h │ │ │ ├── Print.h │ │ │ ├── ShimClient.cpp │ │ │ ├── ShimClient.h │ │ │ ├── Stream.cpp │ │ │ ├── Stream.h │ │ │ └── trace.h │ │ ├── publish_spec.cpp │ │ ├── receive_spec.cpp │ │ └── subscribe_spec.cpp │ │ ├── testcases │ │ ├── __init__.py │ │ ├── mqtt_basic.py │ │ ├── mqtt_publish_in_callback.py │ │ └── settings.py │ │ └── testsuite.py │ └── SparkFun_TMP102 │ ├── LICENSE.md │ ├── README.md │ ├── examples │ ├── Example1_Basic_Temperature_Readings │ │ └── Example1_Basic_Temperature_Readings.ino │ └── Example2_One-Shot_Temperature_Reading │ │ └── Example2_One-Shot_Temperature_Reading.ino │ ├── keywords.txt │ ├── library.properties │ └── src │ ├── SparkFunTMP102.cpp │ └── SparkFunTMP102.h └── img ├── 3dcolor.jpg ├── board_config.jpg ├── ha_entity.png ├── header.jpg ├── hotspot1.jpg ├── hotspot2.jpg ├── hotspot3.jpg ├── nice-img.JPG ├── sens-cap.png ├── sens-kc-full.jpg ├── sens-kc-pcb.png ├── sens-kc.jpg ├── sens-kc.png ├── sens-nk-pcb.png └── solder-jumper.jpg /3D/SoilSens-V5W_Base.SLDPRT: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PricelessToolkit/SOILSENS-V5W/33517e39305819d07e0ccd6587f9742126c36ccc/3D/SoilSens-V5W_Base.SLDPRT -------------------------------------------------------------------------------- /3D/SoilSens-V5W_Base.STL: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PricelessToolkit/SOILSENS-V5W/33517e39305819d07e0ccd6587f9742126c36ccc/3D/SoilSens-V5W_Base.STL -------------------------------------------------------------------------------- /3D/SoilSens-V5W_Base_DIY.SLDPRT: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PricelessToolkit/SOILSENS-V5W/33517e39305819d07e0ccd6587f9742126c36ccc/3D/SoilSens-V5W_Base_DIY.SLDPRT -------------------------------------------------------------------------------- /3D/SoilSens-V5W_Base_DIY.STL: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PricelessToolkit/SOILSENS-V5W/33517e39305819d07e0ccd6587f9742126c36ccc/3D/SoilSens-V5W_Base_DIY.STL -------------------------------------------------------------------------------- /3D/SoilSens-V5W_Top.SLDPRT: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PricelessToolkit/SOILSENS-V5W/33517e39305819d07e0ccd6587f9742126c36ccc/3D/SoilSens-V5W_Top.SLDPRT -------------------------------------------------------------------------------- /3D/SoilSens-V5W_Top.STL: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PricelessToolkit/SOILSENS-V5W/33517e39305819d07e0ccd6587f9742126c36ccc/3D/SoilSens-V5W_Top.STL -------------------------------------------------------------------------------- /3D/SoilSens-V5W_Top_Vent.SLDPRT: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PricelessToolkit/SOILSENS-V5W/33517e39305819d07e0ccd6587f9742126c36ccc/3D/SoilSens-V5W_Top_Vent.SLDPRT -------------------------------------------------------------------------------- /3D/SoilSens-V5W_Top_Vent.STL: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PricelessToolkit/SOILSENS-V5W/33517e39305819d07e0ccd6587f9742126c36ccc/3D/SoilSens-V5W_Top_Vent.STL -------------------------------------------------------------------------------- /3D/Soile_Moisture_Sensor_Wireless.SLDASM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PricelessToolkit/SOILSENS-V5W/33517e39305819d07e0ccd6587f9742126c36ccc/3D/Soile_Moisture_Sensor_Wireless.SLDASM -------------------------------------------------------------------------------- /PCB/Gerber.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PricelessToolkit/SOILSENS-V5W/33517e39305819d07e0ccd6587f9742126c36ccc/PCB/Gerber.zip -------------------------------------------------------------------------------- /PCB/Soilsens-V5W_Schematic.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PricelessToolkit/SOILSENS-V5W/33517e39305819d07e0ccd6587f9742126c36ccc/PCB/Soilsens-V5W_Schematic.jpg -------------------------------------------------------------------------------- /PCB/bom_list.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PricelessToolkit/SOILSENS-V5W/33517e39305819d07e0ccd6587f9742126c36ccc/PCB/bom_list.xlsx -------------------------------------------------------------------------------- /code/libraries/AHT20/README.md: -------------------------------------------------------------------------------- 1 | # Humidity AHT20 Arduino Library 2 | 3 | -------------------------------------------------------------------------------- /code/libraries/AHT20/keywords.txt: -------------------------------------------------------------------------------- 1 | ================================== 2 | CLASS 3 | ================================== 4 | AHT20 KEYWORD1 5 | 6 | ================================== 7 | FUNCTIONS 8 | ================================== 9 | begin KEYWORD2 10 | isConnected KEYWORD2 11 | available KEYWORD2 12 | getStatus KEYWORD2 13 | isCalibrated KEYWORD2 14 | isBusy KEYWORD2 15 | initialize KEYWORD2 16 | triggerMEasurement KEYWORD2 17 | readData KEYWORD2 18 | softReset KEYWORD2 19 | getTemperature KEYWORD2 20 | getHumidity KEYWORD2 21 | 22 | ================================== 23 | CONSTANTS 24 | ================================== 25 | DEFAULT_ADDRESS LITERAL1 26 | 27 | ================================== 28 | DATA TYPES 29 | ================================== -------------------------------------------------------------------------------- /code/libraries/AHT20/library.properties: -------------------------------------------------------------------------------- 1 | name=AHT20 2 | version=1.0.1 3 | author=dvarrel 4 | maintainer=dvarrel 5 | sentence=library to drive AHT20 temperature and humidity IC. Forked from https://github.com/sparkfun/SparkFun_Qwiic_Humidity_AHT20_Arduino_Library 6 | paragraph=I2C sensor, simple library 7 | category=Sensors 8 | url=https://github.com/dvarrel/AHT20.git 9 | architectures=* 10 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/ArduinoJson.h: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #include "src/ArduinoJson.h" 6 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ArduinoJson - https://arduinojson.org 2 | # Copyright © 2014-2024, Benoit BLANCHON 3 | # MIT License 4 | 5 | cmake_minimum_required(VERSION 3.15) 6 | 7 | if(ESP_PLATFORM) 8 | # Build ArduinoJson as an ESP-IDF component 9 | idf_component_register(INCLUDE_DIRS src) 10 | return() 11 | endif() 12 | 13 | project(ArduinoJson VERSION 7.2.0) 14 | 15 | if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) 16 | include(CTest) 17 | endif() 18 | 19 | add_subdirectory(src) 20 | 21 | if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING) 22 | include(extras/CompileOptions.cmake) 23 | add_subdirectory(extras/tests) 24 | add_subdirectory(extras/fuzzing) 25 | endif() 26 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/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. Update the test suite for any change of behavior 10 | 2. Use clang-format in "file" mode to format the code 11 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | --------------------- 3 | 4 | Copyright © 2014-2024, 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 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/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 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/appveyor.yml: -------------------------------------------------------------------------------- 1 | version: 7.2.0.{build} 2 | environment: 3 | matrix: 4 | - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022 5 | CMAKE_GENERATOR: Visual Studio 17 2022 6 | - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 7 | CMAKE_GENERATOR: Visual Studio 16 2019 8 | - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 9 | CMAKE_GENERATOR: Visual Studio 15 2017 10 | - CMAKE_GENERATOR: Ninja 11 | MINGW32: i686-6.3.0-posix-dwarf-rt_v5-rev1 # MinGW-w64 6.3.0 i686 12 | - CMAKE_GENERATOR: Ninja 13 | MINGW64: x86_64-6.3.0-posix-seh-rt_v5-rev1 # MinGW-w64 6.3.0 x86_64 14 | - CMAKE_GENERATOR: Ninja 15 | MINGW64: x86_64-7.3.0-posix-seh-rt_v5-rev0 # MinGW-w64 7.3.0 x86_64 16 | - CMAKE_GENERATOR: Ninja 17 | MINGW64: x86_64-8.1.0-posix-seh-rt_v6-rev0 # MinGW-w64 8.1.0 x86_64 18 | configuration: Debug 19 | before_build: 20 | - set PATH=%PATH:C:\Program Files\Git\usr\bin;=% # Workaround for CMake not wanting sh.exe on PATH for MinGW 21 | - if defined MINGW set PATH=C:\%MINGW%\bin;%PATH% 22 | - if defined MINGW32 set PATH=C:\mingw-w64\%MINGW32%\mingw32\bin;%PATH% 23 | - if defined MINGW64 set PATH=C:\mingw-w64\%MINGW64%\mingw64\bin;%PATH% 24 | - cmake -DCMAKE_BUILD_TYPE=%CONFIGURATION% -G "%CMAKE_GENERATOR%" . 25 | build_script: 26 | - cmake --build . --config %CONFIGURATION% 27 | test_script: 28 | - ctest -C %CONFIGURATION% --output-on-failure . 29 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/component.mk: -------------------------------------------------------------------------------- 1 | COMPONENT_ADD_INCLUDEDIRS := src 2 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/ArduinoJsonConfig.cmake.in: -------------------------------------------------------------------------------- 1 | @PACKAGE_INIT@ 2 | 3 | include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake") 4 | check_required_components("@PROJECT_NAME@") 5 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/ci/espidf/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ArduinoJson - https://arduinojson.org 2 | # Copyright © 2014-2024, Benoit BLANCHON 3 | # MIT License 4 | 5 | cmake_minimum_required(VERSION 3.5) 6 | 7 | include($ENV{IDF_PATH}/tools/cmake/project.cmake) 8 | project(example) 9 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/ci/espidf/main/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ArduinoJson - https://arduinojson.org 2 | # Copyright © 2014-2024, Benoit BLANCHON 3 | # MIT License 4 | 5 | idf_component_register( 6 | SRCS "main.cpp" 7 | INCLUDE_DIRS "" 8 | ) 9 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/ci/espidf/main/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # "main" pseudo-component makefile. 3 | # 4 | # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) 5 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/ci/espidf/main/main.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #include 6 | 7 | extern "C" void app_main() { 8 | char buffer[256]; 9 | JsonDocument doc; 10 | 11 | doc["hello"] = "world"; 12 | serializeJson(doc, buffer); 13 | deserializeJson(doc, buffer); 14 | serializeMsgPack(doc, buffer); 15 | deserializeMsgPack(doc, buffer); 16 | } 17 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/ci/particle.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -ex 2 | 3 | BOARD=$1 4 | 5 | cd "$(dirname "$0")/../../" 6 | 7 | cp extras/particle/src/smocktest.ino src/ 8 | cp extras/particle/project.properties ./ 9 | 10 | particle compile "$BOARD" 11 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/conf_test/avr.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | static_assert(ARDUINOJSON_ENABLE_PROGMEM == 1, "ARDUINOJSON_ENABLE_PROGMEM"); 4 | 5 | static_assert(ARDUINOJSON_USE_LONG_LONG == 0, "ARDUINOJSON_USE_LONG_LONG"); 6 | 7 | static_assert(ARDUINOJSON_SLOT_ID_SIZE == 1, "ARDUINOJSON_SLOT_ID_SIZE"); 8 | 9 | static_assert(ARDUINOJSON_POOL_CAPACITY == 16, "ARDUINOJSON_POOL_CAPACITY"); 10 | 11 | static_assert(ARDUINOJSON_LITTLE_ENDIAN == 1, "ARDUINOJSON_LITTLE_ENDIAN"); 12 | 13 | static_assert(ARDUINOJSON_USE_DOUBLE == 0, "ARDUINOJSON_USE_DOUBLE"); 14 | 15 | static_assert(ArduinoJson::detail::ResourceManager::slotSize == 6, "slot size"); 16 | 17 | void setup() {} 18 | void loop() {} 19 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/conf_test/esp8266.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | static_assert(ARDUINOJSON_USE_LONG_LONG == 1, "ARDUINOJSON_USE_LONG_LONG"); 4 | 5 | static_assert(ARDUINOJSON_SLOT_ID_SIZE == 2, "ARDUINOJSON_SLOT_ID_SIZE"); 6 | 7 | static_assert(ARDUINOJSON_POOL_CAPACITY == 128, "ARDUINOJSON_POOL_CAPACITY"); 8 | 9 | static_assert(ARDUINOJSON_LITTLE_ENDIAN == 1, "ARDUINOJSON_LITTLE_ENDIAN"); 10 | 11 | static_assert(ARDUINOJSON_USE_DOUBLE == 1, "ARDUINOJSON_USE_DOUBLE"); 12 | 13 | static_assert(ArduinoJson::detail::ResourceManager::slotSize == 8, "slot size"); 14 | 15 | void setup() {} 16 | void loop() {} 17 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/conf_test/x64.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | static_assert(ARDUINOJSON_USE_LONG_LONG == 1, "ARDUINOJSON_USE_LONG_LONG"); 4 | 5 | static_assert(ARDUINOJSON_SLOT_ID_SIZE == 4, "ARDUINOJSON_SLOT_ID_SIZE"); 6 | 7 | static_assert(ARDUINOJSON_POOL_CAPACITY == 256, "ARDUINOJSON_POOL_CAPACITY"); 8 | 9 | static_assert(ARDUINOJSON_LITTLE_ENDIAN == 1, "ARDUINOJSON_LITTLE_ENDIAN"); 10 | 11 | static_assert(ARDUINOJSON_USE_DOUBLE == 1, "ARDUINOJSON_USE_DOUBLE"); 12 | 13 | static_assert(ArduinoJson::detail::ResourceManager::slotSize == 16, 14 | "slot size"); 15 | 16 | int main() {} 17 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/conf_test/x86.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | static_assert(ARDUINOJSON_USE_LONG_LONG == 1, "ARDUINOJSON_USE_LONG_LONG"); 4 | 5 | static_assert(ARDUINOJSON_SLOT_ID_SIZE == 2, "ARDUINOJSON_SLOT_ID_SIZE"); 6 | 7 | static_assert(ARDUINOJSON_POOL_CAPACITY == 128, "ARDUINOJSON_POOL_CAPACITY"); 8 | 9 | static_assert(ARDUINOJSON_LITTLE_ENDIAN == 1, "ARDUINOJSON_LITTLE_ENDIAN"); 10 | 11 | static_assert(ARDUINOJSON_USE_DOUBLE == 1, "ARDUINOJSON_USE_DOUBLE"); 12 | 13 | static_assert(ArduinoJson::detail::ResourceManager::slotSize == 8, "slot size"); 14 | 15 | int main() {} 16 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/fuzzing/Makefile: -------------------------------------------------------------------------------- 1 | # CAUTION: this file is invoked by https://github.com/google/oss-fuzz 2 | 3 | CXXFLAGS += -I../../src -DARDUINOJSON_DEBUG=1 -std=c++11 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 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/fuzzing/json_fuzzer.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { 4 | JsonDocument doc; 5 | DeserializationError error = deserializeJson(doc, data, size); 6 | if (!error) { 7 | std::string json; 8 | serializeJson(doc, json); 9 | } 10 | return 0; 11 | } 12 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/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 -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/fuzzing/json_seed_corpus/EmptyArray.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/fuzzing/json_seed_corpus/EmptyObject.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/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]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]] -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/fuzzing/json_seed_corpus/IntegerOverflow.json: -------------------------------------------------------------------------------- 1 | 9720730739393920739 2 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/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 | ] -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/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 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/fuzzing/json_seed_corpus/Strings.json: -------------------------------------------------------------------------------- 1 | [ 2 | "hello", 3 | 'hello', 4 | hello, 5 | {"hello":"world"}, 6 | {'hello':'world'}, 7 | {hello:world} 8 | ] -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/fuzzing/msgpack_fuzzer.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { 4 | JsonDocument doc; 5 | DeserializationError error = deserializeMsgPack(doc, data, size); 6 | if (!error) { 7 | std::string json; 8 | serializeMsgPack(doc, json); 9 | } 10 | return 0; 11 | } 12 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/array16: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PricelessToolkit/SOILSENS-V5W/33517e39305819d07e0ccd6587f9742126c36ccc/code/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/array16 -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/array32: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PricelessToolkit/SOILSENS-V5W/33517e39305819d07e0ccd6587f9742126c36ccc/code/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/array32 -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/false: -------------------------------------------------------------------------------- 1 | � -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/fixarray: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PricelessToolkit/SOILSENS-V5W/33517e39305819d07e0ccd6587f9742126c36ccc/code/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/fixarray -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/fixint_negative: -------------------------------------------------------------------------------- 1 | � -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/fixint_positive: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/fixmap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PricelessToolkit/SOILSENS-V5W/33517e39305819d07e0ccd6587f9742126c36ccc/code/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/fixmap -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/fixstr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PricelessToolkit/SOILSENS-V5W/33517e39305819d07e0ccd6587f9742126c36ccc/code/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/fixstr -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/float32: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PricelessToolkit/SOILSENS-V5W/33517e39305819d07e0ccd6587f9742126c36ccc/code/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/float32 -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/float64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PricelessToolkit/SOILSENS-V5W/33517e39305819d07e0ccd6587f9742126c36ccc/code/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/float64 -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/int16: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PricelessToolkit/SOILSENS-V5W/33517e39305819d07e0ccd6587f9742126c36ccc/code/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/int16 -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/int32: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PricelessToolkit/SOILSENS-V5W/33517e39305819d07e0ccd6587f9742126c36ccc/code/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/int32 -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/int64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PricelessToolkit/SOILSENS-V5W/33517e39305819d07e0ccd6587f9742126c36ccc/code/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/int64 -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/int8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PricelessToolkit/SOILSENS-V5W/33517e39305819d07e0ccd6587f9742126c36ccc/code/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/int8 -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/map16: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PricelessToolkit/SOILSENS-V5W/33517e39305819d07e0ccd6587f9742126c36ccc/code/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/map16 -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/map32: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PricelessToolkit/SOILSENS-V5W/33517e39305819d07e0ccd6587f9742126c36ccc/code/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/map32 -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/nil: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PricelessToolkit/SOILSENS-V5W/33517e39305819d07e0ccd6587f9742126c36ccc/code/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/nil -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/str16: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PricelessToolkit/SOILSENS-V5W/33517e39305819d07e0ccd6587f9742126c36ccc/code/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/str16 -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/str32: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PricelessToolkit/SOILSENS-V5W/33517e39305819d07e0ccd6587f9742126c36ccc/code/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/str32 -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/str8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PricelessToolkit/SOILSENS-V5W/33517e39305819d07e0ccd6587f9742126c36ccc/code/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/str8 -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/true: -------------------------------------------------------------------------------- 1 | � -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/uint16: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PricelessToolkit/SOILSENS-V5W/33517e39305819d07e0ccd6587f9742126c36ccc/code/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/uint16 -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/uint32: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PricelessToolkit/SOILSENS-V5W/33517e39305819d07e0ccd6587f9742126c36ccc/code/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/uint32 -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/uint64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PricelessToolkit/SOILSENS-V5W/33517e39305819d07e0ccd6587f9742126c36ccc/code/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/uint64 -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/uint8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PricelessToolkit/SOILSENS-V5W/33517e39305819d07e0ccd6587f9742126c36ccc/code/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/uint8 -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/particle/project.properties: -------------------------------------------------------------------------------- 1 | name=ArduinoJsonCI 2 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/particle/src/smocktest.ino: -------------------------------------------------------------------------------- 1 | #include "ArduinoJson.h" 2 | 3 | void setup() {} 4 | 5 | void loop() {} 6 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/scripts/get-release-body.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -eu 4 | 5 | TAG="$1" 6 | CHANGELOG="$2" 7 | 8 | cat << END 9 | ## Changes 10 | 11 | $(awk '/\* /{ FOUND=1 } /^[[:space:]]*$/ { if(FOUND) exit } { if(FOUND) print }' "$CHANGELOG") 12 | 13 | [View version history](https://github.com/bblanchon/ArduinoJson/blob/$TAG/CHANGELOG.md) 14 | END 15 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/scripts/get-release-page.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -eu 4 | 5 | VERSION="$1" 6 | CHANGELOG="$2" 7 | ARDUINOJSON_H="$3" 8 | 9 | cat << END 10 | --- 11 | branch: v7 12 | version: $VERSION 13 | date: '$(date +'%Y-%m-%d')' 14 | $(extras/scripts/wandbox/publish.sh "$ARDUINOJSON_H") 15 | --- 16 | 17 | $(awk '/\* /{ FOUND=1; print; next } { if (FOUND) exit}' "$CHANGELOG") 18 | END 19 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/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.txt" "$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 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/scripts/wandbox/JsonGeneratorExample.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | // 5 | // This example shows how to generate a JSON document with ArduinoJson. 6 | 7 | #include 8 | #include "ArduinoJson.h" 9 | 10 | int main() { 11 | // Allocate the JSON document 12 | JsonDocument doc; 13 | 14 | // Add values in the document. 15 | doc["sensor"] = "gps"; 16 | doc["time"] = 1351824120; 17 | 18 | // Add an array 19 | JsonArray data = doc["data"].to(); 20 | data.add(48.756080); 21 | data.add(2.302038); 22 | 23 | // Generate the minified JSON and send it to STDOUT 24 | serializeJson(doc, std::cout); 25 | // The above line prints: 26 | // {"sensor":"gps","time":1351824120,"data":[48.756080,2.302038]} 27 | 28 | // Start a new line 29 | std::cout << std::endl; 30 | 31 | // Generate the prettified JSON and send it to STDOUT 32 | serializeJsonPretty(doc, std::cout); 33 | // The above line prints: 34 | // { 35 | // "sensor": "gps", 36 | // "time": 1351824120, 37 | // "data": [ 38 | // 48.756080, 39 | // 2.302038 40 | // ] 41 | // } 42 | } 43 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/scripts/wandbox/JsonParserExample.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | // 5 | // This example shows how to deserialize a JSON document with ArduinoJson. 6 | 7 | #include 8 | #include "ArduinoJson.h" 9 | 10 | int main() { 11 | // Allocate the JSON document 12 | JsonDocument doc; 13 | 14 | // JSON input string 15 | const char* json = 16 | "{\"sensor\":\"gps\",\"time\":1351824120,\"data\":[48.756080,2.302038]}"; 17 | 18 | // Deserialize the JSON document 19 | DeserializationError error = deserializeJson(doc, json); 20 | 21 | // Test if parsing succeeds 22 | if (error) { 23 | std::cerr << "deserializeJson() failed: " << error.c_str() << std::endl; 24 | return 1; 25 | } 26 | 27 | // Fetch the values 28 | // 29 | // Most of the time, you can rely on the implicit casts. 30 | // In other case, you can do doc["time"].as(); 31 | const char* sensor = doc["sensor"]; 32 | long time = doc["time"]; 33 | double latitude = doc["data"][0]; 34 | double longitude = doc["data"][1]; 35 | 36 | // Print the values 37 | std::cout << sensor << std::endl; 38 | std::cout << time << std::endl; 39 | std::cout << latitude << std::endl; 40 | std::cout << longitude << std::endl; 41 | 42 | return 0; 43 | } 44 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/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 < 2 | 3 | #include 4 | #include 5 | 6 | TEST_CASE("C++20 smoke test") { 7 | JsonDocument doc; 8 | 9 | deserializeJson(doc, "{\"hello\":\"world\"}"); 10 | REQUIRE(doc["hello"] == "world"); 11 | 12 | std::string json; 13 | serializeJson(doc, json); 14 | REQUIRE(json == "{\"hello\":\"world\"}"); 15 | } 16 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/Deprecated/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ArduinoJson - https://arduinojson.org 2 | # Copyright © 2014-2024, Benoit BLANCHON 3 | # MIT License 4 | 5 | if(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang)") 6 | add_compile_options( 7 | -w 8 | ) 9 | endif() 10 | 11 | if(MSVC) 12 | add_compile_options( 13 | /wd4996 14 | ) 15 | endif() 16 | 17 | add_executable(DeprecatedTests 18 | add.cpp 19 | BasicJsonDocument.cpp 20 | containsKey.cpp 21 | createNestedArray.cpp 22 | createNestedObject.cpp 23 | DynamicJsonDocument.cpp 24 | macros.cpp 25 | memoryUsage.cpp 26 | shallowCopy.cpp 27 | StaticJsonDocument.cpp 28 | ) 29 | 30 | add_test(Deprecated DeprecatedTests) 31 | 32 | set_tests_properties(Deprecated 33 | PROPERTIES 34 | LABELS "Catch" 35 | ) 36 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/Deprecated/DynamicJsonDocument.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | using ArduinoJson::detail::is_base_of; 9 | 10 | TEST_CASE("DynamicJsonDocument") { 11 | SECTION("is a JsonDocument") { 12 | REQUIRE(is_base_of::value == true); 13 | } 14 | 15 | SECTION("deserialize / serialize") { 16 | DynamicJsonDocument doc(256); 17 | deserializeJson(doc, "{\"hello\":\"world\"}"); 18 | REQUIRE(doc.as() == "{\"hello\":\"world\"}"); 19 | } 20 | 21 | SECTION("copy") { 22 | DynamicJsonDocument doc(256); 23 | doc["hello"] = "world"; 24 | auto copy = doc; 25 | REQUIRE(copy.as() == "{\"hello\":\"world\"}"); 26 | } 27 | 28 | SECTION("capacity") { 29 | DynamicJsonDocument doc(256); 30 | REQUIRE(doc.capacity() == 256); 31 | } 32 | 33 | SECTION("garbageCollect()") { 34 | DynamicJsonDocument doc(256); 35 | doc.garbageCollect(); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/Deprecated/StaticJsonDocument.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | using ArduinoJson::detail::is_base_of; 9 | 10 | TEST_CASE("StaticJsonDocument") { 11 | SECTION("is a JsonDocument") { 12 | REQUIRE(is_base_of>::value == true); 13 | } 14 | 15 | SECTION("deserialize / serialize") { 16 | StaticJsonDocument<256> doc; 17 | deserializeJson(doc, "{\"hello\":\"world\"}"); 18 | REQUIRE(doc.as() == "{\"hello\":\"world\"}"); 19 | } 20 | 21 | SECTION("copy") { 22 | StaticJsonDocument<256> doc; 23 | doc["hello"] = "world"; 24 | auto copy = doc; 25 | REQUIRE(copy.as() == "{\"hello\":\"world\"}"); 26 | } 27 | 28 | SECTION("capacity") { 29 | StaticJsonDocument<256> doc; 30 | REQUIRE(doc.capacity() == 256); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/Deprecated/add.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | TEST_CASE("JsonArray::add()") { 9 | JsonDocument doc; 10 | JsonArray array = doc.to(); 11 | array.add().set(42); 12 | REQUIRE(doc.as() == "[42]"); 13 | } 14 | 15 | TEST_CASE("JsonDocument::add()") { 16 | JsonDocument doc; 17 | doc.add().set(42); 18 | REQUIRE(doc.as() == "[42]"); 19 | } 20 | 21 | TEST_CASE("ElementProxy::add()") { 22 | JsonDocument doc; 23 | doc[0].add().set(42); 24 | REQUIRE(doc.as() == "[[42]]"); 25 | } 26 | 27 | TEST_CASE("MemberProxy::add()") { 28 | JsonDocument doc; 29 | doc["x"].add().set(42); 30 | REQUIRE(doc.as() == "{\"x\":[42]}"); 31 | } 32 | 33 | TEST_CASE("JsonVariant::add()") { 34 | JsonDocument doc; 35 | JsonVariant v = doc.add(); 36 | v.add().set(42); 37 | REQUIRE(doc.as() == "[[42]]"); 38 | } 39 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/Deprecated/macros.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | TEST_CASE("JSON_ARRAY_SIZE") { 9 | REQUIRE(JSON_ARRAY_SIZE(10) == ArduinoJson::detail::sizeofArray(10)); 10 | } 11 | 12 | TEST_CASE("JSON_OBJECT_SIZE") { 13 | REQUIRE(JSON_OBJECT_SIZE(10) == ArduinoJson::detail::sizeofObject(10)); 14 | } 15 | 16 | TEST_CASE("JSON_STRING_SIZE") { 17 | REQUIRE(JSON_STRING_SIZE(10) == 11); // issue #2054 18 | } 19 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/Deprecated/memoryUsage.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | TEST_CASE("JsonArray::memoryUsage()") { 9 | JsonArray array; 10 | REQUIRE(array.memoryUsage() == 0); 11 | } 12 | 13 | TEST_CASE("JsonArrayConst::memoryUsage()") { 14 | JsonArrayConst array; 15 | REQUIRE(array.memoryUsage() == 0); 16 | } 17 | 18 | TEST_CASE("JsonDocument::memoryUsage()") { 19 | JsonDocument doc; 20 | REQUIRE(doc.memoryUsage() == 0); 21 | } 22 | 23 | TEST_CASE("JsonObject::memoryUsage()") { 24 | JsonObject array; 25 | REQUIRE(array.memoryUsage() == 0); 26 | } 27 | 28 | TEST_CASE("JsonObjectConst::memoryUsage()") { 29 | JsonObjectConst array; 30 | REQUIRE(array.memoryUsage() == 0); 31 | } 32 | 33 | TEST_CASE("JsonVariant::memoryUsage()") { 34 | JsonVariant doc; 35 | REQUIRE(doc.memoryUsage() == 0); 36 | } 37 | 38 | TEST_CASE("JsonVariantConst::memoryUsage()") { 39 | JsonVariantConst doc; 40 | REQUIRE(doc.memoryUsage() == 0); 41 | } 42 | 43 | TEST_CASE("ElementProxy::memoryUsage()") { 44 | JsonDocument doc; 45 | REQUIRE(doc[0].memoryUsage() == 0); 46 | } 47 | 48 | TEST_CASE("MemberProxy::memoryUsage()") { 49 | JsonDocument doc; 50 | REQUIRE(doc["hello"].memoryUsage() == 0); 51 | } 52 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/Deprecated/shallowCopy.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | TEST_CASE("shallowCopy()") { 9 | JsonDocument doc1, doc2; 10 | doc1["b"] = "c"; 11 | doc2["a"].shallowCopy(doc1); 12 | 13 | REQUIRE(doc2.as() == "{\"a\":{\"b\":\"c\"}}"); 14 | } 15 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/FailingBuilds/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ArduinoJson - https://arduinojson.org 2 | # Copyright © 2014-2024, Benoit BLANCHON 3 | # MIT License 4 | 5 | macro(build_should_fail target) 6 | set_target_properties(${target} 7 | PROPERTIES 8 | EXCLUDE_FROM_ALL TRUE 9 | EXCLUDE_FROM_DEFAULT_BUILD TRUE 10 | ) 11 | add_test( 12 | NAME ${target} 13 | COMMAND ${CMAKE_COMMAND} --build . --target ${target} --config $ 14 | WORKING_DIRECTORY ${CMAKE_BINARY_DIR} 15 | ) 16 | set_tests_properties(${target} 17 | PROPERTIES 18 | WILL_FAIL TRUE 19 | LABELS "WillFail;Catch" 20 | ) 21 | endmacro() 22 | 23 | add_executable(Issue978 Issue978.cpp) 24 | build_should_fail(Issue978) 25 | 26 | add_executable(read_long_long read_long_long.cpp) 27 | build_should_fail(read_long_long) 28 | 29 | add_executable(write_long_long write_long_long.cpp) 30 | build_should_fail(write_long_long) 31 | 32 | add_executable(variant_as_char variant_as_char.cpp) 33 | build_should_fail(variant_as_char) 34 | 35 | add_executable(assign_char assign_char.cpp) 36 | build_should_fail(assign_char) 37 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/FailingBuilds/Issue978.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #include 6 | 7 | struct Stream {}; 8 | 9 | int main() { 10 | Stream* stream = 0; 11 | JsonDocument doc; 12 | deserializeJson(doc, stream); 13 | } 14 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/FailingBuilds/assign_char.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #include 6 | 7 | // See issue #1498 8 | 9 | int main() { 10 | JsonDocument doc; 11 | doc["dummy"] = 'A'; 12 | } 13 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/FailingBuilds/read_long_long.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #define ARDUINOJSON_USE_LONG_LONG 0 6 | #include 7 | 8 | #if defined(__SIZEOF_LONG__) && __SIZEOF_LONG__ >= 8 9 | # error This test requires sizeof(long) < 8 10 | #endif 11 | 12 | ARDUINOJSON_ASSERT_INTEGER_TYPE_IS_SUPPORTED(long long) 13 | int main() { 14 | JsonDocument doc; 15 | doc["dummy"].as(); 16 | } 17 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/FailingBuilds/variant_as_char.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #include 6 | 7 | // See issue #1498 8 | 9 | int main() { 10 | JsonDocument doc; 11 | doc["dummy"].as(); 12 | } 13 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/FailingBuilds/write_long_long.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #define ARDUINOJSON_USE_LONG_LONG 0 6 | #include 7 | 8 | #if defined(__SIZEOF_LONG__) && __SIZEOF_LONG__ >= 8 9 | # error This test requires sizeof(long) < 8 10 | #endif 11 | 12 | int main() { 13 | JsonDocument doc; 14 | doc["dummy"] = static_cast(42); 15 | } 16 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/Helpers/Arduino.h: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "api/Print.h" 8 | #include "api/Stream.h" 9 | #include "api/String.h" 10 | #include "avr/pgmspace.h" 11 | 12 | #define ARDUINO 13 | #define ARDUINO_H_INCLUDED 1 14 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/Helpers/CustomReader.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 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 | CustomReader(const CustomReader&) = delete; 15 | 16 | int read() { 17 | return stream_.get(); 18 | } 19 | 20 | size_t readBytes(char* buffer, size_t length) { 21 | stream_.read(buffer, static_cast(length)); 22 | return static_cast(stream_.gcount()); 23 | } 24 | }; 25 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/Helpers/Literals.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | // the space before _s is required by GCC 4.8 10 | inline std::string operator"" _s(const char* str, size_t len) { 11 | return std::string(str, len); 12 | } 13 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/Helpers/api/Print.h: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | class Print { 12 | public: 13 | virtual ~Print() {} 14 | 15 | virtual size_t write(uint8_t) = 0; 16 | virtual size_t write(const uint8_t *buffer, size_t size) = 0; 17 | 18 | size_t write(const char *str) { 19 | if (!str) 20 | return 0; 21 | return write(reinterpret_cast(str), strlen(str)); 22 | } 23 | 24 | size_t write(const char *buffer, size_t size) { 25 | return write(reinterpret_cast(buffer), size); 26 | } 27 | }; 28 | 29 | class Printable { 30 | public: 31 | virtual ~Printable() {} 32 | virtual size_t printTo(Print &p) const = 0; 33 | }; 34 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/Helpers/api/Stream.h: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 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 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/Helpers/avr/pgmspace.h: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include // uint8_t 8 | 9 | #define PROGMEM 10 | 11 | class __FlashStringHelper; 12 | 13 | inline const void* convertPtrToFlash(const void* s) { 14 | return reinterpret_cast(s) + 42; 15 | } 16 | 17 | inline const void* convertFlashToPtr(const void* s) { 18 | return reinterpret_cast(s) - 42; 19 | } 20 | 21 | #define PSTR(X) reinterpret_cast(convertPtrToFlash(X)) 22 | #define F(X) reinterpret_cast(PSTR(X)) 23 | 24 | inline uint8_t pgm_read_byte(const void* p) { 25 | return *reinterpret_cast(convertFlashToPtr(p)); 26 | } 27 | 28 | #define ARDUINOJSON_DEFINE_PROGMEM_ARRAY(type, name, ...) \ 29 | static type const ARDUINOJSON_CONCAT2(name, _progmem)[] = __VA_ARGS__; \ 30 | static type const* name = reinterpret_cast( \ 31 | convertPtrToFlash(ARDUINOJSON_CONCAT2(name, _progmem))); 32 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/IntegrationTests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ArduinoJson - https://arduinojson.org 2 | # Copyright © 2014-2024, Benoit BLANCHON 3 | # MIT License 4 | 5 | add_executable(IntegrationTests 6 | gbathree.cpp 7 | issue772.cpp 8 | round_trip.cpp 9 | openweathermap.cpp 10 | ) 11 | 12 | if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 6) 13 | target_compile_options(IntegrationTests 14 | PUBLIC 15 | -fsingle-precision-constant # issue 544 16 | ) 17 | endif() 18 | 19 | add_test(IntegrationTests IntegrationTests) 20 | 21 | set_tests_properties(IntegrationTests 22 | PROPERTIES 23 | LABELS "Catch" 24 | ) 25 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/IntegrationTests/issue772.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | // https://github.com/bblanchon/ArduinoJson/issues/772 9 | 10 | TEST_CASE("Issue772") { 11 | JsonDocument doc1; 12 | JsonDocument doc2; 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 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/JsonArray/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ArduinoJson - https://arduinojson.org 2 | # Copyright © 2014-2024, Benoit BLANCHON 3 | # MIT License 4 | 5 | add_executable(JsonArrayTests 6 | add.cpp 7 | clear.cpp 8 | compare.cpp 9 | copyArray.cpp 10 | equals.cpp 11 | isNull.cpp 12 | iterator.cpp 13 | nesting.cpp 14 | remove.cpp 15 | size.cpp 16 | std_string.cpp 17 | subscript.cpp 18 | unbound.cpp 19 | ) 20 | 21 | add_test(JsonArray JsonArrayTests) 22 | 23 | set_tests_properties(JsonArray 24 | PROPERTIES 25 | LABELS "Catch" 26 | ) 27 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/JsonArray/clear.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | #include "Allocators.hpp" 9 | 10 | TEST_CASE("JsonArray::clear()") { 11 | SECTION("No-op on null JsonArray") { 12 | JsonArray array; 13 | array.clear(); 14 | REQUIRE(array.isNull() == true); 15 | REQUIRE(array.size() == 0); 16 | } 17 | 18 | SECTION("Removes all elements") { 19 | JsonDocument doc; 20 | JsonArray array = doc.to(); 21 | array.add(1); 22 | array.add(2); 23 | array.clear(); 24 | REQUIRE(array.size() == 0); 25 | REQUIRE(array.isNull() == false); 26 | } 27 | 28 | SECTION("Removed elements are recycled") { 29 | SpyingAllocator spy; 30 | JsonDocument doc(&spy); 31 | JsonArray array = doc.to(); 32 | 33 | // fill the pool entirely 34 | for (int i = 0; i < ARDUINOJSON_POOL_CAPACITY; i++) 35 | array.add(i); 36 | 37 | // clear and fill again 38 | array.clear(); 39 | for (int i = 0; i < ARDUINOJSON_POOL_CAPACITY; i++) 40 | array.add(i); 41 | 42 | REQUIRE(spy.log() == AllocatorLog{ 43 | Allocate(sizeofPool()), 44 | }); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/JsonArray/isNull.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | TEST_CASE("JsonArray::isNull()") { 9 | SECTION("returns true") { 10 | JsonArray arr; 11 | REQUIRE(arr.isNull() == true); 12 | } 13 | 14 | SECTION("returns false") { 15 | JsonDocument doc; 16 | JsonArray arr = doc.to(); 17 | REQUIRE(arr.isNull() == false); 18 | } 19 | } 20 | 21 | TEST_CASE("JsonArray::operator bool()") { 22 | SECTION("returns false") { 23 | JsonArray arr; 24 | REQUIRE(static_cast(arr) == false); 25 | } 26 | 27 | SECTION("returns true") { 28 | JsonDocument doc; 29 | JsonArray arr = doc.to(); 30 | REQUIRE(static_cast(arr) == true); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/JsonArray/iterator.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | TEST_CASE("JsonArray::begin()/end()") { 9 | SECTION("Non null JsonArray") { 10 | JsonDocument doc; 11 | JsonArray array = doc.to(); 12 | array.add(12); 13 | array.add(34); 14 | 15 | auto it = array.begin(); 16 | auto end = array.end(); 17 | 18 | REQUIRE(end != it); 19 | REQUIRE(12 == it->as()); 20 | REQUIRE(12 == static_cast(*it)); 21 | ++it; 22 | REQUIRE(end != it); 23 | REQUIRE(34 == it->as()); 24 | REQUIRE(34 == static_cast(*it)); 25 | ++it; 26 | REQUIRE(end == it); 27 | } 28 | 29 | SECTION("Null JsonArray") { 30 | JsonArray array; 31 | 32 | REQUIRE(array.begin() == array.end()); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/JsonArray/nesting.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | TEST_CASE("JsonArray::nesting()") { 9 | JsonDocument doc; 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.add(); 28 | REQUIRE(arr.nesting() == 2); 29 | } 30 | 31 | SECTION("returns 2 with nested object") { 32 | arr.add(); 33 | REQUIRE(arr.nesting() == 2); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/JsonArray/size.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | TEST_CASE("JsonArray::size()") { 9 | JsonDocument doc; 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 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/JsonArray/std_string.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | #include "Literals.hpp" 9 | 10 | static void eraseString(std::string& str) { 11 | char* p = const_cast(str.c_str()); 12 | while (*p) 13 | *p++ = '*'; 14 | } 15 | 16 | TEST_CASE("std::string") { 17 | JsonDocument doc; 18 | JsonArray array = doc.to(); 19 | 20 | SECTION("add()") { 21 | std::string value("hello"); 22 | array.add(value); 23 | eraseString(value); 24 | REQUIRE("hello"_s == array[0]); 25 | } 26 | 27 | SECTION("operator[]") { 28 | std::string value("world"); 29 | array.add("hello"); 30 | array[0] = value; 31 | eraseString(value); 32 | REQUIRE("world"_s == array[0]); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/JsonArray/unbound.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | using namespace Catch::Matchers; 9 | 10 | TEST_CASE("Unbound 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("PrintToWritesBrackets") { 23 | char buffer[32]; 24 | serializeJson(array, buffer, sizeof(buffer)); 25 | REQUIRE_THAT(buffer, Equals("null")); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/JsonArrayConst/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ArduinoJson - https://arduinojson.org 2 | # Copyright © 2014-2024, Benoit BLANCHON 3 | # MIT License 4 | 5 | add_executable(JsonArrayConstTests 6 | equals.cpp 7 | isNull.cpp 8 | iterator.cpp 9 | nesting.cpp 10 | size.cpp 11 | subscript.cpp 12 | ) 13 | 14 | add_test(JsonArrayConst JsonArrayConstTests) 15 | 16 | set_tests_properties(JsonArrayConst 17 | PROPERTIES 18 | LABELS "Catch" 19 | ) 20 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/JsonArrayConst/isNull.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | TEST_CASE("JsonArrayConst::isNull()") { 9 | SECTION("returns true") { 10 | JsonArrayConst arr; 11 | REQUIRE(arr.isNull() == true); 12 | } 13 | 14 | SECTION("returns false") { 15 | JsonDocument doc; 16 | JsonArrayConst arr = doc.to(); 17 | REQUIRE(arr.isNull() == false); 18 | } 19 | } 20 | 21 | TEST_CASE("JsonArrayConst::operator bool()") { 22 | SECTION("returns false") { 23 | JsonArrayConst arr; 24 | REQUIRE(static_cast(arr) == false); 25 | } 26 | 27 | SECTION("returns true") { 28 | JsonDocument doc; 29 | JsonArrayConst arr = doc.to(); 30 | REQUIRE(static_cast(arr) == true); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/JsonArrayConst/iterator.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | TEST_CASE("JsonArrayConst::begin()/end()") { 9 | SECTION("Non null JsonArrayConst") { 10 | JsonDocument doc; 11 | JsonArrayConst array = doc.to(); 12 | doc.add(12); 13 | doc.add(34); 14 | 15 | auto it = array.begin(); 16 | auto end = array.end(); 17 | 18 | REQUIRE(end != it); 19 | REQUIRE(12 == it->as()); 20 | REQUIRE(12 == static_cast(*it)); 21 | ++it; 22 | REQUIRE(end != it); 23 | REQUIRE(34 == it->as()); 24 | REQUIRE(34 == static_cast(*it)); 25 | ++it; 26 | REQUIRE(end == it); 27 | } 28 | 29 | SECTION("Null JsonArrayConst") { 30 | JsonArrayConst array; 31 | 32 | REQUIRE(array.begin() == array.end()); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/JsonArrayConst/nesting.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | TEST_CASE("JsonArrayConst::nesting()") { 9 | JsonDocument doc; 10 | JsonArrayConst arr = doc.to(); 11 | 12 | SECTION("return 0 if unbound") { 13 | JsonArrayConst unbound; 14 | REQUIRE(unbound.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 | doc.add("hello"); 23 | REQUIRE(arr.nesting() == 1); 24 | } 25 | 26 | SECTION("returns 2 with nested array") { 27 | doc.add(); 28 | REQUIRE(arr.nesting() == 2); 29 | } 30 | 31 | SECTION("returns 2 with nested object") { 32 | doc.add(); 33 | REQUIRE(arr.nesting() == 2); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/JsonArrayConst/size.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | TEST_CASE("JsonArrayConst::size()") { 9 | JsonDocument doc; 10 | JsonArrayConst array = doc.to(); 11 | 12 | SECTION("returns 0 if unbound") { 13 | JsonArrayConst unbound; 14 | REQUIRE(0U == unbound.size()); 15 | } 16 | 17 | SECTION("returns 0 is empty") { 18 | REQUIRE(0U == array.size()); 19 | } 20 | 21 | SECTION("return number of elements") { 22 | doc.add("hello"); 23 | doc.add("world"); 24 | 25 | REQUIRE(2U == array.size()); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/JsonArrayConst/subscript.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | TEST_CASE("JsonArrayConst::operator[]") { 10 | JsonDocument doc; 11 | JsonArrayConst arr = doc.to(); 12 | doc.add(1); 13 | doc.add(2); 14 | doc.add(3); 15 | 16 | SECTION("int") { 17 | REQUIRE(1 == arr[0].as()); 18 | REQUIRE(2 == arr[1].as()); 19 | REQUIRE(3 == arr[2].as()); 20 | REQUIRE(0 == arr[3].as()); 21 | } 22 | 23 | SECTION("JsonVariant") { 24 | REQUIRE(2 == arr[arr[0]].as()); 25 | REQUIRE(0 == arr[arr[3]].as()); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/JsonDeserializer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ArduinoJson - https://arduinojson.org 2 | # Copyright © 2014-2024, Benoit BLANCHON 3 | # MIT License 4 | 5 | add_executable(JsonDeserializerTests 6 | array.cpp 7 | DeserializationError.cpp 8 | destination_types.cpp 9 | errors.cpp 10 | filter.cpp 11 | input_types.cpp 12 | misc.cpp 13 | nestingLimit.cpp 14 | number.cpp 15 | object.cpp 16 | string.cpp 17 | ) 18 | 19 | set_target_properties(JsonDeserializerTests PROPERTIES UNITY_BUILD OFF) 20 | 21 | add_test(JsonDeserializer JsonDeserializerTests) 22 | 23 | set_tests_properties(JsonDeserializer 24 | PROPERTIES 25 | LABELS "Catch" 26 | ) 27 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/JsonDeserializer/misc.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | #include "Allocators.hpp" 9 | 10 | using ArduinoJson::detail::sizeofArray; 11 | 12 | TEST_CASE("deserializeJson() misc cases") { 13 | SpyingAllocator spy; 14 | JsonDocument doc(&spy); 15 | 16 | SECTION("null") { 17 | DeserializationError err = deserializeJson(doc, "null"); 18 | REQUIRE(err == DeserializationError::Ok); 19 | REQUIRE(doc.is() == false); 20 | } 21 | 22 | SECTION("true") { 23 | DeserializationError err = deserializeJson(doc, "true"); 24 | 25 | REQUIRE(err == DeserializationError::Ok); 26 | REQUIRE(doc.is()); 27 | REQUIRE(doc.as() == true); 28 | } 29 | 30 | SECTION("false") { 31 | DeserializationError err = deserializeJson(doc, "false"); 32 | 33 | REQUIRE(err == DeserializationError::Ok); 34 | REQUIRE(doc.is()); 35 | REQUIRE(doc.as() == false); 36 | } 37 | 38 | SECTION("Should clear the JsonVariant") { 39 | deserializeJson(doc, "[1,2,3]"); 40 | spy.clearLog(); 41 | 42 | deserializeJson(doc, "{}"); 43 | 44 | REQUIRE(doc.is()); 45 | REQUIRE(spy.log() == AllocatorLog{ 46 | Deallocate(sizeofArray(3)), 47 | }); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/JsonDocument/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ArduinoJson - https://arduinojson.org 2 | # Copyright © 2014-2024, Benoit BLANCHON 3 | # MIT License 4 | 5 | add_executable(JsonDocumentTests 6 | add.cpp 7 | assignment.cpp 8 | cast.cpp 9 | clear.cpp 10 | compare.cpp 11 | constructor.cpp 12 | ElementProxy.cpp 13 | isNull.cpp 14 | issue1120.cpp 15 | MemberProxy.cpp 16 | nesting.cpp 17 | overflowed.cpp 18 | remove.cpp 19 | shrinkToFit.cpp 20 | size.cpp 21 | subscript.cpp 22 | swap.cpp 23 | ) 24 | 25 | add_test(JsonDocument JsonDocumentTests) 26 | 27 | set_tests_properties(JsonDocument 28 | PROPERTIES 29 | LABELS "Catch" 30 | ) 31 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/JsonDocument/cast.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | TEST_CASE("Implicit cast to JsonVariant") { 11 | JsonDocument doc; 12 | 13 | doc["hello"] = "world"; 14 | 15 | JsonVariant var = doc; 16 | 17 | CHECK(var.as() == "{\"hello\":\"world\"}"); 18 | } 19 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/JsonDocument/clear.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | #include // malloc, free 9 | #include 10 | 11 | #include "Allocators.hpp" 12 | #include "Literals.hpp" 13 | 14 | TEST_CASE("JsonDocument::clear()") { 15 | SpyingAllocator spy; 16 | JsonDocument doc(&spy); 17 | 18 | SECTION("null") { 19 | doc.clear(); 20 | 21 | REQUIRE(doc.isNull()); 22 | REQUIRE(spy.log() == AllocatorLog{}); 23 | } 24 | 25 | SECTION("releases resources") { 26 | doc["hello"_s] = "world"_s; 27 | spy.clearLog(); 28 | 29 | doc.clear(); 30 | 31 | REQUIRE(doc.isNull()); 32 | REQUIRE(spy.log() == AllocatorLog{ 33 | Deallocate(sizeofPool()), 34 | Deallocate(sizeofString("hello")), 35 | Deallocate(sizeofString("world")), 36 | }); 37 | } 38 | 39 | SECTION("clear free list") { // issue #2034 40 | JsonObject obj = doc.to(); 41 | obj["a"] = 1; 42 | obj.clear(); // puts the slot in the free list 43 | 44 | doc.clear(); 45 | 46 | doc["b"] = 2; // will it pick from the free list? 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/JsonDocument/compare.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | TEST_CASE("JsonDocument::operator==(const JsonDocument&)") { 9 | JsonDocument doc1; 10 | JsonDocument doc2; 11 | 12 | SECTION("Empty") { 13 | REQUIRE(doc1 == doc2); 14 | REQUIRE_FALSE(doc1 != doc2); 15 | } 16 | 17 | SECTION("With same object") { 18 | doc1["hello"] = "world"; 19 | doc2["hello"] = "world"; 20 | REQUIRE(doc1 == doc2); 21 | REQUIRE_FALSE(doc1 != doc2); 22 | } 23 | SECTION("With different object") { 24 | doc1["hello"] = "world"; 25 | doc2["world"] = "hello"; 26 | REQUIRE_FALSE(doc1 == doc2); 27 | REQUIRE(doc1 != doc2); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/JsonDocument/isNull.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | TEST_CASE("JsonDocument::isNull()") { 9 | JsonDocument doc; 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 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/JsonDocument/nesting.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | TEST_CASE("JsonDocument::nesting()") { 9 | JsonDocument doc; 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 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/JsonDocument/size.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | TEST_CASE("JsonDocument::size()") { 9 | JsonDocument doc; 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 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/JsonDocument/swap.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | using namespace std; 8 | 9 | TEST_CASE("std::swap") { 10 | SECTION("JsonDocument*") { 11 | JsonDocument *p1, *p2; 12 | swap(p1, p2); // issue #1678 13 | } 14 | 15 | SECTION("JsonDocument") { 16 | JsonDocument doc1, doc2; 17 | doc1.set("hello"); 18 | doc2.set("world"); 19 | 20 | swap(doc1, doc2); 21 | 22 | CHECK(doc1.as() == "world"); 23 | CHECK(doc2.as() == "hello"); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/JsonObject/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ArduinoJson - https://arduinojson.org 2 | # Copyright © 2014-2024, Benoit BLANCHON 3 | # MIT License 4 | 5 | add_executable(JsonObjectTests 6 | clear.cpp 7 | compare.cpp 8 | equals.cpp 9 | isNull.cpp 10 | iterator.cpp 11 | nesting.cpp 12 | remove.cpp 13 | set.cpp 14 | size.cpp 15 | std_string.cpp 16 | subscript.cpp 17 | unbound.cpp 18 | ) 19 | 20 | add_test(JsonObject JsonObjectTests) 21 | 22 | set_tests_properties(JsonObject 23 | PROPERTIES 24 | LABELS "Catch" 25 | ) 26 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/JsonObject/clear.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | TEST_CASE("JsonObject::clear()") { 9 | SECTION("No-op on null JsonObject") { 10 | JsonObject obj; 11 | obj.clear(); 12 | REQUIRE(obj.isNull() == true); 13 | REQUIRE(obj.size() == 0); 14 | } 15 | 16 | SECTION("Removes all elements") { 17 | JsonDocument doc; 18 | JsonObject obj = doc.to(); 19 | obj["hello"] = 1; 20 | obj["world"] = 2; 21 | obj.clear(); 22 | REQUIRE(obj.size() == 0); 23 | REQUIRE(obj.isNull() == false); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/JsonObject/isNull.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | TEST_CASE("JsonObject::isNull()") { 9 | SECTION("returns true") { 10 | JsonObject obj; 11 | REQUIRE(obj.isNull() == true); 12 | } 13 | 14 | SECTION("returns false") { 15 | JsonDocument doc; 16 | JsonObject obj = doc.to(); 17 | REQUIRE(obj.isNull() == false); 18 | } 19 | } 20 | 21 | TEST_CASE("JsonObject::operator bool()") { 22 | SECTION("returns false") { 23 | JsonObject obj; 24 | REQUIRE(static_cast(obj) == false); 25 | } 26 | 27 | SECTION("returns true") { 28 | JsonDocument doc; 29 | JsonObject obj = doc.to(); 30 | REQUIRE(static_cast(obj) == true); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/JsonObject/iterator.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | TEST_CASE("JsonObject::begin()/end()") { 9 | JsonDocument doc; 10 | JsonObject obj = doc.to(); 11 | obj["ab"] = 12; 12 | obj["cd"] = 34; 13 | 14 | SECTION("NonConstIterator") { 15 | JsonObject::iterator it = obj.begin(); 16 | REQUIRE(obj.end() != it); 17 | REQUIRE(it->key() == "ab"); 18 | REQUIRE(12 == it->value()); 19 | ++it; 20 | REQUIRE(obj.end() != it); 21 | REQUIRE(it->key() == "cd"); 22 | REQUIRE(34 == it->value()); 23 | ++it; 24 | REQUIRE(obj.end() == it); 25 | } 26 | 27 | SECTION("Dereferencing end() is safe") { 28 | REQUIRE(obj.end()->key().isNull()); 29 | REQUIRE(obj.end()->value().isNull()); 30 | } 31 | 32 | SECTION("null JsonObject") { 33 | JsonObject null; 34 | REQUIRE(null.begin() == null.end()); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/JsonObject/nesting.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | TEST_CASE("JsonObject::nesting()") { 9 | JsonDocument doc; 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["nested"].to(); 28 | REQUIRE(obj.nesting() == 2); 29 | } 30 | 31 | SECTION("returns 2 with nested object") { 32 | obj["nested"].to(); 33 | REQUIRE(obj.nesting() == 2); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/JsonObject/size.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | TEST_CASE("JsonObject::size()") { 10 | JsonDocument doc; 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 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/JsonObject/unbound.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | using namespace Catch::Matchers; 9 | 10 | TEST_CASE("Unbound JsonObject") { 11 | JsonObject obj; 12 | 13 | SECTION("retrieve member") { 14 | REQUIRE(obj["key"].isNull()); 15 | } 16 | 17 | SECTION("add member") { 18 | obj["hello"] = "world"; 19 | REQUIRE(0 == obj.size()); 20 | } 21 | 22 | SECTION("serialize") { 23 | char buffer[32]; 24 | serializeJson(obj, buffer, sizeof(buffer)); 25 | REQUIRE_THAT(buffer, Equals("null")); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/JsonObjectConst/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ArduinoJson - https://arduinojson.org 2 | # Copyright © 2014-2024, Benoit BLANCHON 3 | # MIT License 4 | 5 | add_executable(JsonObjectConstTests 6 | equals.cpp 7 | isNull.cpp 8 | iterator.cpp 9 | nesting.cpp 10 | size.cpp 11 | subscript.cpp 12 | ) 13 | 14 | add_test(JsonObjectConst JsonObjectConstTests) 15 | 16 | set_tests_properties(JsonObjectConst 17 | PROPERTIES 18 | LABELS "Catch" 19 | ) 20 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/JsonObjectConst/isNull.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | TEST_CASE("JsonObjectConst::isNull()") { 9 | SECTION("returns true") { 10 | JsonObjectConst obj; 11 | REQUIRE(obj.isNull() == true); 12 | } 13 | 14 | SECTION("returns false") { 15 | JsonDocument doc; 16 | JsonObjectConst obj = doc.to(); 17 | REQUIRE(obj.isNull() == false); 18 | } 19 | } 20 | 21 | TEST_CASE("JsonObjectConst::operator bool()") { 22 | SECTION("returns false") { 23 | JsonObjectConst obj; 24 | REQUIRE(static_cast(obj) == false); 25 | } 26 | 27 | SECTION("returns true") { 28 | JsonDocument doc; 29 | JsonObjectConst obj = doc.to(); 30 | REQUIRE(static_cast(obj) == true); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/JsonObjectConst/iterator.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | TEST_CASE("JsonObjectConst::begin()/end()") { 9 | JsonDocument doc; 10 | JsonObjectConst obj = doc.to(); 11 | doc["ab"] = 12; 12 | doc["cd"] = 34; 13 | 14 | SECTION("Iteration") { 15 | JsonObjectConst::iterator it = obj.begin(); 16 | REQUIRE(obj.end() != it); 17 | REQUIRE(it->key() == "ab"); 18 | REQUIRE(12 == it->value()); 19 | 20 | ++it; 21 | REQUIRE(obj.end() != it); 22 | JsonPairConst pair = *it; 23 | REQUIRE(pair.key() == "cd"); 24 | REQUIRE(34 == pair.value()); 25 | 26 | ++it; 27 | REQUIRE(obj.end() == it); 28 | } 29 | 30 | SECTION("Dereferencing end() is safe") { 31 | REQUIRE(obj.end()->key().isNull()); 32 | REQUIRE(obj.end()->value().isNull()); 33 | } 34 | 35 | SECTION("null JsonObjectConst") { 36 | JsonObjectConst null; 37 | REQUIRE(null.begin() == null.end()); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/JsonObjectConst/nesting.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | TEST_CASE("JsonObjectConst::nesting()") { 9 | JsonDocument doc; 10 | JsonObjectConst obj = doc.to(); 11 | 12 | SECTION("return 0 if unbound") { 13 | JsonObjectConst unbound; 14 | REQUIRE(unbound.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 | doc["hello"] = "world"; 23 | REQUIRE(obj.nesting() == 1); 24 | } 25 | 26 | SECTION("returns 2 with nested array") { 27 | doc["nested"].to(); 28 | REQUIRE(obj.nesting() == 2); 29 | } 30 | 31 | SECTION("returns 2 with nested object") { 32 | doc["nested"].to(); 33 | REQUIRE(obj.nesting() == 2); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/JsonObjectConst/size.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | TEST_CASE("JsonObjectConst::size()") { 10 | JsonDocument doc; 11 | JsonObjectConst obj = doc.to(); 12 | 13 | SECTION("returns 0 when empty") { 14 | REQUIRE(0 == obj.size()); 15 | } 16 | 17 | SECTION("returns the number of members") { 18 | doc["hello"] = 1; 19 | doc["world"] = 2; 20 | REQUIRE(2 == obj.size()); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/JsonObjectConst/subscript.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | #include "Allocators.hpp" 9 | #include "Literals.hpp" 10 | 11 | TEST_CASE("JsonObjectConst::operator[]") { 12 | JsonDocument doc; 13 | doc["hello"] = "world"; 14 | JsonObjectConst obj = doc.as(); 15 | 16 | SECTION("supports const char*") { 17 | REQUIRE(obj["hello"] == "world"); // issue #2019 18 | } 19 | 20 | SECTION("supports std::string") { 21 | REQUIRE(obj["hello"_s] == "world"); // issue #2019 22 | } 23 | 24 | #if defined(HAS_VARIABLE_LENGTH_ARRAY) && \ 25 | !defined(SUBSCRIPT_CONFLICTS_WITH_BUILTIN_OPERATOR) 26 | SECTION("supports VLA") { 27 | size_t i = 16; 28 | char vla[i]; 29 | strcpy(vla, "hello"); 30 | 31 | REQUIRE("world"_s == obj[vla]); 32 | } 33 | #endif 34 | 35 | SECTION("supports JsonVariant") { 36 | doc["key"] = "hello"; 37 | REQUIRE(obj[obj["key"]] == "world"); 38 | REQUIRE(obj[obj["foo"]] == nullptr); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/JsonSerializer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ArduinoJson - https://arduinojson.org 2 | # Copyright © 2014-2024, Benoit BLANCHON 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 | add_test(JsonSerializer JsonSerializerTests) 18 | 19 | set_tests_properties(JsonSerializer 20 | PROPERTIES 21 | LABELS "Catch" 22 | ) 23 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/JsonSerializer/CustomWriter.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | class CustomWriter { 9 | public: 10 | CustomWriter() {} 11 | CustomWriter(const CustomWriter&) = delete; 12 | CustomWriter& operator=(const CustomWriter&) = delete; 13 | 14 | size_t write(uint8_t c) { 15 | str_.append(1, static_cast(c)); 16 | return 1; 17 | } 18 | 19 | size_t write(const uint8_t* s, size_t n) { 20 | str_.append(reinterpret_cast(s), n); 21 | return n; 22 | } 23 | 24 | const std::string& str() const { 25 | return str_; 26 | } 27 | 28 | private: 29 | std::string str_; 30 | }; 31 | 32 | TEST_CASE("CustomWriter") { 33 | JsonDocument doc; 34 | JsonArray array = doc.to(); 35 | array.add(4); 36 | array.add(2); 37 | 38 | SECTION("serializeJson()") { 39 | CustomWriter writer; 40 | serializeJson(array, writer); 41 | 42 | REQUIRE("[4,2]" == writer.str()); 43 | } 44 | 45 | SECTION("serializeJsonPretty") { 46 | CustomWriter writer; 47 | serializeJsonPretty(array, writer); 48 | 49 | REQUIRE("[\r\n 4,\r\n 2\r\n]" == writer.str()); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/JsonSerializer/misc.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | TEST_CASE("serializeJson(MemberProxy)") { 6 | JsonDocument doc; 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 | JsonDocument doc; 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 | JsonDocument doc; 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 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/JsonVariant/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ArduinoJson - https://arduinojson.org 2 | # Copyright © 2014-2024, Benoit BLANCHON 3 | # MIT License 4 | 5 | add_executable(JsonVariantTests 6 | add.cpp 7 | as.cpp 8 | clear.cpp 9 | compare.cpp 10 | converters.cpp 11 | copy.cpp 12 | is.cpp 13 | isnull.cpp 14 | misc.cpp 15 | nesting.cpp 16 | nullptr.cpp 17 | or.cpp 18 | overflow.cpp 19 | remove.cpp 20 | set.cpp 21 | size.cpp 22 | stl_containers.cpp 23 | subscript.cpp 24 | types.cpp 25 | unbound.cpp 26 | ) 27 | 28 | add_test(JsonVariant JsonVariantTests) 29 | 30 | set_tests_properties(JsonVariant 31 | PROPERTIES 32 | LABELS "Catch" 33 | ) 34 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/JsonVariant/clear.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | #include "Allocators.hpp" 10 | #include "Literals.hpp" 11 | 12 | TEST_CASE("JsonVariant::clear()") { 13 | SpyingAllocator spy; 14 | JsonDocument doc(&spy); 15 | JsonVariant var = doc.to(); 16 | 17 | SECTION("size goes back to zero") { 18 | var.add(42); 19 | var.clear(); 20 | 21 | REQUIRE(var.size() == 0); 22 | } 23 | 24 | SECTION("isNull() return true") { 25 | var.add("hello"); 26 | var.clear(); 27 | 28 | REQUIRE(var.isNull() == true); 29 | } 30 | 31 | SECTION("releases owned string") { 32 | var.set("hello"_s); 33 | var.clear(); 34 | 35 | REQUIRE(spy.log() == AllocatorLog{ 36 | Allocate(sizeofString("hello")), 37 | Deallocate(sizeofString("hello")), 38 | }); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/JsonVariant/nesting.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | TEST_CASE("JsonVariant::nesting()") { 9 | JsonDocument doc; 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 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/JsonVariant/nullptr.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | TEST_CASE("nullptr") { 6 | JsonDocument doc; 7 | JsonVariant variant = doc.to(); 8 | 9 | SECTION("JsonVariant == nullptr") { 10 | REQUIRE(variant == nullptr); 11 | REQUIRE_FALSE(variant != nullptr); 12 | } 13 | 14 | SECTION("JsonVariant != nullptr") { 15 | variant.set(42); 16 | 17 | REQUIRE_FALSE(variant == nullptr); 18 | REQUIRE(variant != nullptr); 19 | } 20 | 21 | SECTION("JsonVariant.set(nullptr)") { 22 | variant.set(42); 23 | variant.set(nullptr); 24 | 25 | REQUIRE(variant.isNull()); 26 | } 27 | 28 | SECTION("JsonVariant.set(nullptr) with unbound reference") { 29 | JsonVariant unboundReference; 30 | 31 | unboundReference.set(nullptr); 32 | 33 | REQUIRE(variant.isNull()); 34 | } 35 | 36 | SECTION("JsonVariant.is()") { 37 | variant.set(42); 38 | REQUIRE(variant.is() == false); 39 | 40 | variant.clear(); 41 | REQUIRE(variant.is() == true); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/JsonVariant/size.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | TEST_CASE("JsonVariant::size()") { 9 | JsonDocument doc; 10 | JsonVariant variant = doc.to(); 11 | 12 | SECTION("unbound reference") { 13 | JsonVariant unbound; 14 | 15 | CHECK(unbound.size() == 0); 16 | } 17 | 18 | SECTION("int") { 19 | variant.set(42); 20 | 21 | CHECK(variant.size() == 0); 22 | } 23 | 24 | SECTION("string") { 25 | variant.set("hello"); 26 | 27 | CHECK(variant.size() == 0); 28 | } 29 | 30 | SECTION("object") { 31 | variant["a"] = 1; 32 | variant["b"] = 2; 33 | 34 | CHECK(variant.size() == 2); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/JsonVariantConst/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ArduinoJson - https://arduinojson.org 2 | # Copyright © 2014-2024, Benoit BLANCHON 3 | # MIT License 4 | 5 | add_executable(JsonVariantConstTests 6 | as.cpp 7 | is.cpp 8 | isnull.cpp 9 | nesting.cpp 10 | size.cpp 11 | subscript.cpp 12 | ) 13 | 14 | add_test(JsonVariantConst JsonVariantConstTests) 15 | 16 | set_tests_properties(JsonVariantConst 17 | PROPERTIES 18 | LABELS "Catch" 19 | ) 20 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/JsonVariantConst/isnull.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | TEST_CASE("JsonVariantConst::isNull()") { 9 | JsonDocument doc; 10 | JsonVariantConst variant = doc.to(); 11 | 12 | SECTION("returns true when undefined") { 13 | REQUIRE(variant.isNull() == true); 14 | } 15 | 16 | SECTION("returns false if value is integer") { 17 | doc.set(42); 18 | 19 | REQUIRE(variant.isNull() == false); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/JsonVariantConst/nesting.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | TEST_CASE("JsonVariantConst::nesting()") { 9 | JsonDocument doc; 10 | JsonVariantConst var = doc.to(); 11 | 12 | SECTION("return 0 if unbound") { 13 | JsonVariantConst unbound; 14 | REQUIRE(unbound.nesting() == 0); 15 | } 16 | 17 | SECTION("returns 0 for string") { 18 | doc.set("hello"); 19 | REQUIRE(var.nesting() == 0); 20 | } 21 | 22 | SECTION("returns 1 for empty object") { 23 | doc.to(); 24 | REQUIRE(var.nesting() == 1); 25 | } 26 | 27 | SECTION("returns 1 for empty array") { 28 | doc.to(); 29 | REQUIRE(var.nesting() == 1); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/JsonVariantConst/size.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | TEST_CASE("JsonVariantConst::size()") { 9 | JsonDocument doc; 10 | JsonVariantConst variant = doc.to(); 11 | 12 | SECTION("unbound reference") { 13 | JsonVariantConst unbound; 14 | 15 | CHECK(unbound.size() == 0); 16 | } 17 | 18 | SECTION("int") { 19 | doc.set(42); 20 | 21 | CHECK(variant.size() == 0); 22 | } 23 | 24 | SECTION("string") { 25 | doc.set("hello"); 26 | 27 | CHECK(variant.size() == 0); 28 | } 29 | 30 | SECTION("object") { 31 | doc["a"] = 1; 32 | doc["b"] = 2; 33 | 34 | CHECK(variant.size() == 2); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/Misc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ArduinoJson - https://arduinojson.org 2 | # Copyright © 2014-2024, Benoit BLANCHON 3 | # MIT License 4 | 5 | add_executable(MiscTests 6 | arithmeticCompare.cpp 7 | conflicts.cpp 8 | issue1967.cpp 9 | JsonString.cpp 10 | NoArduinoHeader.cpp 11 | printable.cpp 12 | Readers.cpp 13 | StringAdapters.cpp 14 | StringWriter.cpp 15 | TypeTraits.cpp 16 | unsigned_char.cpp 17 | Utf16.cpp 18 | Utf8.cpp 19 | version.cpp 20 | ) 21 | 22 | set_target_properties(MiscTests PROPERTIES UNITY_BUILD OFF) 23 | 24 | add_test(Misc MiscTests) 25 | 26 | set_tests_properties(Misc 27 | PROPERTIES 28 | LABELS "Catch" 29 | ) 30 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/Misc/NoArduinoHeader.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #define ARDUINO 1 6 | #define ARDUINOJSON_ENABLE_PROGMEM 0 7 | #define ARDUINOJSON_ENABLE_ARDUINO_STRING 0 8 | #define ARDUINOJSON_ENABLE_ARDUINO_STREAM 0 9 | #define ARDUINOJSON_ENABLE_ARDUINO_PRINT 0 10 | #include 11 | 12 | #include 13 | 14 | TEST_CASE("Arduino.h") { 15 | #ifdef ARDUINO_H_INCLUDED 16 | FAIL("Arduino.h should not be included"); 17 | #else 18 | INFO("Arduino.h not included"); 19 | #endif 20 | } 21 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/Misc/Utf8.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | using namespace ArduinoJson::detail; 11 | 12 | static void testCodepoint(uint32_t codepoint, std::string expected) { 13 | ResourceManager resources; 14 | StringBuilder str(&resources); 15 | str.startString(); 16 | 17 | CAPTURE(codepoint); 18 | Utf8::encodeCodepoint(codepoint, str); 19 | 20 | REQUIRE(str.str().c_str() == expected); 21 | } 22 | 23 | TEST_CASE("Utf8::encodeCodepoint()") { 24 | SECTION("U+0000") { 25 | testCodepoint(0x0000, ""); 26 | } 27 | 28 | SECTION("U+0001") { 29 | testCodepoint(0x0001, "\x01"); 30 | } 31 | 32 | SECTION("U+007F") { 33 | testCodepoint(0x007F, "\x7f"); 34 | } 35 | 36 | SECTION("U+0080") { 37 | testCodepoint(0x0080, "\xc2\x80"); 38 | } 39 | 40 | SECTION("U+07FF") { 41 | testCodepoint(0x07FF, "\xdf\xbf"); 42 | } 43 | 44 | SECTION("U+0800") { 45 | testCodepoint(0x0800, "\xe0\xa0\x80"); 46 | } 47 | 48 | SECTION("U+FFFF") { 49 | testCodepoint(0xFFFF, "\xef\xbf\xbf"); 50 | } 51 | 52 | SECTION("U+10000") { 53 | testCodepoint(0x10000, "\xf0\x90\x80\x80"); 54 | } 55 | 56 | SECTION("U+10FFFF") { 57 | testCodepoint(0x10FFFF, "\xf4\x8f\xbf\xbf"); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/Misc/conflicts.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 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 | // Realtek Ameba 43 | #define isdigit(c) (((c) >= '0') && ((c) <= '9')) 44 | #define isprint(c) 45 | #define isxdigit(c) 46 | #define isspace(c) 47 | #define isupper(c) 48 | #define islower(c) 49 | #define isalpha(c) 50 | 51 | // issue #839 52 | #define BLOCKSIZE 53 | #define CAPACITY 54 | 55 | // issue #1905 56 | #define _current 57 | 58 | // issue #1914 59 | #define V7 7 60 | 61 | // STM32, Mbed, Particle 62 | #define A0 16 63 | #define A1 17 64 | #define A2 18 65 | 66 | // catch.hpp mutes several warnings, this file also allows to detect them 67 | #include "ArduinoJson.h" 68 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/Misc/custom_string.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | struct custom_char_traits : std::char_traits {}; 10 | 11 | typedef std::basic_string custom_string; 12 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/Misc/issue1967.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | // we expect ArduinoJson.h to include 6 | #define ARDUINOJSON_ENABLE_STD_STRING 1 7 | 8 | // but we don't want it to included accidentally 9 | #undef ARDUINO 10 | #define ARDUINOJSON_ENABLE_STD_STREAM 0 11 | #define ARDUINOJSON_ENABLE_STRING_VIEW 0 12 | 13 | #include 14 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/Misc/version.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 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 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/Misc/weird_strcmp.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #include 6 | 7 | #include // strcmp, strncmp 8 | 9 | // Issue #1198: strcmp() implementation that returns a value larger than 8-bit 10 | 11 | ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE 12 | 13 | int strcmp(const char* a, const char* b) { 14 | int result = ::strcmp(a, b); 15 | if (result > 0) 16 | return 2147483647; 17 | if (result < 0) 18 | return -214748364; 19 | return 0; 20 | } 21 | 22 | int strncmp(const char* a, const char* b, size_t n) { 23 | int result = ::strncmp(a, b, n); 24 | if (result > 0) 25 | return 2147483647; 26 | if (result < 0) 27 | return -214748364; 28 | return 0; 29 | } 30 | 31 | ARDUINOJSON_END_PRIVATE_NAMESPACE 32 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/MixedConfiguration/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ArduinoJson - https://arduinojson.org 2 | # Copyright © 2014-2024, Benoit BLANCHON 3 | # MIT License 4 | 5 | add_executable(MixedConfigurationTests 6 | decode_unicode_0.cpp 7 | decode_unicode_1.cpp 8 | enable_alignment_0.cpp 9 | enable_alignment_1.cpp 10 | enable_comments_0.cpp 11 | enable_comments_1.cpp 12 | enable_infinity_0.cpp 13 | enable_infinity_1.cpp 14 | enable_nan_0.cpp 15 | enable_nan_1.cpp 16 | enable_progmem_1.cpp 17 | issue1707.cpp 18 | string_length_size_1.cpp 19 | string_length_size_2.cpp 20 | string_length_size_4.cpp 21 | use_double_0.cpp 22 | use_double_1.cpp 23 | use_long_long_0.cpp 24 | use_long_long_1.cpp 25 | ) 26 | 27 | set_target_properties(MixedConfigurationTests PROPERTIES UNITY_BUILD OFF) 28 | 29 | add_test(MixedConfiguration MixedConfigurationTests) 30 | 31 | set_tests_properties(MixedConfiguration 32 | PROPERTIES 33 | LABELS "Catch" 34 | ) 35 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/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 | JsonDocument doc; 8 | DeserializationError err = deserializeJson(doc, "\"\\uD834\\uDD1E\""); 9 | 10 | REQUIRE(err == DeserializationError::Ok); 11 | REQUIRE(doc.as() == "\\uD834\\uDD1E"); 12 | } 13 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/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 | JsonDocument doc; 8 | DeserializationError err = deserializeJson(doc, "\"\\uD834\\uDD1E\""); 9 | 10 | REQUIRE(err == DeserializationError::Ok); 11 | } 12 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/MixedConfiguration/enable_alignment_0.cpp: -------------------------------------------------------------------------------- 1 | #define ARDUINOJSON_VERSION_NAMESPACE NoAlignment 2 | #define ARDUINOJSON_ENABLE_ALIGNMENT 0 3 | #include 4 | 5 | #include 6 | 7 | TEST_CASE("ARDUINOJSON_ENABLE_ALIGNMENT == 0") { 8 | using namespace ArduinoJson::detail; 9 | 10 | const size_t N = sizeof(void*); 11 | 12 | SECTION("isAligned()") { 13 | CHECK(isAligned(0) == true); 14 | CHECK(isAligned(1) == true); 15 | CHECK(isAligned(N) == true); 16 | CHECK(isAligned(N + 1) == true); 17 | CHECK(isAligned(2 * N) == true); 18 | CHECK(isAligned(2 * N + 1) == true); 19 | } 20 | 21 | SECTION("addPadding()") { 22 | CHECK(addPadding(0) == 0); 23 | CHECK(addPadding(1) == 1); 24 | CHECK(addPadding(N) == N); 25 | CHECK(addPadding(N + 1) == N + 1); 26 | } 27 | 28 | SECTION("AddPadding<>") { 29 | const size_t a = AddPadding<0>::value; 30 | CHECK(a == 0); 31 | 32 | const size_t b = AddPadding<1>::value; 33 | CHECK(b == 1); 34 | 35 | const size_t c = AddPadding::value; 36 | CHECK(c == N); 37 | 38 | const size_t d = AddPadding::value; 39 | CHECK(d == N + 1); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/MixedConfiguration/enable_alignment_1.cpp: -------------------------------------------------------------------------------- 1 | #define ARDUINOJSON_ENABLE_ALIGNMENT 1 2 | #include 3 | 4 | #include 5 | 6 | TEST_CASE("ARDUINOJSON_ENABLE_ALIGNMENT == 1") { 7 | using namespace ArduinoJson::detail; 8 | 9 | const size_t N = sizeof(void*); 10 | 11 | SECTION("isAligned()") { 12 | CHECK(isAligned(0) == true); 13 | CHECK(isAligned(1) == false); 14 | CHECK(isAligned(N) == true); 15 | CHECK(isAligned(N + 1) == false); 16 | CHECK(isAligned(2 * N) == true); 17 | CHECK(isAligned(2 * N + 1) == false); 18 | } 19 | 20 | SECTION("addPadding()") { 21 | CHECK(addPadding(0) == 0); 22 | CHECK(addPadding(1) == N); 23 | CHECK(addPadding(N) == N); 24 | CHECK(addPadding(N + 1) == 2 * N); 25 | } 26 | 27 | SECTION("AddPadding<>") { 28 | const size_t a = AddPadding<0>::value; 29 | CHECK(a == 0); 30 | 31 | const size_t b = AddPadding<1>::value; 32 | CHECK(b == N); 33 | 34 | const size_t c = AddPadding::value; 35 | CHECK(c == N); 36 | 37 | const size_t d = AddPadding::value; 38 | CHECK(d == 2 * N); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/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 | JsonDocument doc; 9 | DeserializationError 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 | JsonDocument doc; 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 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/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::detail::isinf; 9 | } // namespace my 10 | 11 | TEST_CASE("ARDUINOJSON_ENABLE_INFINITY == 1") { 12 | JsonDocument doc; 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 | DeserializationError err = 26 | deserializeJson(doc, "[Infinity,-Infinity,+Infinity]"); 27 | float a = doc[0]; 28 | float b = doc[1]; 29 | float c = doc[2]; 30 | 31 | REQUIRE(err == DeserializationError::Ok); 32 | REQUIRE(my::isinf(a)); 33 | REQUIRE(a > 0); 34 | REQUIRE(my::isinf(b)); 35 | REQUIRE(b < 0); 36 | REQUIRE(my::isinf(c)); 37 | REQUIRE(c > 0); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/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 | JsonDocument doc; 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 | DeserializationError err = deserializeJson(doc, "{\"X\":NaN}"); 22 | 23 | REQUIRE(err == DeserializationError::InvalidInput); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/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::detail::isnan; 9 | } // namespace my 10 | 11 | TEST_CASE("ARDUINOJSON_ENABLE_NAN == 1") { 12 | JsonDocument doc; 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 | DeserializationError err = deserializeJson(doc, "{\"X\":NaN}"); 26 | float x = doc["X"]; 27 | 28 | REQUIRE(err == DeserializationError::Ok); 29 | REQUIRE(my::isnan(x)); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/MixedConfiguration/issue1707.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #define ARDUINO 6 | #define memcpy_P(dest, src, n) memcpy((dest), (src), (n)) 7 | 8 | #include 9 | 10 | #include 11 | 12 | TEST_CASE("Issue1707") { 13 | JsonDocument doc; 14 | 15 | DeserializationError err = deserializeJson(doc, F("{\"hello\":12}")); 16 | REQUIRE(err == DeserializationError::Ok); 17 | } 18 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/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 | JsonDocument doc; 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 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/MixedConfiguration/use_long_long_0.cpp: -------------------------------------------------------------------------------- 1 | #define ARDUINOJSON_USE_LONG_LONG 0 2 | #include 3 | 4 | #include 5 | 6 | #include "Literals.hpp" 7 | 8 | TEST_CASE("ARDUINOJSON_USE_LONG_LONG == 0") { 9 | JsonDocument doc; 10 | 11 | SECTION("smoke test") { 12 | doc["A"] = 42; 13 | doc["B"] = 84; 14 | 15 | std::string json; 16 | serializeJson(doc, json); 17 | 18 | REQUIRE(json == "{\"A\":42,\"B\":84}"); 19 | } 20 | 21 | SECTION("deserializeMsgPack()") { 22 | SECTION("cf 00 00 00 00 ff ff ff ff") { 23 | auto err = 24 | deserializeMsgPack(doc, "\xcf\x00\x00\x00\x00\xff\xff\xff\xff"_s); 25 | 26 | REQUIRE(err == DeserializationError::Ok); 27 | REQUIRE(doc.as() == 0xFFFFFFFF); 28 | } 29 | 30 | SECTION("cf 00 00 00 01 00 00 00 00") { 31 | auto err = 32 | deserializeMsgPack(doc, "\xcf\x00\x00\x00\x01\x00\x00\x00\x00"_s); 33 | 34 | REQUIRE(err == DeserializationError::Ok); 35 | REQUIRE(doc.isNull()); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/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 | JsonDocument doc; 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 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/MsgPackDeserializer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ArduinoJson - https://arduinojson.org 2 | # Copyright © 2014-2024, Benoit BLANCHON 3 | # MIT License 4 | 5 | add_executable(MsgPackDeserializerTests 6 | deserializeArray.cpp 7 | deserializeObject.cpp 8 | deserializeVariant.cpp 9 | destination_types.cpp 10 | doubleToFloat.cpp 11 | errors.cpp 12 | filter.cpp 13 | input_types.cpp 14 | nestingLimit.cpp 15 | ) 16 | 17 | add_test(MsgPackDeserializer MsgPackDeserializerTests) 18 | 19 | set_tests_properties(MsgPackDeserializer 20 | PROPERTIES 21 | LABELS "Catch" 22 | ) 23 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/MsgPackDeserializer/doubleToFloat.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | using namespace ArduinoJson::detail; 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 | fixEndianness(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 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/MsgPackSerializer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ArduinoJson - https://arduinojson.org 2 | # Copyright © 2014-2024, Benoit BLANCHON 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 | add_test(MsgPackSerializer MsgPackSerializerTests) 15 | 16 | set_tests_properties(MsgPackSerializer 17 | PROPERTIES 18 | LABELS "Catch" 19 | ) 20 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/MsgPackSerializer/measure.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | TEST_CASE("measureMsgPack()") { 9 | JsonDocument doc; 10 | JsonObject object = doc.to(); 11 | object["hello"] = "world"; 12 | 13 | REQUIRE(measureMsgPack(doc) == 13); 14 | } 15 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/MsgPackSerializer/misc.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | template 6 | void check(T value, const std::string& expected) { 7 | JsonDocument doc; 8 | doc.to().set(value); 9 | char buffer[256] = ""; 10 | size_t returnValue = serializeMsgPack(doc, buffer, sizeof(buffer)); 11 | REQUIRE(expected == buffer); 12 | REQUIRE(expected.size() == returnValue); 13 | } 14 | 15 | TEST_CASE("serializeMsgPack(MemberProxy)") { 16 | JsonDocument doc; 17 | deserializeJson(doc, "{\"hello\":42}"); 18 | JsonObject obj = doc.as(); 19 | std::string result; 20 | 21 | serializeMsgPack(obj["hello"], result); 22 | 23 | REQUIRE(result == "*"); 24 | } 25 | 26 | TEST_CASE("serializeMsgPack(ElementProxy)") { 27 | JsonDocument doc; 28 | deserializeJson(doc, "[42]"); 29 | JsonArray arr = doc.as(); 30 | std::string result; 31 | 32 | serializeMsgPack(arr[0], result); 33 | 34 | REQUIRE(result == "*"); 35 | } 36 | 37 | TEST_CASE("serializeMsgPack(JsonVariantSubscript)") { 38 | JsonDocument doc; 39 | deserializeJson(doc, "[42]"); 40 | JsonVariant var = doc.as(); 41 | std::string result; 42 | 43 | serializeMsgPack(var[0], result); 44 | 45 | REQUIRE(result == "*"); 46 | } 47 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/Numbers/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ArduinoJson - https://arduinojson.org 2 | # Copyright © 2014-2024, Benoit BLANCHON 3 | # MIT License 4 | 5 | add_executable(NumbersTests 6 | convertNumber.cpp 7 | decomposeFloat.cpp 8 | parseDouble.cpp 9 | parseFloat.cpp 10 | parseInteger.cpp 11 | parseNumber.cpp 12 | ) 13 | 14 | add_test(Numbers NumbersTests) 15 | 16 | set_tests_properties(Numbers 17 | PROPERTIES 18 | LABELS "Catch" 19 | ) 20 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/Numbers/decomposeFloat.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #include 6 | #include 7 | 8 | using namespace ArduinoJson::detail; 9 | 10 | TEST_CASE("decomposeFloat()") { 11 | SECTION("1.7976931348623157E+308") { 12 | auto parts = decomposeFloat(1.7976931348623157E+308, 9); 13 | REQUIRE(parts.integral == 1); 14 | REQUIRE(parts.decimal == 797693135); 15 | REQUIRE(parts.decimalPlaces == 9); 16 | REQUIRE(parts.exponent == 308); 17 | } 18 | 19 | SECTION("4.94065645841247e-324") { 20 | auto parts = decomposeFloat(4.94065645841247e-324, 9); 21 | REQUIRE(parts.integral == 4); 22 | REQUIRE(parts.decimal == 940656458); 23 | REQUIRE(parts.decimalPlaces == 9); 24 | REQUIRE(parts.exponent == -324); 25 | } 26 | 27 | SECTION("3.4E+38") { 28 | auto parts = decomposeFloat(3.4E+38f, 6); 29 | REQUIRE(parts.integral == 3); 30 | REQUIRE(parts.decimal == 4); 31 | REQUIRE(parts.decimalPlaces == 1); 32 | REQUIRE(parts.exponent == 38); 33 | } 34 | 35 | SECTION("1.17549435e−38") { 36 | auto parts = decomposeFloat(1.17549435e-38f, 6); 37 | REQUIRE(parts.integral == 1); 38 | REQUIRE(parts.decimal == 175494); 39 | REQUIRE(parts.decimalPlaces == 6); 40 | REQUIRE(parts.exponent == -38); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/ResourceManager/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ArduinoJson - https://arduinojson.org 2 | # Copyright © 2014-2024, Benoit BLANCHON 3 | # MIT License 4 | 5 | add_executable(ResourceManagerTests 6 | allocVariant.cpp 7 | clear.cpp 8 | saveString.cpp 9 | shrinkToFit.cpp 10 | size.cpp 11 | StringBuilder.cpp 12 | swap.cpp 13 | ) 14 | 15 | add_compile_definitions(ResourceManagerTests 16 | ARDUINOJSON_SLOT_ID_SIZE=1 # require less RAM for overflow tests 17 | ARDUINOJSON_POOL_CAPACITY=16 18 | ) 19 | 20 | add_test(ResourceManager ResourceManagerTests) 21 | 22 | set_tests_properties(ResourceManager 23 | PROPERTIES 24 | LABELS "Catch" 25 | ) 26 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/ResourceManager/clear.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | using namespace ArduinoJson::detail; 11 | 12 | TEST_CASE("ResourceManager::clear()") { 13 | ResourceManager resources; 14 | 15 | SECTION("Discards allocated variants") { 16 | resources.allocVariant(); 17 | 18 | resources.clear(); 19 | REQUIRE(resources.size() == 0); 20 | } 21 | 22 | SECTION("Discards allocated strings") { 23 | resources.saveString(adaptString("123456789")); 24 | REQUIRE(resources.size() == sizeofString(9)); 25 | 26 | resources.clear(); 27 | 28 | REQUIRE(resources.size() == 0); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/ResourceManager/size.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | #include "Allocators.hpp" 10 | 11 | using namespace ArduinoJson::detail; 12 | 13 | TEST_CASE("ResourceManager::size()") { 14 | TimebombAllocator timebomb(0); 15 | ResourceManager resources(&timebomb); 16 | 17 | SECTION("Initial size is 0") { 18 | REQUIRE(0 == resources.size()); 19 | } 20 | 21 | SECTION("Doesn't grow when allocation of second pool fails") { 22 | timebomb.setCountdown(1); 23 | for (size_t i = 0; i < ARDUINOJSON_POOL_CAPACITY; i++) 24 | resources.allocVariant(); 25 | size_t size = resources.size(); 26 | 27 | resources.allocVariant(); 28 | 29 | REQUIRE(size == resources.size()); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/TextFormatter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ArduinoJson - https://arduinojson.org 2 | # Copyright © 2014-2024, Benoit BLANCHON 3 | # MIT License 4 | 5 | add_executable(TextFormatterTests 6 | writeFloat.cpp 7 | writeInteger.cpp 8 | writeString.cpp 9 | ) 10 | 11 | set_target_properties(TextFormatterTests PROPERTIES UNITY_BUILD OFF) 12 | 13 | add_test(TextFormatter TextFormatterTests) 14 | 15 | set_tests_properties(TextFormatter 16 | PROPERTIES 17 | LABELS "Catch" 18 | ) 19 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/catch/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ArduinoJson - https://arduinojson.org 2 | # Copyright Benoit Blanchon 2014-2021 3 | # MIT License 4 | 5 | set(CMAKE_CXX_STANDARD 17) 6 | set(CMAKE_CXX_STANDARD_REQUIRED OFF) 7 | 8 | add_library(catch 9 | catch.hpp 10 | catch.cpp 11 | ) 12 | 13 | target_include_directories(catch 14 | PUBLIC 15 | ${CMAKE_CURRENT_SOURCE_DIR} 16 | ) 17 | 18 | if(MINGW) 19 | # prevent "too many sections (32837)" with MinGW 20 | target_compile_options(catch PRIVATE -Wa,-mbig-obj) 21 | endif() 22 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/extras/tests/catch/catch.cpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2021 3 | // MIT License 4 | 5 | #define CATCH_CONFIG_MAIN 6 | #include "catch.hpp" 7 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/idf_component.yml: -------------------------------------------------------------------------------- 1 | version: "7.2.0" 2 | description: >- 3 | A simple and efficient JSON library for embedded C++. 4 | ⭐ 6690 stars on GitHub! 5 | Supports serialization, deserialization, MessagePack, streams, filtering, and more. 6 | Fully tested and documented. 7 | url: https://arduinojson.org/ 8 | files: 9 | exclude: 10 | - "**/.vs/**/*" 11 | - ".devcontainer/**/*" 12 | - "examples/**/*" 13 | - "extras/**/*" 14 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/keywords.txt: -------------------------------------------------------------------------------- 1 | # Free functions 2 | deserializeJson KEYWORD2 3 | deserializeMsgPack KEYWORD2 4 | serialized KEYWORD2 5 | serializeJson KEYWORD2 6 | serializeJsonPretty KEYWORD2 7 | serializeMsgPack KEYWORD2 8 | measureJson KEYWORD2 9 | measureJsonPretty KEYWORD2 10 | measureMsgPack KEYWORD2 11 | 12 | # Methods 13 | add KEYWORD2 14 | as KEYWORD2 15 | get KEYWORD2 16 | set KEYWORD2 17 | to KEYWORD2 18 | 19 | # Type names 20 | DeserializationError KEYWORD1 DATA_TYPE 21 | JsonDocument KEYWORD1 DATA_TYPE 22 | JsonArray KEYWORD1 DATA_TYPE 23 | JsonArrayConst KEYWORD1 DATA_TYPE 24 | JsonDocument KEYWORD1 DATA_TYPE 25 | JsonFloat KEYWORD1 DATA_TYPE 26 | JsonInteger KEYWORD1 DATA_TYPE 27 | JsonObject KEYWORD1 DATA_TYPE 28 | JsonObjectConst KEYWORD1 DATA_TYPE 29 | JsonString KEYWORD1 DATA_TYPE 30 | JsonUInt KEYWORD1 DATA_TYPE 31 | JsonVariant KEYWORD1 DATA_TYPE 32 | JsonVariantConst KEYWORD1 DATA_TYPE 33 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/library.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ArduinoJson", 3 | "keywords": "json, rest, http, web", 4 | "description": "A simple and efficient JSON library for embedded C++. ⭐ 6690 stars on GitHub! Supports serialization, deserialization, MessagePack, streams, filtering, and more. Fully tested and documented.", 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": "7.2.0", 11 | "authors": { 12 | "name": "Benoit Blanchon", 13 | "url": "https://blog.benoitblanchon.fr" 14 | }, 15 | "export": { 16 | "include": ["src", "examples", "LICENSE.txt", "ArduinoJson.h"] 17 | }, 18 | "frameworks": "*", 19 | "platforms": "*", 20 | "build": { 21 | "libArchive": false 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/library.properties: -------------------------------------------------------------------------------- 1 | name=ArduinoJson 2 | version=7.2.0 3 | author=Benoit Blanchon 4 | maintainer=Benoit Blanchon 5 | sentence=A simple and efficient JSON library for embedded C++. 6 | paragraph=⭐ 6690 stars on GitHub! Supports serialization, deserialization, MessagePack, streams, filtering, and more. Fully tested and documented. 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 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/src/ArduinoJson.h: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 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 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/src/ArduinoJson/Deserialization/DeserializationOptions.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | #include 9 | 10 | ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE 11 | 12 | template 13 | struct DeserializationOptions { 14 | TFilter filter; 15 | DeserializationOption::NestingLimit nestingLimit; 16 | }; 17 | 18 | template 19 | inline DeserializationOptions makeDeserializationOptions( 20 | TFilter filter, DeserializationOption::NestingLimit nestingLimit = {}) { 21 | return {filter, nestingLimit}; 22 | } 23 | 24 | template 25 | inline DeserializationOptions makeDeserializationOptions( 26 | DeserializationOption::NestingLimit nestingLimit, TFilter filter) { 27 | return {filter, nestingLimit}; 28 | } 29 | 30 | inline DeserializationOptions makeDeserializationOptions( 31 | DeserializationOption::NestingLimit nestingLimit = {}) { 32 | return {{}, nestingLimit}; 33 | } 34 | 35 | ARDUINOJSON_END_PRIVATE_NAMESPACE 36 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/src/ArduinoJson/Deserialization/NestingLimit.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | #include 9 | 10 | ARDUINOJSON_BEGIN_PUBLIC_NAMESPACE 11 | 12 | namespace DeserializationOption { 13 | class NestingLimit { 14 | public: 15 | NestingLimit() : value_(ARDUINOJSON_DEFAULT_NESTING_LIMIT) {} 16 | explicit NestingLimit(uint8_t n) : value_(n) {} 17 | 18 | NestingLimit decrement() const { 19 | ARDUINOJSON_ASSERT(value_ > 0); 20 | return NestingLimit(static_cast(value_ - 1)); 21 | } 22 | 23 | bool reached() const { 24 | return value_ == 0; 25 | } 26 | 27 | private: 28 | uint8_t value_; 29 | }; 30 | } // namespace DeserializationOption 31 | 32 | ARDUINOJSON_END_PUBLIC_NAMESPACE 33 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/src/ArduinoJson/Deserialization/Readers/ArduinoStreamReader.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE 10 | 11 | template 12 | struct Reader::value>> { 13 | public: 14 | explicit Reader(Stream& stream) : stream_(&stream) {} 15 | 16 | int read() { 17 | // don't use stream_->read() as it ignores the timeout 18 | char c; 19 | return stream_->readBytes(&c, 1) ? static_cast(c) : -1; 20 | } 21 | 22 | size_t readBytes(char* buffer, size_t length) { 23 | return stream_->readBytes(buffer, length); 24 | } 25 | 26 | private: 27 | Stream* stream_; 28 | }; 29 | 30 | ARDUINOJSON_END_PRIVATE_NAMESPACE 31 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/src/ArduinoJson/Deserialization/Readers/ArduinoStringReader.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE 10 | 11 | template 12 | struct Reader::value>> 13 | : BoundedReader { 14 | explicit Reader(const ::String& s) 15 | : BoundedReader(s.c_str(), s.length()) {} 16 | }; 17 | 18 | ARDUINOJSON_END_PRIVATE_NAMESPACE 19 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/src/ArduinoJson/Deserialization/Readers/IteratorReader.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE 10 | 11 | template 12 | class IteratorReader { 13 | TIterator ptr_, end_; 14 | 15 | public: 16 | explicit IteratorReader(TIterator begin, TIterator end) 17 | : ptr_(begin), end_(end) {} 18 | 19 | int read() { 20 | if (ptr_ < end_) 21 | return static_cast(*ptr_++); 22 | else 23 | return -1; 24 | } 25 | 26 | size_t readBytes(char* buffer, size_t length) { 27 | size_t i = 0; 28 | while (i < length && ptr_ < end_) 29 | buffer[i++] = *ptr_++; 30 | return i; 31 | } 32 | }; 33 | 34 | template 35 | struct Reader> 36 | : IteratorReader { 37 | explicit Reader(const TSource& source) 38 | : IteratorReader(source.begin(), 39 | source.end()) {} 40 | }; 41 | 42 | ARDUINOJSON_END_PRIVATE_NAMESPACE 43 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/src/ArduinoJson/Deserialization/Readers/StdStreamReader.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE 10 | 11 | template 12 | struct Reader::value>> { 13 | public: 14 | explicit Reader(std::istream& stream) : stream_(&stream) {} 15 | 16 | int read() { 17 | return stream_->get(); 18 | } 19 | 20 | size_t readBytes(char* buffer, size_t length) { 21 | stream_->read(buffer, static_cast(length)); 22 | return static_cast(stream_->gcount()); 23 | } 24 | 25 | private: 26 | std::istream* stream_; 27 | }; 28 | 29 | ARDUINOJSON_END_PRIVATE_NAMESPACE 30 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/src/ArduinoJson/Deserialization/Readers/VariantReader.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | #include 9 | 10 | ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE 11 | 12 | template 13 | struct Reader::value>> 14 | : Reader { 15 | explicit Reader(const TVariant& x) 16 | : Reader(x.template as()) {} 17 | }; 18 | 19 | ARDUINOJSON_END_PRIVATE_NAMESPACE 20 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/src/ArduinoJson/Json/EscapeSequence.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | ARDUINOJSON_BEGIN_PRIVATE_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(true); 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(false); 25 | for (;;) { 26 | if (p[0] == '\0') 27 | return 0; 28 | if (p[0] == c) 29 | return p[1]; 30 | p += 2; 31 | } 32 | } 33 | 34 | private: 35 | static const char* escapeTable(bool isSerializing) { 36 | return &"//''\"\"\\\\b\bf\fn\nr\rt\t"[isSerializing ? 4 : 0]; 37 | } 38 | }; 39 | 40 | ARDUINOJSON_END_PRIVATE_NAMESPACE 41 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/src/ArduinoJson/Json/Latch.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE 10 | 11 | template 12 | class Latch { 13 | public: 14 | Latch(TReader reader) : reader_(reader), loaded_(false) { 15 | #if ARDUINOJSON_DEBUG 16 | ended_ = false; 17 | #endif 18 | } 19 | 20 | void clear() { 21 | loaded_ = false; 22 | } 23 | 24 | int last() const { 25 | return current_; 26 | } 27 | 28 | FORCE_INLINE char current() { 29 | if (!loaded_) { 30 | load(); 31 | } 32 | return current_; 33 | } 34 | 35 | private: 36 | void load() { 37 | ARDUINOJSON_ASSERT(!ended_); 38 | int c = reader_.read(); 39 | #if ARDUINOJSON_DEBUG 40 | if (c <= 0) 41 | ended_ = true; 42 | #endif 43 | current_ = static_cast(c > 0 ? c : 0); 44 | loaded_ = true; 45 | } 46 | 47 | TReader reader_; 48 | char current_; // NOLINT(clang-analyzer-optin.cplusplus.UninitializedObject) 49 | // Not initialized in constructor (+10 bytes on AVR) 50 | bool loaded_; 51 | #if ARDUINOJSON_DEBUG 52 | bool ended_; 53 | #endif 54 | }; 55 | 56 | ARDUINOJSON_END_PRIVATE_NAMESPACE 57 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/src/ArduinoJson/Json/Utf8.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE 10 | 11 | namespace Utf8 { 12 | template 13 | inline void encodeCodepoint(uint32_t codepoint32, TStringBuilder& str) { 14 | // this function was optimize for code size on AVR 15 | 16 | if (codepoint32 < 0x80) { 17 | str.append(char(codepoint32)); 18 | } else { 19 | // a buffer to store the string in reverse 20 | char buf[5]; 21 | char* p = buf; 22 | 23 | *(p++) = 0; 24 | *(p++) = char((codepoint32 | 0x80) & 0xBF); 25 | uint16_t codepoint16 = uint16_t(codepoint32 >> 6); 26 | if (codepoint16 < 0x20) { // 0x800 27 | *(p++) = char(codepoint16 | 0xC0); 28 | } else { 29 | *(p++) = char((codepoint16 | 0x80) & 0xBF); 30 | codepoint16 = uint16_t(codepoint16 >> 6); 31 | if (codepoint16 < 0x10) { // 0x10000 32 | *(p++) = char(codepoint16 | 0xE0); 33 | } else { 34 | *(p++) = char((codepoint16 | 0x80) & 0xBF); 35 | codepoint16 = uint16_t(codepoint16 >> 6); 36 | *(p++) = char(codepoint16 | 0xF0); 37 | } 38 | } 39 | 40 | while (*(--p)) { 41 | str.append(*p); 42 | } 43 | } 44 | } 45 | } // namespace Utf8 46 | ARDUINOJSON_END_PRIVATE_NAMESPACE 47 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/src/ArduinoJson/Memory/Allocator.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | #include // malloc, free 10 | 11 | ARDUINOJSON_BEGIN_PUBLIC_NAMESPACE 12 | 13 | class Allocator { 14 | public: 15 | virtual void* allocate(size_t size) = 0; 16 | virtual void deallocate(void* ptr) = 0; 17 | virtual void* reallocate(void* ptr, size_t new_size) = 0; 18 | 19 | protected: 20 | ~Allocator() = default; 21 | }; 22 | 23 | namespace detail { 24 | class DefaultAllocator : public Allocator { 25 | public: 26 | void* allocate(size_t size) override { 27 | return malloc(size); 28 | } 29 | 30 | void deallocate(void* ptr) override { 31 | free(ptr); 32 | } 33 | 34 | void* reallocate(void* ptr, size_t new_size) override { 35 | return realloc(ptr, new_size); 36 | } 37 | 38 | static Allocator* instance() { 39 | static DefaultAllocator allocator; 40 | return &allocator; 41 | } 42 | 43 | private: 44 | DefaultAllocator() = default; 45 | ~DefaultAllocator() = default; 46 | }; 47 | } // namespace detail 48 | 49 | ARDUINOJSON_END_PUBLIC_NAMESPACE 50 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/src/ArduinoJson/MsgPack/endianness.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE 10 | 11 | #if ARDUINOJSON_LITTLE_ENDIAN 12 | inline void swapBytes(uint8_t& a, uint8_t& b) { 13 | uint8_t t(a); 14 | a = b; 15 | b = t; 16 | } 17 | 18 | inline void fixEndianness(uint8_t* p, integral_constant) { 19 | swapBytes(p[0], p[7]); 20 | swapBytes(p[1], p[6]); 21 | swapBytes(p[2], p[5]); 22 | swapBytes(p[3], p[4]); 23 | } 24 | 25 | inline void fixEndianness(uint8_t* p, integral_constant) { 26 | swapBytes(p[0], p[3]); 27 | swapBytes(p[1], p[2]); 28 | } 29 | 30 | inline void fixEndianness(uint8_t* p, integral_constant) { 31 | swapBytes(p[0], p[1]); 32 | } 33 | 34 | inline void fixEndianness(uint8_t*, integral_constant) {} 35 | 36 | template 37 | inline void fixEndianness(T& value) { 38 | fixEndianness(reinterpret_cast(&value), 39 | integral_constant()); 40 | } 41 | #else 42 | template 43 | inline void fixEndianness(T&) {} 44 | #endif 45 | 46 | ARDUINOJSON_END_PRIVATE_NAMESPACE 47 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/src/ArduinoJson/MsgPack/ieee754.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | ARDUINOJSON_BEGIN_PRIVATE_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 | ARDUINOJSON_END_PRIVATE_NAMESPACE 19 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/src/ArduinoJson/Numbers/JsonFloat.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | #include 9 | 10 | ARDUINOJSON_BEGIN_PUBLIC_NAMESPACE 11 | 12 | #if ARDUINOJSON_USE_DOUBLE 13 | typedef double JsonFloat; 14 | #else 15 | typedef float JsonFloat; 16 | #endif 17 | 18 | ARDUINOJSON_END_PUBLIC_NAMESPACE 19 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/src/ArduinoJson/Numbers/JsonInteger.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | #include 9 | 10 | #include // int64_t 11 | 12 | ARDUINOJSON_BEGIN_PUBLIC_NAMESPACE 13 | 14 | #if ARDUINOJSON_USE_LONG_LONG 15 | typedef int64_t JsonInteger; 16 | typedef uint64_t JsonUInt; 17 | #else 18 | typedef long JsonInteger; 19 | typedef unsigned long JsonUInt; 20 | #endif 21 | 22 | ARDUINOJSON_END_PUBLIC_NAMESPACE 23 | 24 | #define ARDUINOJSON_ASSERT_INTEGER_TYPE_IS_SUPPORTED(T) \ 25 | static_assert(sizeof(T) <= sizeof(ArduinoJson::JsonInteger), \ 26 | "To use 64-bit integers with ArduinoJson, you must set " \ 27 | "ARDUINOJSON_USE_LONG_LONG to 1. See " \ 28 | "https://arduinojson.org/v7/api/config/use_long_long/"); 29 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/src/ArduinoJson/Polyfills/alias_cast.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | #include // for size_t 9 | 10 | #include 11 | #include "math.hpp" 12 | 13 | ARDUINOJSON_BEGIN_PRIVATE_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 | 30 | ARDUINOJSON_END_PRIVATE_NAMESPACE 31 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/src/ArduinoJson/Polyfills/assert.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | #if ARDUINOJSON_DEBUG 10 | # include 11 | # define ARDUINOJSON_ASSERT(X) assert(X) 12 | #else 13 | # define ARDUINOJSON_ASSERT(X) ((void)0) 14 | #endif 15 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/src/ArduinoJson/Polyfills/attributes.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 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 | 11 | # ifndef ARDUINOJSON_DEPRECATED 12 | # define ARDUINOJSON_DEPRECATED(msg) __declspec(deprecated(msg)) 13 | # endif 14 | 15 | #elif defined(__GNUC__) // GCC or Clang 16 | 17 | # define FORCE_INLINE __attribute__((always_inline)) 18 | 19 | # ifndef ARDUINOJSON_DEPRECATED 20 | # if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) 21 | # define ARDUINOJSON_DEPRECATED(msg) __attribute__((deprecated(msg))) 22 | # else 23 | # define ARDUINOJSON_DEPRECATED(msg) __attribute__((deprecated)) 24 | # endif 25 | # endif 26 | 27 | #else // Other compilers 28 | 29 | # define FORCE_INLINE 30 | 31 | # ifndef ARDUINOJSON_DEPRECATED 32 | # define ARDUINOJSON_DEPRECATED(msg) 33 | # endif 34 | 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 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/src/ArduinoJson/Polyfills/ctype.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE 10 | 11 | #ifndef isdigit 12 | inline bool isdigit(char c) { 13 | return '0' <= c && c <= '9'; 14 | } 15 | #endif 16 | 17 | inline bool issign(char c) { 18 | return '-' == c || c == '+'; 19 | } 20 | 21 | ARDUINOJSON_END_PRIVATE_NAMESPACE 22 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/src/ArduinoJson/Polyfills/integer.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include // int8_t, int16_t 8 | 9 | #include 10 | 11 | ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE 12 | 13 | template 14 | struct uint_; 15 | 16 | template <> 17 | struct uint_<8> { 18 | typedef uint8_t type; 19 | }; 20 | 21 | template <> 22 | struct uint_<16> { 23 | typedef uint16_t type; 24 | }; 25 | 26 | template <> 27 | struct uint_<32> { 28 | typedef uint32_t type; 29 | }; 30 | 31 | template 32 | using uint_t = typename uint_::type; 33 | 34 | ARDUINOJSON_END_PRIVATE_NAMESPACE 35 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/src/ArduinoJson/Polyfills/limits.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 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 | ARDUINOJSON_BEGIN_PRIVATE_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>> { 22 | static constexpr T lowest() { 23 | return 0; 24 | } 25 | static constexpr T highest() { 26 | return T(-1); 27 | } 28 | }; 29 | 30 | template 31 | struct numeric_limits< 32 | T, enable_if_t::value && is_signed::value>> { 33 | static constexpr T lowest() { 34 | return T(T(1) << (sizeof(T) * 8 - 1)); 35 | } 36 | static constexpr T highest() { 37 | return T(~lowest()); 38 | } 39 | }; 40 | 41 | ARDUINOJSON_END_PRIVATE_NAMESPACE 42 | 43 | #ifdef _MSC_VER 44 | # pragma warning(pop) 45 | #endif 46 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/src/ArduinoJson/Polyfills/math.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | ARDUINOJSON_BEGIN_PRIVATE_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 | ARDUINOJSON_END_PRIVATE_NAMESPACE 28 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/src/ArduinoJson/Polyfills/mpl/max.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | #include // for size_t 10 | 11 | ARDUINOJSON_BEGIN_PRIVATE_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 | 27 | ARDUINOJSON_END_PRIVATE_NAMESPACE 28 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/src/ArduinoJson/Polyfills/preprocessor.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #define ARDUINOJSON_CONCAT_(A, B) A##B 8 | #define ARDUINOJSON_CONCAT2(A, B) ARDUINOJSON_CONCAT_(A, B) 9 | #define ARDUINOJSON_CONCAT3(A, B, C) \ 10 | ARDUINOJSON_CONCAT2(ARDUINOJSON_CONCAT2(A, B), C) 11 | #define ARDUINOJSON_CONCAT4(A, B, C, D) \ 12 | ARDUINOJSON_CONCAT2(ARDUINOJSON_CONCAT3(A, B, C), D) 13 | #define ARDUINOJSON_CONCAT5(A, B, C, D, E) \ 14 | ARDUINOJSON_CONCAT2(ARDUINOJSON_CONCAT4(A, B, C, D), E) 15 | 16 | #define ARDUINOJSON_BIN2ALPHA_0000() A 17 | #define ARDUINOJSON_BIN2ALPHA_0001() B 18 | #define ARDUINOJSON_BIN2ALPHA_0010() C 19 | #define ARDUINOJSON_BIN2ALPHA_0011() D 20 | #define ARDUINOJSON_BIN2ALPHA_0100() E 21 | #define ARDUINOJSON_BIN2ALPHA_0101() F 22 | #define ARDUINOJSON_BIN2ALPHA_0110() G 23 | #define ARDUINOJSON_BIN2ALPHA_0111() H 24 | #define ARDUINOJSON_BIN2ALPHA_1000() I 25 | #define ARDUINOJSON_BIN2ALPHA_1001() J 26 | #define ARDUINOJSON_BIN2ALPHA_1010() K 27 | #define ARDUINOJSON_BIN2ALPHA_1011() L 28 | #define ARDUINOJSON_BIN2ALPHA_1100() M 29 | #define ARDUINOJSON_BIN2ALPHA_1101() N 30 | #define ARDUINOJSON_BIN2ALPHA_1110() O 31 | #define ARDUINOJSON_BIN2ALPHA_1111() P 32 | #define ARDUINOJSON_BIN2ALPHA_(A, B, C, D) ARDUINOJSON_BIN2ALPHA_##A##B##C##D() 33 | #define ARDUINOJSON_BIN2ALPHA(A, B, C, D) ARDUINOJSON_BIN2ALPHA_(A, B, C, D) 34 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/src/ArduinoJson/Polyfills/type_traits.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 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/function_traits.hpp" 10 | #include "type_traits/integral_constant.hpp" 11 | #include "type_traits/is_array.hpp" 12 | #include "type_traits/is_base_of.hpp" 13 | #include "type_traits/is_class.hpp" 14 | #include "type_traits/is_const.hpp" 15 | #include "type_traits/is_convertible.hpp" 16 | #include "type_traits/is_enum.hpp" 17 | #include "type_traits/is_floating_point.hpp" 18 | #include "type_traits/is_integral.hpp" 19 | #include "type_traits/is_pointer.hpp" 20 | #include "type_traits/is_same.hpp" 21 | #include "type_traits/is_signed.hpp" 22 | #include "type_traits/is_unsigned.hpp" 23 | #include "type_traits/make_unsigned.hpp" 24 | #include "type_traits/remove_const.hpp" 25 | #include "type_traits/remove_reference.hpp" 26 | #include "type_traits/void_t.hpp" 27 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/conditional.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE 10 | 11 | template 12 | struct conditional { 13 | typedef TrueType type; 14 | }; 15 | 16 | template 17 | struct conditional { 18 | typedef FalseType type; 19 | }; 20 | 21 | template 22 | using conditional_t = 23 | typename conditional::type; 24 | 25 | ARDUINOJSON_END_PRIVATE_NAMESPACE 26 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/declval.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE 10 | 11 | template 12 | T&& declval(); 13 | 14 | ARDUINOJSON_END_PRIVATE_NAMESPACE 15 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/enable_if.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | ARDUINOJSON_BEGIN_PRIVATE_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 | 20 | template 21 | using enable_if_t = typename enable_if::type; 22 | 23 | ARDUINOJSON_END_PRIVATE_NAMESPACE 24 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/function_traits.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE 10 | 11 | template 12 | struct function_traits; 13 | 14 | template 15 | struct function_traits { 16 | using return_type = ReturnType; 17 | using arg1_type = Arg1; 18 | }; 19 | 20 | template 21 | struct function_traits { 22 | using return_type = ReturnType; 23 | using arg1_type = Arg1; 24 | using arg2_type = Arg2; 25 | }; 26 | 27 | ARDUINOJSON_END_PRIVATE_NAMESPACE 28 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/integral_constant.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | ARDUINOJSON_BEGIN_PRIVATE_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 | ARDUINOJSON_END_PRIVATE_NAMESPACE 20 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/is_array.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | #include // size_t 10 | 11 | ARDUINOJSON_BEGIN_PRIVATE_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 | 22 | ARDUINOJSON_END_PRIVATE_NAMESPACE 23 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/is_base_of.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | #include "remove_reference.hpp" 10 | 11 | ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE 12 | 13 | // A meta-function that returns true if Derived inherits from TBase is an 14 | // integral type. 15 | template 16 | class is_base_of { 17 | protected: // <- to avoid GCC's "all member functions in class are private" 18 | static int probe(const TBase*); 19 | static char probe(...); 20 | 21 | public: 22 | static const bool value = 23 | sizeof(probe(reinterpret_cast*>(0))) == 24 | sizeof(int); 25 | }; 26 | 27 | ARDUINOJSON_END_PRIVATE_NAMESPACE 28 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/is_class.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "declval.hpp" 8 | 9 | ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE 10 | 11 | template 12 | struct is_class { 13 | protected: // <- to avoid GCC's "all member functions in class are private" 14 | template 15 | static int probe(void (U::*)(void)); 16 | template 17 | static char probe(...); 18 | 19 | public: 20 | static const bool value = sizeof(probe(0)) == sizeof(int); 21 | }; 22 | 23 | ARDUINOJSON_END_PRIVATE_NAMESPACE 24 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/is_const.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "integral_constant.hpp" 8 | 9 | ARDUINOJSON_BEGIN_PRIVATE_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 | 18 | ARDUINOJSON_END_PRIVATE_NAMESPACE 19 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/is_convertible.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "declval.hpp" 8 | 9 | #ifdef _MSC_VER 10 | # pragma warning(push) 11 | // conversion from 'T' to 'To', possible loss of data 12 | # pragma warning(disable : 4244) 13 | #endif 14 | 15 | // clang-format off 16 | #ifdef __ICCARM__ 17 | // Suppress IAR Compiler Warning[Pa093]: implicit conversion from floating point to integer 18 | #pragma diag_suppress=Pa093 19 | #endif 20 | // clang-format on 21 | 22 | ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE 23 | 24 | template 25 | struct is_convertible { 26 | protected: // <- to avoid GCC's "all member functions in class are private" 27 | static int probe(To); 28 | static char probe(...); 29 | 30 | static From& from_; 31 | 32 | public: 33 | static const bool value = sizeof(probe(from_)) == sizeof(int); 34 | }; 35 | 36 | ARDUINOJSON_END_PRIVATE_NAMESPACE 37 | 38 | #ifdef _MSC_VER 39 | # pragma warning(pop) 40 | #endif 41 | 42 | // clang-format off 43 | #ifdef __ICCARM__ 44 | #pragma diag_default=Pa093 45 | #endif 46 | // clang-format on 47 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/is_enum.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "is_class.hpp" 8 | #include "is_convertible.hpp" 9 | #include "is_floating_point.hpp" 10 | #include "is_integral.hpp" 11 | #include "is_same.hpp" 12 | 13 | ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE 14 | 15 | template 16 | struct is_enum { 17 | static const bool value = is_convertible::value && 18 | !is_class::value && !is_integral::value && 19 | !is_floating_point::value; 20 | }; 21 | 22 | ARDUINOJSON_END_PRIVATE_NAMESPACE 23 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/is_floating_point.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "integral_constant.hpp" 8 | #include "is_same.hpp" 9 | #include "remove_cv.hpp" 10 | 11 | ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE 12 | 13 | template 14 | struct is_floating_point 15 | : integral_constant>::value || 17 | is_same>::value> {}; 18 | 19 | ARDUINOJSON_END_PRIVATE_NAMESPACE 20 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/is_integral.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | #include "integral_constant.hpp" 10 | #include "is_same.hpp" 11 | #include "remove_cv.hpp" 12 | 13 | ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE 14 | 15 | // clang-format off 16 | template 17 | struct is_integral : integral_constant, signed char>::value || 19 | is_same, unsigned char>::value || 20 | is_same, signed short>::value || 21 | is_same, unsigned short>::value || 22 | is_same, signed int>::value || 23 | is_same, unsigned int>::value || 24 | is_same, signed long>::value || 25 | is_same, unsigned long>::value || 26 | is_same, signed long long>::value || 27 | is_same, unsigned long long>::value || 28 | is_same, char>::value || 29 | is_same, bool>::value> {}; 30 | // clang-format on 31 | 32 | ARDUINOJSON_END_PRIVATE_NAMESPACE 33 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/is_pointer.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "integral_constant.hpp" 8 | 9 | ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE 10 | 11 | template 12 | struct is_pointer : false_type {}; 13 | 14 | template 15 | struct is_pointer : true_type {}; 16 | 17 | ARDUINOJSON_END_PRIVATE_NAMESPACE 18 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/is_same.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "integral_constant.hpp" 8 | 9 | ARDUINOJSON_BEGIN_PRIVATE_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 | 18 | ARDUINOJSON_END_PRIVATE_NAMESPACE 19 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/is_signed.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "integral_constant.hpp" 8 | #include "is_same.hpp" 9 | #include "remove_cv.hpp" 10 | 11 | ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE 12 | 13 | // clang-format off 14 | template 15 | struct is_signed : integral_constant, char>::value || 17 | is_same, signed char>::value || 18 | is_same, signed short>::value || 19 | is_same, signed int>::value || 20 | is_same, signed long>::value || 21 | is_same, signed long long>::value || 22 | is_same, float>::value || 23 | is_same, double>::value> {}; 24 | // clang-format on 25 | 26 | ARDUINOJSON_END_PRIVATE_NAMESPACE 27 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/is_unsigned.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "integral_constant.hpp" 8 | #include "is_same.hpp" 9 | #include "remove_cv.hpp" 10 | 11 | ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE 12 | 13 | // clang-format off 14 | template 15 | struct is_unsigned : integral_constant, unsigned char>::value || 17 | is_same, unsigned short>::value || 18 | is_same, unsigned int>::value || 19 | is_same, unsigned long>::value || 20 | is_same, unsigned long long>::value || 21 | is_same, bool>::value> {}; 22 | // clang-format on 23 | 24 | ARDUINOJSON_END_PRIVATE_NAMESPACE 25 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/remove_const.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | ARDUINOJSON_BEGIN_PRIVATE_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 | 21 | template 22 | using remove_const_t = typename remove_const::type; 23 | 24 | ARDUINOJSON_END_PRIVATE_NAMESPACE 25 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/remove_cv.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE 10 | 11 | template 12 | struct remove_cv { 13 | typedef T type; 14 | }; 15 | template 16 | struct remove_cv { 17 | typedef T type; 18 | }; 19 | template 20 | struct remove_cv { 21 | typedef T type; 22 | }; 23 | template 24 | struct remove_cv { 25 | typedef T type; 26 | }; 27 | 28 | template 29 | using remove_cv_t = typename remove_cv::type; 30 | 31 | ARDUINOJSON_END_PRIVATE_NAMESPACE 32 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/remove_reference.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | ARDUINOJSON_BEGIN_PRIVATE_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 | 21 | template 22 | using remove_reference_t = typename remove_reference::type; 23 | 24 | ARDUINOJSON_END_PRIVATE_NAMESPACE 25 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/type_identity.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "integral_constant.hpp" 8 | 9 | ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE 10 | 11 | template 12 | struct type_identity { 13 | typedef T type; 14 | }; 15 | 16 | ARDUINOJSON_END_PRIVATE_NAMESPACE 17 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/src/ArduinoJson/Polyfills/type_traits/void_t.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE 10 | 11 | template 12 | struct make_void { 13 | using type = void; 14 | }; 15 | 16 | template 17 | using void_t = typename make_void::type; 18 | // NOTE: using void_t = void; doesn't work on GCC 4.8 19 | 20 | ARDUINOJSON_END_PRIVATE_NAMESPACE 21 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/src/ArduinoJson/Polyfills/utility.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "type_traits.hpp" 8 | 9 | ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE 10 | 11 | using nullptr_t = decltype(nullptr); 12 | 13 | template 14 | T&& forward(remove_reference_t& t) noexcept { 15 | return static_cast(t); 16 | } 17 | 18 | template 19 | remove_reference_t&& move(T&& t) { 20 | return static_cast&&>(t); 21 | } 22 | 23 | // Polyfull for std::swap 24 | // Don't use the name "swap" because it makes calls ambiguous for types in the 25 | // detail namespace 26 | template 27 | void swap_(T& a, T& b) { 28 | T tmp = move(a); 29 | a = move(b); 30 | b = move(tmp); 31 | } 32 | 33 | ARDUINOJSON_END_PRIVATE_NAMESPACE 34 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/src/ArduinoJson/Serialization/CountingDecorator.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE 10 | 11 | template 12 | class CountingDecorator { 13 | public: 14 | explicit CountingDecorator(TWriter& writer) : writer_(writer), count_(0) {} 15 | 16 | void write(uint8_t c) { 17 | count_ += writer_.write(c); 18 | } 19 | 20 | void write(const uint8_t* s, size_t n) { 21 | count_ += writer_.write(s, n); 22 | } 23 | 24 | size_t count() const { 25 | return count_; 26 | } 27 | 28 | private: 29 | TWriter writer_; 30 | size_t count_; 31 | }; 32 | 33 | ARDUINOJSON_END_PRIVATE_NAMESPACE 34 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/src/ArduinoJson/Serialization/Writer.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE 10 | 11 | // The default writer is a simple wrapper for Writers that are not copiable 12 | template 13 | class Writer { 14 | public: 15 | explicit Writer(TDestination& dest) : dest_(&dest) {} 16 | 17 | size_t write(uint8_t c) { 18 | return dest_->write(c); 19 | } 20 | 21 | size_t write(const uint8_t* s, size_t n) { 22 | return dest_->write(s, n); 23 | } 24 | 25 | private: 26 | TDestination* dest_; 27 | }; 28 | 29 | ARDUINOJSON_END_PRIVATE_NAMESPACE 30 | 31 | #include 32 | 33 | #if ARDUINOJSON_ENABLE_STD_STRING 34 | # include 35 | #endif 36 | 37 | #if ARDUINOJSON_ENABLE_ARDUINO_STRING 38 | # include 39 | #endif 40 | 41 | #if ARDUINOJSON_ENABLE_STD_STREAM 42 | # include 43 | #endif 44 | 45 | #if ARDUINOJSON_ENABLE_ARDUINO_PRINT 46 | # include 47 | #endif 48 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/src/ArduinoJson/Serialization/Writers/DummyWriter.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | ARDUINOJSON_BEGIN_PRIVATE_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 | 22 | ARDUINOJSON_END_PRIVATE_NAMESPACE 23 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/src/ArduinoJson/Serialization/Writers/PrintWriter.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE 10 | 11 | template 12 | class Writer::value>> { 14 | public: 15 | explicit Writer(::Print& print) : print_(&print) {} 16 | 17 | size_t write(uint8_t c) { 18 | return print_->write(c); 19 | } 20 | 21 | size_t write(const uint8_t* s, size_t n) { 22 | return print_->write(s, n); 23 | } 24 | 25 | private: 26 | ::Print* print_; 27 | }; 28 | 29 | ARDUINOJSON_END_PRIVATE_NAMESPACE 30 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/src/ArduinoJson/Serialization/Writers/StaticStringWriter.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE 10 | 11 | class StaticStringWriter { 12 | public: 13 | StaticStringWriter(char* buf, size_t size) : end(buf + size), p(buf) {} 14 | 15 | size_t write(uint8_t c) { 16 | if (p >= end) 17 | return 0; 18 | *p++ = static_cast(c); 19 | return 1; 20 | } 21 | 22 | size_t write(const uint8_t* s, size_t n) { 23 | char* begin = p; 24 | while (p < end && n > 0) { 25 | *p++ = static_cast(*s++); 26 | n--; 27 | } 28 | return size_t(p - begin); 29 | } 30 | 31 | private: 32 | char* end; 33 | char* p; 34 | }; 35 | 36 | ARDUINOJSON_END_PRIVATE_NAMESPACE 37 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/src/ArduinoJson/Serialization/Writers/StdStreamWriter.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE 10 | 11 | template 12 | class Writer::value>> { 14 | public: 15 | explicit Writer(std::ostream& os) : os_(&os) {} 16 | 17 | size_t write(uint8_t c) { 18 | os_->put(static_cast(c)); 19 | return 1; 20 | } 21 | 22 | size_t write(const uint8_t* s, size_t n) { 23 | os_->write(reinterpret_cast(s), 24 | static_cast(n)); 25 | return n; 26 | } 27 | 28 | private: 29 | std::ostream* os_; 30 | }; 31 | 32 | ARDUINOJSON_END_PRIVATE_NAMESPACE 33 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/src/ArduinoJson/Serialization/Writers/StdStringWriter.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | #include 9 | 10 | ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE 11 | 12 | template 13 | struct is_std_string : false_type {}; 14 | 15 | template 16 | struct is_std_string< 17 | T, enable_if_t::value && 18 | is_same::value>> : true_type { 19 | }; 20 | 21 | template 22 | class Writer::value>> { 23 | public: 24 | Writer(TDestination& str) : str_(&str) { 25 | str.clear(); 26 | } 27 | 28 | size_t write(uint8_t c) { 29 | str_->push_back(static_cast(c)); 30 | return 1; 31 | } 32 | 33 | size_t write(const uint8_t* s, size_t n) { 34 | str_->append(reinterpret_cast(s), n); 35 | return n; 36 | } 37 | 38 | private: 39 | TDestination* str_; 40 | }; 41 | 42 | ARDUINOJSON_END_PRIVATE_NAMESPACE 43 | -------------------------------------------------------------------------------- /code/libraries/ArduinoJson/src/ArduinoJson/Serialization/measure.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2024, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE 10 | 11 | template