├── .gitattributes ├── CHANGELOG.md ├── ESP-sc-gway ├── ESP-sc-gway.h ├── ESP-sc-gway.ino ├── LICENSE.md ├── LICENSE.txt ├── _gatewayMgt.ino ├── _loraFiles.ino ├── _loraModem.ino ├── _otaServer.ino ├── _repeater.ino ├── _sensor.ino ├── _txRx.ino ├── _wwwServer.ino ├── loraFiles.h ├── loraModem.h └── testing.md ├── LICENSE ├── README.md └── libraries ├── ArduinoJson ├── ArduinoJson.h ├── CHANGELOG.md ├── CMakeLists.txt ├── LICENSE.md ├── README.md ├── appveyor.yml ├── examples │ ├── JsonGeneratorExample │ │ └── JsonGeneratorExample.ino │ ├── JsonHttpClient │ │ └── JsonHttpClient.ino │ ├── JsonParserExample │ │ └── JsonParserExample.ino │ ├── JsonServer │ │ └── JsonServer.ino │ ├── JsonUdpBeacon │ │ └── JsonUdpBeacon.ino │ ├── ProgmemExample │ │ └── ProgmemExample.ino │ └── StringExample │ │ └── StringExample.ino ├── fuzzing │ ├── Makefile │ ├── fuzz.sh │ ├── fuzzer.cpp │ ├── my_corpus │ │ └── .gitignore │ └── seed_corpus │ │ ├── Comments.json │ │ ├── EmptyArray.json │ │ ├── EmptyObject.json │ │ ├── ExcessiveNesting.json │ │ ├── Numbers.json │ │ ├── OpenWeatherMap.json │ │ ├── Strings.json │ │ └── WeatherUnderground.json ├── keywords.txt ├── library.json ├── library.properties ├── scripts │ ├── build-arduino-package.sh │ ├── build-single-header.sh │ ├── create-build-envs.sh │ ├── create-size-graph.sh │ ├── oss-fuzz │ │ ├── .gitignore │ │ └── Vagrantfile │ └── travis │ │ ├── arduino.sh │ │ ├── cmake.sh │ │ ├── coverage.sh │ │ └── platformio.sh ├── src │ ├── ArduinoJson.h │ ├── ArduinoJson.hpp │ └── ArduinoJson │ │ ├── Configuration.hpp │ │ ├── Data │ │ ├── Encoding.hpp │ │ ├── JsonBufferAllocated.hpp │ │ ├── JsonFloat.hpp │ │ ├── JsonInteger.hpp │ │ ├── JsonVariantAs.hpp │ │ ├── JsonVariantComparer.hpp │ │ ├── JsonVariantContent.hpp │ │ ├── JsonVariantDefault.hpp │ │ ├── JsonVariantType.hpp │ │ ├── List.hpp │ │ ├── ListConstIterator.hpp │ │ ├── ListIterator.hpp │ │ ├── ListNode.hpp │ │ ├── NonCopyable.hpp │ │ ├── ReferenceType.hpp │ │ └── ValueSetter.hpp │ │ ├── Deserialization │ │ ├── Comments.hpp │ │ ├── JsonParser.hpp │ │ ├── JsonParserImpl.hpp │ │ └── StringWriter.hpp │ │ ├── DynamicJsonBuffer.hpp │ │ ├── JsonArray.hpp │ │ ├── JsonArrayImpl.hpp │ │ ├── JsonArraySubscript.hpp │ │ ├── JsonBuffer.hpp │ │ ├── JsonBufferBase.hpp │ │ ├── JsonBufferImpl.hpp │ │ ├── JsonObject.hpp │ │ ├── JsonObjectImpl.hpp │ │ ├── JsonObjectSubscript.hpp │ │ ├── JsonPair.hpp │ │ ├── JsonVariant.hpp │ │ ├── JsonVariantBase.hpp │ │ ├── JsonVariantComparisons.hpp │ │ ├── JsonVariantImpl.hpp │ │ ├── Polyfills │ │ ├── attributes.hpp │ │ ├── ctype.hpp │ │ ├── isFloat.hpp │ │ ├── isInteger.hpp │ │ ├── math.hpp │ │ ├── parseFloat.hpp │ │ └── parseInteger.hpp │ │ ├── RawJson.hpp │ │ ├── Serialization │ │ ├── DummyPrint.hpp │ │ ├── DynamicStringBuilder.hpp │ │ ├── FloatParts.hpp │ │ ├── IndentedPrint.hpp │ │ ├── JsonPrintable.hpp │ │ ├── JsonSerializer.hpp │ │ ├── JsonSerializerImpl.hpp │ │ ├── JsonWriter.hpp │ │ ├── Prettyfier.hpp │ │ ├── StaticStringBuilder.hpp │ │ └── StreamPrintAdapter.hpp │ │ ├── StaticJsonBuffer.hpp │ │ ├── StringTraits │ │ ├── ArduinoStream.hpp │ │ ├── CharPointer.hpp │ │ ├── FlashString.hpp │ │ ├── StdStream.hpp │ │ ├── StdString.hpp │ │ └── StringTraits.hpp │ │ └── TypeTraits │ │ ├── EnableIf.hpp │ │ ├── FloatTraits.hpp │ │ ├── IsArray.hpp │ │ ├── IsBaseOf.hpp │ │ ├── IsChar.hpp │ │ ├── IsConst.hpp │ │ ├── IsFloatingPoint.hpp │ │ ├── IsIntegral.hpp │ │ ├── IsSame.hpp │ │ ├── IsSignedIntegral.hpp │ │ ├── IsUnsignedIntegral.hpp │ │ ├── RemoveConst.hpp │ │ └── RemoveReference.hpp ├── test │ ├── CMakeLists.txt │ ├── DynamicJsonBuffer │ │ ├── CMakeLists.txt │ │ ├── alloc.cpp │ │ ├── createArray.cpp │ │ ├── createObject.cpp │ │ ├── no_memory.cpp │ │ ├── size.cpp │ │ ├── startString.cpp │ │ └── strdup.cpp │ ├── IntegrationTests │ │ ├── CMakeLists.txt │ │ ├── gbathree.cpp │ │ └── round_trip.cpp │ ├── JsonArray │ │ ├── CMakeLists.txt │ │ ├── add.cpp │ │ ├── basics.cpp │ │ ├── copyFrom.cpp │ │ ├── copyTo.cpp │ │ ├── invalid.cpp │ │ ├── iterator.cpp │ │ ├── prettyPrintTo.cpp │ │ ├── printTo.cpp │ │ ├── remove.cpp │ │ ├── set.cpp │ │ └── subscript.cpp │ ├── JsonBuffer │ │ ├── CMakeLists.txt │ │ ├── nested.cpp │ │ ├── nestingLimit.cpp │ │ ├── parse.cpp │ │ ├── parseArray.cpp │ │ └── parseObject.cpp │ ├── JsonObject │ │ ├── CMakeLists.txt │ │ ├── basics.cpp │ │ ├── containsKey.cpp │ │ ├── get.cpp │ │ ├── invalid.cpp │ │ ├── iterator.cpp │ │ ├── prettyPrintTo.cpp │ │ ├── printTo.cpp │ │ ├── remove.cpp │ │ ├── set.cpp │ │ └── subscript.cpp │ ├── JsonVariant │ │ ├── CMakeLists.txt │ │ ├── as.cpp │ │ ├── compare.cpp │ │ ├── copy.cpp │ │ ├── is.cpp │ │ ├── printTo.cpp │ │ ├── set_get.cpp │ │ ├── subscript.cpp │ │ ├── success.cpp │ │ └── undefined.cpp │ ├── JsonWriter │ │ ├── CMakeLists.txt │ │ ├── writeFloat.cpp │ │ └── writeString.cpp │ ├── Misc │ │ ├── CMakeLists.txt │ │ ├── FloatParts.cpp │ │ ├── StringBuilder.cpp │ │ ├── TypeTraits.cpp │ │ ├── deprecated.cpp │ │ ├── std_stream.cpp │ │ ├── std_string.cpp │ │ ├── unsigned_char.cpp │ │ └── vla.cpp │ ├── Polyfills │ │ ├── CMakeLists.txt │ │ ├── isFloat.cpp │ │ ├── isInteger.cpp │ │ ├── parseFloat.cpp │ │ └── parseInteger.cpp │ └── StaticJsonBuffer │ │ ├── CMakeLists.txt │ │ ├── alloc.cpp │ │ ├── createArray.cpp │ │ ├── createObject.cpp │ │ ├── parseArray.cpp │ │ ├── parseObject.cpp │ │ ├── size.cpp │ │ └── startString.cpp └── third-party │ └── catch │ ├── CMakeLists.txt │ ├── catch.cpp │ └── catch.hpp ├── ESP8266_Oled_Driver_for_SSD1306_display ├── OLEDDisplay.cpp ├── OLEDDisplay.h ├── OLEDDisplayFonts.h ├── OLEDDisplayUi.cpp ├── OLEDDisplayUi.h ├── README.md ├── SH1106.h ├── SH1106Brzo.h ├── SH1106Spi.h ├── SH1106Wire.h ├── SSD1306.h ├── SSD1306Brzo.h ├── SSD1306Spi.h ├── SSD1306Wire.h ├── UPGRADE-3.0.md ├── examples │ ├── SSD1306ClockDemo │ │ ├── SSD1306ClockDemo.ino │ │ └── images.h │ ├── SSD1306DrawingDemo │ │ └── SSD1306DrawingDemo.ino │ ├── SSD1306OTADemo │ │ └── SSD1306OTADemo.ino │ ├── SSD1306SimpleDemo │ │ ├── SSD1306SimpleDemo.ino │ │ └── images.h │ └── SSD1306UiDemo │ │ ├── SSD1306UiDemo.ino │ │ └── images.h ├── library.json ├── library.properties ├── license └── resources │ ├── DemoFrame1.jpg │ ├── DemoFrame2.jpg │ ├── DemoFrame3.jpg │ ├── DemoFrame4.jpg │ ├── FontTool.png │ ├── SPI_version.jpg │ └── xbmPreview.png ├── SimpleTimer ├── SimpleTimer.cpp └── SimpleTimer.h ├── Streaming ├── Examples │ └── streaming_example │ │ └── streaming_example.pde ├── Streaming.h └── keywords.txt ├── Time ├── DateStrings.cpp ├── Readme.txt ├── Time.cpp ├── Time.h ├── TimeLib.h ├── examples │ ├── Processing │ │ └── SyncArduinoClock │ │ │ ├── SyncArduinoClock.pde │ │ │ └── readme.txt │ ├── TimeArduinoDue │ │ └── TimeArduinoDue.ino │ ├── TimeGPS │ │ └── TimeGPS.ino │ ├── TimeNTP │ │ └── TimeNTP.ino │ ├── TimeNTP_ESP8266WiFi │ │ └── TimeNTP_ESP8266WiFi.ino │ ├── TimeRTC │ │ └── TimeRTC.ino │ ├── TimeRTCLog │ │ └── TimeRTCLog.ino │ ├── TimeRTCSet │ │ └── TimeRTCSet.ino │ ├── TimeSerial │ │ └── TimeSerial.ino │ ├── TimeSerialDateStrings │ │ └── TimeSerialDateStrings.ino │ └── TimeTeensy3 │ │ └── TimeTeensy3.ino ├── keywords.txt ├── library.json └── library.properties ├── WebServer_tng ├── .gitignore ├── .travis.yml ├── LICENSE ├── README.md ├── examples │ ├── AdvancedWebServer │ │ └── AdvancedWebServer.ino │ ├── FSBrowser │ │ ├── FSBrowser.ino │ │ └── data │ │ │ ├── edit.htm.gz │ │ │ ├── favicon.ico │ │ │ ├── graphs.js.gz │ │ │ └── index.htm │ ├── HelloServer │ │ └── HelloServer.ino │ ├── HttpBasicAuth │ │ └── HttpBasicAuth.ino │ ├── SDWebServer │ │ ├── SDWebServer.ino │ │ └── SdRoot │ │ │ ├── edit │ │ │ └── index.htm │ │ │ ├── index.htm │ │ │ └── pins.png │ ├── SimpleAuthentification │ │ └── SimpleAuthentification.ino │ └── WebUpdate │ │ └── WebUpdate.ino ├── keywords.txt ├── library.properties └── src │ ├── ESP8266WebServer.h │ ├── Parsing.cpp │ ├── WebServer.cpp │ ├── WebServer.h │ └── detail │ ├── RequestHandler.h │ └── RequestHandlersImpl.h ├── WiFiEsp ├── CHANGES.txt ├── LICENSE ├── README.md ├── examples │ ├── ConnectWPA │ │ └── ConnectWPA.ino │ ├── ScanNetworks │ │ └── ScanNetworks.ino │ ├── UdpNTPClient │ │ └── UdpNTPClient.ino │ ├── UdpSendReceive │ │ └── UdpSendReceive.ino │ ├── WebClient │ │ └── WebClient.ino │ ├── WebClientRepeating │ │ └── WebClientRepeating.ino │ ├── WebClientSSL │ │ └── WebClientSSL.ino │ ├── WebServer │ │ └── WebServer.ino │ ├── WebServerAP │ │ └── WebServerAP.ino │ └── WebServerLed │ │ └── WebServerLed.ino ├── keywords.txt ├── library.properties ├── src │ ├── WiFiEsp.cpp │ ├── WiFiEsp.h │ ├── WiFiEspClient.cpp │ ├── WiFiEspClient.h │ ├── WiFiEspServer.cpp │ ├── WiFiEspServer.h │ ├── WiFiEspUdp.cpp │ ├── WiFiEspUdp.h │ └── utility │ │ ├── EspDrv.cpp │ │ ├── EspDrv.h │ │ ├── RingBuffer.cpp │ │ ├── RingBuffer.h │ │ └── debug.h └── test │ ├── BasicTest │ └── BasicTest.ino │ ├── ClientTest │ └── ClientTest.ino │ ├── EspDebug │ └── EspDebug.ino │ └── RingBufferTest │ └── RingBufferTest.ino ├── WiFiManager ├── LICENSE ├── README.md ├── WiFiManager.cpp ├── WiFiManager.h ├── examples │ ├── AutoConnect │ │ └── AutoConnect.ino │ ├── AutoConnectWithFSParameters │ │ └── AutoConnectWithFSParameters.ino │ ├── AutoConnectWithFSParametersAndCustomIP │ │ └── AutoConnectWithFSParametersAndCustomIP.ino │ ├── AutoConnectWithFeedback │ │ └── AutoConnectWithFeedback.ino │ ├── AutoConnectWithFeedbackLED │ │ └── AutoConnectWithFeedbackLED.ino │ ├── AutoConnectWithReset │ │ └── AutoConnectWithReset.ino │ ├── AutoConnectWithStaticIP │ │ └── AutoConnectWithStaticIP.ino │ ├── AutoConnectWithTimeout │ │ └── AutoConnectWithTimeout.ino │ └── OnDemandConfigPortal │ │ └── OnDemandConfigPortal.ino ├── extras │ └── WiFiManager.template.html ├── keywords.txt ├── library.json ├── library.properties └── travis │ └── common.sh ├── aes ├── AES-128_V10.cpp ├── AES-128_V10.h └── README.md ├── gBase64 ├── LICENSE ├── README.markdown ├── examples │ └── base64 │ │ └── base64.ino ├── gBase64.cpp ├── gBase64.h ├── keywords (1).txt ├── keywords.txt └── library.properties └── readme.txt /.gitattributes: -------------------------------------------------------------------------------- 1 | * text eol=lf -------------------------------------------------------------------------------- /ESP-sc-gway/LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016,2017 Maarten Westenberg (mw12554@hotmail.com) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /ESP-sc-gway/LICENSE.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 Maarten Westenberg 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /ESP-sc-gway/_repeater.ino: -------------------------------------------------------------------------------- 1 | // 1-channel LoRa Gateway for ESP8266 2 | // Copyright (c) 2016, 2017 Maarten Westenberg 3 | // Verison 5.0.1 4 | // Date: 2017-11-15 5 | // 6 | // All rights reserved. This program and the accompanying materials 7 | // are made available under the terms of the MIT License 8 | // which accompanies this distribution, and is available at 9 | // https://opensource.org/licenses/mit-license.php 10 | // 11 | // NO WARRANTY OF ANY KIND IS PROVIDED 12 | // 13 | // Author: Maarten Westenberg (mw12554@hotmail.com) 14 | // 15 | // This file contains code for using the single channel gateway also as a sensor node. 16 | // Please specify the DevAddr and the AppSKey below (and on your LoRa backend). 17 | // Also you will have to choose what sensors to forward to your application. 18 | // 19 | // ============================================================================ 20 | 21 | #if REPEATER==1 22 | 23 | #define _ICHAN 0 24 | #define _OCHAN 1 25 | 26 | #ifdef _TTNSERVER 27 | #error "Please undefined _THINGSERVER, for REAPETR shutdown WiFi" 28 | #endif 29 | 30 | // Send a LoRa message out from the gateway transmitter 31 | // XXX Maybe we should block the received ontul the message is transmitter 32 | 33 | int sendLora(char *msg, int len) { 34 | // Check whete len is not exceeding maximum length 35 | Serial.print("sendLora:: "); 36 | 37 | for (int i=0; i< len; i++) { 38 | Serial.print(msg[1],HEX); 39 | Serial.print('.'); 40 | } 41 | 42 | if (debug>=2) Serial.flush(); 43 | return(1); 44 | } 45 | 46 | #endif //REPEATER==1 -------------------------------------------------------------------------------- /ESP-sc-gway/loraFiles.h: -------------------------------------------------------------------------------- 1 | // 1-channel LoRa Gateway for ESP8266 2 | // Copyright (c) 2016, 2017 Maarten Westenberg version for ESP8266 3 | // Version 5.0.1 4 | // Date: 2017-11-15 5 | // 6 | // based on work done by Thomas Telkamp for Raspberry PI 1ch gateway 7 | // and many others. 8 | // 9 | // All rights reserved. This program and the accompanying materials 10 | // are made available under the terms of the MIT License 11 | // which accompanies this distribution, and is available at 12 | // https://opensource.org/licenses/mit-license.php 13 | // 14 | // Author: Maarten Westenberg (mw12554@hotmail.com) 15 | // 16 | // This file contains a number of compile-time settings that can be set on (=1) or off (=0) 17 | // The disadvantage of compile time is minor compared to the memory gain of not having 18 | // too much code compiled and loaded on your ESP8266. 19 | // 20 | // ---------------------------------------------------------------------------------------- 21 | 22 | 23 | 24 | // Definition of the configuration record that is read at startup and written 25 | // when settings are changed. 26 | struct espGwayConfig { 27 | uint16_t fcnt; // =0 as init value XXX Could be 32 bit in size 28 | uint16_t boots; // Number of restarts made by the gateway after reset 29 | uint16_t resets; // Number of statistics resets 30 | uint16_t views; // Number of sendWebPage() calls 31 | uint16_t wifis; // Number of WiFi Setups 32 | uint16_t reents; // Number of re-entrant interrupt handler calls 33 | uint16_t ntpErr; // Number of UTP requests that failed 34 | uint16_t ntps; 35 | 36 | uint32_t ntpErrTime; // Record the time of the last NTP error 37 | uint8_t ch; // index to freqs array, freqs[ifreq]=868100000 default 38 | uint8_t sf; // range from SF7 to SF12 39 | uint8_t debug; // range 0 to 4 40 | 41 | bool cad; // is CAD enabled? 42 | bool hop; // Is HOP enabled (Note: SHould be disabled) 43 | bool isNode; // Is gateway node enabled 44 | bool refresh; // Is WWW browser refresh enabled 45 | 46 | String ssid; // SSID of the last connected WiFi Network 47 | String pass; // Password 48 | } gwayConfig; 49 | 50 | 51 | -------------------------------------------------------------------------------- /ESP-sc-gway/testing.md: -------------------------------------------------------------------------------- 1 | #Testing the Gateway 2 | 3 | ## Introduction 4 | 5 | This document describes the testing of the single channel gateway. These parameters are set in gthe loraModem.h file and determine its behaviour for switching from S_SCAN state to S_CAD state and the fallback from S_CAD state to scanning if the rssi drop dramatically. 6 | 7 | ## Optimize for STD 8 | 9 | For the standard mode, the folowing values are used for parameter setting: 10 | 11 | - RSSI_LIMIT 40 12 | - RSSI_WAIT 275 13 | - 14 | 15 | ## Optimize for CAD 16 | 17 | For the standard mode, the folowing values are used for parameter setting: 18 | 19 | 20 | ## Optimize for HOP 21 | 22 | For the HOP mode, the folowing values are used for parameter setting: 23 | 24 | - RSSI_LIMIT 39 for the S_SCAN state, and -5 for the S_CAD state 25 | - RSSI_WAIT 250 26 | - RSSI_WAIT_DOWN 225; microseconds to wait before reading RSSI when in S_CAD mode to decide going back to S_SCAN 27 | - 28 | 29 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 things4u 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/ArduinoJson.h: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #include "src/ArduinoJson.h" 9 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright Benoit Blanchon 2014-2017 2 | # MIT License 3 | # 4 | # Arduino JSON library 5 | # https://bblanchon.github.io/ArduinoJson/ 6 | # If you like this project, please add a star! 7 | 8 | cmake_minimum_required(VERSION 3.0) 9 | project(ArduinoJson) 10 | 11 | enable_testing() 12 | 13 | if(${COVERAGE}) 14 | set(CMAKE_CXX_FLAGS "-g -O0 -fprofile-arcs -ftest-coverage") 15 | endif() 16 | 17 | include_directories(${CMAKE_CURRENT_LIST_DIR}/src) 18 | add_subdirectory(third-party/catch) 19 | add_subdirectory(test) 20 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | --------------------- 3 | 4 | Copyright © 2014-2017 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 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/appveyor.yml: -------------------------------------------------------------------------------- 1 | version: 5.11.1.{build} 2 | environment: 3 | matrix: 4 | - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 5 | CMAKE_GENERATOR: Visual Studio 15 2017 6 | - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 7 | CMAKE_GENERATOR: Visual Studio 14 2015 8 | - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013 9 | CMAKE_GENERATOR: Visual Studio 12 2013 10 | - CMAKE_GENERATOR: Visual Studio 11 2012 11 | - CMAKE_GENERATOR: Visual Studio 10 2010 12 | - CMAKE_GENERATOR: MinGW Makefiles 13 | configuration: Debug 14 | before_build: 15 | - set PATH=C:\MinGW\bin;%PATH:C:\Program Files\Git\usr\bin;=% # Workaround for CMake not wanting sh.exe on PATH for MinGW 16 | - cmake -DCMAKE_BUILD_TYPE=%CONFIGURATION% -G "%CMAKE_GENERATOR%" . 17 | build_script: 18 | - cmake --build . --config %CONFIGURATION% 19 | test_script: 20 | - ctest --output-on-failure . 21 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/examples/JsonGeneratorExample/JsonGeneratorExample.ino: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #include 9 | 10 | void setup() { 11 | Serial.begin(9600); 12 | while (!Serial) { 13 | // wait serial port initialization 14 | } 15 | 16 | // Memory pool for JSON object tree. 17 | // 18 | // Inside the brackets, 200 is the size of the pool in bytes. 19 | // If the JSON object is more complex, you need to increase that value. 20 | // See https://bblanchon.github.io/ArduinoJson/assistant/ 21 | StaticJsonBuffer<200> jsonBuffer; 22 | 23 | // StaticJsonBuffer allocates memory on the stack, it can be 24 | // replaced by DynamicJsonBuffer which allocates in the heap. 25 | // 26 | // DynamicJsonBuffer jsonBuffer(200); 27 | 28 | // Create the root of the object tree. 29 | // 30 | // It's a reference to the JsonObject, the actual bytes are inside the 31 | // JsonBuffer with all the other nodes of the object tree. 32 | // Memory is freed when jsonBuffer goes out of scope. 33 | JsonObject& root = jsonBuffer.createObject(); 34 | 35 | // Add values in the object 36 | // 37 | // Most of the time, you can rely on the implicit casts. 38 | // In other case, you can do root.set("time", 1351824120); 39 | root["sensor"] = "gps"; 40 | root["time"] = 1351824120; 41 | 42 | // Add a nested array. 43 | // 44 | // It's also possible to create the array separately and add it to the 45 | // JsonObject but it's less efficient. 46 | JsonArray& data = root.createNestedArray("data"); 47 | data.add(48.756080); 48 | data.add(2.302038); 49 | 50 | root.printTo(Serial); 51 | // This prints: 52 | // {"sensor":"gps","time":1351824120,"data":[48.756080,2.302038]} 53 | 54 | Serial.println(); 55 | 56 | root.prettyPrintTo(Serial); 57 | // This prints: 58 | // { 59 | // "sensor": "gps", 60 | // "time": 1351824120, 61 | // "data": [ 62 | // 48.756080, 63 | // 2.302038 64 | // ] 65 | // } 66 | } 67 | 68 | void loop() { 69 | // not used in this example 70 | } 71 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/examples/JsonParserExample/JsonParserExample.ino: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #include 9 | 10 | void setup() { 11 | Serial.begin(9600); 12 | while (!Serial) { 13 | // wait serial port initialization 14 | } 15 | 16 | // Memory pool for JSON object tree. 17 | // 18 | // Inside the brackets, 200 is the size of the pool in bytes, 19 | // If the JSON object is more complex, you need to increase that value. 20 | // See https://bblanchon.github.io/ArduinoJson/assistant/ 21 | StaticJsonBuffer<200> jsonBuffer; 22 | 23 | // StaticJsonBuffer allocates memory on the stack, it can be 24 | // replaced by DynamicJsonBuffer which allocates in the heap. 25 | // 26 | // DynamicJsonBuffer jsonBuffer(200); 27 | 28 | // JSON input string. 29 | // 30 | // It's better to use a char[] as shown here. 31 | // If you use a const char* or a String, ArduinoJson will 32 | // have to make a copy of the input in the JsonBuffer. 33 | char json[] = 34 | "{\"sensor\":\"gps\",\"time\":1351824120,\"data\":[48.756080,2.302038]}"; 35 | 36 | // Root of the object tree. 37 | // 38 | // It's a reference to the JsonObject, the actual bytes are inside the 39 | // JsonBuffer with all the other nodes of the object tree. 40 | // Memory is freed when jsonBuffer goes out of scope. 41 | JsonObject& root = jsonBuffer.parseObject(json); 42 | 43 | // Test if parsing succeeds. 44 | if (!root.success()) { 45 | Serial.println("parseObject() failed"); 46 | return; 47 | } 48 | 49 | // Fetch values. 50 | // 51 | // Most of the time, you can rely on the implicit casts. 52 | // In other case, you can do root["time"].as(); 53 | const char* sensor = root["sensor"]; 54 | long time = root["time"]; 55 | double latitude = root["data"][0]; 56 | double longitude = root["data"][1]; 57 | 58 | // Print values. 59 | Serial.println(sensor); 60 | Serial.println(time); 61 | Serial.println(latitude, 6); 62 | Serial.println(longitude, 6); 63 | } 64 | 65 | void loop() { 66 | // not used in this example 67 | } 68 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/examples/JsonServer/JsonServer.ino: -------------------------------------------------------------------------------- 1 | // Sample Arduino Json Web Server 2 | // Created by Benoit Blanchon. 3 | // Heavily inspired by "Web Server" from David A. Mellis and Tom Igoe 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED}; 10 | IPAddress ip(192, 168, 0, 177); 11 | EthernetServer server(80); 12 | 13 | bool readRequest(EthernetClient& client) { 14 | bool currentLineIsBlank = true; 15 | while (client.connected()) { 16 | if (client.available()) { 17 | char c = client.read(); 18 | if (c == '\n' && currentLineIsBlank) { 19 | return true; 20 | } else if (c == '\n') { 21 | currentLineIsBlank = true; 22 | } else if (c != '\r') { 23 | currentLineIsBlank = false; 24 | } 25 | } 26 | } 27 | return false; 28 | } 29 | 30 | JsonObject& prepareResponse(JsonBuffer& jsonBuffer) { 31 | JsonObject& root = jsonBuffer.createObject(); 32 | 33 | JsonArray& analogValues = root.createNestedArray("analog"); 34 | for (int pin = 0; pin < 6; pin++) { 35 | int value = analogRead(pin); 36 | analogValues.add(value); 37 | } 38 | 39 | JsonArray& digitalValues = root.createNestedArray("digital"); 40 | for (int pin = 0; pin < 14; pin++) { 41 | int value = digitalRead(pin); 42 | digitalValues.add(value); 43 | } 44 | 45 | return root; 46 | } 47 | 48 | void writeResponse(EthernetClient& client, JsonObject& json) { 49 | client.println("HTTP/1.1 200 OK"); 50 | client.println("Content-Type: application/json"); 51 | client.println("Connection: close"); 52 | client.println(); 53 | 54 | json.prettyPrintTo(client); 55 | } 56 | 57 | void setup() { 58 | Ethernet.begin(mac, ip); 59 | server.begin(); 60 | } 61 | 62 | void loop() { 63 | EthernetClient client = server.available(); 64 | if (client) { 65 | bool success = readRequest(client); 66 | if (success) { 67 | // Use https://bblanchon.github.io/ArduinoJson/assistant/ to 68 | // compute the right size for the buffer 69 | StaticJsonBuffer<500> jsonBuffer; 70 | JsonObject& json = prepareResponse(jsonBuffer); 71 | writeResponse(client, json); 72 | } 73 | delay(1); 74 | client.stop(); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/examples/JsonUdpBeacon/JsonUdpBeacon.ino: -------------------------------------------------------------------------------- 1 | // Send a JSON object on UDP at regular interval 2 | // 3 | // You can easily test this program with netcat: 4 | // $ nc -ulp 8888 5 | // 6 | // by Benoit Blanchon, MIT License 2015-2017 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED}; 13 | IPAddress localIp(192, 168, 0, 177); 14 | IPAddress remoteIp(192, 168, 0, 109); 15 | unsigned int remotePort = 8888; 16 | unsigned localPort = 8888; 17 | EthernetUDP udp; 18 | 19 | JsonObject& buildJson(JsonBuffer& jsonBuffer) { 20 | JsonObject& root = jsonBuffer.createObject(); 21 | 22 | JsonArray& analogValues = root.createNestedArray("analog"); 23 | for (int pin = 0; pin < 6; pin++) { 24 | int value = analogRead(pin); 25 | analogValues.add(value); 26 | } 27 | 28 | JsonArray& digitalValues = root.createNestedArray("digital"); 29 | for (int pin = 0; pin < 14; pin++) { 30 | int value = digitalRead(pin); 31 | digitalValues.add(value); 32 | } 33 | 34 | return root; 35 | } 36 | 37 | void sendJson(JsonObject& json) { 38 | udp.beginPacket(remoteIp, remotePort); 39 | json.printTo(udp); 40 | udp.println(); 41 | udp.endPacket(); 42 | } 43 | 44 | void setup() { 45 | Ethernet.begin(mac, localIp); 46 | udp.begin(localPort); 47 | } 48 | 49 | void loop() { 50 | delay(1000); 51 | 52 | // Use https://bblanchon.github.io/ArduinoJson/assistant/ to 53 | // compute the right size for the buffer 54 | StaticJsonBuffer<300> jsonBuffer; 55 | JsonObject& json = buildJson(jsonBuffer); 56 | sendJson(json); 57 | } 58 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/examples/ProgmemExample/ProgmemExample.ino: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #include 9 | 10 | // About 11 | // ----- 12 | // This example shows the different ways you can use PROGMEM with ArduinoJson. 13 | // Please don't see this as an invitation to use PROGMEM. 14 | // On the contrary, you should always use char[] when possible, it's much more 15 | // efficient in term of code size, speed and memory usage. 16 | 17 | void setup() { 18 | #ifdef PROGMEM 19 | DynamicJsonBuffer jsonBuffer; 20 | 21 | // You can use a Flash String as your JSON input. 22 | // WARNING: the content of the Flash String will be duplicated in the 23 | // JsonBuffer. 24 | JsonObject& root = 25 | jsonBuffer.parseObject(F("{\"sensor\":\"gps\",\"time\":1351824120," 26 | "\"data\":[48.756080,2.302038]}")); 27 | 28 | // You can use a Flash String to get an element of a JsonObject 29 | // No duplication is done. 30 | long time = root[F("time")]; 31 | 32 | // You can use a Flash String to set an element of a JsonObject 33 | // WARNING: the content of the Flash String will be duplicated in the 34 | // JsonBuffer. 35 | root[F("time")] = time; 36 | 37 | // You can set a Flash String to a JsonObject or JsonArray: 38 | // WARNING: the content of the Flash String will be duplicated in the 39 | // JsonBuffer. 40 | root["sensor"] = F("gps"); 41 | 42 | // You can compare the content of a JsonVariant to a Flash String 43 | if (root["sensor"] == F("gps")) { 44 | // ... 45 | } 46 | 47 | #else 48 | 49 | #warning PROGMEM is not supported on this platform 50 | 51 | #endif 52 | } 53 | 54 | void loop() { 55 | // not used in this example 56 | } 57 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/fuzzing/Makefile: -------------------------------------------------------------------------------- 1 | # CAUTION: this file is invoked by https://github.com/google/oss-fuzz 2 | 3 | CXXFLAGS += -I../src 4 | 5 | all: \ 6 | $(OUT)/json_fuzzer \ 7 | $(OUT)/json_fuzzer_seed_corpus.zip \ 8 | $(OUT)/json_fuzzer.options 9 | 10 | $(OUT)/json_fuzzer: fuzzer.cpp $(shell find ../src -type f) 11 | $(CXX) $(CXXFLAGS) $< -o$@ $(LIB_FUZZING_ENGINE) 12 | 13 | $(OUT)/json_fuzzer_seed_corpus.zip: seed_corpus/* 14 | zip -j $@ $? 15 | 16 | $(OUT)/json_fuzzer.options: 17 | @echo "[libfuzzer]" > $@ 18 | @echo "max_len = 256" >> $@ 19 | @echo "timeout = 10" >> $@ 20 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/fuzzing/fuzz.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # This script mimics an invocation from https://github.com/google/oss-fuzz 3 | 4 | cd $(dirname $0) 5 | export CXX='clang++' 6 | export CXXFLAGS='-fsanitize-coverage=trace-pc-guard -fsanitize=address' 7 | export LIB_FUZZING_ENGINE=-lFuzzer 8 | make OUT=. 9 | ./json_fuzzer my_corpus seed_corpus -max_len=1024 -timeout=10 10 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/fuzzing/fuzzer.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | class memstream : public std::istream { 4 | struct membuf : std::streambuf { 5 | membuf(const uint8_t *p, size_t l) { 6 | setg((char *)p, (char *)p, (char *)p + l); 7 | } 8 | }; 9 | membuf _buffer; 10 | 11 | public: 12 | memstream(const uint8_t *p, size_t l) 13 | : std::istream(&_buffer), _buffer(p, l) { 14 | rdbuf(&_buffer); 15 | } 16 | }; 17 | 18 | extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { 19 | DynamicJsonBuffer jsonBuffer; 20 | memstream json(data, size); 21 | JsonVariant variant = jsonBuffer.parse(json); 22 | if (variant.success()) { 23 | variant.as(); // <- serialize to JSON 24 | } 25 | return 0; 26 | } 27 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/fuzzing/my_corpus/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/fuzzing/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 -------------------------------------------------------------------------------- /libraries/ArduinoJson/fuzzing/seed_corpus/EmptyArray.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /libraries/ArduinoJson/fuzzing/seed_corpus/EmptyObject.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /libraries/ArduinoJson/fuzzing/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]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]] -------------------------------------------------------------------------------- /libraries/ArduinoJson/fuzzing/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 | ] -------------------------------------------------------------------------------- /libraries/ArduinoJson/fuzzing/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 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/fuzzing/seed_corpus/Strings.json: -------------------------------------------------------------------------------- 1 | [ 2 | "hello", 3 | 'hello', 4 | hello, 5 | {"hello":"world"}, 6 | {'hello':'world'}, 7 | {hello:world} 8 | ] -------------------------------------------------------------------------------- /libraries/ArduinoJson/keywords.txt: -------------------------------------------------------------------------------- 1 | JsonArray KEYWORD1 2 | JsonObject KEYWORD1 3 | JsonVariant KEYWORD1 4 | StaticJsonBuffer KEYWORD1 5 | DynamicJsonBuffer KEYWORD1 6 | add KEYWORD2 7 | createArray KEYWORD2 8 | createNestedArray KEYWORD2 9 | createNestedObject KEYWORD2 10 | createObject KEYWORD2 11 | parseArray KEYWORD2 12 | parseObject KEYWORD2 13 | prettyPrintTo KEYWORD2 14 | printTo KEYWORD2 15 | success KEYWORD2 16 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/library.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ArduinoJson", 3 | "keywords": "json, rest, http, web", 4 | "description": "An elegant and efficient JSON library for embedded systems", 5 | "repository": { 6 | "type": "git", 7 | "url": "https://github.com/bblanchon/ArduinoJson.git" 8 | }, 9 | "version": "5.11.1", 10 | "authors": { 11 | "name": "Benoit Blanchon", 12 | "url": "https://blog.benoitblanchon.fr" 13 | }, 14 | "exclude": [ 15 | "fuzzing", 16 | "scripts", 17 | "test", 18 | "third-party" 19 | ], 20 | "frameworks": "arduino", 21 | "platforms": "*" 22 | } 23 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/library.properties: -------------------------------------------------------------------------------- 1 | name=ArduinoJson 2 | version=5.11.1 3 | author=Benoit Blanchon 4 | maintainer=Benoit Blanchon 5 | sentence=An efficient and elegant JSON library for Arduino. 6 | paragraph=Like this project? Please star it on GitHub! 7 | category=Data Processing 8 | url=https://bblanchon.github.io/ArduinoJson/ 9 | architectures=* 10 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/scripts/build-arduino-package.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | TAG=$(git describe) 4 | OUTPUT="ArduinoJson-$TAG.zip" 5 | 6 | cd $(dirname $0)/../.. 7 | 8 | # remove existing file 9 | rm -f $OUTPUT 10 | 11 | # create zip 12 | 7z a $OUTPUT \ 13 | ArduinoJson/CHANGELOG.md \ 14 | ArduinoJson/examples \ 15 | ArduinoJson/src \ 16 | ArduinoJson/keywords.txt \ 17 | ArduinoJson/library.properties \ 18 | ArduinoJson/LICENSE.md \ 19 | ArduinoJson/README.md \ 20 | ArduinoJson/ArduinoJson.h 21 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/scripts/build-single-header.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | TAG=$(git describe) 4 | RE_INCLUDE='^#include[[:space:]]*["<](.*)[">]' 5 | RE_EMPTY='^(#pragma[[:space:]]+once)?[[:space:]]*(//.*)?$' 6 | 7 | declare -A INCLUDED 8 | 9 | process() 10 | { 11 | local PARENT=$1 12 | local FOLDER=$(dirname $1) 13 | local SHOW_COMMENT=$2 14 | while IFS= read -r LINE; do 15 | if [[ $LINE =~ $RE_INCLUDE ]]; then 16 | local CHILD=${BASH_REMATCH[1]} 17 | pushd "$FOLDER" > /dev/null 18 | if [[ -e $CHILD ]]; then 19 | local CHILD_PATH=$(realpath $CHILD) 20 | if [[ ! ${INCLUDED[$CHILD_PATH]} ]]; then 21 | #echo "// $PARENT -> $CHILD" 22 | INCLUDED[$CHILD_PATH]=true 23 | process "$CHILD" false 24 | fi 25 | else 26 | if [[ ! ${INCLUDED[$CHILD]} ]]; then 27 | echo "$LINE" 28 | INCLUDED[$CHILD]=true 29 | fi 30 | fi 31 | popd > /dev/null 32 | elif [[ "${SHOW_COMMENT}" = "true" ]] ; then 33 | echo "$LINE" 34 | elif [[ ! $LINE =~ $RE_EMPTY ]]; then 35 | echo "$LINE" 36 | fi 37 | done < $PARENT 38 | } 39 | 40 | cd $(dirname $0)/../ 41 | INCLUDED=() 42 | process src/ArduinoJson.h true > ../ArduinoJson-$TAG.h 43 | g++ -x c++ -c -o ../smoketest.o - < ../ArduinoJson-$TAG.hpp 50 | g++ -x c++ -c -o ../smoketest.o - < $OUTPUT 8 | 9 | cd $(dirname $(dirname $0)) 10 | 11 | git tag | while read TAG 12 | do 13 | 14 | git checkout -q tags/$TAG 15 | 16 | DATE=$(git log -1 --date=short --pretty=format:%cd) 17 | PARSER_SIZE=$(arduino --verify examples/JsonParserExample/JsonParserExample.ino 2>/dev/null | grep -e 'Sketch uses' | sed 's/.*uses \([0-9]*\).\([0-9]\+\).*/\1\2/') 18 | 19 | if [ -e 'examples/JsonGeneratorExample/JsonGeneratorExample.ino' ]; then 20 | GENERATOR_SIZE=$(arduino --verify examples/JsonGeneratorExample/JsonGeneratorExample.ino 2>/dev/null | grep -e 'Sketch uses' | sed 's/.*uses \([0-9]*\).\([0-9]\+\).*/\1\2/') 21 | else 22 | GENERATOR_SIZE="" 23 | fi 24 | 25 | echo $TAG 26 | if [ ! -z "$PARSER_SIZE" ] 27 | then 28 | echo "JsonParserExample = $PARSER_SIZE bytes" 29 | else 30 | echo "JsonParserExample compilation failed." 31 | fi 32 | 33 | if [ ! -z "$GENERATOR_SIZE" ] 34 | then 35 | echo "JsonGeneratorExample = $GENERATOR_SIZE bytes" 36 | else 37 | echo "JsonGeneratorExample compilation failed." 38 | fi 39 | 40 | echo "$TAG;$DATE;$PARSER_SIZE;$GENERATOR_SIZE" >> $OUTPUT 41 | 42 | done 43 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/scripts/oss-fuzz/.gitignore: -------------------------------------------------------------------------------- 1 | /.vagrant/ 2 | *.log 3 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/scripts/oss-fuzz/Vagrantfile: -------------------------------------------------------------------------------- 1 | # A virtual machine to run https://github.com/google/oss-fuzz 2 | Vagrant.configure(2) do |config| 3 | config.vm.box = "ubuntu/xenial64" 4 | 5 | config.vm.synced_folder "E:\\Git\\Arduino\\libraries\\ArduinoJson", "/host/ArduinoJson" 6 | config.vm.synced_folder "E:\\Git\\oss-fuzz", "/host/oss-fuzz" 7 | 8 | config.vm.network "forwarded_port", guest: 8001, host: 8001 9 | 10 | config.vm.provision "shell", privileged: false, inline: <<-SHELL 11 | set -x 12 | 13 | sudo apt-get update 14 | sudo apt-get install -y make git docker.io zip 15 | sudo groupadd docker 16 | sudo usermod -aG docker $USER 17 | 18 | git clone https://github.com/google/fuzzer-test-suite.git FTS 19 | ./FTS/tutorial/install-deps.sh # Get deps 20 | ./FTS/tutorial/install-clang.sh # Get fresh clang binaries 21 | # Get libFuzzer sources and build it 22 | svn co http://llvm.org/svn/llvm-project/llvm/trunk/lib/Fuzzer 23 | Fuzzer/build.sh 24 | sudo mv libFuzzer.a /usr/local/lib/ 25 | 26 | echo "export PROJECT_NAME='arduinojson'" >> $HOME/.profile 27 | echo "export CC='clang'" >> $HOME/.profile 28 | echo "export CXX='clang++'" >> $HOME/.profile 29 | echo "export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/" >> $HOME/.profile 30 | 31 | echo "Run /host/ArduinoJson/fuzzing/fuzz.sh" | sudo tee /etc/motd 32 | SHELL 33 | end 34 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/scripts/travis/arduino.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -eux 2 | 3 | /sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_1.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :1 -ac -screen 0 1280x1024x16 4 | sleep 3 5 | export DISPLAY=:1.0 6 | 7 | mkdir -p /tmp/arduino 8 | curl -sS http://downloads.arduino.cc/arduino-$VERSION-linux64.tar.xz | tar xJ -C /tmp/arduino --strip 1 || 9 | curl -sS http://downloads.arduino.cc/arduino-$VERSION-linux64.tgz | tar xz -C /tmp/arduino --strip 1 10 | export PATH=$PATH:/tmp/arduino/ 11 | 12 | ln -s $PWD /tmp/arduino/libraries/ArduinoJson 13 | 14 | for EXAMPLE in $PWD/examples/*/*.ino; do 15 | arduino --verify --board $BOARD $EXAMPLE 16 | done 17 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/scripts/travis/cmake.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -ex 2 | 3 | if [ $(uname) = 'Darwin' ]; then 4 | URL=https://cmake.org/files/v3.4/cmake-3.4.3-Darwin-x86_64.tar.gz 5 | CMAKE=/tmp/CMake.app/Contents/bin/cmake 6 | CTEST=/tmp/CMake.app/Contents/bin/ctest 7 | else 8 | URL=https://cmake.org/files/v3.4/cmake-3.4.3-Linux-x86_64.tar.gz 9 | CMAKE=/tmp/bin/cmake 10 | CTEST=/tmp/bin/ctest 11 | fi 12 | curl -sS $URL | tar xz -C /tmp --strip 1 13 | 14 | if [ -n "$GCC" ]; then 15 | export CC="gcc-$GCC" 16 | export CXX="g++-$GCC" 17 | fi 18 | 19 | if [ -n "$CLANG" ]; then 20 | export CC="clang-$CLANG" 21 | export CXX="clang++-$CLANG" 22 | fi 23 | 24 | if [ -n "$SANITIZE" ]; then 25 | export CXXFLAGS="-fsanitize=$SANITIZE" 26 | fi 27 | 28 | $CMAKE . 29 | $CMAKE --build . 30 | $CTEST --output-on-failure . 31 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/scripts/travis/coverage.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -eux 2 | 3 | curl https://cmake.org/files/v3.4/cmake-3.4.0-Linux-x86_64.tar.gz | tar xz -C /tmp --strip 1 4 | 5 | /tmp/bin/cmake -DCOVERAGE=true . 6 | make 7 | make test 8 | 9 | pip install --user cpp-coveralls 'requests[security]' 10 | coveralls --exclude third-party --gcov-options '\-lp'; fi 11 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/scripts/travis/platformio.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -eux 2 | 3 | pip install --user platformio 4 | 5 | rm -r test 6 | 7 | for EXAMPLE in $PWD/examples/*/*.ino; 8 | do 9 | platformio ci $EXAMPLE -l '.' -b $BOARD 10 | done 11 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/src/ArduinoJson.h: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #pragma once 9 | 10 | #include "ArduinoJson.hpp" 11 | 12 | using namespace ArduinoJson; 13 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/src/ArduinoJson.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #pragma once 9 | 10 | #include "ArduinoJson/DynamicJsonBuffer.hpp" 11 | #include "ArduinoJson/JsonArray.hpp" 12 | #include "ArduinoJson/JsonObject.hpp" 13 | #include "ArduinoJson/JsonVariantComparisons.hpp" 14 | #include "ArduinoJson/StaticJsonBuffer.hpp" 15 | 16 | #include "ArduinoJson/Deserialization/JsonParserImpl.hpp" 17 | #include "ArduinoJson/JsonArrayImpl.hpp" 18 | #include "ArduinoJson/JsonBufferImpl.hpp" 19 | #include "ArduinoJson/JsonObjectImpl.hpp" 20 | #include "ArduinoJson/JsonVariantImpl.hpp" 21 | #include "ArduinoJson/Serialization/JsonSerializerImpl.hpp" 22 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/src/ArduinoJson/Data/Encoding.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #pragma once 9 | 10 | namespace ArduinoJson { 11 | namespace Internals { 12 | 13 | class Encoding { 14 | public: 15 | // Optimized for code size on a 8-bit AVR 16 | static char escapeChar(char c) { 17 | const char *p = escapeTable(false); 18 | while (p[0] && p[1] != c) { 19 | p += 2; 20 | } 21 | return p[0]; 22 | } 23 | 24 | // Optimized for code size on a 8-bit AVR 25 | static char unescapeChar(char c) { 26 | const char *p = escapeTable(true); 27 | for (;;) { 28 | if (p[0] == '\0') return c; 29 | if (p[0] == c) return p[1]; 30 | p += 2; 31 | } 32 | } 33 | 34 | private: 35 | static const char *escapeTable(bool excludeIdenticals) { 36 | return &"\"\"\\\\b\bf\fn\nr\rt\t"[excludeIdenticals ? 4 : 0]; 37 | } 38 | }; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/src/ArduinoJson/Data/JsonBufferAllocated.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #pragma once 9 | 10 | #include "../JsonBuffer.hpp" 11 | 12 | namespace ArduinoJson { 13 | namespace Internals { 14 | 15 | class JsonBufferAllocated { 16 | public: 17 | void *operator new(size_t n, JsonBuffer *jsonBuffer) throw() { 18 | if (!jsonBuffer) return NULL; 19 | return jsonBuffer->alloc(n); 20 | } 21 | 22 | void operator delete(void *, JsonBuffer *)throw(); 23 | }; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/src/ArduinoJson/Data/JsonFloat.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #pragma once 9 | 10 | #include "../Configuration.hpp" 11 | 12 | namespace ArduinoJson { 13 | namespace Internals { 14 | 15 | #if ARDUINOJSON_USE_DOUBLE 16 | typedef double JsonFloat; 17 | #else 18 | typedef float JsonFloat; 19 | #endif 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/src/ArduinoJson/Data/JsonInteger.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #pragma once 9 | 10 | #include "../Configuration.hpp" 11 | 12 | namespace ArduinoJson { 13 | namespace Internals { 14 | 15 | #if ARDUINOJSON_USE_LONG_LONG 16 | typedef long long JsonInteger; 17 | typedef unsigned long long JsonUInt; 18 | #elif ARDUINOJSON_USE_INT64 19 | typedef __int64 JsonInteger; 20 | typedef unsigned _int64 JsonUInt; 21 | #else 22 | typedef long JsonInteger; 23 | typedef unsigned long JsonUInt; 24 | #endif 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/src/ArduinoJson/Data/JsonVariantAs.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #pragma once 9 | 10 | namespace ArduinoJson { 11 | namespace Internals { 12 | 13 | // A metafunction that returns the type of the value returned by 14 | // JsonVariant::as() 15 | template 16 | struct JsonVariantAs { 17 | typedef T type; 18 | }; 19 | 20 | template <> 21 | struct JsonVariantAs { 22 | typedef const char* type; 23 | }; 24 | 25 | template <> 26 | struct JsonVariantAs { 27 | typedef JsonArray& type; 28 | }; 29 | 30 | template <> 31 | struct JsonVariantAs { 32 | typedef const JsonArray& type; 33 | }; 34 | 35 | template <> 36 | struct JsonVariantAs { 37 | typedef JsonObject& type; 38 | }; 39 | 40 | template <> 41 | struct JsonVariantAs { 42 | typedef const JsonObject& type; 43 | }; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/src/ArduinoJson/Data/JsonVariantContent.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #pragma once 9 | 10 | #include "JsonFloat.hpp" 11 | #include "JsonInteger.hpp" 12 | 13 | namespace ArduinoJson { 14 | 15 | // Forward declarations 16 | class JsonArray; 17 | class JsonObject; 18 | 19 | namespace Internals { 20 | // A union that defines the actual content of a JsonVariant. 21 | // The enum JsonVariantType determines which member is in use. 22 | union JsonVariantContent { 23 | JsonFloat asFloat; // used for double and float 24 | JsonUInt asInteger; // used for bool, char, short, int and longs 25 | const char* asString; // asString can be null 26 | JsonArray* asArray; // asArray cannot be null 27 | JsonObject* asObject; // asObject cannot be null 28 | }; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/src/ArduinoJson/Data/JsonVariantDefault.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #pragma once 9 | 10 | namespace ArduinoJson { 11 | namespace Internals { 12 | 13 | template 14 | struct JsonVariantDefault { 15 | static T get() { 16 | return T(); 17 | } 18 | }; 19 | 20 | template 21 | struct JsonVariantDefault : JsonVariantDefault {}; 22 | 23 | template 24 | struct JsonVariantDefault : JsonVariantDefault {}; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/src/ArduinoJson/Data/JsonVariantType.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #pragma once 9 | 10 | namespace ArduinoJson { 11 | class JsonArray; 12 | class JsonObject; 13 | 14 | namespace Internals { 15 | 16 | // Enumerated type to know the current type of a JsonVariant. 17 | // The value determines which member of JsonVariantContent is used. 18 | enum JsonVariantType { 19 | JSON_UNDEFINED, // JsonVariant has not been initialized 20 | JSON_UNPARSED, // JsonVariant contains an unparsed string 21 | JSON_STRING, // JsonVariant stores a const char* 22 | JSON_BOOLEAN, // JsonVariant stores a bool 23 | JSON_POSITIVE_INTEGER, // JsonVariant stores an JsonUInt 24 | JSON_NEGATIVE_INTEGER, // JsonVariant stores an JsonUInt that must be negated 25 | JSON_ARRAY, // JsonVariant stores a pointer to a JsonArray 26 | JSON_OBJECT, // JsonVariant stores a pointer to a JsonObject 27 | JSON_FLOAT // JsonVariant stores a JsonFloat 28 | }; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/src/ArduinoJson/Data/ListConstIterator.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #pragma once 9 | 10 | #include "ListNode.hpp" 11 | 12 | namespace ArduinoJson { 13 | namespace Internals { 14 | 15 | // A read-only forward itertor for List 16 | template 17 | class ListConstIterator { 18 | public: 19 | explicit ListConstIterator(const ListNode *node = NULL) : _node(node) {} 20 | 21 | const T &operator*() const { 22 | return _node->content; 23 | } 24 | const T *operator->() { 25 | return &_node->content; 26 | } 27 | 28 | bool operator==(const ListConstIterator &other) const { 29 | return _node == other._node; 30 | } 31 | 32 | bool operator!=(const ListConstIterator &other) const { 33 | return _node != other._node; 34 | } 35 | 36 | ListConstIterator &operator++() { 37 | if (_node) _node = _node->next; 38 | return *this; 39 | } 40 | 41 | ListConstIterator &operator+=(size_t distance) { 42 | while (_node && distance) { 43 | _node = _node->next; 44 | --distance; 45 | } 46 | return *this; 47 | } 48 | 49 | private: 50 | const ListNode *_node; 51 | }; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/src/ArduinoJson/Data/ListIterator.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #pragma once 9 | 10 | #include "ListConstIterator.hpp" 11 | #include "ListNode.hpp" 12 | 13 | namespace ArduinoJson { 14 | namespace Internals { 15 | 16 | template 17 | class List; 18 | 19 | // A read-write forward iterator for List 20 | template 21 | class ListIterator { 22 | friend class List; 23 | 24 | public: 25 | explicit ListIterator(ListNode *node = NULL) : _node(node) {} 26 | 27 | T &operator*() const { 28 | return _node->content; 29 | } 30 | T *operator->() { 31 | return &_node->content; 32 | } 33 | 34 | bool operator==(const ListIterator &other) const { 35 | return _node == other._node; 36 | } 37 | 38 | bool operator!=(const ListIterator &other) const { 39 | return _node != other._node; 40 | } 41 | 42 | ListIterator &operator++() { 43 | if (_node) _node = _node->next; 44 | return *this; 45 | } 46 | 47 | ListIterator &operator+=(size_t distance) { 48 | while (_node && distance) { 49 | _node = _node->next; 50 | --distance; 51 | } 52 | return *this; 53 | } 54 | 55 | operator ListConstIterator() const { 56 | return ListConstIterator(_node); 57 | } 58 | 59 | private: 60 | ListNode *_node; 61 | }; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/src/ArduinoJson/Data/ListNode.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #pragma once 9 | 10 | #include // for NULL 11 | 12 | #include "JsonBufferAllocated.hpp" 13 | 14 | namespace ArduinoJson { 15 | namespace Internals { 16 | 17 | // A node for a singly-linked list. 18 | // Used by List and its iterators. 19 | template 20 | struct ListNode : public Internals::JsonBufferAllocated { 21 | ListNode() throw() : next(NULL) {} 22 | 23 | ListNode *next; 24 | T content; 25 | }; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/src/ArduinoJson/Data/NonCopyable.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #pragma once 9 | 10 | namespace ArduinoJson { 11 | namespace Internals { 12 | 13 | // A type that cannot be copied 14 | class NonCopyable { 15 | protected: 16 | NonCopyable() {} 17 | 18 | private: 19 | // copy constructor is private 20 | NonCopyable(const NonCopyable&); 21 | 22 | // copy operator is private 23 | NonCopyable& operator=(const NonCopyable&); 24 | }; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/src/ArduinoJson/Data/ReferenceType.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #pragma once 9 | 10 | namespace ArduinoJson { 11 | namespace Internals { 12 | 13 | // A type that is meant to be used by reference only (JsonArray and JsonObject) 14 | class ReferenceType { 15 | public: 16 | bool operator==(const ReferenceType& other) const { 17 | // two JsonArray are equal if they are the same instance 18 | // (we don't compare the content) 19 | return this == &other; 20 | } 21 | 22 | bool operator!=(const ReferenceType& other) const { 23 | return this != &other; 24 | } 25 | }; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/src/ArduinoJson/Data/ValueSetter.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #pragma once 9 | 10 | #include "../JsonBuffer.hpp" 11 | #include "../JsonVariant.hpp" 12 | #include "../StringTraits/StringTraits.hpp" 13 | #include "../TypeTraits/EnableIf.hpp" 14 | 15 | namespace ArduinoJson { 16 | namespace Internals { 17 | 18 | template 19 | struct ValueSetter { 20 | template 21 | static bool set(JsonBuffer*, TDestination& destination, TSourceRef source) { 22 | destination = source; 23 | return true; 24 | } 25 | }; 26 | 27 | template 28 | struct ValueSetter::should_duplicate>::type> { 30 | template 31 | static bool set(JsonBuffer* buffer, TDestination& destination, 32 | TSourceRef source) { 33 | const char* copy = buffer->strdup(source); 34 | if (!copy) return false; 35 | destination = copy; 36 | return true; 37 | } 38 | }; 39 | 40 | template 41 | struct ValueSetter::should_duplicate>::type> { 43 | template 44 | static bool set(JsonBuffer*, TDestination& destination, TSourceRef source) { 45 | // unsigned char* -> char* 46 | destination = reinterpret_cast(source); 47 | return true; 48 | } 49 | }; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/src/ArduinoJson/Deserialization/Comments.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #pragma once 9 | 10 | namespace ArduinoJson { 11 | namespace Internals { 12 | template 13 | void skipSpacesAndComments(TInput& input) { 14 | for (;;) { 15 | switch (input.current()) { 16 | // spaces 17 | case ' ': 18 | case '\t': 19 | case '\r': 20 | case '\n': 21 | input.move(); 22 | continue; 23 | 24 | // comments 25 | case '/': 26 | switch (input.next()) { 27 | // C-style block comment 28 | case '*': 29 | input.move(); // skip '/' 30 | // no need to skip '*' 31 | for (;;) { 32 | input.move(); 33 | if (input.current() == '\0') return; 34 | if (input.current() == '*' && input.next() == '/') { 35 | input.move(); // skip '*' 36 | input.move(); // skip '/' 37 | break; 38 | } 39 | } 40 | break; 41 | 42 | // C++-style line comment 43 | case '/': 44 | // not need to skip "//" 45 | for (;;) { 46 | input.move(); 47 | if (input.current() == '\0') return; 48 | if (input.current() == '\n') break; 49 | } 50 | break; 51 | 52 | // not a comment, just a '/' 53 | default: 54 | return; 55 | } 56 | break; 57 | 58 | default: 59 | return; 60 | } 61 | } 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/src/ArduinoJson/Deserialization/StringWriter.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #pragma once 9 | 10 | namespace ArduinoJson { 11 | namespace Internals { 12 | 13 | template 14 | class StringWriter { 15 | public: 16 | class String { 17 | public: 18 | String(TChar** ptr) : _writePtr(ptr), _startPtr(*ptr) {} 19 | 20 | void append(char c) { 21 | *(*_writePtr)++ = TChar(c); 22 | } 23 | 24 | const char* c_str() const { 25 | *(*_writePtr)++ = 0; 26 | return reinterpret_cast(_startPtr); 27 | } 28 | 29 | private: 30 | TChar** _writePtr; 31 | TChar* _startPtr; 32 | }; 33 | 34 | StringWriter(TChar* buffer) : _ptr(buffer) {} 35 | 36 | String startString() { 37 | return String(&_ptr); 38 | } 39 | 40 | private: 41 | TChar* _ptr; 42 | }; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/src/ArduinoJson/JsonArrayImpl.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #pragma once 9 | 10 | #include "JsonArray.hpp" 11 | #include "JsonArraySubscript.hpp" 12 | #include "JsonObject.hpp" 13 | 14 | namespace ArduinoJson { 15 | 16 | inline JsonArray &JsonArray::createNestedArray() { 17 | if (!_buffer) return JsonArray::invalid(); 18 | JsonArray &array = _buffer->createArray(); 19 | add(array); 20 | return array; 21 | } 22 | 23 | inline JsonObject &JsonArray::createNestedObject() { 24 | if (!_buffer) return JsonObject::invalid(); 25 | JsonObject &object = _buffer->createObject(); 26 | add(object); 27 | return object; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/src/ArduinoJson/JsonBufferImpl.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #pragma once 9 | 10 | #include "Deserialization/JsonParser.hpp" 11 | 12 | inline ArduinoJson::JsonArray &ArduinoJson::JsonBuffer::createArray() { 13 | JsonArray *ptr = new (this) JsonArray(this); 14 | return ptr ? *ptr : JsonArray::invalid(); 15 | } 16 | 17 | inline ArduinoJson::JsonObject &ArduinoJson::JsonBuffer::createObject() { 18 | JsonObject *ptr = new (this) JsonObject(this); 19 | return ptr ? *ptr : JsonObject::invalid(); 20 | } 21 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/src/ArduinoJson/JsonObjectImpl.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #pragma once 9 | 10 | #include "JsonArray.hpp" 11 | #include "JsonObject.hpp" 12 | #include "JsonObjectSubscript.hpp" 13 | 14 | namespace ArduinoJson { 15 | 16 | template 17 | inline JsonArray &JsonObject::createNestedArray_impl(TStringRef key) { 18 | if (!_buffer) return JsonArray::invalid(); 19 | JsonArray &array = _buffer->createArray(); 20 | set(key, array); 21 | return array; 22 | } 23 | 24 | template 25 | inline JsonObject &JsonObject::createNestedObject_impl(TStringRef key) { 26 | if (!_buffer) return JsonObject::invalid(); 27 | JsonObject &object = _buffer->createObject(); 28 | set(key, object); 29 | return object; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/src/ArduinoJson/JsonPair.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #pragma once 9 | 10 | #include "JsonVariant.hpp" 11 | 12 | namespace ArduinoJson { 13 | 14 | // A key value pair for JsonObject. 15 | struct JsonPair { 16 | const char* key; 17 | JsonVariant value; 18 | }; 19 | } 20 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/src/ArduinoJson/Polyfills/attributes.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #pragma once 9 | 10 | #ifdef _MSC_VER // Visual Studio 11 | 12 | #define FORCE_INLINE __forceinline 13 | #define NO_INLINE __declspec(noinline) 14 | #define DEPRECATED(msg) __declspec(deprecated(msg)) 15 | 16 | #elif defined(__GNUC__) // GCC or Clang 17 | 18 | #define FORCE_INLINE __attribute__((always_inline)) 19 | #define NO_INLINE __attribute__((noinline)) 20 | #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) 21 | #define DEPRECATED(msg) __attribute__((deprecated(msg))) 22 | #else 23 | #define DEPRECATED(msg) __attribute__((deprecated)) 24 | #endif 25 | 26 | #else // Other compilers 27 | 28 | #define FORCE_INLINE 29 | #define NO_INLINE 30 | #define DEPRECATED(msg) 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/src/ArduinoJson/Polyfills/ctype.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #pragma once 9 | 10 | namespace ArduinoJson { 11 | namespace Polyfills { 12 | 13 | inline bool isdigit(char c) { 14 | return '0' <= c && c <= '9'; 15 | } 16 | 17 | inline bool issign(char c) { 18 | return '-' == c || c == '+'; 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/src/ArduinoJson/Polyfills/isFloat.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #pragma once 9 | 10 | #include // for strcmp 11 | #include "./ctype.hpp" 12 | 13 | namespace ArduinoJson { 14 | namespace Polyfills { 15 | 16 | inline bool isFloat(const char* s) { 17 | if (!s) return false; 18 | 19 | if (!strcmp(s, "NaN")) return true; 20 | if (issign(*s)) s++; 21 | if (!strcmp(s, "Infinity")) return true; 22 | if (*s == '\0') return false; 23 | 24 | while (isdigit(*s)) s++; 25 | 26 | if (*s == '.') { 27 | s++; 28 | while (isdigit(*s)) s++; 29 | } 30 | 31 | if (*s == 'e' || *s == 'E') { 32 | s++; 33 | if (issign(*s)) s++; 34 | if (!isdigit(*s)) return false; 35 | while (isdigit(*s)) s++; 36 | } 37 | 38 | return *s == '\0'; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/src/ArduinoJson/Polyfills/isInteger.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #pragma once 9 | 10 | #include "./ctype.hpp" 11 | 12 | namespace ArduinoJson { 13 | namespace Polyfills { 14 | 15 | inline bool isInteger(const char* s) { 16 | if (!s) return false; 17 | if (issign(*s)) s++; 18 | while (isdigit(*s)) s++; 19 | return *s == '\0'; 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/src/ArduinoJson/Polyfills/math.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #pragma once 9 | 10 | namespace ArduinoJson { 11 | namespace Polyfills { 12 | template 13 | bool isNaN(T x) { 14 | return x != x; 15 | } 16 | 17 | template 18 | bool isInfinity(T x) { 19 | return x != 0.0 && x * 2 == x; 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/src/ArduinoJson/Polyfills/parseInteger.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | #include "../Configuration.hpp" 13 | #include "./ctype.hpp" 14 | 15 | namespace ArduinoJson { 16 | namespace Polyfills { 17 | template 18 | T parseInteger(const char *s) { 19 | if (!s) return 0; // NULL 20 | 21 | if (*s == 't') return 1; // "true" 22 | 23 | T result = 0; 24 | bool negative_result = false; 25 | 26 | switch (*s) { 27 | case '-': 28 | negative_result = true; 29 | s++; 30 | break; 31 | case '+': 32 | s++; 33 | break; 34 | } 35 | 36 | while (isdigit(*s)) { 37 | result = T(result * 10 + T(*s - '0')); 38 | s++; 39 | } 40 | 41 | return negative_result ? T(~result + 1) : result; 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/src/ArduinoJson/RawJson.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #pragma once 9 | 10 | namespace ArduinoJson { 11 | 12 | // A special type of data that can be used to insert pregenerated JSON portions. 13 | class RawJson { 14 | public: 15 | explicit RawJson(const char* str) : _str(str) {} 16 | operator const char*() const { 17 | return _str; 18 | } 19 | 20 | private: 21 | const char* _str; 22 | }; 23 | } 24 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/src/ArduinoJson/Serialization/DummyPrint.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #pragma once 9 | 10 | namespace ArduinoJson { 11 | namespace Internals { 12 | 13 | // A dummy Print implementation used in JsonPrintable::measureLength() 14 | class DummyPrint { 15 | public: 16 | size_t print(char) { 17 | return 1; 18 | } 19 | 20 | size_t print(const char* s) { 21 | return strlen(s); 22 | } 23 | }; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/src/ArduinoJson/Serialization/DynamicStringBuilder.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #pragma once 9 | 10 | #include "../StringTraits/StringTraits.hpp" 11 | 12 | namespace ArduinoJson { 13 | namespace Internals { 14 | 15 | // A Print implementation that allows to write in a String 16 | template 17 | class DynamicStringBuilder { 18 | public: 19 | DynamicStringBuilder(TString &str) : _str(str) {} 20 | 21 | size_t print(char c) { 22 | StringTraits::append(_str, c); 23 | return 1; 24 | } 25 | 26 | size_t print(const char *s) { 27 | size_t initialLen = _str.length(); 28 | StringTraits::append(_str, s); 29 | return _str.length() - initialLen; 30 | } 31 | 32 | private: 33 | DynamicStringBuilder &operator=(const DynamicStringBuilder &); 34 | 35 | TString &_str; 36 | }; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/src/ArduinoJson/Serialization/IndentedPrint.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #pragma once 9 | 10 | namespace ArduinoJson { 11 | namespace Internals { 12 | 13 | // Decorator on top of Print to allow indented output. 14 | // This class is used by JsonPrintable::prettyPrintTo() but can also be used 15 | // for your own purpose, like logging. 16 | template 17 | class IndentedPrint { 18 | public: 19 | explicit IndentedPrint(Print &p) : sink(&p) { 20 | level = 0; 21 | tabSize = 2; 22 | isNewLine = true; 23 | } 24 | 25 | size_t print(char c) { 26 | size_t n = 0; 27 | if (isNewLine) n += writeTabs(); 28 | n += sink->print(c); 29 | isNewLine = c == '\n'; 30 | return n; 31 | } 32 | 33 | size_t print(const char *s) { 34 | // TODO: optimize 35 | size_t n = 0; 36 | while (*s) n += print(*s++); 37 | return n; 38 | } 39 | 40 | // Adds one level of indentation 41 | void indent() { 42 | if (level < MAX_LEVEL) level++; 43 | } 44 | 45 | // Removes one level of indentation 46 | void unindent() { 47 | if (level > 0) level--; 48 | } 49 | 50 | // Set the number of space printed for each level of indentation 51 | void setTabSize(uint8_t n) { 52 | if (n < MAX_TAB_SIZE) tabSize = n & MAX_TAB_SIZE; 53 | } 54 | 55 | private: 56 | Print *sink; 57 | uint8_t level : 4; 58 | uint8_t tabSize : 3; 59 | bool isNewLine : 1; 60 | 61 | size_t writeTabs() { 62 | size_t n = 0; 63 | for (int i = 0; i < level * tabSize; i++) n += sink->print(' '); 64 | return n; 65 | } 66 | 67 | static const int MAX_LEVEL = 15; // because it's only 4 bits 68 | static const int MAX_TAB_SIZE = 7; // because it's only 3 bits 69 | }; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/src/ArduinoJson/Serialization/JsonSerializer.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #pragma once 9 | 10 | #include "JsonWriter.hpp" 11 | 12 | namespace ArduinoJson { 13 | 14 | class JsonArray; 15 | class JsonArraySubscript; 16 | class JsonObject; 17 | template 18 | class JsonObjectSubscript; 19 | class JsonVariant; 20 | 21 | namespace Internals { 22 | 23 | template 24 | class JsonSerializer { 25 | public: 26 | static void serialize(const JsonArray &, Writer &); 27 | static void serialize(const JsonArraySubscript &, Writer &); 28 | static void serialize(const JsonObject &, Writer &); 29 | template 30 | static void serialize(const JsonObjectSubscript &, Writer &); 31 | static void serialize(const JsonVariant &, Writer &); 32 | }; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/src/ArduinoJson/Serialization/StaticStringBuilder.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #pragma once 9 | 10 | namespace ArduinoJson { 11 | namespace Internals { 12 | 13 | // A Print implementation that allows to write in a char[] 14 | class StaticStringBuilder { 15 | public: 16 | StaticStringBuilder(char *buf, size_t size) : end(buf + size - 1), p(buf) { 17 | *p = '\0'; 18 | } 19 | 20 | size_t print(char c) { 21 | if (p >= end) return 0; 22 | *p++ = c; 23 | *p = '\0'; 24 | return 1; 25 | } 26 | 27 | size_t print(const char *s) { 28 | char *begin = p; 29 | while (p < end && *s) *p++ = *s++; 30 | *p = '\0'; 31 | return size_t(p - begin); 32 | } 33 | 34 | private: 35 | char *end; 36 | char *p; 37 | }; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/src/ArduinoJson/Serialization/StreamPrintAdapter.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #pragma once 9 | 10 | #include "../Configuration.hpp" 11 | 12 | #if ARDUINOJSON_ENABLE_STD_STREAM 13 | 14 | #include 15 | 16 | namespace ArduinoJson { 17 | namespace Internals { 18 | 19 | class StreamPrintAdapter { 20 | public: 21 | explicit StreamPrintAdapter(std::ostream& os) : _os(os) {} 22 | 23 | size_t print(char c) { 24 | _os << c; 25 | return 1; 26 | } 27 | 28 | size_t print(const char* s) { 29 | _os << s; 30 | return strlen(s); 31 | } 32 | 33 | private: 34 | // cannot be assigned 35 | StreamPrintAdapter& operator=(const StreamPrintAdapter&); 36 | 37 | std::ostream& _os; 38 | }; 39 | } 40 | } 41 | 42 | #endif // ARDUINOJSON_ENABLE_STD_STREAM 43 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/src/ArduinoJson/StringTraits/ArduinoStream.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #pragma once 9 | 10 | #if ARDUINOJSON_ENABLE_ARDUINO_STREAM 11 | 12 | #include 13 | 14 | namespace ArduinoJson { 15 | namespace Internals { 16 | 17 | struct ArduinoStreamTraits { 18 | class Reader { 19 | Stream& _stream; 20 | char _current, _next; 21 | 22 | public: 23 | Reader(Stream& stream) : _stream(stream), _current(0), _next(0) {} 24 | 25 | void move() { 26 | _current = _next; 27 | _next = 0; 28 | } 29 | 30 | char current() { 31 | if (!_current) _current = read(); 32 | return _current; 33 | } 34 | 35 | char next() { 36 | // assumes that current() has been called 37 | if (!_next) _next = read(); 38 | return _next; 39 | } 40 | 41 | private: 42 | char read() { 43 | // don't use _stream.read() as it ignores the timeout 44 | char c = 0; 45 | _stream.readBytes(&c, 1); 46 | return c; 47 | } 48 | }; 49 | }; 50 | 51 | template 52 | struct StringTraits::type>::value>::type> 57 | : ArduinoStreamTraits {}; 58 | } 59 | } 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/src/ArduinoJson/StringTraits/CharPointer.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #pragma once 9 | 10 | namespace ArduinoJson { 11 | namespace Internals { 12 | 13 | template 14 | struct CharPointerTraits { 15 | class Reader { 16 | const TChar* _ptr; 17 | 18 | public: 19 | Reader(const TChar* ptr) 20 | : _ptr(ptr ? ptr : reinterpret_cast("")) {} 21 | 22 | void move() { 23 | ++_ptr; 24 | } 25 | 26 | char current() const { 27 | return char(_ptr[0]); 28 | } 29 | 30 | char next() const { 31 | return char(_ptr[1]); 32 | } 33 | }; 34 | 35 | static bool equals(const TChar* str, const char* expected) { 36 | return strcmp(reinterpret_cast(str), expected) == 0; 37 | } 38 | 39 | template 40 | static char* duplicate(const TChar* str, Buffer* buffer) { 41 | if (!str) return NULL; 42 | size_t size = strlen(reinterpret_cast(str)) + 1; 43 | void* dup = buffer->alloc(size); 44 | if (dup != NULL) memcpy(dup, str, size); 45 | return static_cast(dup); 46 | } 47 | 48 | static const bool has_append = false; 49 | static const bool has_equals = true; 50 | static const bool should_duplicate = false; 51 | }; 52 | 53 | template 54 | struct StringTraits::value>::type> 56 | : CharPointerTraits {}; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/src/ArduinoJson/StringTraits/FlashString.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #pragma once 9 | 10 | #if ARDUINOJSON_ENABLE_PROGMEM 11 | 12 | namespace ArduinoJson { 13 | namespace Internals { 14 | template <> 15 | struct StringTraits { 16 | class Reader { 17 | const char* _ptr; 18 | 19 | public: 20 | Reader(const __FlashStringHelper* ptr) 21 | : _ptr(reinterpret_cast(ptr)) {} 22 | 23 | void move() { 24 | _ptr++; 25 | } 26 | 27 | char current() const { 28 | return pgm_read_byte_near(_ptr); 29 | } 30 | 31 | char next() const { 32 | return pgm_read_byte_near(_ptr + 1); 33 | } 34 | }; 35 | 36 | static bool equals(const __FlashStringHelper* str, const char* expected) { 37 | return strcmp_P(expected, (const char*)str) == 0; 38 | } 39 | 40 | template 41 | static char* duplicate(const __FlashStringHelper* str, Buffer* buffer) { 42 | if (!str) return NULL; 43 | size_t size = strlen_P((const char*)str) + 1; 44 | void* dup = buffer->alloc(size); 45 | if (dup != NULL) memcpy_P(dup, (const char*)str, size); 46 | return static_cast(dup); 47 | } 48 | 49 | static const bool has_append = false; 50 | static const bool has_equals = true; 51 | static const bool should_duplicate = true; 52 | }; 53 | } 54 | } 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/src/ArduinoJson/StringTraits/StdStream.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #pragma once 9 | 10 | #if ARDUINOJSON_ENABLE_STD_STREAM 11 | 12 | #include 13 | 14 | namespace ArduinoJson { 15 | namespace Internals { 16 | 17 | struct StdStreamTraits { 18 | class Reader { 19 | std::istream& _stream; 20 | char _current, _next; 21 | 22 | public: 23 | Reader(std::istream& stream) : _stream(stream), _current(0), _next(0) {} 24 | 25 | void move() { 26 | _current = _next; 27 | _next = 0; 28 | } 29 | 30 | char current() { 31 | if (!_current) _current = read(); 32 | return _current; 33 | } 34 | 35 | char next() { 36 | // assumes that current() has been called 37 | if (!_next) _next = read(); 38 | return _next; 39 | } 40 | 41 | private: 42 | Reader& operator=(const Reader&); // Visual Studio C4512 43 | 44 | char read() { 45 | return _stream.eof() ? '\0' : static_cast(_stream.get()); 46 | } 47 | }; 48 | }; 49 | 50 | template 51 | struct StringTraits::type>::value>::type> 56 | : StdStreamTraits {}; 57 | } 58 | } 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/src/ArduinoJson/StringTraits/StdString.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #pragma once 9 | 10 | #if ARDUINOJSON_ENABLE_STD_STRING || ARDUINOJSON_ENABLE_ARDUINO_STRING 11 | 12 | #if ARDUINOJSON_ENABLE_ARDUINO_STRING 13 | #include 14 | #endif 15 | 16 | #if ARDUINOJSON_ENABLE_STD_STRING 17 | #include 18 | #endif 19 | 20 | namespace ArduinoJson { 21 | namespace Internals { 22 | 23 | template 24 | struct StdStringTraits { 25 | template 26 | static char* duplicate(const TString& str, Buffer* buffer) { 27 | if (!str.c_str()) return NULL; // <- Arduino string can return NULL 28 | size_t size = str.length() + 1; 29 | void* dup = buffer->alloc(size); 30 | if (dup != NULL) memcpy(dup, str.c_str(), size); 31 | return static_cast(dup); 32 | } 33 | 34 | struct Reader : CharPointerTraits::Reader { 35 | Reader(const TString& str) : CharPointerTraits::Reader(str.c_str()) {} 36 | }; 37 | 38 | static bool equals(const TString& str, const char* expected) { 39 | return 0 == strcmp(str.c_str(), expected); 40 | } 41 | 42 | static void append(TString& str, char c) { 43 | str += c; 44 | } 45 | 46 | static void append(TString& str, const char* s) { 47 | str += s; 48 | } 49 | 50 | static const bool has_append = true; 51 | static const bool has_equals = true; 52 | static const bool should_duplicate = true; 53 | }; 54 | 55 | #if ARDUINOJSON_ENABLE_ARDUINO_STRING 56 | template <> 57 | struct StringTraits : StdStringTraits {}; 58 | template <> 59 | struct StringTraits : StdStringTraits { 60 | }; 61 | #endif 62 | 63 | #if ARDUINOJSON_ENABLE_STD_STRING 64 | template <> 65 | struct StringTraits : StdStringTraits {}; 66 | #endif 67 | } 68 | } 69 | 70 | #endif 71 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/src/ArduinoJson/StringTraits/StringTraits.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #pragma once 9 | 10 | #include 11 | #include "../Configuration.hpp" 12 | #include "../TypeTraits/EnableIf.hpp" 13 | #include "../TypeTraits/IsBaseOf.hpp" 14 | #include "../TypeTraits/IsChar.hpp" 15 | #include "../TypeTraits/RemoveReference.hpp" 16 | 17 | namespace ArduinoJson { 18 | namespace Internals { 19 | 20 | template 21 | struct StringTraits {}; 22 | 23 | template 24 | struct StringTraits : StringTraits {}; 25 | 26 | template 27 | struct StringTraits : StringTraits {}; 28 | } 29 | } 30 | 31 | #include "ArduinoStream.hpp" 32 | #include "CharPointer.hpp" 33 | #include "FlashString.hpp" 34 | #include "StdStream.hpp" 35 | #include "StdString.hpp" 36 | 37 | namespace ArduinoJson { 38 | namespace TypeTraits { 39 | template 40 | struct IsString { 41 | static const bool value = false; 42 | }; 43 | 44 | template 45 | struct IsString::has_equals>::type> { 47 | static const bool value = Internals::StringTraits::has_equals; 48 | }; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/src/ArduinoJson/TypeTraits/EnableIf.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #pragma once 9 | 10 | namespace ArduinoJson { 11 | namespace TypeTraits { 12 | 13 | // A meta-function that return the type T if Condition is true. 14 | template 15 | struct EnableIf {}; 16 | 17 | template 18 | struct EnableIf { 19 | typedef T type; 20 | }; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/src/ArduinoJson/TypeTraits/IsArray.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #pragma once 9 | 10 | namespace ArduinoJson { 11 | namespace TypeTraits { 12 | 13 | // A meta-function that return the type T without the const modifier 14 | template 15 | struct IsArray { 16 | static const bool value = false; 17 | }; 18 | template 19 | struct IsArray { 20 | static const bool value = true; 21 | }; 22 | template 23 | struct IsArray { 24 | static const bool value = true; 25 | }; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/src/ArduinoJson/TypeTraits/IsBaseOf.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #pragma once 9 | 10 | namespace ArduinoJson { 11 | namespace TypeTraits { 12 | 13 | // A meta-function that returns true if Derived inherits from TBase is an 14 | // integral type. 15 | template 16 | class IsBaseOf { 17 | protected: // <- to avoid GCC's "all member functions in class are private" 18 | typedef char Yes[1]; 19 | typedef char No[2]; 20 | 21 | static Yes &probe(const TBase *); 22 | static No &probe(...); 23 | 24 | public: 25 | enum { 26 | value = sizeof(probe(reinterpret_cast(0))) == sizeof(Yes) 27 | }; 28 | }; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/src/ArduinoJson/TypeTraits/IsChar.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #pragma once 9 | 10 | #include "IsSame.hpp" 11 | 12 | namespace ArduinoJson { 13 | namespace TypeTraits { 14 | 15 | // A meta-function that returns true if T is a charater 16 | template 17 | struct IsChar { 18 | static const bool value = IsSame::value || 19 | IsSame::value || 20 | IsSame::value; 21 | }; 22 | 23 | template 24 | struct IsChar : IsChar {}; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/src/ArduinoJson/TypeTraits/IsConst.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #pragma once 9 | 10 | namespace ArduinoJson { 11 | namespace TypeTraits { 12 | 13 | // A meta-function that return the type T without the const modifier 14 | template 15 | struct IsConst { 16 | static const bool value = false; 17 | }; 18 | 19 | template 20 | struct IsConst { 21 | static const bool value = true; 22 | }; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/src/ArduinoJson/TypeTraits/IsFloatingPoint.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #pragma once 9 | 10 | #include "IsSame.hpp" 11 | 12 | namespace ArduinoJson { 13 | namespace TypeTraits { 14 | 15 | // A meta-function that returns true if T is a floating point type 16 | template 17 | struct IsFloatingPoint { 18 | static const bool value = IsSame::value || IsSame::value; 19 | }; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/src/ArduinoJson/TypeTraits/IsIntegral.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #pragma once 9 | 10 | #include "IsSame.hpp" 11 | #include "IsSignedIntegral.hpp" 12 | #include "IsUnsignedIntegral.hpp" 13 | 14 | namespace ArduinoJson { 15 | namespace TypeTraits { 16 | 17 | // A meta-function that returns true if T is an integral type. 18 | template 19 | struct IsIntegral { 20 | static const bool value = TypeTraits::IsSignedIntegral::value || 21 | TypeTraits::IsUnsignedIntegral::value || 22 | TypeTraits::IsSame::value; 23 | // CAUTION: differs from std::is_integral as it doesn't include bool 24 | }; 25 | 26 | template 27 | struct IsIntegral : IsIntegral {}; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/src/ArduinoJson/TypeTraits/IsSame.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #pragma once 9 | 10 | namespace ArduinoJson { 11 | namespace TypeTraits { 12 | 13 | // A meta-function that returns true if types T and U are the same. 14 | template 15 | struct IsSame { 16 | static const bool value = false; 17 | }; 18 | 19 | template 20 | struct IsSame { 21 | static const bool value = true; 22 | }; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/src/ArduinoJson/TypeTraits/IsSignedIntegral.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #pragma once 9 | 10 | #include "../Configuration.hpp" 11 | #include "IsSame.hpp" 12 | 13 | namespace ArduinoJson { 14 | namespace TypeTraits { 15 | 16 | // A meta-function that returns true if T is an integral type. 17 | template 18 | struct IsSignedIntegral { 19 | static const bool value = TypeTraits::IsSame::value || 20 | TypeTraits::IsSame::value || 21 | TypeTraits::IsSame::value || 22 | TypeTraits::IsSame::value || 23 | #if ARDUINOJSON_USE_LONG_LONG 24 | TypeTraits::IsSame::value || 25 | #endif 26 | 27 | #if ARDUINOJSON_USE_INT64 28 | TypeTraits::IsSame::value || 29 | #endif 30 | false; 31 | }; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/src/ArduinoJson/TypeTraits/IsUnsignedIntegral.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #pragma once 9 | 10 | #include "../Configuration.hpp" 11 | #include "IsSame.hpp" 12 | 13 | namespace ArduinoJson { 14 | namespace TypeTraits { 15 | 16 | // A meta-function that returns true if T is an integral type. 17 | template 18 | struct IsUnsignedIntegral { 19 | static const bool value = TypeTraits::IsSame::value || 20 | TypeTraits::IsSame::value || 21 | TypeTraits::IsSame::value || 22 | TypeTraits::IsSame::value || 23 | #if ARDUINOJSON_USE_LONG_LONG 24 | TypeTraits::IsSame::value || 25 | #endif 26 | 27 | #if ARDUINOJSON_USE_INT64 28 | TypeTraits::IsSame::value || 29 | #endif 30 | false; 31 | }; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/src/ArduinoJson/TypeTraits/RemoveConst.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #pragma once 9 | 10 | namespace ArduinoJson { 11 | namespace TypeTraits { 12 | 13 | // A meta-function that return the type T without the const modifier 14 | template 15 | struct RemoveConst { 16 | typedef T type; 17 | }; 18 | template 19 | struct RemoveConst { 20 | typedef T type; 21 | }; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/src/ArduinoJson/TypeTraits/RemoveReference.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #pragma once 9 | 10 | namespace ArduinoJson { 11 | namespace TypeTraits { 12 | 13 | // A meta-function that return the type T without the reference modifier. 14 | template 15 | struct RemoveReference { 16 | typedef T type; 17 | }; 18 | template 19 | struct RemoveReference { 20 | typedef T type; 21 | }; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright Benoit Blanchon 2014-2017 2 | # MIT License 3 | # 4 | # Arduino JSON library 5 | # https://bblanchon.github.io/ArduinoJson/ 6 | # If you like this project, please add a star! 7 | 8 | if(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang)") 9 | add_compile_options( 10 | -pedantic 11 | -Wall 12 | -Wcast-align 13 | -Wcast-qual 14 | -Wconversion 15 | -Wctor-dtor-privacy 16 | -Wdisabled-optimization 17 | -Werror 18 | -Wextra 19 | -Wformat=2 20 | -Winit-self 21 | -Wmissing-include-dirs 22 | -Wnon-virtual-dtor 23 | -Wold-style-cast 24 | -Woverloaded-virtual 25 | -Wparentheses 26 | -Wredundant-decls 27 | -Wshadow 28 | -Wsign-promo 29 | -Wstrict-aliasing 30 | -Wstrict-overflow=5 31 | -Wundef 32 | ) 33 | 34 | if(NOT MINGW) 35 | add_compile_options( 36 | -std=c++98 37 | ) 38 | endif() 39 | endif() 40 | 41 | if(CMAKE_CXX_COMPILER_ID MATCHES "GNU") 42 | add_compile_options( 43 | -Wstrict-null-sentinel 44 | ) 45 | 46 | if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.5) 47 | add_compile_options(-Wlogical-op) # the flag exists in 4.4 but is buggy 48 | endif() 49 | 50 | if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.6) 51 | add_compile_options(-Wnoexcept) 52 | endif() 53 | endif() 54 | 55 | if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") 56 | add_compile_options( 57 | -Wc++11-compat 58 | -Wdeprecated-register 59 | ) 60 | endif() 61 | 62 | if(MSVC) 63 | add_definitions(-D_CRT_SECURE_NO_WARNINGS) 64 | add_compile_options( 65 | /W4 # Set warning level 66 | /WX # Treats all compiler warnings as errors. 67 | ) 68 | endif() 69 | 70 | add_subdirectory(DynamicJsonBuffer) 71 | add_subdirectory(IntegrationTests) 72 | add_subdirectory(JsonArray) 73 | add_subdirectory(JsonBuffer) 74 | add_subdirectory(JsonObject) 75 | add_subdirectory(JsonVariant) 76 | add_subdirectory(JsonWriter) 77 | add_subdirectory(Misc) 78 | add_subdirectory(Polyfills) 79 | add_subdirectory(StaticJsonBuffer) -------------------------------------------------------------------------------- /libraries/ArduinoJson/test/DynamicJsonBuffer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright Benoit Blanchon 2014-2017 2 | # MIT License 3 | # 4 | # Arduino JSON library 5 | # https://bblanchon.github.io/ArduinoJson/ 6 | # If you like this project, please add a star! 7 | 8 | add_executable(DynamicJsonBufferTests 9 | alloc.cpp 10 | createArray.cpp 11 | createObject.cpp 12 | no_memory.cpp 13 | size.cpp 14 | startString.cpp 15 | strdup.cpp 16 | ) 17 | 18 | target_link_libraries(DynamicJsonBufferTests catch) 19 | add_test(DynamicJsonBuffer DynamicJsonBufferTests) 20 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/test/DynamicJsonBuffer/createArray.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #include 9 | #include 10 | 11 | TEST_CASE("DynamicJsonBuffer::createArray()") { 12 | DynamicJsonBuffer jsonBuffer; 13 | JsonArray &array = jsonBuffer.createArray(); 14 | 15 | SECTION("GrowsWithArray") { 16 | REQUIRE(JSON_ARRAY_SIZE(0) == jsonBuffer.size()); 17 | 18 | array.add("hello"); 19 | REQUIRE(JSON_ARRAY_SIZE(1) == jsonBuffer.size()); 20 | 21 | array.add("world"); 22 | REQUIRE(JSON_ARRAY_SIZE(2) == jsonBuffer.size()); 23 | } 24 | 25 | SECTION("CanAdd1000Values") { 26 | for (size_t i = 1; i <= 1000; i++) { 27 | array.add("hello"); 28 | REQUIRE(array.size() == i); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/test/DynamicJsonBuffer/createObject.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #include 9 | #include 10 | 11 | TEST_CASE("DynamicJsonBuffer::createObject()") { 12 | DynamicJsonBuffer json; 13 | 14 | JsonObject &obj = json.createObject(); 15 | REQUIRE(JSON_OBJECT_SIZE(0) == json.size()); 16 | 17 | obj["hello"] = 1; 18 | REQUIRE(JSON_OBJECT_SIZE(1) == json.size()); 19 | 20 | obj["world"] = 2; 21 | REQUIRE(JSON_OBJECT_SIZE(2) == json.size()); 22 | 23 | obj["world"] = 3; // <- same key, should not grow 24 | REQUIRE(JSON_OBJECT_SIZE(2) == json.size()); 25 | } 26 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/test/DynamicJsonBuffer/no_memory.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #include 9 | #include 10 | 11 | struct NoMemoryAllocator { 12 | void* allocate(size_t) { 13 | return NULL; 14 | } 15 | void deallocate(void*) {} 16 | }; 17 | 18 | TEST_CASE("DynamicJsonBuffer no memory") { 19 | DynamicJsonBufferBase _jsonBuffer; 20 | 21 | SECTION("FixCodeCoverage") { 22 | // call this function to fix code coverage 23 | NoMemoryAllocator().deallocate(NULL); 24 | } 25 | 26 | SECTION("createArray()") { 27 | REQUIRE_FALSE(_jsonBuffer.createArray().success()); 28 | } 29 | 30 | SECTION("createObject()") { 31 | REQUIRE_FALSE(_jsonBuffer.createObject().success()); 32 | } 33 | 34 | SECTION("parseArray()") { 35 | char json[] = "[]"; 36 | REQUIRE_FALSE(_jsonBuffer.parseArray(json).success()); 37 | } 38 | 39 | SECTION("parseObject()") { 40 | char json[] = "{}"; 41 | REQUIRE_FALSE(_jsonBuffer.parseObject(json).success()); 42 | } 43 | 44 | SECTION("startString()") { 45 | DynamicJsonBufferBase::String str = 46 | _jsonBuffer.startString(); 47 | str.append('!'); 48 | REQUIRE(0 == str.c_str()); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/test/DynamicJsonBuffer/size.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #include 9 | #include 10 | 11 | TEST_CASE("DynamicJsonBuffer::size()") { 12 | DynamicJsonBuffer buffer; 13 | 14 | SECTION("Initial size is 0") { 15 | REQUIRE(0 == buffer.size()); 16 | } 17 | 18 | SECTION("Increases after alloc()") { 19 | buffer.alloc(1); 20 | REQUIRE(1U <= buffer.size()); 21 | buffer.alloc(1); 22 | REQUIRE(2U <= buffer.size()); 23 | } 24 | 25 | SECTION("Goes back to 0 after clear()") { 26 | buffer.alloc(1); 27 | buffer.clear(); 28 | REQUIRE(0 == buffer.size()); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/test/DynamicJsonBuffer/startString.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #include 9 | #include 10 | 11 | TEST_CASE("DynamicJsonBuffer::startString()") { 12 | SECTION("WorksWhenBufferIsBigEnough") { 13 | DynamicJsonBuffer jsonBuffer(6); 14 | 15 | DynamicJsonBuffer::String str = jsonBuffer.startString(); 16 | str.append('h'); 17 | str.append('e'); 18 | str.append('l'); 19 | str.append('l'); 20 | str.append('o'); 21 | 22 | REQUIRE(std::string("hello") == str.c_str()); 23 | } 24 | 25 | SECTION("GrowsWhenBufferIsTooSmall") { 26 | DynamicJsonBuffer jsonBuffer(5); 27 | 28 | DynamicJsonBuffer::String str = jsonBuffer.startString(); 29 | str.append('h'); 30 | str.append('e'); 31 | str.append('l'); 32 | str.append('l'); 33 | str.append('o'); 34 | 35 | REQUIRE(std::string("hello") == str.c_str()); 36 | } 37 | 38 | SECTION("SizeIncreases") { 39 | DynamicJsonBuffer jsonBuffer(5); 40 | 41 | DynamicJsonBuffer::String str = jsonBuffer.startString(); 42 | REQUIRE(0 == jsonBuffer.size()); 43 | 44 | str.append('h'); 45 | REQUIRE(1 == jsonBuffer.size()); 46 | 47 | str.c_str(); 48 | REQUIRE(2 == jsonBuffer.size()); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/test/DynamicJsonBuffer/strdup.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #include 9 | #include 10 | 11 | TEST_CASE("DynamicJsonBuffer::strdup()") { 12 | DynamicJsonBuffer buffer; 13 | 14 | SECTION("Should return a copy") { 15 | char original[] = "hello"; 16 | char* copy = buffer.strdup(original); 17 | strcpy(original, "world"); 18 | REQUIRE(std::string("hello") == copy); 19 | } 20 | 21 | SECTION("Given NULL, return NULL") { 22 | const char* original = NULL; 23 | char* copy = buffer.strdup(original); 24 | REQUIRE(0 == copy); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/test/IntegrationTests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright Benoit Blanchon 2014-2017 2 | # MIT License 3 | # 4 | # Arduino JSON library 5 | # https://bblanchon.github.io/ArduinoJson/ 6 | # If you like this project, please add a star! 7 | 8 | add_executable(IntegrationTests 9 | gbathree.cpp 10 | round_trip.cpp 11 | ) 12 | 13 | if(CMAKE_CXX_COMPILER_ID MATCHES "GNU") 14 | target_compile_options(IntegrationTests 15 | PUBLIC 16 | -fsingle-precision-constant # issue 544 17 | ) 18 | endif() 19 | 20 | target_link_libraries(IntegrationTests catch) 21 | add_test(IntegrationTests IntegrationTests) 22 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/test/JsonArray/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright Benoit Blanchon 2014-2017 2 | # MIT License 3 | # 4 | # Arduino JSON library 5 | # https://bblanchon.github.io/ArduinoJson/ 6 | # If you like this project, please add a star! 7 | 8 | add_executable(JsonArrayTests 9 | add.cpp 10 | basics.cpp 11 | copyFrom.cpp 12 | copyTo.cpp 13 | invalid.cpp 14 | iterator.cpp 15 | prettyPrintTo.cpp 16 | printTo.cpp 17 | remove.cpp 18 | set.cpp 19 | subscript.cpp 20 | ) 21 | 22 | target_link_libraries(JsonArrayTests catch) 23 | add_test(JsonArray JsonArrayTests) 24 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/test/JsonArray/basics.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #include 9 | #include 10 | 11 | TEST_CASE("JsonArray basics") { 12 | DynamicJsonBuffer jb; 13 | JsonArray& array = jb.createArray(); 14 | 15 | SECTION("SuccessIsTrue") { 16 | REQUIRE(array.success()); 17 | } 18 | 19 | SECTION("InitialSizeIsZero") { 20 | REQUIRE(0U == array.size()); 21 | } 22 | 23 | SECTION("CreateNestedArray") { 24 | JsonArray& arr = array.createNestedArray(); 25 | REQUIRE(&arr == &array[0].as()); 26 | } 27 | 28 | SECTION("CreateNestedObject") { 29 | JsonObject& obj = array.createNestedObject(); 30 | REQUIRE(&obj == &array[0].as()); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/test/JsonArray/copyFrom.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #include 9 | #include 10 | 11 | TEST_CASE("JsonArray::copyFrom()") { 12 | SECTION("OneDimension") { 13 | DynamicJsonBuffer jsonBuffer; 14 | JsonArray& array = jsonBuffer.createArray(); 15 | char json[32]; 16 | int source[] = {1, 2, 3}; 17 | 18 | bool ok = array.copyFrom(source); 19 | REQUIRE(ok); 20 | 21 | array.printTo(json, sizeof(json)); 22 | REQUIRE(std::string("[1,2,3]") == json); 23 | } 24 | 25 | SECTION("OneDimension_JsonBufferTooSmall") { 26 | const size_t SIZE = JSON_ARRAY_SIZE(2); 27 | StaticJsonBuffer jsonBuffer; 28 | JsonArray& array = jsonBuffer.createArray(); 29 | char json[32]; 30 | int source[] = {1, 2, 3}; 31 | 32 | bool ok = array.copyFrom(source); 33 | REQUIRE_FALSE(ok); 34 | 35 | array.printTo(json, sizeof(json)); 36 | REQUIRE(std::string("[1,2]") == json); 37 | } 38 | 39 | SECTION("TwoDimensions") { 40 | DynamicJsonBuffer jsonBuffer; 41 | JsonArray& array = jsonBuffer.createArray(); 42 | char json[32]; 43 | int source[][3] = {{1, 2, 3}, {4, 5, 6}}; 44 | 45 | bool ok = array.copyFrom(source); 46 | REQUIRE(ok); 47 | 48 | array.printTo(json, sizeof(json)); 49 | REQUIRE(std::string("[[1,2,3],[4,5,6]]") == json); 50 | } 51 | 52 | SECTION("TwoDimensions_JsonBufferTooSmall") { 53 | const size_t SIZE = 54 | JSON_ARRAY_SIZE(2) + JSON_ARRAY_SIZE(3) + JSON_ARRAY_SIZE(2); 55 | StaticJsonBuffer jsonBuffer; 56 | JsonArray& array = jsonBuffer.createArray(); 57 | char json[32]; 58 | int source[][3] = {{1, 2, 3}, {4, 5, 6}}; 59 | 60 | bool ok = array.copyFrom(source); 61 | REQUIRE_FALSE(ok); 62 | 63 | array.printTo(json, sizeof(json)); 64 | REQUIRE(std::string("[[1,2,3],[4,5]]") == json); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/test/JsonArray/copyTo.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #include 9 | #include 10 | 11 | TEST_CASE("JsonArray::copyTo()") { 12 | DynamicJsonBuffer jsonBuffer; 13 | 14 | SECTION("BiggerOneDimensionIntegerArray") { 15 | char json[] = "[1,2,3]"; 16 | JsonArray& array = jsonBuffer.parseArray(json); 17 | 18 | int destination[4] = {0}; 19 | size_t result = array.copyTo(destination); 20 | 21 | REQUIRE(3 == result); 22 | REQUIRE(1 == destination[0]); 23 | REQUIRE(2 == destination[1]); 24 | REQUIRE(3 == destination[2]); 25 | REQUIRE(0 == destination[3]); 26 | } 27 | 28 | SECTION("SmallerOneDimensionIntegerArray") { 29 | char json[] = "[1,2,3]"; 30 | JsonArray& array = jsonBuffer.parseArray(json); 31 | 32 | int destination[2] = {0}; 33 | size_t result = array.copyTo(destination); 34 | 35 | REQUIRE(2 == result); 36 | REQUIRE(1 == destination[0]); 37 | REQUIRE(2 == destination[1]); 38 | } 39 | 40 | SECTION("TwoOneDimensionIntegerArray") { 41 | char json[] = "[[1,2],[3],[4]]"; 42 | 43 | JsonArray& array = jsonBuffer.parseArray(json); 44 | 45 | int destination[3][2] = {{0}}; 46 | array.copyTo(destination); 47 | 48 | REQUIRE(1 == destination[0][0]); 49 | REQUIRE(2 == destination[0][1]); 50 | REQUIRE(3 == destination[1][0]); 51 | REQUIRE(0 == destination[1][1]); 52 | REQUIRE(4 == destination[2][0]); 53 | REQUIRE(0 == destination[2][1]); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/test/JsonArray/invalid.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #include 9 | #include 10 | 11 | using namespace Catch::Matchers; 12 | 13 | TEST_CASE("JsonArray::invalid()") { 14 | SECTION("SubscriptFails") { 15 | REQUIRE_FALSE(JsonArray::invalid()[0].success()); 16 | } 17 | 18 | SECTION("AddFails") { 19 | JsonArray& array = JsonArray::invalid(); 20 | array.add(1); 21 | REQUIRE(0 == array.size()); 22 | } 23 | 24 | SECTION("CreateNestedArrayFails") { 25 | REQUIRE_FALSE(JsonArray::invalid().createNestedArray().success()); 26 | } 27 | 28 | SECTION("CreateNestedObjectFails") { 29 | REQUIRE_FALSE(JsonArray::invalid().createNestedObject().success()); 30 | } 31 | 32 | SECTION("PrintToWritesBrackets") { 33 | char buffer[32]; 34 | JsonArray::invalid().printTo(buffer, sizeof(buffer)); 35 | REQUIRE_THAT(buffer, Equals("[]")); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/test/JsonArray/iterator.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #include 9 | #include 10 | 11 | template 12 | static void run_iterator_test() { 13 | StaticJsonBuffer jsonBuffer; 14 | 15 | JsonArray &array = jsonBuffer.createArray(); 16 | array.add(12); 17 | array.add(34); 18 | 19 | TIterator it = array.begin(); 20 | TIterator end = array.end(); 21 | 22 | REQUIRE(end != it); 23 | REQUIRE(12 == it->template as()); 24 | REQUIRE(12 == static_cast(*it)); 25 | ++it; 26 | REQUIRE(end != it); 27 | REQUIRE(34 == it->template as()); 28 | REQUIRE(34 == static_cast(*it)); 29 | ++it; 30 | REQUIRE(end == it); 31 | } 32 | 33 | TEST_CASE("JsonArray::begin()/end()") { 34 | SECTION("Mutable") { 35 | run_iterator_test(); 36 | } 37 | 38 | SECTION("Const") { 39 | run_iterator_test(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/test/JsonArray/prettyPrintTo.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #include 9 | #include 10 | 11 | static void check(JsonArray& array, std::string expected) { 12 | std::string actual; 13 | size_t actualLen = array.prettyPrintTo(actual); 14 | size_t measuredLen = array.measurePrettyLength(); 15 | CHECK(actualLen == expected.size()); 16 | CHECK(measuredLen == expected.size()); 17 | REQUIRE(expected == actual); 18 | } 19 | 20 | TEST_CASE("JsonArray::prettyPrintTo()") { 21 | DynamicJsonBuffer jb; 22 | JsonArray& array = jb.createArray(); 23 | 24 | SECTION("Empty") { 25 | check(array, "[]"); 26 | } 27 | 28 | SECTION("OneElement") { 29 | array.add(1); 30 | 31 | check(array, 32 | "[\r\n" 33 | " 1\r\n" 34 | "]"); 35 | } 36 | 37 | SECTION("TwoElements") { 38 | array.add(1); 39 | array.add(2); 40 | 41 | check(array, 42 | "[\r\n" 43 | " 1,\r\n" 44 | " 2\r\n" 45 | "]"); 46 | } 47 | 48 | SECTION("EmptyNestedArrays") { 49 | array.createNestedArray(); 50 | array.createNestedArray(); 51 | 52 | check(array, 53 | "[\r\n" 54 | " [],\r\n" 55 | " []\r\n" 56 | "]"); 57 | } 58 | 59 | SECTION("NestedArrays") { 60 | JsonArray& nested1 = array.createNestedArray(); 61 | nested1.add(1); 62 | nested1.add(2); 63 | 64 | JsonObject& nested2 = array.createNestedObject(); 65 | nested2["key"] = 3; 66 | 67 | check(array, 68 | "[\r\n" 69 | " [\r\n" 70 | " 1,\r\n" 71 | " 2\r\n" 72 | " ],\r\n" 73 | " {\r\n" 74 | " \"key\": 3\r\n" 75 | " }\r\n" 76 | "]"); 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/test/JsonArray/remove.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #include 9 | #include 10 | 11 | TEST_CASE("JsonArray::remove()") { 12 | DynamicJsonBuffer _jsonBuffer; 13 | JsonArray& _array = _jsonBuffer.createArray(); 14 | _array.add(1); 15 | _array.add(2); 16 | _array.add(3); 17 | 18 | SECTION("RemoveFirstByIndex") { 19 | _array.remove(0); 20 | 21 | REQUIRE(2 == _array.size()); 22 | REQUIRE(_array[0] == 2); 23 | REQUIRE(_array[1] == 3); 24 | } 25 | 26 | SECTION("RemoveMiddleByIndex") { 27 | _array.remove(1); 28 | 29 | REQUIRE(2 == _array.size()); 30 | REQUIRE(_array[0] == 1); 31 | REQUIRE(_array[1] == 3); 32 | } 33 | 34 | SECTION("RemoveLastByIndex") { 35 | _array.remove(2); 36 | 37 | REQUIRE(2 == _array.size()); 38 | REQUIRE(_array[0] == 1); 39 | REQUIRE(_array[1] == 2); 40 | } 41 | 42 | SECTION("RemoveFirstByIterator") { 43 | JsonArray::iterator it = _array.begin(); 44 | _array.remove(it); 45 | 46 | REQUIRE(2 == _array.size()); 47 | REQUIRE(_array[0] == 2); 48 | REQUIRE(_array[1] == 3); 49 | } 50 | 51 | SECTION("RemoveMiddleByIterator") { 52 | JsonArray::iterator it = _array.begin(); 53 | ++it; 54 | _array.remove(it); 55 | 56 | REQUIRE(2 == _array.size()); 57 | REQUIRE(_array[0] == 1); 58 | REQUIRE(_array[1] == 3); 59 | } 60 | 61 | SECTION("RemoveLastByIterator") { 62 | JsonArray::iterator it = _array.begin(); 63 | ++it; 64 | ++it; 65 | _array.remove(it); 66 | 67 | REQUIRE(2 == _array.size()); 68 | REQUIRE(_array[0] == 1); 69 | REQUIRE(_array[1] == 2); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/test/JsonBuffer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright Benoit Blanchon 2014-2017 2 | # MIT License 3 | # 4 | # Arduino JSON library 5 | # https://bblanchon.github.io/ArduinoJson/ 6 | # If you like this project, please add a star! 7 | 8 | add_executable(JsonBufferTests 9 | nested.cpp 10 | nestingLimit.cpp 11 | parse.cpp 12 | parseArray.cpp 13 | parseObject.cpp 14 | ) 15 | 16 | target_link_libraries(JsonBufferTests catch) 17 | add_test(JsonBuffer JsonBufferTests) 18 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/test/JsonBuffer/nested.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #include 9 | #include 10 | 11 | TEST_CASE("JsonBuffer nested objects") { 12 | SECTION("ArrayNestedInObject") { 13 | DynamicJsonBuffer jsonBuffer; 14 | char jsonString[] = " { \"ab\" : [ 1 , 2 ] , \"cd\" : [ 3 , 4 ] } "; 15 | 16 | JsonObject &object = jsonBuffer.parseObject(jsonString); 17 | JsonArray &array1 = object["ab"]; 18 | const JsonArray &array2 = object["cd"]; 19 | JsonArray &array3 = object["ef"]; 20 | 21 | REQUIRE(true == object.success()); 22 | 23 | REQUIRE(true == array1.success()); 24 | REQUIRE(true == array2.success()); 25 | REQUIRE(false == array3.success()); 26 | 27 | REQUIRE(2 == array1.size()); 28 | REQUIRE(2 == array2.size()); 29 | REQUIRE(0 == array3.size()); 30 | 31 | REQUIRE(1 == array1[0].as()); 32 | REQUIRE(2 == array1[1].as()); 33 | 34 | REQUIRE(3 == array2[0].as()); 35 | REQUIRE(4 == array2[1].as()); 36 | 37 | REQUIRE(0 == array3[0].as()); 38 | } 39 | 40 | SECTION("ObjectNestedInArray") { 41 | DynamicJsonBuffer jsonBuffer; 42 | char jsonString[] = 43 | " [ { \"a\" : 1 , \"b\" : 2 } , { \"c\" : 3 , \"d\" : 4 } ] "; 44 | 45 | JsonArray &array = jsonBuffer.parseArray(jsonString); 46 | JsonObject &object1 = array[0]; 47 | const JsonObject &object2 = array[1]; 48 | JsonObject &object3 = array[2]; 49 | 50 | REQUIRE(true == array.success()); 51 | 52 | REQUIRE(true == object1.success()); 53 | REQUIRE(true == object2.success()); 54 | REQUIRE(false == object3.success()); 55 | 56 | REQUIRE(2 == object1.size()); 57 | REQUIRE(2 == object2.size()); 58 | REQUIRE(0 == object3.size()); 59 | 60 | REQUIRE(1 == object1["a"].as()); 61 | REQUIRE(2 == object1["b"].as()); 62 | REQUIRE(3 == object2["c"].as()); 63 | REQUIRE(4 == object2["d"].as()); 64 | REQUIRE(0 == object3["e"].as()); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/test/JsonBuffer/nestingLimit.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #include 9 | #include 10 | 11 | bool tryParseArray(const char *json, uint8_t nestingLimit) { 12 | DynamicJsonBuffer buffer; 13 | return buffer.parseArray(json, nestingLimit).success(); 14 | } 15 | 16 | bool tryParseObject(const char *json, uint8_t nestingLimit) { 17 | DynamicJsonBuffer buffer; 18 | return buffer.parseObject(json, nestingLimit).success(); 19 | } 20 | 21 | TEST_CASE("JsonParser nestingLimit") { 22 | SECTION("ParseArrayWithNestingLimit0") { 23 | REQUIRE(true == tryParseArray("[]", 0)); 24 | REQUIRE(false == tryParseArray("[[]]", 0)); 25 | } 26 | 27 | SECTION("ParseArrayWithNestingLimit1") { 28 | REQUIRE(true == tryParseArray("[[]]", 1)); 29 | REQUIRE(false == tryParseArray("[[[]]]", 1)); 30 | } 31 | 32 | SECTION("ParseArrayWithNestingLimit2") { 33 | REQUIRE(true == tryParseArray("[[[]]]", 2)); 34 | REQUIRE(false == tryParseArray("[[[[]]]]", 2)); 35 | } 36 | 37 | SECTION("ParseObjectWithNestingLimit0") { 38 | REQUIRE(true == tryParseObject("{}", 0)); 39 | REQUIRE(false == tryParseObject("{\"key\":{}}", 0)); 40 | } 41 | 42 | SECTION("ParseObjectWithNestingLimit1") { 43 | REQUIRE(true == tryParseObject("{\"key\":{}}", 1)); 44 | REQUIRE(false == tryParseObject("{\"key\":{\"key\":{}}}", 1)); 45 | } 46 | 47 | SECTION("ParseObjectWithNestingLimit2") { 48 | REQUIRE(true == tryParseObject("{\"key\":{\"key\":{}}}", 2)); 49 | REQUIRE(false == tryParseObject("{\"key\":{\"key\":{\"key\":{}}}}", 2)); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/test/JsonObject/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright Benoit Blanchon 2014-2017 2 | # MIT License 3 | # 4 | # Arduino JSON library 5 | # https://bblanchon.github.io/ArduinoJson/ 6 | # If you like this project, please add a star! 7 | 8 | add_executable(JsonObjectTests 9 | basics.cpp 10 | containsKey.cpp 11 | get.cpp 12 | invalid.cpp 13 | iterator.cpp 14 | prettyPrintTo.cpp 15 | printTo.cpp 16 | remove.cpp 17 | set.cpp 18 | subscript.cpp 19 | ) 20 | 21 | target_link_libraries(JsonObjectTests catch) 22 | add_test(JsonObject JsonObjectTests) 23 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/test/JsonObject/basics.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #include 9 | #include 10 | 11 | TEST_CASE("JsonObject basics") { 12 | DynamicJsonBuffer _jsonBuffer; 13 | JsonObject& _object = _jsonBuffer.createObject(); 14 | 15 | SECTION("InitialSizeIsZero") { 16 | REQUIRE(0 == _object.size()); 17 | } 18 | 19 | SECTION("SuccessIsTrue") { 20 | REQUIRE(_object.success()); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/test/JsonObject/containsKey.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #include 9 | #include 10 | 11 | TEST_CASE("JsonObject::containsKey()") { 12 | DynamicJsonBuffer _jsonBuffer; 13 | JsonObject& _object = _jsonBuffer.createObject(); 14 | 15 | SECTION("ContainsKeyReturnsFalseForNonExistingKey") { 16 | _object.set("hello", 42); 17 | 18 | REQUIRE(false == _object.containsKey("world")); 19 | } 20 | 21 | SECTION("ContainsKeyReturnsTrueForDefinedValue") { 22 | _object.set("hello", 42); 23 | 24 | REQUIRE(true == _object.containsKey("hello")); 25 | } 26 | 27 | SECTION("ContainsKeyReturnsFalseAfterRemove") { 28 | _object.set("hello", 42); 29 | _object.remove("hello"); 30 | 31 | REQUIRE(false == _object.containsKey("hello")); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/test/JsonObject/get.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #include 9 | #include 10 | 11 | using namespace Catch::Matchers; 12 | 13 | TEST_CASE("JsonObject::get()") { 14 | DynamicJsonBuffer jb; 15 | JsonObject& obj = jb.createObject(); 16 | 17 | SECTION("GetConstCharPointer_GivenStringLiteral") { 18 | obj.set("hello", "world"); 19 | const char* value = obj.get("hello"); 20 | REQUIRE_THAT(value, Equals("world")); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/test/JsonObject/invalid.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #include 9 | #include 10 | 11 | using namespace Catch::Matchers; 12 | 13 | TEST_CASE("JsonObject::invalid()") { 14 | JsonObject& obj = JsonObject::invalid(); 15 | 16 | SECTION("SubscriptFails") { 17 | REQUIRE_FALSE(obj["key"].success()); 18 | } 19 | 20 | SECTION("AddFails") { 21 | obj.set("hello", "world"); 22 | REQUIRE(0 == obj.size()); 23 | } 24 | 25 | SECTION("CreateNestedArrayFails") { 26 | REQUIRE_FALSE(obj.createNestedArray("hello").success()); 27 | } 28 | 29 | SECTION("CreateNestedObjectFails") { 30 | REQUIRE_FALSE(obj.createNestedObject("world").success()); 31 | } 32 | 33 | SECTION("PrintToWritesBraces") { 34 | char buffer[32]; 35 | obj.printTo(buffer, sizeof(buffer)); 36 | REQUIRE_THAT(buffer, Equals("{}")); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/test/JsonObject/iterator.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #include 9 | #include 10 | 11 | using namespace Catch::Matchers; 12 | 13 | TEST_CASE("JsonObject::begin()/end()") { 14 | StaticJsonBuffer jb; 15 | JsonObject& obj = jb.createObject(); 16 | obj["ab"] = 12; 17 | obj["cd"] = 34; 18 | 19 | SECTION("NonConstIterator") { 20 | JsonObject::iterator it = obj.begin(); 21 | REQUIRE(obj.end() != it); 22 | REQUIRE_THAT(it->key, Equals("ab")); 23 | REQUIRE(12 == it->value); 24 | it->key = "a.b"; 25 | it->value = 1.2; 26 | ++it; 27 | REQUIRE(obj.end() != it); 28 | REQUIRE_THAT(it->key, Equals("cd")); 29 | REQUIRE(34 == it->value); 30 | it->key = "c.d"; 31 | it->value = 3.4; 32 | ++it; 33 | REQUIRE(obj.end() == it); 34 | 35 | REQUIRE(2 == obj.size()); 36 | REQUIRE(1.2 == obj["a.b"]); 37 | REQUIRE(3.4 == obj["c.d"]); 38 | } 39 | 40 | SECTION("ConstIterator") { 41 | const JsonObject& const_object = obj; 42 | JsonObject::const_iterator it = const_object.begin(); 43 | 44 | REQUIRE(const_object.end() != it); 45 | REQUIRE_THAT(it->key, Equals("ab")); 46 | REQUIRE(12 == it->value); 47 | ++it; 48 | REQUIRE(const_object.end() != it); 49 | REQUIRE_THAT(it->key, Equals("cd")); 50 | REQUIRE(34 == it->value); 51 | ++it; 52 | REQUIRE(const_object.end() == it); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/test/JsonObject/prettyPrintTo.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | void check(const JsonObject &obj, const std::string expected) { 13 | char json[256]; 14 | 15 | size_t actualLen = obj.prettyPrintTo(json); 16 | size_t measuredLen = obj.measurePrettyLength(); 17 | 18 | REQUIRE(json == expected); 19 | REQUIRE(expected.size() == actualLen); 20 | REQUIRE(expected.size() == measuredLen); 21 | } 22 | 23 | TEST_CASE("JsonObject::prettyPrintTo()") { 24 | DynamicJsonBuffer jb; 25 | JsonObject &obj = jb.createObject(); 26 | 27 | SECTION("EmptyObject") { 28 | check(obj, "{}"); 29 | } 30 | 31 | SECTION("OneMember") { 32 | obj["key"] = "value"; 33 | 34 | check(obj, 35 | "{\r\n" 36 | " \"key\": \"value\"\r\n" 37 | "}"); 38 | } 39 | 40 | SECTION("TwoMembers") { 41 | obj["key1"] = "value1"; 42 | obj["key2"] = "value2"; 43 | 44 | check(obj, 45 | "{\r\n" 46 | " \"key1\": \"value1\",\r\n" 47 | " \"key2\": \"value2\"\r\n" 48 | "}"); 49 | } 50 | 51 | SECTION("EmptyNestedContainers") { 52 | obj.createNestedObject("key1"); 53 | obj.createNestedArray("key2"); 54 | 55 | check(obj, 56 | "{\r\n" 57 | " \"key1\": {},\r\n" 58 | " \"key2\": []\r\n" 59 | "}"); 60 | } 61 | 62 | SECTION("NestedContainers") { 63 | JsonObject &nested1 = obj.createNestedObject("key1"); 64 | nested1["a"] = 1; 65 | 66 | JsonArray &nested2 = obj.createNestedArray("key2"); 67 | nested2.add(2); 68 | 69 | check(obj, 70 | "{\r\n" 71 | " \"key1\": {\r\n" 72 | " \"a\": 1\r\n" 73 | " },\r\n" 74 | " \"key2\": [\r\n" 75 | " 2\r\n" 76 | " ]\r\n" 77 | "}"); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/test/JsonObject/remove.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | TEST_CASE("JsonObject::remove()") { 13 | DynamicJsonBuffer jb; 14 | 15 | SECTION("SizeDecreased_WhenValuesAreRemoved") { 16 | JsonObject& obj = jb.createObject(); 17 | obj["hello"] = 1; 18 | 19 | obj.remove("hello"); 20 | 21 | REQUIRE(0 == obj.size()); 22 | } 23 | 24 | SECTION("SizeUntouched_WhenRemoveIsCalledWithAWrongKey") { 25 | JsonObject& obj = jb.createObject(); 26 | obj["hello"] = 1; 27 | 28 | obj.remove("world"); 29 | 30 | REQUIRE(1 == obj.size()); 31 | } 32 | 33 | SECTION("RemoveByIterator") { 34 | JsonObject& obj = jb.parseObject("{\"a\":0,\"b\":1,\"c\":2}"); 35 | 36 | for (JsonObject::iterator it = obj.begin(); it != obj.end(); ++it) { 37 | if (it->value == 1) obj.remove(it); 38 | } 39 | 40 | std::string result; 41 | obj.printTo(result); 42 | REQUIRE("{\"a\":0,\"c\":2}" == result); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/test/JsonVariant/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright Benoit Blanchon 2014-2017 2 | # MIT License 3 | # 4 | # Arduino JSON library 5 | # https://bblanchon.github.io/ArduinoJson/ 6 | # If you like this project, please add a star! 7 | 8 | add_executable(JsonVariantTests 9 | as.cpp 10 | compare.cpp 11 | copy.cpp 12 | is.cpp 13 | printTo.cpp 14 | set_get.cpp 15 | subscript.cpp 16 | success.cpp 17 | undefined.cpp 18 | ) 19 | 20 | target_link_libraries(JsonVariantTests catch) 21 | add_test(JsonVariant JsonVariantTests) 22 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/test/JsonVariant/copy.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #include 9 | #include 10 | 11 | TEST_CASE("JsonVariant copy") { 12 | DynamicJsonBuffer _jsonBuffer; 13 | JsonVariant _variant1; 14 | JsonVariant _variant2; 15 | 16 | SECTION("IntegersAreCopiedByValue") { 17 | _variant1 = 123; 18 | _variant2 = _variant1; 19 | _variant1 = 456; 20 | 21 | REQUIRE(123 == _variant2.as()); 22 | } 23 | 24 | SECTION("DoublesAreCopiedByValue") { 25 | _variant1 = 123.45; 26 | _variant2 = _variant1; 27 | _variant1 = 456.78; 28 | 29 | REQUIRE(123.45 == _variant2.as()); 30 | } 31 | 32 | SECTION("BooleansAreCopiedByValue") { 33 | _variant1 = true; 34 | _variant2 = _variant1; 35 | _variant1 = false; 36 | 37 | REQUIRE(_variant2.as()); 38 | } 39 | 40 | SECTION("StringsAreCopiedByValue") { 41 | _variant1 = "hello"; 42 | _variant2 = _variant1; 43 | _variant1 = "world"; 44 | 45 | REQUIRE(std::string("hello") == _variant2.as()); 46 | } 47 | 48 | SECTION("ObjectsAreCopiedByReference") { 49 | JsonObject &object = _jsonBuffer.createObject(); 50 | 51 | _variant1 = object; 52 | 53 | object["hello"] = "world"; 54 | 55 | REQUIRE(1 == _variant1.as().size()); 56 | } 57 | 58 | SECTION("ArraysAreCopiedByReference") { 59 | JsonArray &array = _jsonBuffer.createArray(); 60 | 61 | _variant1 = array; 62 | 63 | array.add("world"); 64 | 65 | REQUIRE(1 == _variant1.as().size()); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/test/JsonVariant/printTo.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | void check(JsonVariant variant, const std::string &expected) { 13 | char buffer[256] = ""; 14 | size_t returnValue = variant.printTo(buffer, sizeof(buffer)); 15 | REQUIRE(expected == buffer); 16 | REQUIRE(expected.size() == returnValue); 17 | } 18 | 19 | TEST_CASE("JsonVariant::printTo()") { 20 | SECTION("Empty") { 21 | check(JsonVariant(), ""); 22 | } 23 | 24 | SECTION("Null") { 25 | check(static_cast(0), "null"); 26 | } 27 | 28 | SECTION("String") { 29 | check("hello", "\"hello\""); 30 | } 31 | 32 | SECTION("Double") { 33 | check(3.1415927, "3.1415927"); 34 | } 35 | 36 | SECTION("Integer") { 37 | check(42, "42"); 38 | } 39 | 40 | SECTION("NegativeLong") { 41 | check(-42, "-42"); 42 | } 43 | 44 | SECTION("UnsignedLong") { 45 | check(4294967295UL, "4294967295"); 46 | } 47 | 48 | SECTION("True") { 49 | check(true, "true"); 50 | } 51 | 52 | SECTION("OneFalse") { 53 | check(false, "false"); 54 | } 55 | 56 | #if ARDUINOJSON_USE_LONG_LONG || ARDUINOJSON_USE_INT64 57 | SECTION("NegativeInt64") { 58 | check(-9223372036854775807 - 1, "-9223372036854775808"); 59 | } 60 | 61 | SECTION("PositiveInt64") { 62 | check(9223372036854775807, "9223372036854775807"); 63 | } 64 | 65 | SECTION("UInt64") { 66 | check(18446744073709551615U, "18446744073709551615"); 67 | } 68 | #endif 69 | } 70 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/test/JsonVariant/success.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #include 9 | #include 10 | 11 | TEST_CASE("JsonVariant::success()") { 12 | SECTION("ReturnsFalse_WhenUndefined") { 13 | JsonVariant variant; 14 | REQUIRE(false == variant.success()); 15 | } 16 | 17 | SECTION("ReturnsTrue_WhenInteger") { 18 | JsonVariant variant = 0; 19 | REQUIRE(true == variant.success()); 20 | } 21 | 22 | SECTION("ReturnsTrue_WhenEmptyArray") { 23 | DynamicJsonBuffer jsonBuffer; 24 | 25 | JsonVariant variant = jsonBuffer.createArray(); 26 | REQUIRE(true == variant.success()); 27 | } 28 | 29 | SECTION("ReturnsTrue_WhenEmptyObject") { 30 | DynamicJsonBuffer jsonBuffer; 31 | 32 | JsonVariant variant = jsonBuffer.createObject(); 33 | REQUIRE(true == variant.success()); 34 | } 35 | 36 | SECTION("ReturnsFalse_WhenInvalidArray") { 37 | JsonVariant variant = JsonArray::invalid(); 38 | REQUIRE(false == variant.success()); 39 | } 40 | 41 | SECTION("ReturnsFalse_WhenInvalidObject") { 42 | JsonVariant variant = JsonObject::invalid(); 43 | REQUIRE(false == variant.success()); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/test/JsonVariant/undefined.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #include 9 | #include 10 | 11 | TEST_CASE("JsonVariant undefined") { 12 | JsonVariant variant; 13 | 14 | SECTION("AsLongReturns0") { 15 | REQUIRE(0 == variant.as()); 16 | } 17 | 18 | SECTION("AsUnsignedReturns0") { 19 | REQUIRE(0 == variant.as()); 20 | } 21 | 22 | SECTION("AsStringReturnsNull") { 23 | REQUIRE(0 == variant.as()); 24 | } 25 | 26 | SECTION("AsDoubleReturns0") { 27 | REQUIRE(0 == variant.as()); 28 | } 29 | 30 | SECTION("AsBoolReturnsFalse") { 31 | REQUIRE(false == variant.as()); 32 | } 33 | 34 | SECTION("AsArrayReturnInvalid") { 35 | REQUIRE(JsonArray::invalid() == variant.as()); 36 | } 37 | 38 | SECTION("AsConstArrayReturnInvalid") { 39 | REQUIRE(JsonArray::invalid() == variant.as()); 40 | } 41 | 42 | SECTION("AsObjectReturnInvalid") { 43 | REQUIRE(JsonObject::invalid() == variant.as()); 44 | } 45 | 46 | SECTION("AsConstObjectReturnInvalid") { 47 | REQUIRE(JsonObject::invalid() == variant.as()); 48 | } 49 | 50 | SECTION("AsArrayWrapperReturnInvalid") { 51 | REQUIRE(JsonArray::invalid() == variant.as()); 52 | } 53 | 54 | SECTION("AsObjectWrapperReturnInvalid") { 55 | REQUIRE(JsonObject::invalid() == variant.as()); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/test/JsonWriter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright Benoit Blanchon 2014-2017 2 | # MIT License 3 | # 4 | # Arduino JSON library 5 | # https://bblanchon.github.io/ArduinoJson/ 6 | # If you like this project, please add a star! 7 | 8 | add_executable(JsonWriterTests 9 | writeFloat.cpp 10 | writeString.cpp 11 | ) 12 | 13 | target_link_libraries(JsonWriterTests catch) 14 | add_test(JsonWriter JsonWriterTests) 15 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/test/JsonWriter/writeString.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #include 9 | 10 | #include 11 | #include 12 | 13 | using namespace ArduinoJson::Internals; 14 | 15 | void check(const char* input, std::string expected) { 16 | char output[1024]; 17 | StaticStringBuilder sb(output, sizeof(output)); 18 | JsonWriter writer(sb); 19 | writer.writeString(input); 20 | REQUIRE(expected == output); 21 | REQUIRE(writer.bytesWritten() == expected.size()); 22 | } 23 | 24 | TEST_CASE("JsonWriter::writeString()") { 25 | SECTION("Null") { 26 | check(0, "null"); 27 | } 28 | 29 | SECTION("EmptyString") { 30 | check("", "\"\""); 31 | } 32 | 33 | SECTION("QuotationMark") { 34 | check("\"", "\"\\\"\""); 35 | } 36 | 37 | SECTION("ReverseSolidus") { 38 | check("\\", "\"\\\\\""); 39 | } 40 | 41 | SECTION("Solidus") { 42 | check("/", "\"/\""); // but the JSON format allows \/ 43 | } 44 | 45 | SECTION("Backspace") { 46 | check("\b", "\"\\b\""); 47 | } 48 | 49 | SECTION("Formfeed") { 50 | check("\f", "\"\\f\""); 51 | } 52 | 53 | SECTION("Newline") { 54 | check("\n", "\"\\n\""); 55 | } 56 | 57 | SECTION("CarriageReturn") { 58 | check("\r", "\"\\r\""); 59 | } 60 | 61 | SECTION("HorizontalTab") { 62 | check("\t", "\"\\t\""); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/test/Misc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright Benoit Blanchon 2014-2017 2 | # MIT License 3 | # 4 | # Arduino JSON library 5 | # https://bblanchon.github.io/ArduinoJson/ 6 | # If you like this project, please add a star! 7 | 8 | add_executable(MiscTests 9 | deprecated.cpp 10 | FloatParts.cpp 11 | std_stream.cpp 12 | std_string.cpp 13 | StringBuilder.cpp 14 | TypeTraits.cpp 15 | unsigned_char.cpp 16 | vla.cpp 17 | ) 18 | 19 | target_link_libraries(MiscTests catch) 20 | add_test(Misc MiscTests) 21 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/test/Misc/FloatParts.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #include 9 | #include 10 | 11 | using namespace ArduinoJson::Internals; 12 | 13 | TEST_CASE("FloatParts") { 14 | SECTION("1.7976931348623157E+308") { 15 | FloatParts parts(1.7976931348623157E+308); 16 | REQUIRE(parts.integral == 1); 17 | REQUIRE(parts.decimal == 797693135); 18 | REQUIRE(parts.decimalPlaces == 9); 19 | REQUIRE(parts.exponent == 308); 20 | } 21 | 22 | SECTION("4.94065645841247e-324") { 23 | FloatParts parts(4.94065645841247e-324); 24 | REQUIRE(parts.integral == 4); 25 | REQUIRE(parts.decimal == 940656458); 26 | REQUIRE(parts.decimalPlaces == 9); 27 | REQUIRE(parts.exponent == -324); 28 | } 29 | } 30 | 31 | TEST_CASE("FloatParts") { 32 | SECTION("3.4E+38") { 33 | FloatParts parts(3.4E+38f); 34 | REQUIRE(parts.integral == 3); 35 | REQUIRE(parts.decimal == 4); 36 | REQUIRE(parts.decimalPlaces == 1); 37 | REQUIRE(parts.exponent == 38); 38 | } 39 | 40 | SECTION("1.17549435e−38") { 41 | FloatParts parts(1.17549435e-38f); 42 | REQUIRE(parts.integral == 1); 43 | REQUIRE(parts.decimal == 175494); 44 | REQUIRE(parts.decimalPlaces == 6); 45 | REQUIRE(parts.exponent == -38); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/test/Misc/StringBuilder.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #include 9 | #include 10 | 11 | using namespace ArduinoJson::Internals; 12 | 13 | template 14 | void common_tests(StringBuilder& sb, const String& output) { 15 | SECTION("InitialState") { 16 | REQUIRE(std::string("") == output); 17 | } 18 | 19 | SECTION("EmptyString") { 20 | REQUIRE(0 == sb.print("")); 21 | REQUIRE(std::string("") == output); 22 | } 23 | 24 | SECTION("OneString") { 25 | REQUIRE(4 == sb.print("ABCD")); 26 | REQUIRE(std::string("ABCD") == output); 27 | } 28 | 29 | SECTION("TwoStrings") { 30 | REQUIRE(4 == sb.print("ABCD")); 31 | REQUIRE(4 == sb.print("EFGH")); 32 | REQUIRE(std::string("ABCDEFGH") == output); 33 | } 34 | } 35 | 36 | TEST_CASE("StaticStringBuilder") { 37 | char output[20]; 38 | StaticStringBuilder sb(output, sizeof(output)); 39 | 40 | common_tests(sb, static_cast(output)); 41 | 42 | SECTION("OverCapacity") { 43 | REQUIRE(19 == sb.print("ABCDEFGHIJKLMNOPQRSTUVWXYZ")); 44 | REQUIRE(0 == sb.print("ABC")); 45 | REQUIRE(std::string("ABCDEFGHIJKLMNOPQRS") == output); 46 | } 47 | } 48 | 49 | TEST_CASE("DynamicStringBuilder") { 50 | std::string output; 51 | DynamicStringBuilder sb(output); 52 | common_tests(sb, output); 53 | } 54 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/test/Misc/TypeTraits.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | using namespace ArduinoJson::TypeTraits; 13 | 14 | TEST_CASE("TypeTraits") { 15 | SECTION("IsBaseOf") { 16 | REQUIRE_FALSE( 17 | static_cast(IsBaseOf::value)); 18 | REQUIRE( 19 | static_cast(IsBaseOf::value)); 20 | REQUIRE(static_cast( 21 | IsBaseOf >, 22 | JsonObjectSubscript >::value)); 23 | } 24 | 25 | SECTION("IsArray") { 26 | REQUIRE_FALSE((IsArray::value)); 27 | REQUIRE((IsArray::value)); 28 | REQUIRE((IsArray::value)); 29 | } 30 | 31 | SECTION("IsVariant") { 32 | REQUIRE( 33 | static_cast(IsVariant >::value)); 34 | REQUIRE(static_cast(IsVariant::value)); 35 | } 36 | 37 | SECTION("IsString") { 38 | REQUIRE((IsString::value)); 39 | REQUIRE((IsString::value)); 40 | REQUIRE_FALSE((IsString::value)); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/test/Polyfills/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright Benoit Blanchon 2014-2017 2 | # MIT License 3 | # 4 | # Arduino JSON library 5 | # https://bblanchon.github.io/ArduinoJson/ 6 | # If you like this project, please add a star! 7 | 8 | add_executable(PolyfillsTests 9 | isFloat.cpp 10 | isInteger.cpp 11 | parseFloat.cpp 12 | parseInteger.cpp 13 | ) 14 | 15 | target_link_libraries(PolyfillsTests catch) 16 | add_test(Polyfills PolyfillsTests) 17 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/test/Polyfills/isFloat.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #include 9 | #include 10 | 11 | using namespace ArduinoJson::Polyfills; 12 | 13 | TEST_CASE("isFloat()") { 14 | SECTION("Input is NULL") { 15 | REQUIRE(isFloat(NULL) == false); 16 | } 17 | 18 | SECTION("NoExponent") { 19 | REQUIRE(isFloat("3.14")); 20 | REQUIRE(isFloat("-3.14")); 21 | REQUIRE(isFloat("+3.14")); 22 | } 23 | 24 | SECTION("IntegralPartMissing") { 25 | REQUIRE(isFloat(".14")); 26 | REQUIRE(isFloat("-.14")); 27 | REQUIRE(isFloat("+.14")); 28 | } 29 | 30 | SECTION("FractionalPartMissing") { 31 | REQUIRE(isFloat("3.")); 32 | REQUIRE(isFloat("-3.e14")); 33 | REQUIRE(isFloat("+3.e-14")); 34 | } 35 | 36 | SECTION("NoDot") { 37 | REQUIRE(isFloat("3e14")); 38 | REQUIRE(isFloat("3e-14")); 39 | REQUIRE(isFloat("3e+14")); 40 | } 41 | 42 | SECTION("Integer") { 43 | REQUIRE(isFloat("14")); 44 | REQUIRE(isFloat("-14")); 45 | REQUIRE(isFloat("+14")); 46 | } 47 | 48 | SECTION("ExponentMissing") { 49 | REQUIRE_FALSE(isFloat("3.14e")); 50 | REQUIRE_FALSE(isFloat("3.14e-")); 51 | REQUIRE_FALSE(isFloat("3.14e+")); 52 | } 53 | 54 | SECTION("JustASign") { 55 | REQUIRE_FALSE(isFloat("-")); 56 | REQUIRE_FALSE(isFloat("+")); 57 | } 58 | 59 | SECTION("Empty") { 60 | REQUIRE_FALSE(isFloat("")); 61 | } 62 | 63 | SECTION("NaN") { 64 | REQUIRE(isFloat("NaN")); 65 | REQUIRE_FALSE(isFloat("n")); 66 | REQUIRE_FALSE(isFloat("N")); 67 | REQUIRE_FALSE(isFloat("nan")); 68 | REQUIRE_FALSE(isFloat("-NaN")); 69 | REQUIRE_FALSE(isFloat("+NaN")); 70 | } 71 | 72 | SECTION("Infinity") { 73 | REQUIRE(isFloat("Infinity")); 74 | REQUIRE(isFloat("+Infinity")); 75 | REQUIRE(isFloat("-Infinity")); 76 | REQUIRE_FALSE(isFloat("infinity")); 77 | REQUIRE_FALSE(isFloat("Inf")); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/test/Polyfills/isInteger.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #include 9 | #include 10 | 11 | using namespace ArduinoJson::Polyfills; 12 | 13 | TEST_CASE("isInteger()") { 14 | SECTION("Null") { 15 | REQUIRE_FALSE(isInteger(NULL)); 16 | } 17 | 18 | SECTION("FloatNotInteger") { 19 | REQUIRE_FALSE(isInteger("3.14")); 20 | REQUIRE_FALSE(isInteger("-3.14")); 21 | REQUIRE_FALSE(isInteger("+3.14")); 22 | } 23 | 24 | SECTION("Spaces") { 25 | REQUIRE_FALSE(isInteger("42 ")); 26 | REQUIRE_FALSE(isInteger(" 42")); 27 | } 28 | 29 | SECTION("Valid") { 30 | REQUIRE(isInteger("42")); 31 | REQUIRE(isInteger("-42")); 32 | REQUIRE(isInteger("+42")); 33 | } 34 | 35 | SECTION("ExtraSign") { 36 | REQUIRE_FALSE(isInteger("--42")); 37 | REQUIRE_FALSE(isInteger("++42")); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/test/StaticJsonBuffer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright Benoit Blanchon 2014-2017 2 | # MIT License 3 | # 4 | # Arduino JSON library 5 | # https://bblanchon.github.io/ArduinoJson/ 6 | # If you like this project, please add a star! 7 | 8 | add_executable(StaticJsonBufferTests 9 | alloc.cpp 10 | createArray.cpp 11 | createObject.cpp 12 | parseArray.cpp 13 | parseObject.cpp 14 | size.cpp 15 | startString.cpp 16 | ) 17 | 18 | target_link_libraries(StaticJsonBufferTests catch) 19 | add_test(StaticJsonBuffer StaticJsonBufferTests) 20 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/test/StaticJsonBuffer/alloc.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #include 9 | #include 10 | 11 | static bool isAligned(void *ptr) { 12 | const size_t mask = sizeof(void *) - 1; 13 | size_t addr = reinterpret_cast(ptr); 14 | return (addr & mask) == 0; 15 | } 16 | 17 | TEST_CASE("StaticJsonBuffer::alloc()") { 18 | StaticJsonBuffer<64> buffer; 19 | 20 | SECTION("Returns different addresses") { 21 | void *p1 = buffer.alloc(1); 22 | void *p2 = buffer.alloc(1); 23 | REQUIRE(p1 != p2); 24 | } 25 | 26 | SECTION("Returns non-NULL when using full capacity") { 27 | void *p = buffer.alloc(64); 28 | REQUIRE(0 != p); 29 | } 30 | 31 | SECTION("Returns NULL when full") { 32 | buffer.alloc(64); 33 | void *p = buffer.alloc(1); 34 | REQUIRE(0 == p); 35 | } 36 | 37 | SECTION("Returns NULL when buffer is too small") { 38 | void *p = buffer.alloc(65); 39 | REQUIRE(0 == p); 40 | } 41 | 42 | SECTION("Returns aligned pointers") { 43 | for (size_t size = 1; size <= sizeof(void *); size++) { 44 | void *p = buffer.alloc(1); 45 | REQUIRE(isAligned(p)); 46 | } 47 | } 48 | 49 | SECTION("Returns same address after clear()") { 50 | void *p1 = buffer.alloc(1); 51 | buffer.clear(); 52 | void *p2 = buffer.alloc(1); 53 | REQUIRE(p1 == p2); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/test/StaticJsonBuffer/createArray.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #include 9 | #include 10 | 11 | TEST_CASE("StaticJsonBuffer::createArray()") { 12 | SECTION("GrowsWithArray") { 13 | StaticJsonBuffer json; 14 | 15 | JsonArray &array = json.createArray(); 16 | REQUIRE(JSON_ARRAY_SIZE(0) == json.size()); 17 | 18 | array.add("hello"); 19 | REQUIRE(JSON_ARRAY_SIZE(1) == json.size()); 20 | 21 | array.add("world"); 22 | REQUIRE(JSON_ARRAY_SIZE(2) == json.size()); 23 | } 24 | 25 | SECTION("SucceedWhenBigEnough") { 26 | StaticJsonBuffer json; 27 | 28 | JsonArray &array = json.createArray(); 29 | REQUIRE(array.success()); 30 | } 31 | 32 | SECTION("FailsWhenTooSmall") { 33 | StaticJsonBuffer json; 34 | 35 | JsonArray &array = json.createArray(); 36 | REQUIRE_FALSE(array.success()); 37 | } 38 | 39 | SECTION("ArrayDoesntGrowWhenFull") { 40 | StaticJsonBuffer json; 41 | 42 | JsonArray &array = json.createArray(); 43 | array.add("hello"); 44 | array.add("world"); 45 | 46 | REQUIRE(1 == array.size()); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/test/StaticJsonBuffer/createObject.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #include 9 | #include 10 | 11 | TEST_CASE("StaticJsonBuffer::createObject()") { 12 | SECTION("GrowsWithObject") { 13 | StaticJsonBuffer buffer; 14 | 15 | JsonObject &obj = buffer.createObject(); 16 | REQUIRE(JSON_OBJECT_SIZE(0) == buffer.size()); 17 | 18 | obj["hello"]; 19 | REQUIRE(JSON_OBJECT_SIZE(0) == buffer.size()); 20 | 21 | obj["hello"] = 1; 22 | REQUIRE(JSON_OBJECT_SIZE(1) == buffer.size()); 23 | 24 | obj["world"] = 2; 25 | REQUIRE(JSON_OBJECT_SIZE(2) == buffer.size()); 26 | 27 | obj["world"] = 3; // <- same key, should not grow 28 | REQUIRE(JSON_OBJECT_SIZE(2) == buffer.size()); 29 | } 30 | 31 | SECTION("SucceedWhenBigEnough") { 32 | StaticJsonBuffer buffer; 33 | 34 | JsonObject &object = buffer.createObject(); 35 | REQUIRE(object.success()); 36 | } 37 | 38 | SECTION("FailsWhenTooSmall") { 39 | StaticJsonBuffer buffer; 40 | 41 | JsonObject &object = buffer.createObject(); 42 | REQUIRE_FALSE(object.success()); 43 | } 44 | 45 | SECTION("ObjectDoesntGrowWhenFull") { 46 | StaticJsonBuffer buffer; 47 | 48 | JsonObject &obj = buffer.createObject(); 49 | obj["hello"] = 1; 50 | obj["world"] = 2; 51 | 52 | REQUIRE(JSON_OBJECT_SIZE(1) == buffer.size()); 53 | REQUIRE(1 == obj.size()); 54 | 55 | char json[64]; 56 | obj.printTo(json, sizeof(json)); 57 | REQUIRE(std::string("{\"hello\":1}") == json); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/test/StaticJsonBuffer/parseObject.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #include 9 | #include 10 | TEST_CASE("StaticJsonBuffer::parseObject()") { 11 | SECTION("TooSmallBufferForEmptyObject") { 12 | StaticJsonBuffer bufferTooSmall; 13 | char input[] = "{}"; 14 | JsonObject& obj = bufferTooSmall.parseObject(input); 15 | REQUIRE_FALSE(obj.success()); 16 | } 17 | 18 | SECTION("BufferOfTheRightSizeForEmptyObject") { 19 | StaticJsonBuffer bufferOfRightSize; 20 | char input[] = "{}"; 21 | JsonObject& obj = bufferOfRightSize.parseObject(input); 22 | REQUIRE(obj.success()); 23 | } 24 | 25 | SECTION("TooSmallBufferForObjectWithOneValue") { 26 | StaticJsonBuffer bufferTooSmall; 27 | char input[] = "{\"a\":1}"; 28 | JsonObject& obj = bufferTooSmall.parseObject(input); 29 | REQUIRE_FALSE(obj.success()); 30 | } 31 | 32 | SECTION("BufferOfTheRightSizeForObjectWithOneValue") { 33 | StaticJsonBuffer bufferOfRightSize; 34 | char input[] = "{\"a\":1}"; 35 | JsonObject& obj = bufferOfRightSize.parseObject(input); 36 | REQUIRE(obj.success()); 37 | } 38 | 39 | SECTION("TooSmallBufferForObjectWithNestedObject") { 40 | StaticJsonBuffer 41 | bufferTooSmall; 42 | char input[] = "{\"a\":[]}"; 43 | JsonObject& obj = bufferTooSmall.parseObject(input); 44 | REQUIRE_FALSE(obj.success()); 45 | } 46 | 47 | SECTION("BufferOfTheRightSizeForObjectWithNestedObject") { 48 | StaticJsonBuffer 49 | bufferOfRightSize; 50 | char input[] = "{\"a\":[]}"; 51 | JsonObject& obj = bufferOfRightSize.parseObject(input); 52 | REQUIRE(obj.success()); 53 | } 54 | 55 | SECTION("CharPtrNull") { 56 | REQUIRE_FALSE( 57 | StaticJsonBuffer<100>().parseObject(static_cast(0)).success()); 58 | } 59 | 60 | SECTION("ConstCharPtrNull") { 61 | REQUIRE_FALSE(StaticJsonBuffer<100>() 62 | .parseObject(static_cast(0)) 63 | .success()); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/test/StaticJsonBuffer/size.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #include 9 | #include 10 | 11 | TEST_CASE("StaticJsonBuffer::size()") { 12 | StaticJsonBuffer<64> buffer; 13 | 14 | SECTION("Capacity equals template parameter") { 15 | REQUIRE(64 == buffer.capacity()); 16 | } 17 | 18 | SECTION("Initial size is 0") { 19 | REQUIRE(0 == buffer.size()); 20 | } 21 | 22 | SECTION("Increases after alloc()") { 23 | buffer.alloc(1); 24 | REQUIRE(1U <= buffer.size()); 25 | buffer.alloc(1); 26 | REQUIRE(2U <= buffer.size()); 27 | } 28 | 29 | SECTION("Doesn't grow when buffer is full") { 30 | buffer.alloc(64); 31 | buffer.alloc(1); 32 | REQUIRE(64 == buffer.size()); 33 | } 34 | 35 | SECTION("Does't grow when buffer is too small for alloc") { 36 | buffer.alloc(65); 37 | REQUIRE(0 == buffer.size()); 38 | } 39 | 40 | SECTION("Goes back to zero after clear()") { 41 | buffer.alloc(1); 42 | buffer.clear(); 43 | REQUIRE(0 == buffer.size()); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/test/StaticJsonBuffer/startString.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #include 9 | #include 10 | 11 | TEST_CASE("StaticJsonBuffer::startString()") { 12 | SECTION("WorksWhenBufferIsBigEnough") { 13 | StaticJsonBuffer<6> jsonBuffer; 14 | 15 | StaticJsonBufferBase::String str = jsonBuffer.startString(); 16 | str.append('h'); 17 | str.append('e'); 18 | str.append('l'); 19 | str.append('l'); 20 | str.append('o'); 21 | 22 | REQUIRE(std::string("hello") == str.c_str()); 23 | } 24 | 25 | SECTION("ReturnsNullWhenTooSmall") { 26 | StaticJsonBuffer<5> jsonBuffer; 27 | 28 | StaticJsonBufferBase::String str = jsonBuffer.startString(); 29 | str.append('h'); 30 | str.append('e'); 31 | str.append('l'); 32 | str.append('l'); 33 | str.append('o'); 34 | 35 | REQUIRE(0 == str.c_str()); 36 | } 37 | 38 | SECTION("SizeIncreases") { 39 | StaticJsonBuffer<5> jsonBuffer; 40 | 41 | StaticJsonBufferBase::String str = jsonBuffer.startString(); 42 | REQUIRE(0 == jsonBuffer.size()); 43 | 44 | str.append('h'); 45 | REQUIRE(1 == jsonBuffer.size()); 46 | 47 | str.c_str(); 48 | REQUIRE(2 == jsonBuffer.size()); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/third-party/catch/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright Benoit Blanchon 2014-2017 2 | # MIT License 3 | # 4 | # Arduino JSON library 5 | # https://bblanchon.github.io/ArduinoJson/ 6 | # If you like this project, please add a star! 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 | -------------------------------------------------------------------------------- /libraries/ArduinoJson/third-party/catch/catch.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Benoit Blanchon 2014-2017 2 | // MIT License 3 | // 4 | // Arduino JSON library 5 | // https://bblanchon.github.io/ArduinoJson/ 6 | // If you like this project, please add a star! 7 | 8 | #define CATCH_CONFIG_MAIN 9 | #include "catch.hpp" 10 | -------------------------------------------------------------------------------- /libraries/ESP8266_Oled_Driver_for_SSD1306_display/SH1106.h: -------------------------------------------------------------------------------- 1 | /** 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2016 by Daniel Eichhorn 5 | * Copyright (c) 2016 by Fabrice Weinberg 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in all 15 | * copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | * SOFTWARE. 24 | * 25 | * Credits for parts of this code go to Mike Rankin. Thank you so much for sharing! 26 | */ 27 | 28 | #ifndef SH1106_h 29 | #define SH1106_h 30 | #include "SH1106Wire.h" 31 | 32 | // For make SH1106 an alias for SH1106Wire 33 | typedef SH1106Wire SH1106; 34 | 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /libraries/ESP8266_Oled_Driver_for_SSD1306_display/SSD1306.h: -------------------------------------------------------------------------------- 1 | /** 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2016 by Daniel Eichhorn 5 | * Copyright (c) 2016 by Fabrice Weinberg 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in all 15 | * copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | * SOFTWARE. 24 | * 25 | * Credits for parts of this code go to Mike Rankin. Thank you so much for sharing! 26 | */ 27 | 28 | #ifndef SSD1306_h 29 | #define SSD1306_h 30 | #include "SSD1306Wire.h" 31 | 32 | // For legacy support make SSD1306 an alias for SSD1306 33 | typedef SSD1306Wire SSD1306; 34 | 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /libraries/ESP8266_Oled_Driver_for_SSD1306_display/examples/SSD1306ClockDemo/images.h: -------------------------------------------------------------------------------- 1 | const char activeSymbol[] PROGMEM = { 2 | B00000000, 3 | B00000000, 4 | B00011000, 5 | B00100100, 6 | B01000010, 7 | B01000010, 8 | B00100100, 9 | B00011000 10 | }; 11 | 12 | const char inactiveSymbol[] PROGMEM = { 13 | B00000000, 14 | B00000000, 15 | B00000000, 16 | B00000000, 17 | B00011000, 18 | B00011000, 19 | B00000000, 20 | B00000000 21 | }; 22 | -------------------------------------------------------------------------------- /libraries/ESP8266_Oled_Driver_for_SSD1306_display/examples/SSD1306SimpleDemo/images.h: -------------------------------------------------------------------------------- 1 | #define WiFi_Logo_width 60 2 | #define WiFi_Logo_height 36 3 | const char WiFi_Logo_bits[] PROGMEM = { 4 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 5 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0x07, 0x00, 0x00, 0x00, 6 | 0x00, 0x00, 0xE0, 0xFF, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0xFF, 7 | 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0xFF, 0xFF, 0x00, 0x00, 0x00, 8 | 0x00, 0x00, 0xFE, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 9 | 0xFF, 0x03, 0x00, 0x00, 0x00, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 10 | 0x00, 0xFF, 0xFF, 0xFF, 0x07, 0xC0, 0x83, 0x01, 0x80, 0xFF, 0xFF, 0xFF, 11 | 0x01, 0x00, 0x07, 0x00, 0xC0, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x0C, 0x00, 12 | 0xC0, 0xFF, 0xFF, 0x7C, 0x00, 0x60, 0x0C, 0x00, 0xC0, 0x31, 0x46, 0x7C, 13 | 0xFC, 0x77, 0x08, 0x00, 0xE0, 0x23, 0xC6, 0x3C, 0xFC, 0x67, 0x18, 0x00, 14 | 0xE0, 0x23, 0xE4, 0x3F, 0x1C, 0x00, 0x18, 0x00, 0xE0, 0x23, 0x60, 0x3C, 15 | 0x1C, 0x70, 0x18, 0x00, 0xE0, 0x03, 0x60, 0x3C, 0x1C, 0x70, 0x18, 0x00, 16 | 0xE0, 0x07, 0x60, 0x3C, 0xFC, 0x73, 0x18, 0x00, 0xE0, 0x87, 0x70, 0x3C, 17 | 0xFC, 0x73, 0x18, 0x00, 0xE0, 0x87, 0x70, 0x3C, 0x1C, 0x70, 0x18, 0x00, 18 | 0xE0, 0x87, 0x70, 0x3C, 0x1C, 0x70, 0x18, 0x00, 0xE0, 0x8F, 0x71, 0x3C, 19 | 0x1C, 0x70, 0x18, 0x00, 0xC0, 0xFF, 0xFF, 0x3F, 0x00, 0x00, 0x08, 0x00, 20 | 0xC0, 0xFF, 0xFF, 0x1F, 0x00, 0x00, 0x0C, 0x00, 0x80, 0xFF, 0xFF, 0x1F, 21 | 0x00, 0x00, 0x06, 0x00, 0x80, 0xFF, 0xFF, 0x0F, 0x00, 0x00, 0x07, 0x00, 22 | 0x00, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0xF8, 0xFF, 0xFF, 23 | 0xFF, 0x7F, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFF, 0xFF, 0x01, 0x00, 0x00, 24 | 0x00, 0x00, 0xFC, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0xFF, 25 | 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x1F, 0x00, 0x00, 0x00, 26 | 0x00, 0x00, 0x80, 0xFF, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 27 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 28 | }; 29 | -------------------------------------------------------------------------------- /libraries/ESP8266_Oled_Driver_for_SSD1306_display/library.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ESP8266_SSD1306", 3 | "version": "3.2.7", 4 | "keywords": "ssd1306, oled, display, i2c", 5 | "description": "A I2C display driver for SSD1306 oled displays connected to an ESP8266 or ESP32", 6 | "repository": 7 | { 8 | "type": "git", 9 | "url": "https://github.com/squix78/esp8266-oled-ssd1306.git" 10 | }, 11 | "authors": 12 | [ 13 | { 14 | "name": "Daniel Eichhorn", 15 | "email": "squix78@gmail.com", 16 | "url": "http://blog.squix.ch" 17 | }, 18 | { 19 | "name": "Fabrice Weinberg", 20 | "email": "fabrice@weinberg.me" 21 | } 22 | ], 23 | "frameworks": "arduino", 24 | "platforms": [ 25 | "espressif8266", 26 | "espressif32" 27 | ] 28 | } 29 | -------------------------------------------------------------------------------- /libraries/ESP8266_Oled_Driver_for_SSD1306_display/library.properties: -------------------------------------------------------------------------------- 1 | name=ESP8266 and ESP32 Oled Driver for SSD1306 display 2 | version=3.2.7 3 | author=Daniel Eichhorn, Fabrice Weinberg 4 | maintainer=Daniel Eichhorn 5 | sentence=A I2C display driver for SSD1306 oled displays connected to an ESP8266 or ESP32 6 | paragraph=A I2C display driver for SSD1306 oled displays connected to an ESP8266 or ESP32 7 | category=Display 8 | url=https://github.com/squix78/esp8266-oled-ssd1306 9 | architectures=esp8266,esp32 10 | -------------------------------------------------------------------------------- /libraries/ESP8266_Oled_Driver_for_SSD1306_display/license: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 by Daniel Eichhorn 4 | Copyright (c) 2016 by Fabrice Weinberg 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | 24 | See more at http://blog.squix.ch 25 | -------------------------------------------------------------------------------- /libraries/ESP8266_Oled_Driver_for_SSD1306_display/resources/DemoFrame1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kersing/ESP-1ch-Gateway-v5.0-obsolete-/aa83dddbe973f87ae660cb6a48de093bb2071806/libraries/ESP8266_Oled_Driver_for_SSD1306_display/resources/DemoFrame1.jpg -------------------------------------------------------------------------------- /libraries/ESP8266_Oled_Driver_for_SSD1306_display/resources/DemoFrame2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kersing/ESP-1ch-Gateway-v5.0-obsolete-/aa83dddbe973f87ae660cb6a48de093bb2071806/libraries/ESP8266_Oled_Driver_for_SSD1306_display/resources/DemoFrame2.jpg -------------------------------------------------------------------------------- /libraries/ESP8266_Oled_Driver_for_SSD1306_display/resources/DemoFrame3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kersing/ESP-1ch-Gateway-v5.0-obsolete-/aa83dddbe973f87ae660cb6a48de093bb2071806/libraries/ESP8266_Oled_Driver_for_SSD1306_display/resources/DemoFrame3.jpg -------------------------------------------------------------------------------- /libraries/ESP8266_Oled_Driver_for_SSD1306_display/resources/DemoFrame4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kersing/ESP-1ch-Gateway-v5.0-obsolete-/aa83dddbe973f87ae660cb6a48de093bb2071806/libraries/ESP8266_Oled_Driver_for_SSD1306_display/resources/DemoFrame4.jpg -------------------------------------------------------------------------------- /libraries/ESP8266_Oled_Driver_for_SSD1306_display/resources/FontTool.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kersing/ESP-1ch-Gateway-v5.0-obsolete-/aa83dddbe973f87ae660cb6a48de093bb2071806/libraries/ESP8266_Oled_Driver_for_SSD1306_display/resources/FontTool.png -------------------------------------------------------------------------------- /libraries/ESP8266_Oled_Driver_for_SSD1306_display/resources/SPI_version.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kersing/ESP-1ch-Gateway-v5.0-obsolete-/aa83dddbe973f87ae660cb6a48de093bb2071806/libraries/ESP8266_Oled_Driver_for_SSD1306_display/resources/SPI_version.jpg -------------------------------------------------------------------------------- /libraries/ESP8266_Oled_Driver_for_SSD1306_display/resources/xbmPreview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kersing/ESP-1ch-Gateway-v5.0-obsolete-/aa83dddbe973f87ae660cb6a48de093bb2071806/libraries/ESP8266_Oled_Driver_for_SSD1306_display/resources/xbmPreview.png -------------------------------------------------------------------------------- /libraries/Streaming/Examples/streaming_example/streaming_example.pde: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void setup() 4 | { 5 | Serial.begin(9600); 6 | int lettera = 'A'; 7 | int month = 4, day = 17, year = 2009; 8 | 9 | Serial << "This is an example of the new streaming" << endl; 10 | Serial << "library. This allows you to print variables" << endl; 11 | Serial << "and strings without having to type line after" << endl; 12 | Serial << "line of Serial.print() calls. Examples: " << endl; 13 | 14 | Serial << "A is " << lettera << "." << endl; 15 | Serial << "The current date is " << day << "-" << month << "-" << year << "." << endl; 16 | 17 | Serial << "You can use modifiers too, for example:" << endl; 18 | Serial << _BYTE(lettera) << " is " << _HEX(lettera) << " in hex. " << endl; 19 | } 20 | 21 | void loop() 22 | {} 23 | -------------------------------------------------------------------------------- /libraries/Streaming/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map for Streaming 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | Streaming KEYWORD1 10 | 11 | ####################################### 12 | # Methods and Functions (KEYWORD2) 13 | ####################################### 14 | 15 | _HEX KEYWORD2 16 | _DEC KEYWORD2 17 | _OCT KEYWORD2 18 | _BIN KEYWORD2 19 | _BYTE KEYWORD2 20 | 21 | ####################################### 22 | # Constants (LITERAL1) 23 | ####################################### 24 | 25 | endl LITERAL1 26 | -------------------------------------------------------------------------------- /libraries/Time/Time.h: -------------------------------------------------------------------------------- 1 | #include "TimeLib.h" 2 | -------------------------------------------------------------------------------- /libraries/Time/examples/Processing/SyncArduinoClock/readme.txt: -------------------------------------------------------------------------------- 1 | SyncArduinoClock is a Processing sketch that responds to Arduino requests for 2 | time synchronization messages. 3 | 4 | The portIndex must be set the Serial port connected to Arduino. 5 | 6 | Download TimeSerial.pde onto Arduino and you should see the time 7 | message displayed when you run SyncArduinoClock in Processing. 8 | The Arduino time is set from the time on your computer through the 9 | Processing sketch. 10 | -------------------------------------------------------------------------------- /libraries/Time/examples/TimeArduinoDue/TimeArduinoDue.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * TimeRTC.pde 3 | * example code illustrating Time library with Real Time Clock. 4 | * 5 | * This example requires Markus Lange's Arduino Due RTC Library 6 | * https://github.com/MarkusLange/Arduino-Due-RTC-Library 7 | */ 8 | 9 | #include 10 | #include 11 | 12 | // Select the Slowclock source 13 | //RTC_clock rtc_clock(RC); 14 | RTC_clock rtc_clock(XTAL); 15 | 16 | void setup() { 17 | Serial.begin(9600); 18 | rtc_clock.init(); 19 | if (rtc_clock.date_already_set() == 0) { 20 | // Unfortunately, the Arduino Due hardware does not seem to 21 | // be designed to maintain the RTC clock state when the 22 | // board resets. Markus described it thusly: "Uhh the Due 23 | // does reset with the NRSTB pin. This resets the full chip 24 | // with all backup regions including RTC, RTT and SC. Only 25 | // if the reset is done with the NRST pin will these regions 26 | // stay with their old values." 27 | rtc_clock.set_time(__TIME__); 28 | rtc_clock.set_date(__DATE__); 29 | // However, this might work on other unofficial SAM3X boards 30 | // with different reset circuitry than Arduino Due? 31 | } 32 | setSyncProvider(getArduinoDueTime); 33 | if(timeStatus()!= timeSet) 34 | Serial.println("Unable to sync with the RTC"); 35 | else 36 | Serial.println("RTC has set the system time"); 37 | } 38 | 39 | time_t getArduinoDueTime() 40 | { 41 | return rtc_clock.unixtime(); 42 | } 43 | 44 | void loop() 45 | { 46 | digitalClockDisplay(); 47 | delay(1000); 48 | } 49 | 50 | void digitalClockDisplay(){ 51 | // digital clock display of the time 52 | Serial.print(hour()); 53 | printDigits(minute()); 54 | printDigits(second()); 55 | Serial.print(" "); 56 | Serial.print(day()); 57 | Serial.print(" "); 58 | Serial.print(month()); 59 | Serial.print(" "); 60 | Serial.print(year()); 61 | Serial.println(); 62 | } 63 | 64 | void printDigits(int digits){ 65 | // utility function for digital clock display: prints preceding colon and leading 0 66 | Serial.print(":"); 67 | if(digits < 10) 68 | Serial.print('0'); 69 | Serial.print(digits); 70 | } 71 | 72 | -------------------------------------------------------------------------------- /libraries/Time/examples/TimeRTC/TimeRTC.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * TimeRTC.pde 3 | * example code illustrating Time library with Real Time Clock. 4 | * 5 | */ 6 | 7 | #include 8 | #include 9 | #include // a basic DS1307 library that returns time as a time_t 10 | 11 | void setup() { 12 | Serial.begin(9600); 13 | while (!Serial) ; // wait until Arduino Serial Monitor opens 14 | setSyncProvider(RTC.get); // the function to get the time from the RTC 15 | if(timeStatus()!= timeSet) 16 | Serial.println("Unable to sync with the RTC"); 17 | else 18 | Serial.println("RTC has set the system time"); 19 | } 20 | 21 | void loop() 22 | { 23 | if (timeStatus() == timeSet) { 24 | digitalClockDisplay(); 25 | } else { 26 | Serial.println("The time has not been set. Please run the Time"); 27 | Serial.println("TimeRTCSet example, or DS1307RTC SetTime example."); 28 | Serial.println(); 29 | delay(4000); 30 | } 31 | delay(1000); 32 | } 33 | 34 | void digitalClockDisplay(){ 35 | // digital clock display of the time 36 | Serial.print(hour()); 37 | printDigits(minute()); 38 | printDigits(second()); 39 | Serial.print(" "); 40 | Serial.print(day()); 41 | Serial.print(" "); 42 | Serial.print(month()); 43 | Serial.print(" "); 44 | Serial.print(year()); 45 | Serial.println(); 46 | } 47 | 48 | void printDigits(int digits){ 49 | // utility function for digital clock display: prints preceding colon and leading 0 50 | Serial.print(":"); 51 | if(digits < 10) 52 | Serial.print('0'); 53 | Serial.print(digits); 54 | } 55 | 56 | -------------------------------------------------------------------------------- /libraries/Time/examples/TimeTeensy3/TimeTeensy3.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * TimeRTC.pde 3 | * example code illustrating Time library with Real Time Clock. 4 | * 5 | */ 6 | 7 | #include 8 | 9 | void setup() { 10 | // set the Time library to use Teensy 3.0's RTC to keep time 11 | setSyncProvider(getTeensy3Time); 12 | 13 | Serial.begin(115200); 14 | while (!Serial); // Wait for Arduino Serial Monitor to open 15 | delay(100); 16 | if (timeStatus()!= timeSet) { 17 | Serial.println("Unable to sync with the RTC"); 18 | } else { 19 | Serial.println("RTC has set the system time"); 20 | } 21 | } 22 | 23 | void loop() { 24 | if (Serial.available()) { 25 | time_t t = processSyncMessage(); 26 | if (t != 0) { 27 | Teensy3Clock.set(t); // set the RTC 28 | setTime(t); 29 | } 30 | } 31 | digitalClockDisplay(); 32 | delay(1000); 33 | } 34 | 35 | void digitalClockDisplay() { 36 | // digital clock display of the time 37 | Serial.print(hour()); 38 | printDigits(minute()); 39 | printDigits(second()); 40 | Serial.print(" "); 41 | Serial.print(day()); 42 | Serial.print(" "); 43 | Serial.print(month()); 44 | Serial.print(" "); 45 | Serial.print(year()); 46 | Serial.println(); 47 | } 48 | 49 | time_t getTeensy3Time() 50 | { 51 | return Teensy3Clock.get(); 52 | } 53 | 54 | /* code to process time sync messages from the serial port */ 55 | #define TIME_HEADER "T" // Header tag for serial time sync message 56 | 57 | unsigned long processSyncMessage() { 58 | unsigned long pctime = 0L; 59 | const unsigned long DEFAULT_TIME = 1357041600; // Jan 1 2013 60 | 61 | if(Serial.find(TIME_HEADER)) { 62 | pctime = Serial.parseInt(); 63 | return pctime; 64 | if( pctime < DEFAULT_TIME) { // check the value is a valid time (greater than Jan 1 2013) 65 | pctime = 0L; // return 0 to indicate that the time is not valid 66 | } 67 | } 68 | return pctime; 69 | } 70 | 71 | void printDigits(int digits){ 72 | // utility function for digital clock display: prints preceding colon and leading 0 73 | Serial.print(":"); 74 | if(digits < 10) 75 | Serial.print('0'); 76 | Serial.print(digits); 77 | } 78 | 79 | -------------------------------------------------------------------------------- /libraries/Time/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map For Time 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | time_t KEYWORD1 9 | ####################################### 10 | # Methods and Functions (KEYWORD2) 11 | ####################################### 12 | now KEYWORD2 13 | second KEYWORD2 14 | minute KEYWORD2 15 | hour KEYWORD2 16 | day KEYWORD2 17 | month KEYWORD2 18 | year KEYWORD2 19 | isAM KEYWORD2 20 | isPM KEYWORD2 21 | weekday KEYWORD2 22 | setTime KEYWORD2 23 | adjustTime KEYWORD2 24 | setSyncProvider KEYWORD2 25 | setSyncInterval KEYWORD2 26 | timeStatus KEYWORD2 27 | TimeLib KEYWORD2 28 | ####################################### 29 | # Instances (KEYWORD2) 30 | ####################################### 31 | 32 | ####################################### 33 | # Constants (LITERAL1) 34 | ####################################### 35 | -------------------------------------------------------------------------------- /libraries/Time/library.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Time", 3 | "frameworks": "Arduino", 4 | "keywords": "Time, date, hour, minute, second, day, week, month, year, RTC", 5 | "description": "Time keeping library", 6 | "url": "http://playground.arduino.cc/Code/Time", 7 | "authors": 8 | [ 9 | { 10 | "name": "Michael Margolis" 11 | }, 12 | { 13 | "name": "Paul Stoffregen" 14 | } 15 | ], 16 | "repository": 17 | { 18 | "type": "git", 19 | "url": "https://github.com/PaulStoffregen/Time" 20 | } 21 | } 22 | 23 | -------------------------------------------------------------------------------- /libraries/Time/library.properties: -------------------------------------------------------------------------------- 1 | name=Time 2 | version=1.5 3 | author=Michael Margolis 4 | maintainer=Paul Stoffregen 5 | sentence=Timekeeping functionality for Arduino 6 | paragraph=Date and Time functions, with provisions to synchronize to external time sources like GPS and NTP (Internet). This library is often used together with TimeAlarms and DS1307RTC. 7 | category=Timing 8 | url=http://playground.arduino.cc/code/time 9 | architectures=* 10 | 11 | -------------------------------------------------------------------------------- /libraries/WebServer_tng/.gitignore: -------------------------------------------------------------------------------- 1 | # Prerequisites 2 | *.d 3 | 4 | # Compiled Object files 5 | *.slo 6 | *.lo 7 | *.o 8 | *.obj 9 | 10 | # Precompiled Headers 11 | *.gch 12 | *.pch 13 | 14 | # Compiled Dynamic libraries 15 | *.so 16 | *.dylib 17 | *.dll 18 | 19 | # Fortran module files 20 | *.mod 21 | *.smod 22 | 23 | # Compiled Static libraries 24 | *.lai 25 | *.la 26 | *.a 27 | *.lib 28 | 29 | # Executables 30 | *.exe 31 | *.out 32 | *.app 33 | -------------------------------------------------------------------------------- /libraries/WebServer_tng/README.md: -------------------------------------------------------------------------------- 1 | # WebServer 2 | ESP8266/ESP32 WebServer library 3 | 4 | This is an experimental port of the ESP8266WebServer library that should work 5 | on ESP8266 and ESP32. This is NOT an official repo supported by Espressif. Do 6 | not depend on this code for anything important or expect it to be updated. Once 7 | the official repo is created, this repo will be deleted. 8 | 9 | Added Travis CI 10 | -------------------------------------------------------------------------------- /libraries/WebServer_tng/examples/FSBrowser/data/edit.htm.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kersing/ESP-1ch-Gateway-v5.0-obsolete-/aa83dddbe973f87ae660cb6a48de093bb2071806/libraries/WebServer_tng/examples/FSBrowser/data/edit.htm.gz -------------------------------------------------------------------------------- /libraries/WebServer_tng/examples/FSBrowser/data/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kersing/ESP-1ch-Gateway-v5.0-obsolete-/aa83dddbe973f87ae660cb6a48de093bb2071806/libraries/WebServer_tng/examples/FSBrowser/data/favicon.ico -------------------------------------------------------------------------------- /libraries/WebServer_tng/examples/FSBrowser/data/graphs.js.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kersing/ESP-1ch-Gateway-v5.0-obsolete-/aa83dddbe973f87ae660cb6a48de093bb2071806/libraries/WebServer_tng/examples/FSBrowser/data/graphs.js.gz -------------------------------------------------------------------------------- /libraries/WebServer_tng/examples/HelloServer/HelloServer.ino: -------------------------------------------------------------------------------- 1 | #ifdef ESP8266 2 | #include 3 | #include 4 | #include 5 | #include 6 | ESP8266WebServer server(80); 7 | #else 8 | #include 9 | #include 10 | #include 11 | #include 12 | WebServer server(80); 13 | #endif 14 | 15 | const char* ssid = "........"; 16 | const char* password = "........"; 17 | 18 | #ifdef LED_BUILTIN 19 | const int led = LED_BUILTIN; 20 | #else 21 | const int led = 13; 22 | #endif 23 | 24 | void handleRoot() { 25 | digitalWrite(led, 1); 26 | #ifdef ESP8266 27 | server.send(200, "text/plain", "hello from esp8266!"); 28 | #else 29 | server.send(200, "text/plain", "hello from esp32!"); 30 | #endif 31 | digitalWrite(led, 0); 32 | } 33 | 34 | void handleNotFound(){ 35 | digitalWrite(led, 1); 36 | String message = "File Not Found\n\n"; 37 | message += "URI: "; 38 | message += server.uri(); 39 | message += "\nMethod: "; 40 | message += (server.method() == HTTP_GET)?"GET":"POST"; 41 | message += "\nArguments: "; 42 | message += server.args(); 43 | message += "\n"; 44 | for (uint8_t i=0; i 3 | #include 4 | #include 5 | #include 6 | ESP8266WebServer server(80); 7 | #else 8 | #include 9 | #include 10 | #include 11 | #include 12 | WebServer server(80); 13 | #endif 14 | 15 | const char* ssid = "........"; 16 | const char* password = "........"; 17 | 18 | const char* www_username = "admin"; 19 | const char* www_password = "esp8266esp32"; 20 | 21 | void setup() { 22 | Serial.begin(115200); 23 | WiFi.mode(WIFI_STA); 24 | WiFi.begin(ssid, password); 25 | if(WiFi.waitForConnectResult() != WL_CONNECTED) { 26 | Serial.println("WiFi Connect Failed! Rebooting..."); 27 | delay(1000); 28 | ESP.restart(); 29 | } 30 | ArduinoOTA.begin(); 31 | 32 | server.on("/", [](){ 33 | if(!server.authenticate(www_username, www_password)) 34 | return server.requestAuthentication(); 35 | server.send(200, "text/plain", "Login OK"); 36 | }); 37 | server.begin(); 38 | 39 | Serial.print("Open http://"); 40 | Serial.print(WiFi.localIP()); 41 | Serial.println("/ in your browser to see it working"); 42 | } 43 | 44 | void loop() { 45 | ArduinoOTA.handle(); 46 | server.handleClient(); 47 | } 48 | -------------------------------------------------------------------------------- /libraries/WebServer_tng/examples/SDWebServer/SdRoot/index.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | ESP Index 6 | 12 | 17 | 18 | 19 |

ESP8266 Pin Functions

20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /libraries/WebServer_tng/examples/SDWebServer/SdRoot/pins.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kersing/ESP-1ch-Gateway-v5.0-obsolete-/aa83dddbe973f87ae660cb6a48de093bb2071806/libraries/WebServer_tng/examples/SDWebServer/SdRoot/pins.png -------------------------------------------------------------------------------- /libraries/WebServer_tng/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map For Ultrasound 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | ESP8266WebServer KEYWORD1 10 | HTTPMethod KEYWORD1 11 | 12 | ####################################### 13 | # Methods and Functions (KEYWORD2) 14 | ####################################### 15 | 16 | begin KEYWORD2 17 | handleClient KEYWORD2 18 | on KEYWORD2 19 | addHandler KEYWORD2 20 | uri KEYWORD2 21 | method KEYWORD2 22 | client KEYWORD2 23 | send KEYWORD2 24 | arg KEYWORD2 25 | argName KEYWORD2 26 | args KEYWORD2 27 | hasArg KEYWORD2 28 | onNotFound KEYWORD2 29 | 30 | ####################################### 31 | # Constants (LITERAL1) 32 | ####################################### 33 | 34 | HTTP_GET LITERAL1 35 | HTTP_POST LITERAL1 36 | HTTP_ANY LITERAL1 37 | -------------------------------------------------------------------------------- /libraries/WebServer_tng/library.properties: -------------------------------------------------------------------------------- 1 | name=WebServer 2 | version=1.0 3 | author=Ivan Grokhotkov 4 | maintainer=Ivan Grokhtkov 5 | sentence=Simple web server library 6 | paragraph=The library supports HTTP GET and POST requests, provides argument parsing, handles one client at a time. 7 | category=Communication 8 | url= 9 | architectures=esp8266,esp32 10 | -------------------------------------------------------------------------------- /libraries/WebServer_tng/src/ESP8266WebServer.h: -------------------------------------------------------------------------------- 1 | /* 2 | ESP8266WebServer.h - Dead simple web-server. 3 | Supports only one simultaneous client, knows how to handle GET and POST. 4 | 5 | Copyright (c) 2014 Ivan Grokhotkov. All rights reserved. 6 | 7 | This library is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU Lesser General Public 9 | License as published by the Free Software Foundation; either 10 | version 2.1 of the License, or (at your option) any later version. 11 | 12 | This library is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | Lesser General Public License for more details. 16 | 17 | You should have received a copy of the GNU Lesser General Public 18 | License along with this library; if not, write to the Free Software 19 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 20 | Modified 8 May 2015 by Hristo Gochkov (proper post and file upload handling) 21 | */ 22 | 23 | 24 | #ifndef ESP8266WEBSERVER_H 25 | #define ESP8266WEBSERVER_H 26 | 27 | #include 28 | 29 | #endif //ESP8266WEBSERVER_H 30 | -------------------------------------------------------------------------------- /libraries/WebServer_tng/src/detail/RequestHandler.h: -------------------------------------------------------------------------------- 1 | #ifndef REQUESTHANDLER_H 2 | #define REQUESTHANDLER_H 3 | 4 | class RequestHandler { 5 | public: 6 | virtual ~RequestHandler() { } 7 | virtual bool canHandle(HTTPMethod method, String uri) { (void) method; (void) uri; return false; } 8 | virtual bool canUpload(String uri) { (void) uri; return false; } 9 | virtual bool handle(WebServer& server, HTTPMethod requestMethod, String requestUri) { (void) server; (void) requestMethod; (void) requestUri; return false; } 10 | virtual void upload(WebServer& server, String requestUri, HTTPUpload& upload) { (void) server; (void) requestUri; (void) upload; } 11 | 12 | RequestHandler* next() { return _next; } 13 | void next(RequestHandler* r) { _next = r; } 14 | 15 | private: 16 | RequestHandler* _next = nullptr; 17 | }; 18 | 19 | #endif //REQUESTHANDLER_H 20 | -------------------------------------------------------------------------------- /libraries/WiFiEsp/CHANGES.txt: -------------------------------------------------------------------------------- 1 | 2.2.1 (2017-01-02) 2 | * Fixing Issue #69 (Can't declare member function to have static linkage) 3 | * Supporting ESP8266 firmware 2.X 4 | 5 | 2.1.2 (2016-05-08) 6 | * Added retry in EspDrv::wifiDriverInit method 7 | * Clean buffer in ScanNetwork (bug #43) 8 | 9 | 2.1.1 (2016-05-09) 10 | * Implemented gatwayIP() and subnetMask() methods 11 | 12 | 2.1 (2016-03-13) 13 | * SSL connection support 14 | * Implementation of config and configAP methods 15 | * Fixed read methods WiFiEspClient.read(buf, size) and WiFiEspUDP::read(buf, size) 16 | * Fixed possible buffer overflow in EspDrv.sendCmdGet 17 | * Added beginAP methods similar to WiFi101 library - parameters order for beginAP is now different! 18 | 19 | 1.6 (2016-02-21) 20 | * Improved UDP support 21 | * Added WiFiEspClient.remoteIP() method 22 | * Consistent use use of uint16_t to manage port numbers 23 | * Added AT+CIPDINFO=1 during init to return remote IP and port with IPD 24 | * Added AT+CWAUTOCONN=0 during init to disable autoconnect 25 | 26 | 1.5.1 (2016-02-11) 27 | * Fix in EspDrv.getScanNetworks method 28 | * Fix buffer overflow in getFwVersion 29 | 30 | 1.5 (2016-01-25) 31 | * Implemented scanNetworks method 32 | * Increased ring buffer size to 32 to read long SSID names 33 | 34 | 1.4.2 (2016-01-05) 35 | * Fixed compilation problem when using WiFiEspClient.print 36 | 37 | 1.4.1 (2016-01-05) 38 | * Speed optimizations 39 | 40 | 1.4 (2016-01-04) 41 | * Reduced dynamic memory footprint 42 | 43 | 1.3 (2016-01-03) 44 | * UDP support (experimental) 45 | * Fixed WiFiEspClient.connected and WiFi.status and methods 46 | * Connection close detection 47 | * Ring buffer optimization 48 | * Client peek method fixed 49 | 50 | 1.2 (2015-12-29) 51 | * Redesigned WiFi.init method to accept a Stream object 52 | * Use CUR when starting the AP 53 | * Small improvements to samples 54 | 55 | 1.1 (2015-12-20) 56 | * Fix for receiving large data packets 57 | * Access point mode support 58 | * Ring buffer class is now used in EspDrv.cpp 59 | * Removed not implemented methods 60 | * Prints firmware version if not recognized 61 | * Multiple exclamation marks fixed for Arduino Mega 62 | * Cleaned up comments 63 | 64 | 1.0 (2015-12-11) 65 | * First stable release 66 | -------------------------------------------------------------------------------- /libraries/WiFiEsp/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map For WiFiEsp 3 | ####################################### 4 | 5 | ####################################### 6 | # Library (KEYWORD3) 7 | ####################################### 8 | 9 | WiFiEsp KEYWORD3 10 | 11 | 12 | ####################################### 13 | # Datatypes (KEYWORD1) 14 | ####################################### 15 | 16 | WiFiEspClient KEYWORD1 17 | WiFiEspServer KEYWORD1 18 | WiFiEspUDP KEYWORD1 19 | RingBuffer KEYWORD1 20 | 21 | ####################################### 22 | # Methods and Functions (KEYWORD2) 23 | ####################################### 24 | 25 | firmwareVersion KEYWORD2 26 | status KEYWORD2 27 | connect KEYWORD2 28 | write KEYWORD2 29 | available KEYWORD2 30 | config KEYWORD2 31 | setDNS KEYWORD2 32 | read KEYWORD2 33 | flush KEYWORD2 34 | stop KEYWORD2 35 | connected KEYWORD2 36 | begin KEYWORD2 37 | disconnect KEYWORD2 38 | macAddress KEYWORD2 39 | localIP KEYWORD2 40 | subnetMask KEYWORD2 41 | gatewayIP KEYWORD2 42 | scanNetworks KEYWORD2 43 | SSID KEYWORD2 44 | BSSID KEYWORD2 45 | RSSI KEYWORD2 46 | encryptionType KEYWORD2 47 | getResult KEYWORD2 48 | getSocket KEYWORD2 49 | beginPacket KEYWORD2 50 | endPacket KEYWORD2 51 | parsePacket KEYWORD2 52 | remoteIP KEYWORD2 53 | remotePort KEYWORD2 54 | 55 | 56 | ####################################### 57 | # Constants (LITERAL1) 58 | ####################################### 59 | 60 | -------------------------------------------------------------------------------- /libraries/WiFiEsp/library.properties: -------------------------------------------------------------------------------- 1 | name=WiFiEsp 2 | version=2.2.1 3 | author=bportaluri 4 | maintainer=Bruno Portaluri 5 | sentence=Arduino WiFi library for ESP8266 6 | paragraph=Arduino WiFi library for ESP8266. Works only with SDK version 1.1.1 and above (AT version 0.25 and above). 7 | category=Other 8 | url=https://github.com/bportaluri/WiFiEsp 9 | architectures=* -------------------------------------------------------------------------------- /libraries/WiFiEsp/src/WiFiEspServer.h: -------------------------------------------------------------------------------- 1 | /*-------------------------------------------------------------------- 2 | This file is part of the Arduino WiFiEsp library. 3 | 4 | The Arduino WiFiEsp library is free software: you can redistribute it 5 | and/or modify it under the terms of the GNU General Public License as 6 | published by the Free Software Foundation, either version 3 of the 7 | License, or (at your option) any later version. 8 | 9 | The Arduino WiFiEsp library is distributed in the hope that it will be 10 | useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with The Arduino WiFiEsp library. If not, see 16 | . 17 | --------------------------------------------------------------------*/ 18 | 19 | #ifndef WiFiEspServer_h 20 | #define WiFiEspServer_h 21 | 22 | #include 23 | 24 | #include "WiFiEsp.h" 25 | 26 | 27 | class WiFiEspClient; 28 | 29 | class WiFiEspServer : public Server 30 | { 31 | 32 | public: 33 | WiFiEspServer(uint16_t port); 34 | 35 | 36 | /* 37 | * Gets a client that is connected to the server and has data available for reading. 38 | * The connection persists when the returned client object goes out of scope; you can close it by calling client.stop(). 39 | * Returns a Client object; if no Client has data available for reading, this object will evaluate to false in an if-statement. 40 | */ 41 | WiFiEspClient available(uint8_t* status = NULL); 42 | 43 | /* 44 | * Start the TCP server 45 | */ 46 | void begin(); 47 | 48 | virtual size_t write(uint8_t); 49 | virtual size_t write(const uint8_t *buf, size_t size); 50 | 51 | uint8_t status(); 52 | 53 | using Print::write; 54 | 55 | 56 | private: 57 | uint16_t _port; 58 | uint8_t _sock; 59 | bool _started; 60 | 61 | }; 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /libraries/WiFiEsp/src/utility/RingBuffer.h: -------------------------------------------------------------------------------- 1 | /*-------------------------------------------------------------------- 2 | This file is part of the Arduino WiFiEsp library. 3 | 4 | The Arduino WiFiEsp library is free software: you can redistribute it 5 | and/or modify it under the terms of the GNU General Public License as 6 | published by the Free Software Foundation, either version 3 of the 7 | License, or (at your option) any later version. 8 | 9 | The Arduino WiFiEsp library is distributed in the hope that it will be 10 | useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with The Arduino WiFiEsp library. If not, see 16 | . 17 | --------------------------------------------------------------------*/ 18 | 19 | #ifndef RingBuffer_h 20 | #define RingBuffer_h 21 | 22 | 23 | class RingBuffer 24 | { 25 | public: 26 | RingBuffer(unsigned int size); 27 | ~RingBuffer(); 28 | 29 | void reset(); 30 | void init(); 31 | void push(char c); 32 | int getPos(); 33 | bool endsWith(const char* str); 34 | void getStr(char * destination, unsigned int skipChars); 35 | void getStrN(char * destination, unsigned int skipChars, unsigned int num); 36 | 37 | 38 | private: 39 | 40 | unsigned int _size; 41 | char* ringBuf; 42 | char* ringBufEnd; 43 | char* ringBufP; 44 | 45 | }; 46 | 47 | #endif -------------------------------------------------------------------------------- /libraries/WiFiEsp/test/EspDebug/EspDebug.ino: -------------------------------------------------------------------------------- 1 | // EspDebug - Test sketch for ESP8266 module 2 | 3 | #include "Arduino.h" 4 | 5 | // Emulate Serial1 on pins 7/6 if not present 6 | #ifndef HAVE_HWSERIAL1 7 | #include "SoftwareSerial.h" 8 | SoftwareSerial Serial1(6, 7); // RX, TX 9 | #endif 10 | 11 | void setup() 12 | { 13 | Serial.begin(115200); // serial port used for debugging 14 | Serial1.begin(9600); // your ESP's baud rate might be different 15 | } 16 | 17 | void loop() 18 | { 19 | if(Serial1.available()) // check if the ESP is sending a message 20 | { 21 | while(Serial1.available()) 22 | { 23 | int c = Serial1.read(); // read the next character 24 | Serial.write((char)c); // writes data to the serial monitor 25 | } 26 | } 27 | 28 | if(Serial.available()) 29 | { 30 | // wait to let all the input command in the serial buffer 31 | delay(10); 32 | 33 | // read the input command in a string 34 | String cmd = ""; 35 | while(Serial.available()) 36 | { 37 | cmd += (char)Serial.read(); 38 | } 39 | 40 | // print the command and send it to the ESP 41 | Serial.println(); 42 | Serial.print(">>>> "); 43 | Serial.println(cmd); 44 | 45 | // send the read character to the ESP 46 | Serial1.print(cmd); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /libraries/WiFiEsp/test/RingBufferTest/RingBufferTest.ino: -------------------------------------------------------------------------------- 1 | /* 2 | WiFiEsp test: RingBufferTest 3 | 4 | Test of the RingBuffer class. 5 | */ 6 | 7 | #include "WiFiEsp.h" 8 | 9 | RingBuffer buf(5); 10 | 11 | 12 | void setup() 13 | { 14 | Serial.begin(115200); 15 | 16 | Serial.println("Starting tests"); 17 | 18 | buf.init(); 19 | 20 | buf.push('a'); 21 | assert(10, buf.endsWith("a"), true); 22 | assert(11, buf.endsWith("A"), false); 23 | assert(12, buf.endsWith("ab"), false); 24 | 25 | buf.push('b'); 26 | assert(21, buf.endsWith("a"), false); 27 | assert(22, buf.endsWith("A"), false); 28 | assert(23, buf.endsWith("ab"), true); 29 | 30 | buf.push('c'); 31 | buf.push('d'); 32 | buf.push('e'); 33 | assert(31, buf.endsWith("abcde"), true); 34 | assert(32, buf.endsWith("de"), true); 35 | 36 | buf.push('f'); 37 | assert(43, buf.endsWith("bcdef"), true); 38 | assert(44, buf.endsWith("ef"), true); 39 | 40 | Serial.println("Done"); 41 | } 42 | 43 | 44 | void loop() 45 | { 46 | // nothing to do 47 | } 48 | 49 | 50 | void assert(int i, bool x, bool y) 51 | { 52 | if (x!=y) 53 | { 54 | Serial.print ("FAIL "); 55 | Serial.println(i); 56 | } 57 | } 58 | 59 | -------------------------------------------------------------------------------- /libraries/WiFiManager/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 tzapu 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /libraries/WiFiManager/examples/AutoConnect/AutoConnect.ino: -------------------------------------------------------------------------------- 1 | #include //https://github.com/esp8266/Arduino 2 | 3 | //needed for library 4 | #include 5 | #include 6 | #include //https://github.com/tzapu/WiFiManager 7 | 8 | 9 | void setup() { 10 | // put your setup code here, to run once: 11 | Serial.begin(115200); 12 | 13 | //WiFiManager 14 | //Local intialization. Once its business is done, there is no need to keep it around 15 | WiFiManager wifiManager; 16 | //reset saved settings 17 | //wifiManager.resetSettings(); 18 | 19 | //set custom ip for portal 20 | //wifiManager.setAPConfig(IPAddress(10,0,1,1), IPAddress(10,0,1,1), IPAddress(255,255,255,0)); 21 | 22 | //fetches ssid and pass from eeprom and tries to connect 23 | //if it does not connect it starts an access point with the specified name 24 | //here "AutoConnectAP" 25 | //and goes into a blocking loop awaiting configuration 26 | wifiManager.autoConnect("AutoConnectAP"); 27 | //or use this for auto generated name ESP + ChipID 28 | //wifiManager.autoConnect(); 29 | 30 | 31 | //if you get here you have connected to the WiFi 32 | Serial.println("connected...yeey :)"); 33 | } 34 | 35 | void loop() { 36 | // put your main code here, to run repeatedly: 37 | 38 | } 39 | -------------------------------------------------------------------------------- /libraries/WiFiManager/examples/AutoConnectWithFeedback/AutoConnectWithFeedback.ino: -------------------------------------------------------------------------------- 1 | #include //https://github.com/esp8266/Arduino 2 | 3 | //needed for library 4 | #include 5 | #include 6 | #include "WiFiManager.h" //https://github.com/tzapu/WiFiManager 7 | 8 | void configModeCallback (WiFiManager *myWiFiManager) { 9 | Serial.println("Entered config mode"); 10 | Serial.println(WiFi.softAPIP()); 11 | //if you used auto generated SSID, print it 12 | Serial.println(myWiFiManager->getConfigPortalSSID()); 13 | } 14 | 15 | void setup() { 16 | // put your setup code here, to run once: 17 | Serial.begin(115200); 18 | 19 | //WiFiManager 20 | //Local intialization. Once its business is done, there is no need to keep it around 21 | WiFiManager wifiManager; 22 | //reset settings - for testing 23 | //wifiManager.resetSettings(); 24 | 25 | //set callback that gets called when connecting to previous WiFi fails, and enters Access Point mode 26 | wifiManager.setAPCallback(configModeCallback); 27 | 28 | //fetches ssid and pass and tries to connect 29 | //if it does not connect it starts an access point with the specified name 30 | //here "AutoConnectAP" 31 | //and goes into a blocking loop awaiting configuration 32 | if(!wifiManager.autoConnect()) { 33 | Serial.println("failed to connect and hit timeout"); 34 | //reset and try again, or maybe put it to deep sleep 35 | ESP.reset(); 36 | delay(1000); 37 | } 38 | 39 | //if you get here you have connected to the WiFi 40 | Serial.println("connected...yeey :)"); 41 | 42 | } 43 | 44 | void loop() { 45 | // put your main code here, to run repeatedly: 46 | 47 | } 48 | -------------------------------------------------------------------------------- /libraries/WiFiManager/examples/AutoConnectWithReset/AutoConnectWithReset.ino: -------------------------------------------------------------------------------- 1 | #include //this needs to be first, or it all crashes and burns... 2 | 3 | #include //https://github.com/esp8266/Arduino 4 | 5 | //needed for library 6 | #include 7 | #include 8 | #include //https://github.com/tzapu/WiFiManager 9 | 10 | void setup() { 11 | // put your setup code here, to run once: 12 | Serial.begin(115200); 13 | Serial.println(); 14 | 15 | //WiFiManager 16 | //Local intialization. Once its business is done, there is no need to keep it around 17 | WiFiManager wifiManager; 18 | 19 | //exit after config instead of connecting 20 | wifiManager.setBreakAfterConfig(true); 21 | 22 | //reset settings - for testing 23 | //wifiManager.resetSettings(); 24 | 25 | 26 | //tries to connect to last known settings 27 | //if it does not connect it starts an access point with the specified name 28 | //here "AutoConnectAP" with password "password" 29 | //and goes into a blocking loop awaiting configuration 30 | if (!wifiManager.autoConnect("AutoConnectAP", "password")) { 31 | Serial.println("failed to connect, we should reset as see if it connects"); 32 | delay(3000); 33 | ESP.reset(); 34 | delay(5000); 35 | } 36 | 37 | //if you get here you have connected to the WiFi 38 | Serial.println("connected...yeey :)"); 39 | 40 | 41 | Serial.println("local ip"); 42 | Serial.println(WiFi.localIP()); 43 | } 44 | 45 | void loop() { 46 | // put your main code here, to run repeatedly: 47 | 48 | 49 | } 50 | -------------------------------------------------------------------------------- /libraries/WiFiManager/examples/AutoConnectWithTimeout/AutoConnectWithTimeout.ino: -------------------------------------------------------------------------------- 1 | #include //https://github.com/esp8266/Arduino 2 | 3 | //needed for library 4 | #include 5 | #include 6 | #include //https://github.com/tzapu/WiFiManager 7 | 8 | 9 | 10 | void setup() { 11 | // put your setup code here, to run once: 12 | Serial.begin(115200); 13 | 14 | //WiFiManager 15 | //Local intialization. Once its business is done, there is no need to keep it around 16 | WiFiManager wifiManager; 17 | //reset settings - for testing 18 | //wifiManager.resetSettings(); 19 | 20 | //sets timeout until configuration portal gets turned off 21 | //useful to make it all retry or go to sleep 22 | //in seconds 23 | wifiManager.setTimeout(180); 24 | 25 | //fetches ssid and pass and tries to connect 26 | //if it does not connect it starts an access point with the specified name 27 | //here "AutoConnectAP" 28 | //and goes into a blocking loop awaiting configuration 29 | if(!wifiManager.autoConnect("AutoConnectAP")) { 30 | Serial.println("failed to connect and hit timeout"); 31 | delay(3000); 32 | //reset and try again, or maybe put it to deep sleep 33 | ESP.reset(); 34 | delay(5000); 35 | } 36 | 37 | //if you get here you have connected to the WiFi 38 | Serial.println("connected...yeey :)"); 39 | 40 | } 41 | 42 | void loop() { 43 | // put your main code here, to run repeatedly: 44 | 45 | } 46 | -------------------------------------------------------------------------------- /libraries/WiFiManager/examples/OnDemandConfigPortal/OnDemandConfigPortal.ino: -------------------------------------------------------------------------------- 1 | #include //https://github.com/esp8266/Arduino 2 | 3 | //needed for library 4 | #include 5 | #include 6 | #include //https://github.com/tzapu/WiFiManager 7 | 8 | // select wich pin will trigger the configuraton portal when set to LOW 9 | // ESP-01 users please note: the only pins available (0 and 2), are shared 10 | // with the bootloader, so always set them HIGH at power-up 11 | #define TRIGGER_PIN 0 12 | 13 | 14 | void setup() { 15 | // put your setup code here, to run once: 16 | Serial.begin(115200); 17 | Serial.println("\n Starting"); 18 | 19 | pinMode(TRIGGER_PIN, INPUT); 20 | } 21 | 22 | 23 | void loop() { 24 | // is configuration portal requested? 25 | if ( digitalRead(TRIGGER_PIN) == LOW ) { 26 | //WiFiManager 27 | //Local intialization. Once its business is done, there is no need to keep it around 28 | WiFiManager wifiManager; 29 | 30 | //reset settings - for testing 31 | //wifiManager.resetSettings(); 32 | 33 | //sets timeout until configuration portal gets turned off 34 | //useful to make it all retry or go to sleep 35 | //in seconds 36 | //wifiManager.setTimeout(120); 37 | 38 | //it starts an access point with the specified name 39 | //here "AutoConnectAP" 40 | //and goes into a blocking loop awaiting configuration 41 | 42 | //WITHOUT THIS THE AP DOES NOT SEEM TO WORK PROPERLY WITH SDK 1.5 , update to at least 1.5.1 43 | //WiFi.mode(WIFI_STA); 44 | 45 | if (!wifiManager.startConfigPortal("OnDemandAP")) { 46 | Serial.println("failed to connect and hit timeout"); 47 | delay(3000); 48 | //reset and try again, or maybe put it to deep sleep 49 | ESP.reset(); 50 | delay(5000); 51 | } 52 | 53 | //if you get here you have connected to the WiFi 54 | Serial.println("connected...yeey :)"); 55 | } 56 | 57 | 58 | // put your main code here, to run repeatedly: 59 | 60 | } 61 | -------------------------------------------------------------------------------- /libraries/WiFiManager/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map For WifiManager 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | WiFiManager KEYWORD1 10 | WiFiManagerParameter KEYWORD1 11 | 12 | 13 | ####################################### 14 | # Methods and Functions (KEYWORD2) 15 | ####################################### 16 | autoConnect KEYWORD2 17 | getSSID KEYWORD2 18 | getPassword KEYWORD2 19 | getConfigPortalSSID KEYWORD2 20 | resetSettings KEYWORD2 21 | setConfigPortalTimeout KEYWORD2 22 | setConnectTimeout KEYWORD2 23 | setDebugOutput KEYWORD2 24 | setMinimumSignalQuality KEYWORD2 25 | setAPStaticIPConfig KEYWORD2 26 | setSTAStaticIPConfig KEYWORD2 27 | setAPCallback KEYWORD2 28 | setSaveConfigCallback KEYWORD2 29 | addParameter KEYWORD2 30 | getID KEYWORD2 31 | getValue KEYWORD2 32 | getPlaceholder KEYWORD2 33 | getValueLength KEYWORD2 34 | 35 | ####################################### 36 | # Constants (LITERAL1) 37 | ####################################### 38 | 39 | # LITERAL1 40 | -------------------------------------------------------------------------------- /libraries/WiFiManager/library.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "WifiManager", 3 | "keywords": "wifi, wi-fi", 4 | "description": "ESP8266 WiFi Connection manager with fallback web configuration portal", 5 | "repository": 6 | { 7 | "type": "git", 8 | "url": "https://github.com/tzapu/WiFiManager.git" 9 | }, 10 | "frameworks": "arduino", 11 | "platforms": "espressif", 12 | "version": "0.12" 13 | } 14 | -------------------------------------------------------------------------------- /libraries/WiFiManager/library.properties: -------------------------------------------------------------------------------- 1 | name=WiFiManager 2 | version=0.12 3 | author=tzapu 4 | maintainer=tzapu 5 | sentence=ESP8266 WiFi Connection manager with fallback web configuration portal 6 | paragraph=Library for configuring ESP8266 modules WiFi credentials at runtime. 7 | category=Communication 8 | url=https://github.com/tzapu/WiFiManager.git 9 | architectures=esp8266 10 | -------------------------------------------------------------------------------- /libraries/WiFiManager/travis/common.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | function build_examples() 4 | { 5 | # track the exit code for this platform 6 | local exit_code=0 7 | # loop through results and add them to the array 8 | examples=($(find $PWD/examples/ -name "*.pde" -o -name "*.ino")) 9 | 10 | # get the last example in the array 11 | local last="${examples[@]:(-1)}" 12 | 13 | # loop through example sketches 14 | for example in "${examples[@]}"; do 15 | 16 | # store the full path to the example's sketch directory 17 | local example_dir=$(dirname $example) 18 | 19 | # store the filename for the example without the path 20 | local example_file=$(basename $example) 21 | 22 | echo "$example_file: " 23 | local sketch="$example_dir/$example_file" 24 | echo "$sketch" 25 | #arduino -v --verbose-build --verify $sketch 26 | 27 | # verify the example, and save stdout & stderr to a variable 28 | # we have to avoid reading the exit code of local: 29 | # "when declaring a local variable in a function, the local acts as a command in its own right" 30 | local build_stdout 31 | build_stdout=$(arduino --verify $sketch 2>&1) 32 | 33 | # echo output if the build failed 34 | if [ $? -ne 0 ]; then 35 | # heavy X 36 | echo -e "\xe2\x9c\x96" 37 | echo -e "----------------------------- DEBUG OUTPUT -----------------------------\n" 38 | echo "$build_stdout" 39 | echo -e "\n------------------------------------------------------------------------\n" 40 | 41 | # mark as fail 42 | exit_code=1 43 | 44 | else 45 | # heavy checkmark 46 | echo -e "\xe2\x9c\x93" 47 | fi 48 | done 49 | 50 | return $exit_code 51 | } 52 | -------------------------------------------------------------------------------- /libraries/aes/README.md: -------------------------------------------------------------------------------- 1 | AES Library for LoRa messages 2 | 3 | This library is part of the Ideetron code made for their Nexus board. 4 | It is used by LMIC library and by others as this library 5 | is not the most lightweight in terms of time but it is light in terms of 6 | code size. 7 | 8 | The licensing for this code is different from the 1ch Gateway and is detailed in 9 | the source code file(s) as follows: 10 | 11 | /****************************************************************************************** 12 | #if defined(USE_IDEETRON_AES) 13 | * Copyright 2015, 2016 Ideetron B.V. 14 | * 15 | * This program is free software: you can redistribute it and/or modify 16 | * it under the terms of the GNU Lesser General Public License as published by 17 | * the Free Software Foundation, either version 3 of the License, or 18 | * (at your option) any later version. 19 | * 20 | * This program is distributed in the hope that it will be useful, 21 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | * GNU Lesser General Public License for more details. 24 | * 25 | * You should have received a copy of the GNU Lesser General Public License 26 | * along with this program. If not, see . 27 | ******************************************************************************************/ -------------------------------------------------------------------------------- /libraries/gBase64/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2013 Adam Rudd 2 | 3 | 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: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | 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. 8 | -------------------------------------------------------------------------------- /libraries/gBase64/README.markdown: -------------------------------------------------------------------------------- 1 | Introduction 2 | ------------ 3 | 4 | This library provides methods for encoding binary into base64 strings and the reverse operation. -------------------------------------------------------------------------------- /libraries/gBase64/examples/base64/base64.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | /* 5 | Base64 Encode/Decode example 6 | 7 | Encodes the text "Hello world" to "SGVsbG8gd29ybGQA" and decodes "Zm9vYmFy" to "foobar" 8 | 9 | Created 29 April 2015 10 | by Nathan Friedly - http://nfriedly.com/ 11 | 12 | This example code is in the public domain. 13 | 14 | */ 15 | 16 | 17 | void setup() 18 | { 19 | // start serial port at 9600 bps: 20 | Serial.begin(9600); 21 | while (!Serial) { 22 | ; // wait for serial port to connect. Needed for Leonardo only 23 | } 24 | 25 | Serial.println("Base64 example"); 26 | 27 | 28 | 29 | // encoding 30 | char input[] = "Hello world"; 31 | int inputLen = sizeof(input); 32 | 33 | int encodedLen = base64_enc_len(inputLen); 34 | char encoded[encodedLen]; 35 | 36 | Serial.print(input); Serial.print(" = "); 37 | 38 | // note input is consumed in this step: it will be empty afterwards 39 | base64_encode(encoded, input, inputLen); 40 | 41 | Serial.println(encoded); 42 | 43 | 44 | 45 | // decoding 46 | char input2[] = "Zm9vYmFy"; 47 | int input2Len = sizeof(input2); 48 | 49 | int decodedLen = base64_dec_len(input2, input2Len); 50 | char decoded[decodedLen]; 51 | 52 | base64_decode(decoded, input2, input2Len); 53 | 54 | Serial.print(input2); Serial.print(" = "); Serial.println(decoded); 55 | } 56 | 57 | 58 | void loop() 59 | { 60 | 61 | } 62 | -------------------------------------------------------------------------------- /libraries/gBase64/keywords (1).txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map For Base64 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | # I WANT BASE64.h HIGHLIGHTED, DAMMIT! 10 | Base64 KEYWORD1 11 | 12 | ####################################### 13 | # Methods and Functions (KEYWORD2) 14 | ####################################### 15 | 16 | base64_encode KEYWORD2 17 | base64_decode KEYWORD2 18 | base64_enc_len KEYWORD2 19 | base64_dec_len KEYWORD2 20 | 21 | ####################################### 22 | # Constants (LITERAL1) 23 | ####################################### 24 | 25 | -------------------------------------------------------------------------------- /libraries/gBase64/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map For Base64 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | # I WANT BASE64.h HIGHLIGHTED, DAMMIT! 10 | Base64 KEYWORD1 11 | 12 | ####################################### 13 | # Methods and Functions (KEYWORD2) 14 | ####################################### 15 | 16 | base64_encode KEYWORD2 17 | base64_decode KEYWORD2 18 | base64_enc_len KEYWORD2 19 | base64_dec_len KEYWORD2 20 | 21 | ####################################### 22 | # Constants (LITERAL1) 23 | ####################################### 24 | 25 | -------------------------------------------------------------------------------- /libraries/gBase64/library.properties: -------------------------------------------------------------------------------- 1 | name=base64 2 | version=1.0.0 3 | author=Adam Rudd 4 | maintainer=Adam Rudd 5 | sentence=A base64 library for the arduino platform, written in C 6 | paragraph= 7 | category=Data Processing 8 | url=https://github.com/adamvr/arduino-base64 9 | architectures=* 10 | -------------------------------------------------------------------------------- /libraries/readme.txt: -------------------------------------------------------------------------------- 1 | For information on installing libraries, see: http://www.arduino.cc/en/Guide/Libraries 2 | --------------------------------------------------------------------------------