├── ISSUE_TEMPLATE.md ├── LICENSE ├── README.md ├── appveyor.yml ├── examples ├── Blinker_AT_Firmware │ └── AT_Firmware_WiFi │ │ └── AT_Firmware_WiFi.ino ├── Blinker_ArduinoJson │ └── ArduinoJson_WiFi │ │ └── ArduinoJson_WiFi.ino ├── Blinker_Bridge │ └── Bridge_WiFi │ │ └── Bridge_WiFi.ino ├── Blinker_Cloud │ ├── Blinker_CLOUDDATA │ │ └── CLOUDDATA_WiFi │ │ │ └── CLOUDDATA_WiFi.ino │ ├── Blinker_Coordinate │ │ └── Coordinate_WiFi │ │ │ └── Coordinate_WiFi.ino │ ├── Blinker_DataStorage │ │ ├── Blinker_ConfigData │ │ │ └── Blinker_ConfigData.ino │ │ ├── Blinker_TextData │ │ │ └── Blinker_TextData.ino │ │ └── Blinker_TimeSlotData │ │ │ └── Blinker_TimeSlotData.ino │ ├── Blinker_GPSData │ │ └── GPSData_WiFi │ │ │ └── GPSData_WiFi.ino │ └── Blinker_LOG │ │ └── LOG_WiFi │ │ └── LOG_WiFi.ino ├── Blinker_ESP32_CAM │ ├── Blinker_ESP32_CAM.ino │ └── ESP32_CAM_SERVER.h ├── Blinker_Hello │ ├── Blinker_HTTP │ │ └── Blinker_HTTP.ino │ ├── Hello_BLE │ │ └── Hello_BLE.ino │ ├── Hello_WiFi │ │ └── Hello_WiFi.ino │ └── Hello_WiFi_Without_SSL │ │ └── Hello_WiFi_Without_SSL.ino ├── Blinker_MQTT │ └── MQTT_PUB │ │ └── MQTT_PUB.ino ├── Blinker_PRO │ ├── Blinker_PRO_AIR202 │ │ └── Blinker_PRO_AIR202.ino │ ├── Blinker_PRO_Change_Server │ │ └── Blinker_Pro_Change_Server.ino │ ├── Blinker_PRO_ESP │ │ └── Blinker_PRO_ESP.ino │ ├── Blinker_PRO_ESP_APCONFIG │ │ └── Blinker_PRO_ESP_APCONFIG.ino │ ├── Blinker_PRO_Event │ │ ├── Event_Error │ │ │ └── Event_Error.ino │ │ ├── Event_Message │ │ │ └── Event_Message.ino │ │ └── Event_Warning │ │ │ └── Event_Warning.ino │ ├── Blinker_PRO_OTA │ │ └── OTA_PRO │ │ │ └── OTA_PRO.ino │ ├── Blinker_PRO_SIM7020 │ │ └── Blinker_PRO_SIM7020.ino │ └── Blinker_PRO_Wlan_Config │ │ └── Blinker_PRO_Wlan_Config.ino ├── Blinker_PRO_Device │ └── Blinker_PRO_Plug │ │ └── Blinker_PRO_Plug.ino ├── Blinker_RT_DATA │ └── Blinker_RT_DATA.ino ├── Blinker_Sensor │ ├── Blinker_BMP180 │ │ └── BMP180_WiFi │ │ │ └── BMP180_WiFi.ino │ └── Blinker_DHT │ │ ├── DHT_BLE │ │ └── DHT_BLE.ino │ │ └── DHT_WiFi │ │ └── DHT_WiFi.ino ├── Blinker_Voice_Assistant │ ├── Blinker_AliGenie │ │ ├── AliGenie_AIRCONDITION │ │ │ └── AliGenie_AIRCONDITION.ino │ │ ├── AliGenie_FAN │ │ │ └── AliGenie_FAN.ino │ │ ├── AliGenie_LIGHT │ │ │ └── AliGenie_LIGHT.ino │ │ ├── AliGenie_MULTI_OUTLET │ │ │ └── AliGenie_MULTI_OUTLET.ino │ │ ├── AliGenie_OUTLET │ │ │ └── AliGenie_OUTLET.ino │ │ └── AliGenie_SENSOR │ │ │ └── AliGenie_SENSOR.ino │ ├── Blinker_DuerOS │ │ ├── DuerOS_AIRCONDITION │ │ │ └── DuerOS_AIRCONDITION.ino │ │ ├── DuerOS_FAN │ │ │ └── DuerOS_FAN.ino │ │ ├── DuerOS_LIGHT │ │ │ └── DuerOS_LIGHT.ino │ │ ├── DuerOS_MULTI_OUTLET │ │ │ └── DuerOS_MULTI_OUTLET.ino │ │ ├── DuerOS_OUTLET │ │ │ └── DuerOS_OUTLET.ino │ │ └── DuerOS_SENSOR │ │ │ └── DuerOS_SENSOR.ino │ └── Blinker_MIOT │ │ ├── MIOT_AIRCONDITION │ │ └── MIOT_AIRCONDITION.ino │ │ ├── MIOT_FAN │ │ └── MIOT_FAN.ino │ │ ├── MIOT_LIGHT │ │ └── MIOT_LIGHT.ino │ │ ├── MIOT_MULTI_OUTLET │ │ └── MIOT_MULTI_OUTLET.ino │ │ ├── MIOT_OUTLET │ │ └── MIOT_OUTLET.ino │ │ └── MIOT_SENSOR │ │ └── MIOT_SENSOR.ino ├── Blinker_Weathers │ ├── Blinker_Air │ │ └── Air_WiFi │ │ │ └── Air_WiFi.ino │ └── Blinker_Weather │ │ └── Weather_WiFi │ │ └── Weather_WiFi.ino ├── Blinker_WiFi_Config │ ├── Blinker_APCONFIG │ │ └── APCONFIG_WiFi │ │ │ └── APCONFIG_WiFi.ino │ ├── Blinker_APCONFIG_V2 │ │ └── Blinker_APCONFIG_V2.ino │ ├── Blinker_ESPTOUCH │ │ └── ESPTOUCH_WiFi │ │ │ └── ESPTOUCH_WiFi.ino │ └── Blinker_Multi_WiFi │ │ └── Multi_WiFi │ │ └── Multi_WiFi.ino └── Blinker_Widgets │ ├── Blinker_AUTO │ ├── AUTO_Pro │ │ └── AUTO_Pro.ino │ └── AUTO_WiFi │ │ └── AUTO_WiFi.ino │ ├── Blinker_Button │ ├── Button_BLE │ │ └── Button_BLE.ino │ └── Button_WiFi │ │ └── Button_WiFi.ino │ ├── Blinker_Heartbeat │ ├── Heartbeat_BLE │ │ └── Heartbeat_BLE.ino │ └── Heartbeat_WiFi │ │ └── Heartbeat_WiFi.ino │ ├── Blinker_Image │ └── Image_WiFi │ │ └── Image_WiFi.ino │ ├── Blinker_Joystick │ ├── Joystick_BLE │ │ └── Joystick_BLE.ino │ └── Joystick_WiFi │ │ └── Joystick_WiFi.ino │ ├── Blinker_Notify │ ├── Notify_BLE │ │ └── Notify_BLE.ino │ └── Notify_WiFi │ │ └── Notify_WiFi.ino │ ├── Blinker_Number │ ├── Number_BLE │ │ └── Number_BLE.ino │ └── Number_WiFi │ │ └── Number_WiFi.ino │ ├── Blinker_PUSH │ └── PUSH_WiFi │ │ └── PUSH_WiFi.ino │ ├── Blinker_Print │ ├── Print_BLE │ │ └── Print_BLE.ino │ └── Print_WiFi │ │ └── Print_WiFi.ino │ ├── Blinker_RGB │ ├── RGB_BLE │ │ └── RGB_BLE.ino │ └── RGB_WiFi │ │ └── RGB_WiFi.ino │ ├── Blinker_SMS │ └── SMS_WiFi │ │ └── SMS_WiFi.ino │ ├── Blinker_Slider │ ├── Slider_BLE │ │ └── Slider_BLE.ino │ └── Slider_WiFi │ │ └── Slider_WiFi.ino │ ├── Blinker_Summary │ └── Summary_WiFi │ │ └── Summary_WiFi.ino │ ├── Blinker_Switch │ ├── Switch_BLE │ │ └── Switch_BLE.ino │ └── Switch_WiFi │ │ └── Switch_WiFi.ino │ ├── Blinker_TEXT │ ├── TEXT_BLE │ │ └── TEXT_BLE.ino │ └── TEXT_WiFi │ │ └── TEXT_WiFi.ino │ ├── Blinker_Tab │ └── Tab_WiFi │ │ └── Tab_WiFi.ino │ ├── Blinker_Time │ └── Time_WiFi │ │ └── Time_WiFi.ino │ ├── Blinker_WECHAT │ └── WECHAT_WiFi │ │ └── WECHAT_WiFi.ino │ └── Blinker_WS2812 │ ├── WS2812_BLE │ └── WS2812_BLE.ino │ └── WS2812_WiFi │ └── WS2812_WiFi.ino ├── keywords.txt ├── library.json ├── library.properties ├── src ├── Adapters │ ├── BlinkerAIR202LP.h │ ├── BlinkerBLE.h │ ├── BlinkerGateway.h │ ├── BlinkerHTTP.h │ ├── BlinkerMQTT.h │ ├── BlinkerMQTTAT.h │ ├── BlinkerMQTTAUTO.h │ ├── BlinkerMQTTLP.h │ ├── BlinkerPRO.h │ ├── BlinkerPROAIR202.h │ ├── BlinkerPROESP.h │ ├── BlinkerPROESP_QRCODE.h │ ├── BlinkerPROSIM7020.h │ ├── BlinkerQRCodeSIM7000.h │ ├── BlinkerQRCodeSIM7020.h │ ├── BlinkerSerial.h │ ├── BlinkerSerialAIR202.h │ ├── BlinkerSerialGPRS.h │ ├── BlinkerSerialMQTT.h │ ├── BlinkerSerialNBIoT.h │ ├── BlinkerSerialSIM7000.h │ ├── BlinkerSerialSIM7020.h │ ├── BlinkerSubDevice.h │ ├── BlinkerSubStream.h │ └── test.h ├── Blinker.h ├── Blinker │ ├── BlinkerATMaster.h │ ├── BlinkerApi.h │ ├── BlinkerApiBase.h │ ├── BlinkerAuto.h │ ├── BlinkerAutoGateway.h │ ├── BlinkerAutoSubdevice.h │ ├── BlinkerConfig.h │ ├── BlinkerDataTicker.h │ ├── BlinkerDebug.cpp │ ├── BlinkerDebug.h │ ├── BlinkerMQTTATBase.h │ ├── BlinkerProtocol.h │ ├── BlinkerStream.h │ ├── BlinkerTimer.cpp │ ├── BlinkerTimer.h │ ├── BlinkerUtility.cpp │ └── BlinkerUtility.h ├── BlinkerAssistant.h ├── BlinkerESP32BLE.h ├── BlinkerESPGateway.h ├── BlinkerESPHTTP.h ├── BlinkerESPMQTT.h ├── BlinkerESPMQTTAT.h ├── BlinkerESPMQTTAUTO.h ├── BlinkerESPMQTTLP.h ├── BlinkerESPPRO.h ├── BlinkerESPPROESP.h ├── BlinkerESPSubDevice.h ├── BlinkerLUATPRO.h ├── BlinkerLowPowerGPRS.h ├── BlinkerQRCodeSIM7000NBIOT.h ├── BlinkerQRCodeSIMNBIOT.h ├── BlinkerSIMPRO.h ├── BlinkerSerialBLE.h ├── BlinkerSerialESPMQTT.h ├── BlinkerSerialLUATGPRS.h ├── BlinkerSerialSIM7000NBIoT.h ├── BlinkerSerialSIMNBIoT.h ├── BlinkerSerialWHNBIoT.h ├── BlinkerSubDevice.h ├── BlinkerWidgets.h ├── Functions │ ├── BlinkerAIR202.h │ ├── BlinkerAliGenie.h │ ├── BlinkerBridge.h │ ├── BlinkerButton.h │ ├── BlinkerChart.h │ ├── BlinkerDuerOS.h │ ├── BlinkerEvent.h │ ├── BlinkerHTTPAIR202.h │ ├── BlinkerHTTPSIM7000.h │ ├── BlinkerHTTPSIM7020.h │ ├── BlinkerImage.h │ ├── BlinkerJoystick.h │ ├── BlinkerMIOT.h │ ├── BlinkerMQTTAIR202.h │ ├── BlinkerMQTTSIM7000.h │ ├── BlinkerMQTTSIM7020.h │ ├── BlinkerNumber.h │ ├── BlinkerOTA.h │ ├── BlinkerRGB.h │ ├── BlinkerSIM7000.h │ ├── BlinkerSIM7020.h │ ├── BlinkerSlider.h │ ├── BlinkerSwitch.h │ ├── BlinkerTab.h │ ├── BlinkerTable.h │ ├── BlinkerText.h │ ├── BlinkerTicker.h │ ├── BlinkerTimingTimer.h │ ├── BlinkerUpdater.cpp │ ├── BlinkerUpdater.h │ └── BlinkerWlan.h ├── Server │ └── BlinkerServer.h └── modules │ ├── ArduinoJson │ ├── ArduinoJson.h │ ├── ArduinoJson.hpp │ └── ArduinoJson │ │ ├── Array │ │ ├── ArrayFunctions.hpp │ │ ├── ArrayImpl.hpp │ │ ├── ArrayIterator.hpp │ │ ├── ArrayRef.hpp │ │ ├── ArrayShortcuts.hpp │ │ ├── ElementProxy.hpp │ │ └── Utilities.hpp │ │ ├── Collection │ │ ├── CollectionData.hpp │ │ └── CollectionImpl.hpp │ │ ├── Configuration.hpp │ │ ├── Deserialization │ │ ├── ArduinoStreamReader.hpp │ │ ├── CharPointerReader.hpp │ │ ├── DeserializationError.hpp │ │ ├── Filter.hpp │ │ ├── FlashStringReader.hpp │ │ ├── IteratorReader.hpp │ │ ├── NestingLimit.hpp │ │ ├── Reader.hpp │ │ ├── Readers │ │ │ ├── ArduinoStreamReader.hpp │ │ │ ├── ArduinoStringReader.hpp │ │ │ ├── FlashReader.hpp │ │ │ ├── IteratorReader.hpp │ │ │ ├── RamReader.hpp │ │ │ ├── StdStreamReader.hpp │ │ │ └── VariantReader.hpp │ │ ├── StdStreamReader.hpp │ │ └── deserialize.hpp │ │ ├── Document │ │ ├── BasicJsonDocument.hpp │ │ ├── DynamicJsonDocument.hpp │ │ ├── JsonDocument.hpp │ │ └── StaticJsonDocument.hpp │ │ ├── Json │ │ ├── EscapeSequence.hpp │ │ ├── JsonDeserializer.hpp │ │ ├── JsonSerializer.hpp │ │ ├── Latch.hpp │ │ ├── PrettyJsonSerializer.hpp │ │ ├── TextFormatter.hpp │ │ ├── Utf16.hpp │ │ └── Utf8.hpp │ │ ├── Memory │ │ ├── Alignment.hpp │ │ ├── MemoryPool.hpp │ │ ├── StringBuilder.hpp │ │ └── StringSlot.hpp │ │ ├── Misc │ │ ├── SafeBoolIdiom.hpp │ │ ├── SerializedValue.hpp │ │ └── Visitable.hpp │ │ ├── MsgPack │ │ ├── MsgPackDeserializer.hpp │ │ ├── MsgPackSerializer.hpp │ │ ├── endianess.hpp │ │ └── ieee754.hpp │ │ ├── Namespace.hpp │ │ ├── Numbers │ │ ├── Float.hpp │ │ ├── FloatParts.hpp │ │ ├── FloatTraits.hpp │ │ ├── Integer.hpp │ │ ├── arithmeticCompare.hpp │ │ ├── convertNumber.hpp │ │ ├── parseFloat.hpp │ │ ├── parseInteger.hpp │ │ └── parseNumber.hpp │ │ ├── Object │ │ ├── MemberProxy.hpp │ │ ├── ObjectFunctions.hpp │ │ ├── ObjectImpl.hpp │ │ ├── ObjectIterator.hpp │ │ ├── ObjectRef.hpp │ │ ├── ObjectShortcuts.hpp │ │ └── Pair.hpp │ │ ├── Operators │ │ ├── VariantCasts.hpp │ │ ├── VariantComparisons.hpp │ │ ├── VariantOperators.hpp │ │ ├── VariantOr.hpp │ │ └── VariantShortcuts.hpp │ │ ├── Polyfills │ │ ├── alias_cast.hpp │ │ ├── assert.hpp │ │ ├── attributes.hpp │ │ ├── ctype.hpp │ │ ├── gsl │ │ │ └── not_null.hpp │ │ ├── integer.hpp │ │ ├── limits.hpp │ │ ├── math.hpp │ │ ├── mpl │ │ │ └── max.hpp │ │ ├── pgmspace.hpp │ │ ├── pgmspace_generic.hpp │ │ ├── preprocessor.hpp │ │ ├── safe_strcmp.hpp │ │ ├── static_array.hpp │ │ ├── type_traits.hpp │ │ ├── type_traits │ │ │ ├── conditional.hpp │ │ │ ├── declval.hpp │ │ │ ├── enable_if.hpp │ │ │ ├── integral_constant.hpp │ │ │ ├── is_array.hpp │ │ │ ├── is_base_of.hpp │ │ │ ├── is_class.hpp │ │ │ ├── is_const.hpp │ │ │ ├── is_convertible.hpp │ │ │ ├── is_enum.hpp │ │ │ ├── is_floating_point.hpp │ │ │ ├── is_integral.hpp │ │ │ ├── is_pointer.hpp │ │ │ ├── is_same.hpp │ │ │ ├── is_signed.hpp │ │ │ ├── is_unsigned.hpp │ │ │ ├── make_unsigned.hpp │ │ │ ├── make_void.hpp │ │ │ ├── remove_const.hpp │ │ │ ├── remove_cv.hpp │ │ │ ├── remove_reference.hpp │ │ │ └── type_identity.hpp │ │ └── utility.hpp │ │ ├── Serialization │ │ ├── CountingDecorator.hpp │ │ ├── DummyWriter.hpp │ │ ├── DynamicStringWriter.hpp │ │ ├── StaticStringWriter.hpp │ │ ├── StreamWriter.hpp │ │ ├── Writer.hpp │ │ ├── Writers │ │ │ ├── ArduinoStringWriter.hpp │ │ │ ├── DummyWriter.hpp │ │ │ ├── PrintWriter.hpp │ │ │ ├── StaticStringWriter.hpp │ │ │ ├── StdStreamWriter.hpp │ │ │ └── StdStringWriter.hpp │ │ ├── measure.hpp │ │ └── serialize.hpp │ │ ├── StringStorage │ │ ├── StringCopier.hpp │ │ ├── StringMover.hpp │ │ └── StringStorage.hpp │ │ ├── Strings │ │ ├── Adapters │ │ │ ├── ArduinoString.hpp │ │ │ ├── FlashString.hpp │ │ │ ├── JsonString.hpp │ │ │ ├── RamString.hpp │ │ │ ├── StdString.hpp │ │ │ └── StringView.hpp │ │ ├── ArduinoStringAdapter.hpp │ │ ├── ConstRamStringAdapter.hpp │ │ ├── FlashStringAdapter.hpp │ │ ├── IsString.hpp │ │ ├── RamStringAdapter.hpp │ │ ├── SizedFlashStringAdapter.hpp │ │ ├── SizedRamStringAdapter.hpp │ │ ├── StlStringAdapter.hpp │ │ ├── StoragePolicy.hpp │ │ ├── String.hpp │ │ └── StringAdapters.hpp │ │ ├── Variant │ │ ├── Converter.hpp │ │ ├── ConverterImpl.hpp │ │ ├── SlotFunctions.hpp │ │ ├── VariantAs.hpp │ │ ├── VariantAsImpl.hpp │ │ ├── VariantCompare.hpp │ │ ├── VariantContent.hpp │ │ ├── VariantData.hpp │ │ ├── VariantFunctions.hpp │ │ ├── VariantImpl.hpp │ │ ├── VariantOperators.hpp │ │ ├── VariantRef.hpp │ │ ├── VariantShortcuts.hpp │ │ ├── VariantSlot.hpp │ │ ├── VariantTag.hpp │ │ ├── VariantTo.hpp │ │ └── Visitor.hpp │ │ ├── compatibility.hpp │ │ └── version.hpp │ ├── AsyncTCP │ ├── AsyncTCP.cpp │ └── AsyncTCP.h │ ├── ESPAsyncTCP │ ├── AsyncPrinter.cpp │ ├── AsyncPrinter.h │ ├── ESPAsyncTCP.cpp │ ├── ESPAsyncTCP.h │ ├── ESPAsyncTCPbuffer.cpp │ ├── ESPAsyncTCPbuffer.h │ ├── SyncClient.cpp │ ├── SyncClient.h │ ├── async_config.h │ ├── tcp_axtls.c │ └── tcp_axtls.h │ ├── TaskScheduler │ ├── TaskScheduler.h │ └── TaskSchedulerDeclarations.h │ ├── WebSockets │ ├── SocketIOclient.cpp │ ├── SocketIOclient.h │ ├── WebSockets.cpp │ ├── WebSockets.h │ ├── WebSockets4WebServer.h │ ├── WebSocketsClient.cpp │ ├── WebSocketsClient.h │ ├── WebSocketsServer.cpp │ ├── WebSocketsServer.h │ ├── WebSocketsVersion.h │ ├── libb64 │ │ ├── AUTHORS │ │ ├── LICENSE │ │ ├── cdecode.c │ │ ├── cdecode_inc.h │ │ ├── cencode.c │ │ └── cencode_inc.h │ └── libsha1 │ │ ├── libsha1.c │ │ └── libsha1.h │ ├── base64 │ ├── Base64.cpp │ ├── Base64.h │ ├── LICENSE │ ├── README.markdown │ ├── examples │ │ └── base64 │ │ │ └── base64.ino │ ├── keywords.txt │ └── library.properties │ └── mqtt │ ├── Adafruit_MQTT.cpp │ ├── Adafruit_MQTT.h │ ├── Adafruit_MQTT_Client.cpp │ ├── Adafruit_MQTT_Client.h │ └── Adafruit_MQTT_FONA.h └── test ├── build.sh ├── install.sh └── package └── package_esp8266com_index.template.json /ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 2 | ----------------------------- 删除下面的内容 ----------------------------- 3 | 4 | 提问指南 5 | ============= 6 | 请按如下说明描述您的问题,以便您的问题能够得到解决。 7 | 8 | 1. 对照下方的 基本信息 表,在[]中填入x。 9 | 2. 对照下发的 设备信息 表,在[]中填入您的设备信息。 10 | 3. 检查是否使用最新的库及APP,因为这个问题可能在最新的版本中已修复。 11 | 4. 描述您的问题。 12 | 5. 如果有设备端串口LOG信息,请提供LOG信息(建议DEBUG ALL下查看LOG信息)。 13 | 6. 一个能正常运行的描述您问题的最小示例代码。不要提供您的整个项目代码。 14 | 7. 如果编译报错,请提供完整的报错信息。 15 | 8. 如果使用串口蓝牙模块或者blinker AT固件, 请提供接线电路示意。 16 | 9. 提交您的问题前请将该提问指南删除。 17 | 18 | ----------------------------- 删除上面的内容 ----------------------------- 19 | 20 | == 提问请到论坛 https://www.arduino.cn/forum-132-1.html == 21 | 22 | ## 基本信息 23 | - [] 这个问题满足提问指南 24 | - [] 我阅读了开发文档 25 | - [] 我使用了最新的库及APP进行测试,但是问题仍然存在 26 | - [] 我搜索过类似问题的解决方法但是仍然无法解决 27 | - [] 有设备端的LOG信息 28 | - [] 有编译报错信息 29 | - [] 我已填写基本信息 30 | 31 | ## 设备信息 32 | - 硬件: [ESP-12|wifiduino|Arduino UNO] 33 | - 接入方式: [BLE|WIFI] 34 | - package版本: [esp8266-arduino-2.5.0dev|esp32-1.0.1-rc3] 35 | - blinker库版本: [arduino 0.3.0|py 0.2.0] 36 | - 开发环境: [Arduino|linux] 37 | - 操作系统: [Windows|Ubuntu|MacOS] 38 | 39 | ## IDE 中的设置 40 | - Module: [Generic ESP8266 Module|Wemos D1 mini r2|Nodemcu|other] 41 | - Flash Mode: [qio|dio|other] 42 | - Flash Size: [4MB/1MB] 43 | - lwip Variant: [v1.4|v2 Lower Memory|Higher Bandwidth] 44 | - Reset Method: [ck|nodemcu] 45 | - Flash Frequency: [40Mhz] 46 | - CPU Frequency: [80Mhz|160MHz] 47 | - Upload Using: [OTA|SERIAL] 48 | - Upload Speed: [115200|other] (serial upload only) 49 | ## 手机信息及APP信息 50 | - 手机品牌及型号 51 | - android系统版本(请注意是android系统版本,不是厂商自己的版本号) 52 | - blinker App版本 53 | 54 | ## 问题描述 55 | 在这里填写您的问题 56 | 57 | ## 代码 58 | 在这里填写您出现问题的最小示例代码 59 | 60 | ## LOG信息 61 | 在这里填写您设备串口输出的LOG信息 62 | 63 | ## 编译信息 64 | 在这里填写您IDE编译报错信息 -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2017 i3water 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | 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, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /examples/Blinker_AT_Firmware/AT_Firmware_WiFi/AT_Firmware_WiFi.ino: -------------------------------------------------------------------------------- 1 | /* ***************************************************************** 2 | * 3 | * Download latest Blinker library here: 4 | * https://github.com/blinker-iot/blinker-library/archive/master.zip 5 | * 6 | * 7 | * Blinker is a cross-hardware, cross-platform solution for the IoT. 8 | * It provides APP, device and server support, 9 | * and uses public cloud services for data transmission and storage. 10 | * It can be used in smart home, data monitoring and other fields 11 | * to help users build Internet of Things projects better and faster. 12 | * 13 | * Make sure installed 2.7.4 or later ESP8266/Arduino package, 14 | * if use ESP8266 with Blinker. 15 | * https://github.com/esp8266/Arduino/releases 16 | * 17 | * Make sure installed 1.0.5 or later ESP32/Arduino package, 18 | * if use ESP32 with Blinker. 19 | * https://github.com/espressif/arduino-esp32/releases 20 | * 21 | * Docs: https://diandeng.tech/doc 22 | * 23 | * 24 | * ***************************************************************** 25 | * 26 | * Blinker 库下载地址: 27 | * https://github.com/blinker-iot/blinker-library/archive/master.zip 28 | * 29 | * Blinker 是一套跨硬件、跨平台的物联网解决方案,提供APP端、设备端、 30 | * 服务器端支持,使用公有云服务进行数据传输存储。可用于智能家居、 31 | * 数据监测等领域,可以帮助用户更好更快地搭建物联网项目。 32 | * 33 | * 如果使用 ESP8266 接入 Blinker, 34 | * 请确保安装了 2.7.4 或更新的 ESP8266/Arduino 支持包。 35 | * https://github.com/esp8266/Arduino/releases 36 | * 37 | * 如果使用 ESP32 接入 Blinker, 38 | * 请确保安装了 1.0.5 或更新的 ESP32/Arduino 支持包。 39 | * https://github.com/espressif/arduino-esp32/releases 40 | * 41 | * 文档: https://diandeng.tech/doc 42 | * 43 | * 44 | * *****************************************************************/ 45 | 46 | #define BLINKER_AT_MQTT 47 | 48 | #include 49 | 50 | void setup() 51 | { 52 | Blinker.begin(); 53 | } 54 | 55 | void loop() 56 | { 57 | Blinker.run(); 58 | } -------------------------------------------------------------------------------- /examples/Blinker_Cloud/Blinker_DataStorage/Blinker_TextData/Blinker_TextData.ino: -------------------------------------------------------------------------------- 1 | /* ***************************************************************** 2 | * 3 | * Download latest Blinker library here: 4 | * https://github.com/blinker-iot/blinker-library/archive/master.zip 5 | * 6 | * 7 | * Blinker is a cross-hardware, cross-platform solution for the IoT. 8 | * It provides APP, device and server support, 9 | * and uses public cloud services for data transmission and storage. 10 | * It can be used in smart home, data monitoring and other fields 11 | * to help users build Internet of Things projects better and faster. 12 | * 13 | * Make sure installed 2.7.4 or later ESP8266/Arduino package, 14 | * if use ESP8266 with Blinker. 15 | * https://github.com/esp8266/Arduino/releases 16 | * 17 | * Make sure installed 1.0.5 or later ESP32/Arduino package, 18 | * if use ESP32 with Blinker. 19 | * https://github.com/espressif/arduino-esp32/releases 20 | * 21 | * Docs: https://diandeng.tech/doc 22 | * 23 | * 24 | * ***************************************************************** 25 | * 26 | * Blinker 库下载地址: 27 | * https://github.com/blinker-iot/blinker-library/archive/master.zip 28 | * 29 | * Blinker 是一套跨硬件、跨平台的物联网解决方案,提供APP端、设备端、 30 | * 服务器端支持,使用公有云服务进行数据传输存储。可用于智能家居、 31 | * 数据监测等领域,可以帮助用户更好更快地搭建物联网项目。 32 | * 33 | * 如果使用 ESP8266 接入 Blinker, 34 | * 请确保安装了 2.7.4 或更新的 ESP8266/Arduino 支持包。 35 | * https://github.com/esp8266/Arduino/releases 36 | * 37 | * 如果使用 ESP32 接入 Blinker, 38 | * 请确保安装了 1.0.5 或更新的 ESP32/Arduino 支持包。 39 | * https://github.com/espressif/arduino-esp32/releases 40 | * 41 | * 文档: https://diandeng.tech/doc 42 | * 43 | * 44 | * *****************************************************************/ 45 | 46 | #define BLINKER_WIFI 47 | 48 | #include 49 | 50 | char auth[] = "Your Device Secret Key"; 51 | char ssid[] = "Your WiFi network SSID or name"; 52 | char pswd[] = "Your WiFi network WPA password or WEP key"; 53 | 54 | void dataRead(const String & data) 55 | { 56 | BLINKER_LOG("Blinker readString: ", data); 57 | 58 | uint32_t BlinkerTime = millis(); 59 | 60 | Blinker.textData("text data"); 61 | 62 | digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN)); 63 | } 64 | 65 | void setup() 66 | { 67 | Serial.begin(115200); 68 | BLINKER_DEBUG.stream(Serial); 69 | 70 | pinMode(LED_BUILTIN, OUTPUT); 71 | digitalWrite(LED_BUILTIN, LOW); 72 | 73 | Blinker.begin(auth, ssid, pswd); 74 | Blinker.attachData(dataRead); 75 | } 76 | 77 | void loop() 78 | { 79 | Blinker.run(); 80 | } -------------------------------------------------------------------------------- /examples/Blinker_Hello/Hello_BLE/Hello_BLE.ino: -------------------------------------------------------------------------------- 1 | /* ***************************************************************** 2 | * 3 | * Download latest Blinker library here: 4 | * https://github.com/blinker-iot/blinker-library/archive/master.zip 5 | * 6 | * 7 | * Blinker is a cross-hardware, cross-platform solution for the IoT. 8 | * It provides APP, device and server support, 9 | * and uses public cloud services for data transmission and storage. 10 | * It can be used in smart home, data monitoring and other fields 11 | * to help users build Internet of Things projects better and faster. 12 | * 13 | * Make sure installed 2.7.4 or later ESP8266/Arduino package, 14 | * if use ESP8266 with Blinker. 15 | * https://github.com/esp8266/Arduino/releases 16 | * 17 | * Make sure installed 1.0.5 or later ESP32/Arduino package, 18 | * if use ESP32 with Blinker. 19 | * https://github.com/espressif/arduino-esp32/releases 20 | * 21 | * Docs: https://diandeng.tech/doc 22 | * 23 | * 24 | * ***************************************************************** 25 | * 26 | * Blinker 库下载地址: 27 | * https://github.com/blinker-iot/blinker-library/archive/master.zip 28 | * 29 | * Blinker 是一套跨硬件、跨平台的物联网解决方案,提供APP端、设备端、 30 | * 服务器端支持,使用公有云服务进行数据传输存储。可用于智能家居、 31 | * 数据监测等领域,可以帮助用户更好更快地搭建物联网项目。 32 | * 33 | * 如果使用 ESP8266 接入 Blinker, 34 | * 请确保安装了 2.7.4 或更新的 ESP8266/Arduino 支持包。 35 | * https://github.com/esp8266/Arduino/releases 36 | * 37 | * 如果使用 ESP32 接入 Blinker, 38 | * 请确保安装了 1.0.5 或更新的 ESP32/Arduino 支持包。 39 | * https://github.com/espressif/arduino-esp32/releases 40 | * 41 | * 文档: https://diandeng.tech/doc 42 | * 43 | * 44 | * *****************************************************************/ 45 | 46 | #define BLINKER_BLE 47 | 48 | #include 49 | 50 | BlinkerButton Button1("btn-abc"); 51 | BlinkerNumber Number1("num-abc"); 52 | 53 | int counter = 0; 54 | 55 | void button1_callback(const String & state) 56 | { 57 | BLINKER_LOG("get button state: ", state); 58 | digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN)); 59 | } 60 | 61 | void dataRead(const String & data) 62 | { 63 | BLINKER_LOG("Blinker readString: ", data); 64 | counter++; 65 | Number1.print(counter); 66 | } 67 | 68 | void setup() 69 | { 70 | Serial.begin(115200); 71 | BLINKER_DEBUG.stream(Serial); 72 | 73 | pinMode(LED_BUILTIN, OUTPUT); 74 | digitalWrite(LED_BUILTIN, HIGH); 75 | 76 | Blinker.begin(); 77 | Blinker.attachData(dataRead); 78 | 79 | Button1.attach(button1_callback); 80 | } 81 | 82 | void loop() 83 | { 84 | Blinker.run(); 85 | } -------------------------------------------------------------------------------- /examples/Blinker_Widgets/Blinker_Notify/Notify_BLE/Notify_BLE.ino: -------------------------------------------------------------------------------- 1 | /* ***************************************************************** 2 | * 3 | * Download latest Blinker library here: 4 | * https://github.com/blinker-iot/blinker-library/archive/master.zip 5 | * 6 | * 7 | * Blinker is a cross-hardware, cross-platform solution for the IoT. 8 | * It provides APP, device and server support, 9 | * and uses public cloud services for data transmission and storage. 10 | * It can be used in smart home, data monitoring and other fields 11 | * to help users build Internet of Things projects better and faster. 12 | * 13 | * Make sure installed 2.7.4 or later ESP8266/Arduino package, 14 | * if use ESP8266 with Blinker. 15 | * https://github.com/esp8266/Arduino/releases 16 | * 17 | * Make sure installed 1.0.5 or later ESP32/Arduino package, 18 | * if use ESP32 with Blinker. 19 | * https://github.com/espressif/arduino-esp32/releases 20 | * 21 | * Docs: https://diandeng.tech/doc 22 | * 23 | * 24 | * ***************************************************************** 25 | * 26 | * Blinker 库下载地址: 27 | * https://github.com/blinker-iot/blinker-library/archive/master.zip 28 | * 29 | * Blinker 是一套跨硬件、跨平台的物联网解决方案,提供APP端、设备端、 30 | * 服务器端支持,使用公有云服务进行数据传输存储。可用于智能家居、 31 | * 数据监测等领域,可以帮助用户更好更快地搭建物联网项目。 32 | * 33 | * 如果使用 ESP8266 接入 Blinker, 34 | * 请确保安装了 2.7.4 或更新的 ESP8266/Arduino 支持包。 35 | * https://github.com/esp8266/Arduino/releases 36 | * 37 | * 如果使用 ESP32 接入 Blinker, 38 | * 请确保安装了 1.0.5 或更新的 ESP32/Arduino 支持包。 39 | * https://github.com/espressif/arduino-esp32/releases 40 | * 41 | * 文档: https://diandeng.tech/doc 42 | * 43 | * 44 | * *****************************************************************/ 45 | 46 | #define BLINKER_BLE 47 | 48 | #include 49 | 50 | void dataRead(const String & data) 51 | { 52 | BLINKER_LOG("Blinker readString: ", data); 53 | 54 | Blinker.vibrate(); 55 | 56 | uint32_t BlinkerTime = millis(); 57 | 58 | Blinker.print("millis", BlinkerTime); 59 | 60 | Blinker.notify("!Button Pressed!"); 61 | digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN)); 62 | } 63 | 64 | void setup() 65 | { 66 | Serial.begin(115200); 67 | BLINKER_DEBUG.stream(Serial); 68 | 69 | pinMode(LED_BUILTIN, OUTPUT); 70 | digitalWrite(LED_BUILTIN, LOW); 71 | 72 | Blinker.begin(); 73 | Blinker.attachData(dataRead); 74 | } 75 | 76 | void loop() 77 | { 78 | Blinker.run(); 79 | } -------------------------------------------------------------------------------- /examples/Blinker_Widgets/Blinker_Notify/Notify_WiFi/Notify_WiFi.ino: -------------------------------------------------------------------------------- 1 | /* ***************************************************************** 2 | * 3 | * Download latest Blinker library here: 4 | * https://github.com/blinker-iot/blinker-library/archive/master.zip 5 | * 6 | * 7 | * Blinker is a cross-hardware, cross-platform solution for the IoT. 8 | * It provides APP, device and server support, 9 | * and uses public cloud services for data transmission and storage. 10 | * It can be used in smart home, data monitoring and other fields 11 | * to help users build Internet of Things projects better and faster. 12 | * 13 | * Make sure installed 2.7.4 or later ESP8266/Arduino package, 14 | * if use ESP8266 with Blinker. 15 | * https://github.com/esp8266/Arduino/releases 16 | * 17 | * Make sure installed 1.0.5 or later ESP32/Arduino package, 18 | * if use ESP32 with Blinker. 19 | * https://github.com/espressif/arduino-esp32/releases 20 | * 21 | * Docs: https://diandeng.tech/doc 22 | * 23 | * 24 | * ***************************************************************** 25 | * 26 | * Blinker 库下载地址: 27 | * https://github.com/blinker-iot/blinker-library/archive/master.zip 28 | * 29 | * Blinker 是一套跨硬件、跨平台的物联网解决方案,提供APP端、设备端、 30 | * 服务器端支持,使用公有云服务进行数据传输存储。可用于智能家居、 31 | * 数据监测等领域,可以帮助用户更好更快地搭建物联网项目。 32 | * 33 | * 如果使用 ESP8266 接入 Blinker, 34 | * 请确保安装了 2.7.4 或更新的 ESP8266/Arduino 支持包。 35 | * https://github.com/esp8266/Arduino/releases 36 | * 37 | * 如果使用 ESP32 接入 Blinker, 38 | * 请确保安装了 1.0.5 或更新的 ESP32/Arduino 支持包。 39 | * https://github.com/espressif/arduino-esp32/releases 40 | * 41 | * 文档: https://diandeng.tech/doc 42 | * 43 | * 44 | * *****************************************************************/ 45 | 46 | #define BLINKER_WIFI 47 | 48 | #include 49 | 50 | char auth[] = "Your Device Secret Key"; 51 | char ssid[] = "Your WiFi network SSID or name"; 52 | char pswd[] = "Your WiFi network WPA password or WEP key"; 53 | 54 | void dataRead(const String & data) 55 | { 56 | BLINKER_LOG("Blinker readString: ", data); 57 | 58 | Blinker.vibrate(); 59 | 60 | uint32_t BlinkerTime = millis(); 61 | 62 | Blinker.print("millis", BlinkerTime); 63 | 64 | Blinker.notify("!Button Pressed!"); 65 | digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN)); 66 | } 67 | 68 | void setup() 69 | { 70 | Serial.begin(115200); 71 | BLINKER_DEBUG.stream(Serial); 72 | 73 | pinMode(LED_BUILTIN, OUTPUT); 74 | digitalWrite(LED_BUILTIN, LOW); 75 | 76 | Blinker.begin(auth, ssid, pswd); 77 | Blinker.attachData(dataRead); 78 | } 79 | 80 | void loop() 81 | { 82 | Blinker.run(); 83 | } 84 | -------------------------------------------------------------------------------- /examples/Blinker_Widgets/Blinker_Number/Number_BLE/Number_BLE.ino: -------------------------------------------------------------------------------- 1 | /* ***************************************************************** 2 | * 3 | * Download latest Blinker library here: 4 | * https://github.com/blinker-iot/blinker-library/archive/master.zip 5 | * 6 | * 7 | * Blinker is a cross-hardware, cross-platform solution for the IoT. 8 | * It provides APP, device and server support, 9 | * and uses public cloud services for data transmission and storage. 10 | * It can be used in smart home, data monitoring and other fields 11 | * to help users build Internet of Things projects better and faster. 12 | * 13 | * Make sure installed 2.7.4 or later ESP8266/Arduino package, 14 | * if use ESP8266 with Blinker. 15 | * https://github.com/esp8266/Arduino/releases 16 | * 17 | * Make sure installed 1.0.5 or later ESP32/Arduino package, 18 | * if use ESP32 with Blinker. 19 | * https://github.com/espressif/arduino-esp32/releases 20 | * 21 | * Docs: https://diandeng.tech/doc 22 | * 23 | * 24 | * ***************************************************************** 25 | * 26 | * Blinker 库下载地址: 27 | * https://github.com/blinker-iot/blinker-library/archive/master.zip 28 | * 29 | * Blinker 是一套跨硬件、跨平台的物联网解决方案,提供APP端、设备端、 30 | * 服务器端支持,使用公有云服务进行数据传输存储。可用于智能家居、 31 | * 数据监测等领域,可以帮助用户更好更快地搭建物联网项目。 32 | * 33 | * 如果使用 ESP8266 接入 Blinker, 34 | * 请确保安装了 2.7.4 或更新的 ESP8266/Arduino 支持包。 35 | * https://github.com/esp8266/Arduino/releases 36 | * 37 | * 如果使用 ESP32 接入 Blinker, 38 | * 请确保安装了 1.0.5 或更新的 ESP32/Arduino 支持包。 39 | * https://github.com/espressif/arduino-esp32/releases 40 | * 41 | * 文档: https://diandeng.tech/doc 42 | * 43 | * 44 | * *****************************************************************/ 45 | 46 | #define BLINKER_BLE 47 | 48 | #include 49 | 50 | #define Number_1 "NUMKey" 51 | 52 | BlinkerNumber Number1(Number_1); 53 | 54 | void dataRead(const String & data) 55 | { 56 | BLINKER_LOG("Blinker readString: ", data); 57 | 58 | Blinker.vibrate(); 59 | 60 | uint32_t BlinkerTime = millis(); 61 | 62 | Blinker.print("millis", BlinkerTime); 63 | 64 | Number1.icon("icon_1"); 65 | Number1.color("#FFFFFF"); 66 | Number1.unit("ms"); 67 | Number1.print(BlinkerTime); 68 | 69 | digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN)); 70 | } 71 | 72 | void setup() 73 | { 74 | Serial.begin(115200); 75 | BLINKER_DEBUG.stream(Serial); 76 | 77 | pinMode(LED_BUILTIN, OUTPUT); 78 | digitalWrite(LED_BUILTIN, LOW); 79 | 80 | Blinker.begin(); 81 | Blinker.attachData(dataRead); 82 | } 83 | 84 | void loop() 85 | { 86 | Blinker.run(); 87 | } 88 | -------------------------------------------------------------------------------- /examples/Blinker_Widgets/Blinker_Print/Print_BLE/Print_BLE.ino: -------------------------------------------------------------------------------- 1 | /* ***************************************************************** 2 | * 3 | * Download latest Blinker library here: 4 | * https://github.com/blinker-iot/blinker-library/archive/master.zip 5 | * 6 | * 7 | * Blinker is a cross-hardware, cross-platform solution for the IoT. 8 | * It provides APP, device and server support, 9 | * and uses public cloud services for data transmission and storage. 10 | * It can be used in smart home, data monitoring and other fields 11 | * to help users build Internet of Things projects better and faster. 12 | * 13 | * Make sure installed 2.7.4 or later ESP8266/Arduino package, 14 | * if use ESP8266 with Blinker. 15 | * https://github.com/esp8266/Arduino/releases 16 | * 17 | * Make sure installed 1.0.5 or later ESP32/Arduino package, 18 | * if use ESP32 with Blinker. 19 | * https://github.com/espressif/arduino-esp32/releases 20 | * 21 | * Docs: https://diandeng.tech/doc 22 | * 23 | * 24 | * ***************************************************************** 25 | * 26 | * Blinker 库下载地址: 27 | * https://github.com/blinker-iot/blinker-library/archive/master.zip 28 | * 29 | * Blinker 是一套跨硬件、跨平台的物联网解决方案,提供APP端、设备端、 30 | * 服务器端支持,使用公有云服务进行数据传输存储。可用于智能家居、 31 | * 数据监测等领域,可以帮助用户更好更快地搭建物联网项目。 32 | * 33 | * 如果使用 ESP8266 接入 Blinker, 34 | * 请确保安装了 2.7.4 或更新的 ESP8266/Arduino 支持包。 35 | * https://github.com/esp8266/Arduino/releases 36 | * 37 | * 如果使用 ESP32 接入 Blinker, 38 | * 请确保安装了 1.0.5 或更新的 ESP32/Arduino 支持包。 39 | * https://github.com/espressif/arduino-esp32/releases 40 | * 41 | * 文档: https://diandeng.tech/doc 42 | * 43 | * 44 | * *****************************************************************/ 45 | 46 | #define BLINKER_BLE 47 | 48 | #include 49 | 50 | void dataRead(const String & data) 51 | { 52 | BLINKER_LOG("Blinker readString: ", data); 53 | 54 | Blinker.vibrate(); 55 | 56 | uint32_t BlinkerTime = millis(); 57 | 58 | Blinker.print("millis", BlinkerTime); 59 | } 60 | 61 | void setup() 62 | { 63 | Serial.begin(115200); 64 | BLINKER_DEBUG.stream(Serial); 65 | 66 | pinMode(LED_BUILTIN, OUTPUT); 67 | digitalWrite(LED_BUILTIN, LOW); 68 | 69 | Blinker.begin(); 70 | Blinker.attachData(dataRead); 71 | } 72 | 73 | void loop() 74 | { 75 | Blinker.run(); 76 | } -------------------------------------------------------------------------------- /examples/Blinker_Widgets/Blinker_Print/Print_WiFi/Print_WiFi.ino: -------------------------------------------------------------------------------- 1 | /* ***************************************************************** 2 | * 3 | * Download latest Blinker library here: 4 | * https://github.com/blinker-iot/blinker-library/archive/master.zip 5 | * 6 | * 7 | * Blinker is a cross-hardware, cross-platform solution for the IoT. 8 | * It provides APP, device and server support, 9 | * and uses public cloud services for data transmission and storage. 10 | * It can be used in smart home, data monitoring and other fields 11 | * to help users build Internet of Things projects better and faster. 12 | * 13 | * Make sure installed 2.7.4 or later ESP8266/Arduino package, 14 | * if use ESP8266 with Blinker. 15 | * https://github.com/esp8266/Arduino/releases 16 | * 17 | * Make sure installed 1.0.5 or later ESP32/Arduino package, 18 | * if use ESP32 with Blinker. 19 | * https://github.com/espressif/arduino-esp32/releases 20 | * 21 | * Docs: https://diandeng.tech/doc 22 | * 23 | * 24 | * ***************************************************************** 25 | * 26 | * Blinker 库下载地址: 27 | * https://github.com/blinker-iot/blinker-library/archive/master.zip 28 | * 29 | * Blinker 是一套跨硬件、跨平台的物联网解决方案,提供APP端、设备端、 30 | * 服务器端支持,使用公有云服务进行数据传输存储。可用于智能家居、 31 | * 数据监测等领域,可以帮助用户更好更快地搭建物联网项目。 32 | * 33 | * 如果使用 ESP8266 接入 Blinker, 34 | * 请确保安装了 2.7.4 或更新的 ESP8266/Arduino 支持包。 35 | * https://github.com/esp8266/Arduino/releases 36 | * 37 | * 如果使用 ESP32 接入 Blinker, 38 | * 请确保安装了 1.0.5 或更新的 ESP32/Arduino 支持包。 39 | * https://github.com/espressif/arduino-esp32/releases 40 | * 41 | * 文档: https://diandeng.tech/doc 42 | * 43 | * 44 | * *****************************************************************/ 45 | 46 | #define BLINKER_WIFI 47 | 48 | #include 49 | 50 | char auth[] = "Your Device Secret Key"; 51 | char ssid[] = "Your WiFi network SSID or name"; 52 | char pswd[] = "Your WiFi network WPA password or WEP key"; 53 | 54 | void dataRead(const String & data) 55 | { 56 | BLINKER_LOG("Blinker readString: ", data); 57 | 58 | Blinker.vibrate(); 59 | 60 | uint32_t BlinkerTime = millis(); 61 | 62 | Blinker.print("millis", BlinkerTime); 63 | } 64 | 65 | void setup() 66 | { 67 | Serial.begin(115200); 68 | BLINKER_DEBUG.stream(Serial); 69 | 70 | pinMode(LED_BUILTIN, OUTPUT); 71 | digitalWrite(LED_BUILTIN, LOW); 72 | 73 | Blinker.begin(auth, ssid, pswd); 74 | Blinker.attachData(dataRead); 75 | } 76 | 77 | void loop() 78 | { 79 | Blinker.run(); 80 | } -------------------------------------------------------------------------------- /examples/Blinker_Widgets/Blinker_Switch/Switch_BLE/Switch_BLE.ino: -------------------------------------------------------------------------------- 1 | /* ***************************************************************** 2 | * 3 | * Download latest Blinker library here: 4 | * https://github.com/blinker-iot/blinker-library/archive/master.zip 5 | * 6 | * 7 | * Blinker is a cross-hardware, cross-platform solution for the IoT. 8 | * It provides APP, device and server support, 9 | * and uses public cloud services for data transmission and storage. 10 | * It can be used in smart home, data monitoring and other fields 11 | * to help users build Internet of Things projects better and faster. 12 | * 13 | * Make sure installed 2.7.4 or later ESP8266/Arduino package, 14 | * if use ESP8266 with Blinker. 15 | * https://github.com/esp8266/Arduino/releases 16 | * 17 | * Make sure installed 1.0.5 or later ESP32/Arduino package, 18 | * if use ESP32 with Blinker. 19 | * https://github.com/espressif/arduino-esp32/releases 20 | * 21 | * Docs: https://diandeng.tech/doc 22 | * 23 | * 24 | * ***************************************************************** 25 | * 26 | * Blinker 库下载地址: 27 | * https://github.com/blinker-iot/blinker-library/archive/master.zip 28 | * 29 | * Blinker 是一套跨硬件、跨平台的物联网解决方案,提供APP端、设备端、 30 | * 服务器端支持,使用公有云服务进行数据传输存储。可用于智能家居、 31 | * 数据监测等领域,可以帮助用户更好更快地搭建物联网项目。 32 | * 33 | * 如果使用 ESP8266 接入 Blinker, 34 | * 请确保安装了 2.7.4 或更新的 ESP8266/Arduino 支持包。 35 | * https://github.com/esp8266/Arduino/releases 36 | * 37 | * 如果使用 ESP32 接入 Blinker, 38 | * 请确保安装了 1.0.5 或更新的 ESP32/Arduino 支持包。 39 | * https://github.com/espressif/arduino-esp32/releases 40 | * 41 | * 文档: https://diandeng.tech/doc 42 | * 43 | * 44 | * *****************************************************************/ 45 | 46 | #define BLINKER_BLE 47 | 48 | #include 49 | 50 | void switch_callback(const String & state) 51 | { 52 | BLINKER_LOG("get switch state: ", state); 53 | 54 | if (state == BLINKER_CMD_ON) { 55 | digitalWrite(LED_BUILTIN, HIGH); 56 | BUILTIN_SWITCH.print("on"); 57 | } 58 | else { 59 | digitalWrite(LED_BUILTIN, LOW); 60 | BUILTIN_SWITCH.print("off"); 61 | } 62 | } 63 | 64 | void setup() 65 | { 66 | Serial.begin(115200); 67 | BLINKER_DEBUG.stream(Serial); 68 | 69 | pinMode(LED_BUILTIN, OUTPUT); 70 | digitalWrite(LED_BUILTIN, LOW); 71 | 72 | Blinker.begin(); 73 | 74 | BUILTIN_SWITCH.attach(switch_callback); 75 | } 76 | 77 | void loop() 78 | { 79 | Blinker.run(); 80 | } 81 | -------------------------------------------------------------------------------- /examples/Blinker_Widgets/Blinker_TEXT/TEXT_BLE/TEXT_BLE.ino: -------------------------------------------------------------------------------- 1 | /* ***************************************************************** 2 | * 3 | * Download latest Blinker library here: 4 | * https://github.com/blinker-iot/blinker-library/archive/master.zip 5 | * 6 | * 7 | * Blinker is a cross-hardware, cross-platform solution for the IoT. 8 | * It provides APP, device and server support, 9 | * and uses public cloud services for data transmission and storage. 10 | * It can be used in smart home, data monitoring and other fields 11 | * to help users build Internet of Things projects better and faster. 12 | * 13 | * Make sure installed 2.7.4 or later ESP8266/Arduino package, 14 | * if use ESP8266 with Blinker. 15 | * https://github.com/esp8266/Arduino/releases 16 | * 17 | * Make sure installed 1.0.5 or later ESP32/Arduino package, 18 | * if use ESP32 with Blinker. 19 | * https://github.com/espressif/arduino-esp32/releases 20 | * 21 | * Docs: https://diandeng.tech/doc 22 | * 23 | * 24 | * ***************************************************************** 25 | * 26 | * Blinker 库下载地址: 27 | * https://github.com/blinker-iot/blinker-library/archive/master.zip 28 | * 29 | * Blinker 是一套跨硬件、跨平台的物联网解决方案,提供APP端、设备端、 30 | * 服务器端支持,使用公有云服务进行数据传输存储。可用于智能家居、 31 | * 数据监测等领域,可以帮助用户更好更快地搭建物联网项目。 32 | * 33 | * 如果使用 ESP8266 接入 Blinker, 34 | * 请确保安装了 2.7.4 或更新的 ESP8266/Arduino 支持包。 35 | * https://github.com/esp8266/Arduino/releases 36 | * 37 | * 如果使用 ESP32 接入 Blinker, 38 | * 请确保安装了 1.0.5 或更新的 ESP32/Arduino 支持包。 39 | * https://github.com/espressif/arduino-esp32/releases 40 | * 41 | * 文档: https://diandeng.tech/doc 42 | * 43 | * 44 | * *****************************************************************/ 45 | 46 | #define BLINKER_BLE 47 | 48 | #include 49 | 50 | #define TEXTE_1 "TextKey" 51 | 52 | BlinkerText Text1(TEXTE_1); 53 | 54 | void dataRead(const String & data) 55 | { 56 | BLINKER_LOG("Blinker readString: ", data); 57 | 58 | Blinker.vibrate(); 59 | 60 | uint32_t BlinkerTime = millis(); 61 | 62 | Blinker.print("millis", BlinkerTime); 63 | 64 | Text1.print("os time", BlinkerTime); 65 | 66 | digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN)); 67 | } 68 | 69 | void setup() 70 | { 71 | Serial.begin(115200); 72 | BLINKER_DEBUG.stream(Serial); 73 | 74 | pinMode(LED_BUILTIN, OUTPUT); 75 | digitalWrite(LED_BUILTIN, LOW); 76 | 77 | Blinker.begin(); 78 | Blinker.attachData(dataRead); 79 | } 80 | 81 | void loop() 82 | { 83 | Blinker.run(); 84 | } 85 | -------------------------------------------------------------------------------- /library.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Blinker", 3 | "description": "Build a easy way for your IoT project. Blinker library for embedded hardware. Works with Arduino, ESP8266, ESP32.", 4 | "keywords": "wifi, websocket, Bluetooth, mqtt", 5 | "authors": [ 6 | { 7 | "name": "i3water", 8 | "url": "https://github.com/i3water", 9 | "maintainer": true 10 | } 11 | ], 12 | "repository": { 13 | "type": "git", 14 | "url": "https://github.com/blinker-iot/blinker-library.git" 15 | }, 16 | "version": "0.3.12", 17 | "homepage": "https://diandeng.tech/home", 18 | "export": { 19 | "exclude": [ 20 | "tests" 21 | ] 22 | }, 23 | "frameworks": "arduino", 24 | "platforms": "*", 25 | "examples": [ 26 | "examples/*/*/*.ino" 27 | ] 28 | } 29 | -------------------------------------------------------------------------------- /library.properties: -------------------------------------------------------------------------------- 1 | name=Blinker 2 | version=0.3.12 3 | author=i3water 4 | maintainer=i3wawter 5 | sentence=Build a easy way for your IoT project. 6 | paragraph=Blinker library for embedded hardware. Support Arduino, ESP8266, ESP32, WiFi, BLE, MQTT. 7 | category=Communication 8 | url=https://diandeng.tech/home 9 | architectures=* 10 | -------------------------------------------------------------------------------- /src/Adapters/test.h: -------------------------------------------------------------------------------- 1 | "-----BEGIN CERTIFICATE-----" 2 | "MIIEgDCCA2igAwIBAgIQDKTfhr9lmWbWUT0hjX36oDANBgkqhkiG9w0BAQsFADBy" 3 | "MQswCQYDVQQGEwJDTjElMCMGA1UEChMcVHJ1c3RBc2lhIFRlY2hub2xvZ2llcywg" 4 | "SW5jLjEdMBsGA1UECxMURG9tYWluIFZhbGlkYXRlZCBTU0wxHTAbBgNVBAMTFFRy" 5 | "dXN0QXNpYSBUTFMgUlNBIENBMB4XDTE4MDEwNDAwMDAwMFoXDTE5MDEwNDEyMDAw" 6 | "MFowGDEWMBQGA1UEAxMNaW90ZGV2LmNsei5tZTCCASIwDQYJKoZIhvcNAQEBBQAD" 7 | "ggEPADCCAQoCggEBALbOFn7cJ2I/FKMJqIaEr38n4kCuJCCeNf1bWdWvOizmU2A8" 8 | "QeTAr5e6Q3GKeJRdPnc8xXhqkTm4LOhgdZB8KzuVZARtu23D4vj4sVzxgC/zwJlZ" 9 | "MRMxN+cqI37kXE8gGKW46l2H9vcukylJX+cx/tjWDfS2YuyXdFuS/RjhCxLgXzbS" 10 | "cve1W0oBZnBPRSMV0kgxTWj7hEGZNWKIzK95BSCiMN59b+XEu3NWGRb/VzSAiJEy" 11 | "Hy9DcDPBC9TEg+p5itHtdMhy2gq1OwsPgl9HUT0xmDATSNEV2RB3vwviNfu9/Eif" 12 | "ObhsV078zf30TqdiESqISEB68gJ0Otru67ePoTkCAwEAAaOCAWowggFmMB8GA1Ud" 13 | "IwQYMBaAFH/TmfOgRw4xAFZWIo63zJ7dygGKMB0GA1UdDgQWBBR/KLqnke61779P" 14 | "xc9htonQwLOxPDAYBgNVHREEETAPgg1pb3RkZXYuY2x6Lm1lMA4GA1UdDwEB/wQE" 15 | "AwIFoDAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwTAYDVR0gBEUwQzA3" 16 | "BglghkgBhv1sAQIwKjAoBggrBgEFBQcCARYcaHR0cHM6Ly93d3cuZGlnaWNlcnQu" 17 | "Y29tL0NQUzAIBgZngQwBAgEwgYEGCCsGAQUFBwEBBHUwczAlBggrBgEFBQcwAYYZ" 18 | "aHR0cDovL29jc3AyLmRpZ2ljZXJ0LmNvbTBKBggrBgEFBQcwAoY+aHR0cDovL2Nh" 19 | "Y2VydHMuZGlnaXRhbGNlcnR2YWxpZGF0aW9uLmNvbS9UcnVzdEFzaWFUTFNSU0FD" 20 | "QS5jcnQwCQYDVR0TBAIwADANBgkqhkiG9w0BAQsFAAOCAQEAhtM4eyrWB14ajJpQ" 21 | "ibZ5FbzVuvv2Le0FOSoss7UFCDJUYiz2LiV8yOhL4KTY+oVVkqHaYtcFS1CYZNzj" 22 | "6xWcqYZJ+pgsto3WBEgNEEe0uLSiTW6M10hm0LFW9Det3k8fqwSlljqMha3gkpZ6" 23 | "8WB0f2clXOuC+f1SxAOymnGUsSqbU0eFSgevcOIBKR7Hr3YXBXH3jjED76Q52OMS" 24 | "ucfOM9/HB3jN8o/ioQbkI7xyd/DUQtzK6hSArEoYRl3p5H2P4fr9XqmpoZV3i3gQ" 25 | "oOdVycVtpLunyUoVAB2DcOElfDxxXCvDH3XsgoIU216VY03MCaUZf7kZ2GiNL+UX" 26 | "9UBd0Q==" 27 | "-----END CERTIFICATE-----" 28 | 29 | A123456789B123456789C123456789D123456789E123456789F123456789G123456789H123456789I123456789J123456789K123456789L123456789M123456789N123456789O123456789P123456789Q123456789R123456789S123456789T123456789U123456789V123456789W123456789X123456789Y123456789Z123456789 -------------------------------------------------------------------------------- /src/Blinker/BlinkerAutoGateway.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blinker-iot/blinker-library/c73abe1a091733c62152ddb3c6ff7b1820705b18/src/Blinker/BlinkerAutoGateway.h -------------------------------------------------------------------------------- /src/Blinker/BlinkerAutoSubdevice.h: -------------------------------------------------------------------------------- 1 | #ifndef BLINKER_AUTO_SUBDEVICE_H 2 | #define BLINKER_AUTO_SUBDEVICE_H 3 | 4 | #if defined(BLINKER_WIFI_SUBDEVICE) 5 | 6 | #if ARDUINO >= 100 7 | #include 8 | #else 9 | #include 10 | #endif 11 | 12 | #include 13 | 14 | // #include "Blinker/BlinkerAuto.h" 15 | #include "Blinker/BlinkerConfig.h" 16 | #include "Blinker/BlinkerDebug.h" 17 | #include "Blinker/BlinkerUtility.h" 18 | #ifndef ARDUINOJSON_VERSION_MAJOR 19 | #include "modules/ArduinoJson/ArduinoJson.h" 20 | #endif 21 | 22 | class BlinkerAutoSubdevice 23 | { 24 | private : 25 | uint8_t a_num; 26 | 27 | // { 28 | // "auto":{ 29 | // "ena":1,//_autoState 30 | // "id":123456,//_autoId 31 | // "logic":"numberic",//_logicType 32 | // "data": 33 | // [ 34 | // { 35 | // "key":"humi", 36 | // "value":40, 37 | // "type":"<",//_targetState|_compareType 38 | // "dur":10 39 | // } 40 | // ], 41 | // "range":[540, 1260], 42 | // } 43 | // } 44 | 45 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 46 | // | | | | | | _time1 0-1440min 11 | _time2 0-1440min 11 47 | // | | | | | _duration 0-60min 6 48 | // | | | | _targetState|_compareType on/off|less/equal/greater 2 49 | // | | | _targetState|_compareType on/off|less/equal/greater 50 | // | 51 | // | logic_type state/numberic 2 52 | // autoData 53 | 54 | // | _linkNum 55 | // - - - - - - - - 56 | // | | |_logicType state/numberic/and/or 2 57 | // | | _autoState true/false 1 58 | // | _haveAuto 59 | // | 60 | // typestate 61 | }; 62 | 63 | #endif 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /src/Blinker/BlinkerDataTicker.h: -------------------------------------------------------------------------------- 1 | // #ifndef BlinkerDataTicker_H 2 | // #define BlinkerDataTicker_H 3 | 4 | // #if defined(ESP8266) || defined(ESP32) 5 | 6 | // #include "Blinker/BlinkerConfig.h" 7 | // #include "Blinker/BlinkerDebug.h" 8 | // #include "Blinker/BlinkerTimer.h" 9 | 10 | // #include 11 | 12 | // Ticker dataTicker; 13 | 14 | // bool _dataTrigged = false; 15 | // uint32_t _data_time = 60; 16 | 17 | // void dataInit(uint8_t mins, uint8_t seconds, uint32_t tickers = 60) 18 | // { 19 | // _data_time = tickers; 20 | 21 | // if (_data_time == 60) 22 | // { 23 | // uint32_t tTime = _data_time - seconds; 24 | // dataTicker. 25 | // } 26 | // } 27 | 28 | // void dataHandle() 29 | // { 30 | // _dataTrigged = true; 31 | // } 32 | 33 | // #endif 34 | 35 | // #endif 36 | -------------------------------------------------------------------------------- /src/Blinker/BlinkerTimer.h: -------------------------------------------------------------------------------- 1 | #ifndef BLINKER_TIMER_H 2 | #define BLINKER_TIMER_H 3 | 4 | #if defined(ESP8266) || defined(ESP32) 5 | 6 | #include 7 | #include 8 | 9 | extern Ticker cdTicker; 10 | extern Ticker lpTicker; 11 | extern Ticker tmTicker; 12 | 13 | extern bool _cdRunState; 14 | extern bool _lpRunState; 15 | extern bool _tmRunState; 16 | extern bool _cdState; 17 | extern bool _lpState; 18 | extern bool _tmState; 19 | extern bool _lpRun1; 20 | extern bool _tmRun1; 21 | extern bool _tmDay; 22 | extern bool _cdTrigged; 23 | extern bool _lpTrigged; 24 | extern bool _tmTrigged; 25 | extern bool _isTimingLoop; 26 | 27 | extern uint8_t _lpTimes; 28 | extern uint8_t _lpTrigged_times; 29 | 30 | extern uint32_t _cdTime1; 31 | extern uint32_t _cdTime2; 32 | extern uint32_t _cdStart; 33 | extern uint32_t _cdData; 34 | // bool _cdStop = true; 35 | 36 | extern uint32_t _lpTime1; 37 | extern uint32_t _lpTime1_start; 38 | extern uint32_t _lpTime2; 39 | extern uint32_t _lpTime2_start; 40 | extern uint32_t _lpData; 41 | extern bool _lpStop; 42 | 43 | extern uint32_t _tmTime1; 44 | extern uint32_t _tmTime2; 45 | extern uint32_t _tmTime; 46 | extern uint8_t _timingDay; 47 | extern uint8_t taskCount; 48 | extern uint8_t triggedTask; 49 | 50 | void disableTimer(); 51 | void _cd_callback(); 52 | void _lp_callback(); 53 | void timingHandle(uint8_t cbackData); 54 | 55 | #endif 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /src/BlinkerESP32BLE.h: -------------------------------------------------------------------------------- 1 | #ifndef BLINKER_ESP32_BLE_H 2 | #define BLINKER_ESP32_BLE_H 3 | 4 | #if defined(ESP32) 5 | 6 | #ifndef BLINKER_ARDUINOJSON 7 | #define BLINKER_ARDUINOJSON 8 | #endif 9 | 10 | #include "Adapters/BlinkerBLE.h" 11 | #include "Blinker/BlinkerApi.h" 12 | 13 | typedef BlinkerApi BApi; 14 | 15 | class BlinkerESP32BLE : public BlinkerApi 16 | { 17 | public : 18 | void begin() 19 | { 20 | BApi::begin(); 21 | Transp.begin(); 22 | transport(Transp); 23 | BLINKER_LOG("ESP32_BLE initialized..."); 24 | } 25 | 26 | private : 27 | BlinkerBLE Transp; 28 | }; 29 | 30 | #endif 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /src/BlinkerESPGateway.h: -------------------------------------------------------------------------------- 1 | #ifndef BLINKER_ESP_GATEWAY_H 2 | #define BLINKER_ESP_GATEWAY_H 3 | 4 | #if defined(ESP8266) || defined(ESP32) 5 | 6 | #ifndef BLINKER_ARDUINOJSON 7 | #define BLINKER_ARDUINOJSON 8 | #endif 9 | 10 | #include "Adapters/BlinkerGateway.h" 11 | #include "Blinker/BlinkerApi.h" 12 | 13 | typedef BlinkerApi BApi; 14 | 15 | class BlinkerESPGateway : public BlinkerApi 16 | { 17 | public : 18 | void begin(const char* _key, const char* _type) 19 | { 20 | transport(Transp); 21 | BApi::begin(_key, _type); 22 | BApi::loadTimer(); 23 | BLINKER_LOG(BLINKER_F("ESP_Gateway initialized...")); 24 | } 25 | 26 | private : 27 | BlinkerGateway Transp; 28 | }; 29 | 30 | #endif 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /src/BlinkerESPHTTP.h: -------------------------------------------------------------------------------- 1 | #ifndef BLINKER_ESP_HTTP_H 2 | #define BLINKER_ESP_HTTP_H 3 | 4 | #if defined(ESP8266) || defined(ESP32) 5 | 6 | #ifndef BLINKER_ARDUINOJSON 7 | #define BLINKER_ARDUINOJSON 8 | #endif 9 | 10 | #include "Adapters/BlinkerHTTP.h" 11 | #include "Blinker/BlinkerApi.h" 12 | #ifndef ARDUINOJSON_VERSION_MAJOR 13 | #include "modules/ArduinoJson/ArduinoJson.h" 14 | #endif 15 | 16 | #if defined(ESP8266) 17 | #include 18 | #include 19 | // #include 20 | #elif defined(ESP32) 21 | #include 22 | #include 23 | // #include 24 | #endif 25 | 26 | typedef BlinkerApi BApi; 27 | 28 | class BlinkerESPHTTP : public BlinkerApi 29 | { 30 | public : 31 | #if defined(BLINKER_ESP_SMARTCONFIG) || defined(BLINKER_APCONFIG) 32 | void begin(const char* _auth) 33 | { 34 | BApi::begin(); 35 | Transp.begin(_auth); 36 | 37 | transport(Transp); 38 | 39 | #if defined(BLINKER_ESP_SMARTCONFIG) 40 | Transp.smartconfigBegin(); 41 | #elif defined(BLINKER_APCONFIG) 42 | Transp.apconfigBegin(); 43 | #endif 44 | } 45 | #else 46 | void begin( const char* _auth, 47 | const char* _ssid, 48 | const char* _pswd ) 49 | { 50 | BApi::begin(); 51 | Transp.begin(_auth); 52 | 53 | transport(Transp); 54 | 55 | Transp.commonBegin(_ssid, _pswd); 56 | } 57 | #endif 58 | 59 | private : 60 | BlinkerHTTP Transp; 61 | }; 62 | 63 | #endif 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /src/BlinkerESPMQTTAT.h: -------------------------------------------------------------------------------- 1 | #ifndef BLINKER_ESP_MQTT_AT_H 2 | #define BLINKER_ESP_MQTT_AT_H 3 | 4 | #if defined(ESP8266) || defined(ESP32) 5 | 6 | #ifndef BLINKER_ARDUINOJSON 7 | #define BLINKER_ARDUINOJSON 8 | #endif 9 | 10 | #include "Adapters/BlinkerMQTTAT.h" 11 | #include "Blinker/BlinkerApi.h" 12 | 13 | typedef BlinkerApi BApi; 14 | 15 | class BlinkerESPMQTTAT : public BlinkerApi 16 | { 17 | public : 18 | void begin() 19 | { 20 | BApi::begin(); 21 | 22 | ::delay(100); 23 | 24 | EEPROM.begin(BLINKER_EEP_SIZE); 25 | EEPROM.get(BLINKER_EEP_ADDR_SERIALCFG, serialSet); 26 | 27 | uint32_t ss_baud = serialSet >> 8 & 0x00FFFFFF; 28 | ss_cfg = serConfig(); 29 | 30 | if (ss_baud != 300 || ss_baud != 1200 || ss_baud != 2400 || 31 | ss_baud != 4800 || ss_baud != 9600 || ss_baud != 19200 || 32 | ss_baud != 38400 || ss_baud != 57600 || ss_baud != 74880 || 33 | ss_baud != 115200 || ss_baud != 230400 || ss_baud != 250000 || 34 | ss_baud != 500000 || ss_baud != 1000000 || ss_baud != 2000000) 35 | { 36 | serialSet = BLINKER_SERIAL_DEFAULT; 37 | ss_baud = 9600; 38 | ss_cfg = SERIAL_8N1; 39 | 40 | EEPROM.put(BLINKER_EEP_ADDR_SERIALCFG, serialSet); 41 | } 42 | 43 | EEPROM.commit(); 44 | EEPROM.end(); 45 | 46 | Serial.begin(ss_baud, ss_cfg); 47 | Transp.serialBegin(Serial, true); 48 | transport(Transp); 49 | BApi::atBegin(); 50 | // strcpy(BApi::_authKey, this->conn.authKey().c_str()); 51 | // strcpy(BApi::_deviceName, this->conn.deviceName().c_str()); 52 | BApi::loadTimer(); 53 | BLINKER_LOG(BLINKER_F("BLINKER_MQTT_AT initialized...")); 54 | } 55 | 56 | private : 57 | BlinkerMQTTAT Transp; 58 | }; 59 | 60 | #endif 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /src/BlinkerESPMQTTAUTO.h: -------------------------------------------------------------------------------- 1 | #ifndef BLINKER_ESP_MQTT_AUTO_H 2 | #define BLINKER_ESP_MQTT_AUTO_H 3 | 4 | #if defined(ESP8266) || defined(ESP32) 5 | 6 | #ifndef BLINKER_ARDUINOJSON 7 | #define BLINKER_ARDUINOJSON 8 | #endif 9 | 10 | #include "Adapters/BlinkerMQTTAUTO.h" 11 | #include "Blinker/BlinkerApi.h" 12 | 13 | typedef BlinkerApi BApi; 14 | 15 | class BlinkerESPMQTTAUTO : public BlinkerApi 16 | { 17 | public : 18 | void begin(const char* _key, const char* _type) 19 | { 20 | transport(Transp); 21 | BApi::begin(_key, _type); 22 | BApi::loadTimer(); 23 | BLINKER_LOG(BLINKER_F("ESP8266_MQTT_AUTO initialized...")); 24 | } 25 | 26 | private : 27 | BlinkerMQTTAUTO Transp; 28 | }; 29 | 30 | #endif 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /src/BlinkerESPPRO.h: -------------------------------------------------------------------------------- 1 | #ifndef BLINKER_ESP_PRO_H 2 | #define BLINKER_ESP_PRO_H 3 | 4 | #if defined(ESP8266) || defined(ESP32) 5 | 6 | #ifndef BLINKER_ARDUINOJSON 7 | #define BLINKER_ARDUINOJSON 8 | #endif 9 | 10 | #include "Adapters/BlinkerPRO.h" 11 | #include "Blinker/BlinkerApi.h" 12 | 13 | typedef BlinkerApi BApi; 14 | 15 | class BlinkerESPPRO : public BlinkerApi 16 | { 17 | public : 18 | void begin(const char* _type = BLINKER_AIR_DETECTOR) 19 | { 20 | transport(Transp); 21 | BApi::begin(_type); 22 | BApi::loadTimer(); 23 | BLINKER_LOG(BLINKER_F("ESP8266_PRO initialized...")); 24 | } 25 | 26 | private : 27 | BlinkerPRO Transp; 28 | }; 29 | 30 | #endif 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /src/BlinkerESPPROESP.h: -------------------------------------------------------------------------------- 1 | #ifndef BLINKER_ESP_PRO_ESP_H 2 | #define BLINKER_ESP_PRO_ESP_H 3 | 4 | #if defined(ESP8266) || defined(ESP32) 5 | 6 | #ifndef BLINKER_ARDUINOJSON 7 | #define BLINKER_ARDUINOJSON 8 | #endif 9 | 10 | #include "Adapters/BlinkerPROESP.h" 11 | #include "Blinker/BlinkerApi.h" 12 | 13 | typedef BlinkerApi BApi; 14 | 15 | class BlinkerESPPROESP : public BlinkerApi 16 | { 17 | public : 18 | void begin(const char* _key, const char* _type) 19 | { 20 | transport(Transp); 21 | BApi::begin(_key, _type); 22 | BApi::loadTimer(); 23 | BLINKER_LOG(BLINKER_F("ESP_PRO initialized...")); 24 | } 25 | 26 | private : 27 | BlinkerPROESP Transp; 28 | }; 29 | 30 | #endif 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /src/BlinkerESPSubDevice.h: -------------------------------------------------------------------------------- 1 | #ifndef BLINKER_ESP_SUBDEVICE_H 2 | #define BLINKER_ESP_SUBDEVICE_H 3 | 4 | #ifndef BLINKER_ARDUINOJSON 5 | #define BLINKER_ARDUINOJSON 6 | #endif 7 | 8 | #include "Adapters/BlinkerSubDevice.h" 9 | #include "Blinker/BlinkerApi.h" 10 | 11 | typedef BlinkerApi BApi; 12 | 13 | class BlinkerESPSubDevice : public BlinkerApi 14 | { 15 | public : 16 | void begin(const char* _key, const char* _type) 17 | { 18 | transport(Transp); 19 | BApi::begin(_key, _type); 20 | BLINKER_LOG(BLINKER_F("Blinker SubDevice initialized...")); 21 | } 22 | 23 | private : 24 | BlinkerSubDevice Transp; 25 | }; 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /src/BlinkerSubDevice.h: -------------------------------------------------------------------------------- 1 | #ifndef BLINKER_SUBDEVICE_H 2 | #define BLINKER_SUBDEVICE_H 3 | 4 | #ifndef BLINKER_ARDUINOJSON 5 | #define BLINKER_ARDUINOJSON 6 | #endif 7 | 8 | #include "Adapters/BlinkerSubStream.h" 9 | #include "Blinker/BlinkerApi.h" 10 | 11 | typedef BlinkerApi BApi; 12 | 13 | class BlinkerSubDevice : public BlinkerApi 14 | { 15 | public : 16 | void begin(const char* _auth) 17 | { 18 | BApi::begin(); 19 | Transp.begin(_auth); 20 | transport(Transp); 21 | BLINKER_LOG(BLINKER_F("Blinker SubDevice initialized...")); 22 | } 23 | 24 | private : 25 | BlinkerSubStream Transp; 26 | }; 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /src/BlinkerWidgets.h: -------------------------------------------------------------------------------- 1 | #ifndef BLINKER_WIDGETS_H 2 | #define BLINKER_WIDGETS_H 3 | 4 | #if defined(BLINKER_MQTT) || defined(BLINKER_WIFI_GATEWAY) || \ 5 | defined(BLINKER_MQTT_AUTO) 6 | #include "Functions/BlinkerBridge.h" 7 | #endif 8 | 9 | #include "Functions/BlinkerButton.h" 10 | #include "Functions/BlinkerNumber.h" 11 | #include "Functions/BlinkerImage.h" 12 | #include "Functions/BlinkerRGB.h" 13 | // #if defined(BLINKER_BLE) 14 | #include "Functions/BlinkerJoystick.h" 15 | // #endif 16 | #include "Functions/BlinkerSlider.h" 17 | #include "Functions/BlinkerSwitch.h" 18 | #include "Functions/BlinkerTab.h" 19 | #include "Functions/BlinkerText.h" 20 | 21 | #if defined(BLINKER_ALIGENIE) 22 | #include "Functions/BlinkerAliGenie.h" 23 | 24 | BLINKERALIGENIE BlinkerAliGenie; 25 | #endif 26 | 27 | #if defined(BLINKER_DUEROS) 28 | #include "Functions/BlinkerDuerOS.h" 29 | 30 | BLINKERDUEROS BlinkerDuerOS; 31 | #endif 32 | 33 | #if defined(BLINKER_MIOT) 34 | #include "Functions/BlinkerMIOT.h" 35 | 36 | BLINKERMIOT BlinkerMIOT; 37 | #endif 38 | 39 | #if defined(BLINKER_BLE) || defined(BLINKER_WIFI) || \ 40 | defined(BLINKER_MQTT) || defined(BLINKER_PRO) || \ 41 | defined(BLINKER_NBIOT_WH) || defined(BLINKER_WIFI_GATEWAY) || \ 42 | defined(BLINKER_MQTT_AUTO) || defined(BLINKER_PRO_ESP) || \ 43 | defined(BLINKE_HTTP) 44 | 45 | BlinkerSwitch BUILTIN_SWITCH; 46 | #endif 47 | 48 | #if defined(BLINKER_PRO_ESP) 49 | #include "Functions/BlinkerEvent.h" 50 | 51 | BLINKEREVENT BlinkerEvent; 52 | #endif 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /src/Functions/BlinkerBridge.h: -------------------------------------------------------------------------------- 1 | #ifndef BLINKER_BRIDGE_H 2 | #define BLINKER_BRIDGE_H 3 | 4 | #include "../Blinker/BlinkerConfig.h" 5 | #include "../Blinker/BlinkerUtility.h" 6 | 7 | class BlinkerBridge 8 | { 9 | public : 10 | BlinkerBridge(char _key[], blinker_callback_with_string_arg_t _func = NULL) 11 | { 12 | bNum = Blinker.attachBridge(_key, _func); 13 | } 14 | 15 | void attach(blinker_callback_with_string_arg_t _func) 16 | { 17 | if (bNum == 0) return; 18 | 19 | Blinker.freshAttachBridge(Blinker.bridgeKey(bNum), _func); 20 | } 21 | 22 | template 23 | void print(T1 n1) 24 | { 25 | BLINKER_LOG_ALL(BLINKER_F("Bridge to: "), bNum, BLINKER_F(", data: "), n1); 26 | if (strcmp(Blinker.bridgeName(bNum), BLINKER_CMD_FALSE) != 0) 27 | { 28 | Blinker.bridgePrint(Blinker.bridgeName(bNum), STRING_format(n1)); 29 | } 30 | } 31 | 32 | template 33 | void print(T1 n1, T2 n2) 34 | { 35 | if (strcmp(Blinker.bridgeName(bNum), BLINKER_CMD_FALSE) != 0) 36 | { 37 | String msg = BLINKER_F("{\""); 38 | msg += STRING_format(n1); 39 | msg += BLINKER_F("\":\""); 40 | msg += STRING_format(n2); 41 | msg += BLINKER_F("\"}"); 42 | 43 | Blinker.bridgePrint(Blinker.bridgeName(bNum), msg); 44 | } 45 | } 46 | 47 | // void name(char name[]) 48 | // { 49 | // _bName = (char*)malloc((strlen(name)+1)*sizeof(char)); 50 | // strcpy(_bName, name); 51 | // } 52 | // char * getName() { return _bName; } 53 | // void freshBridge(const String & name) 54 | // { 55 | // bridgeName = (char*)malloc((name.length()+1)*sizeof(char)); 56 | // strcpy(bridgeName, name.c_str()); 57 | // } 58 | // char * getBridge() { return bridgeName; } 59 | // bool checkName(char name[]) { return strcmp(_bName, name) == 0; } 60 | 61 | private : 62 | uint8_t bNum; 63 | }; 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /src/Functions/BlinkerChart.h: -------------------------------------------------------------------------------- 1 | #ifndef BLINKER_REAL_TIME_DATA_H 2 | #define BLINKER_REAL_TIME_DATA_H 3 | 4 | #include "../Blinker/BlinkerConfig.h" 5 | #include "../Blinker/BlinkerUtility.h" 6 | 7 | class BlinkerRealTimeData 8 | { 9 | public : 10 | BlinkerRealTimeData(char _name[], blinker_callback_t _func = NULL) 11 | { 12 | Blinker.attachRTData(_name, _func); 13 | } 14 | 15 | void saveData(char key[], int32_t data) 16 | { 17 | if (_count = 0) 18 | { 19 | strcpy(_keys, key); 20 | } 21 | 22 | _datas[_count] = data; 23 | _times[_count] = Blinker.time(); 24 | 25 | _count++; 26 | } 27 | 28 | void print() 29 | { 30 | String rtData; 31 | 32 | if (_count > 0) 33 | { 34 | rtData = BLINKER_F("{\"rt\":\"{\""); 35 | rtData += STRING_format(_keys); 36 | rtData += BLINKER_F("\":["); 37 | 38 | for (uint8_t i = 0; i < _count; i++) 39 | { 40 | rtData += BLINKER_F("{\"value\":"); 41 | rtData += STRING_format(_datas[i]); 42 | rtData += BLINKER_F(",\"date\":"); 43 | rtData += STRING_format(_times[i]); 44 | rtData += BLINKER_F("}"); 45 | 46 | if (i < _count - 1) 47 | { 48 | rtData += BLINKER_F(","); 49 | } 50 | } 51 | 52 | rtData += BLINKER_F("]}}"); 53 | 54 | Blinker.printObject(Blinker.widgetName_str(wNum), buttonData); 55 | 56 | _count = 0; 57 | } 58 | } 59 | 60 | private : 61 | uint8_t wNum; 62 | 63 | uint8_t _count = 0; 64 | int32_t _datas[12]; 65 | time_t _times[12]; 66 | char _keys[12]; 67 | }; 68 | 69 | #endif 70 | -------------------------------------------------------------------------------- /src/Functions/BlinkerEvent.h: -------------------------------------------------------------------------------- 1 | #ifndef BLINKER_EVENT_H 2 | #define BLINKER_EVENT_H 3 | 4 | #include "../Blinker/BlinkerConfig.h" 5 | #include "../Blinker/BlinkerUtility.h" 6 | 7 | class BLINKEREVENT 8 | { 9 | public : 10 | BLINKEREVENT() 11 | {} 12 | 13 | void warning(const String & msg) 14 | { 15 | Blinker.eventWarn(msg); 16 | } 17 | 18 | void error(const String & msg) 19 | { 20 | Blinker.eventError(msg); 21 | } 22 | 23 | void message(const String & msg) 24 | { 25 | Blinker.eventMsg(msg); 26 | } 27 | 28 | private : 29 | 30 | }; 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /src/Functions/BlinkerImage.h: -------------------------------------------------------------------------------- 1 | #ifndef BlinkerImage_H 2 | #define BlinkerImage_H 3 | 4 | #include "../Blinker/BlinkerConfig.h" 5 | #include "../Blinker/BlinkerUtility.h" 6 | 7 | class BlinkerImage 8 | { 9 | public : 10 | BlinkerImage(char _name[], blinker_callback_with_int32_arg_t _func = NULL) 11 | { 12 | wNum = Blinker.attachWidget(_name, _func); 13 | // numName = (char*)malloc((strlen(_name)+1)*sizeof(char)); 14 | // strcpy(numName, _name); 15 | } 16 | 17 | void attach(blinker_callback_with_int32_arg_t _func) 18 | { 19 | if (wNum == 0) return; 20 | 21 | Blinker.freshAttachWidget(Blinker.widgetName_int(wNum), _func); 22 | } 23 | 24 | uint8_t getNum() { return num; } 25 | 26 | void print(uint8_t _num) 27 | { 28 | num = _num; 29 | 30 | String ImageData = BLINKER_F("{\"img\":"); 31 | ImageData += STRING_format(num); 32 | ImageData += BLINKER_F("}"); 33 | 34 | // Blinker.printArray(numName, ImageData); 35 | Blinker.printArray(Blinker.widgetName_int(wNum), ImageData); 36 | } 37 | 38 | private : 39 | uint8_t wNum; 40 | uint8_t num = 0; 41 | }; 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /src/Functions/BlinkerJoystick.h: -------------------------------------------------------------------------------- 1 | #ifndef BLINKER_JOYSTICK_H 2 | #define BLINKER_JOYSTICK_H 3 | 4 | // #if defined(BLINKER_BLE) 5 | #include "../Blinker/BlinkerConfig.h" 6 | #include "../Blinker/BlinkerUtility.h" 7 | 8 | class BlinkerJoystick 9 | { 10 | public : 11 | BlinkerJoystick(char _name[], blinker_callback_with_joy_arg_t _func = NULL) 12 | // : jName(_name) 13 | { 14 | wNum = Blinker.attachWidget(_name, _func); 15 | } 16 | 17 | void attach(blinker_callback_with_joy_arg_t _func) 18 | { 19 | if (wNum == 0) { 20 | return; 21 | } 22 | 23 | Blinker.freshAttachWidget(Blinker.widgetName_joy(wNum), _func); 24 | } 25 | 26 | private : 27 | uint8_t wNum; 28 | }; 29 | // #endif 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /src/Functions/BlinkerRGB.h: -------------------------------------------------------------------------------- 1 | #ifndef BlinkerRGB_H 2 | #define BlinkerRGB_H 3 | 4 | #include "../Blinker/BlinkerConfig.h" 5 | #include "../Blinker/BlinkerUtility.h" 6 | 7 | class BlinkerRGB 8 | { 9 | public : 10 | BlinkerRGB(char _name[], blinker_callback_with_rgb_arg_t _func = NULL) 11 | // : rgbName(_name) 12 | { 13 | wNum = Blinker.attachWidget(_name, _func); 14 | } 15 | 16 | void attach(blinker_callback_with_rgb_arg_t _func) 17 | { 18 | if (wNum == 0) return; 19 | 20 | Blinker.freshAttachWidget(Blinker.widgetName_rgb(wNum), _func); 21 | } 22 | 23 | void brightness(uint8_t _bright) { rgbrightness = _bright; } 24 | 25 | void print(uint8_t _r, uint8_t _g, uint8_t _b) 26 | { 27 | if (wNum == 0) return; 28 | 29 | String rgbData = BLINKER_F("["); 30 | rgbData += STRING_format(_r); 31 | rgbData += BLINKER_F(","); 32 | rgbData += STRING_format(_g); 33 | rgbData += BLINKER_F(","); 34 | rgbData += STRING_format(_b); 35 | rgbData += BLINKER_F(","); 36 | rgbData += STRING_format(rgbrightness); 37 | rgbData += BLINKER_F("]"); 38 | 39 | Blinker.printArray(Blinker.widgetName_rgb(wNum), rgbData); 40 | } 41 | 42 | void print(uint8_t _r, uint8_t _g, uint8_t _b, uint8_t _bright) 43 | { 44 | if (wNum == 0) { 45 | return; 46 | } 47 | 48 | String rgbData = BLINKER_F("["); 49 | rgbData += STRING_format(_r); 50 | rgbData += BLINKER_F(","); 51 | rgbData += STRING_format(_g); 52 | rgbData += BLINKER_F(","); 53 | rgbData += STRING_format(_b); 54 | rgbData += BLINKER_F(","); 55 | rgbData += STRING_format(_bright); 56 | rgbData += BLINKER_F("]"); 57 | 58 | Blinker.printArray(Blinker.widgetName_rgb(wNum), rgbData); 59 | } 60 | 61 | private : 62 | uint8_t wNum; 63 | uint8_t rgbrightness = 0; 64 | }; 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /src/Functions/BlinkerSwitch.h: -------------------------------------------------------------------------------- 1 | #ifndef BlinkerSwitch_H 2 | #define BlinkerSwitch_H 3 | 4 | #include "../Blinker/BlinkerConfig.h" 5 | #include "../Blinker/BlinkerUtility.h" 6 | 7 | class BlinkerSwitch 8 | { 9 | public : 10 | BlinkerSwitch() 11 | // : sName(BLINKER_CMD_BUILTIN_SWITCH) 12 | {} 13 | 14 | void attach(blinker_callback_with_string_arg_t _func) 15 | { 16 | Blinker.attachSwitch(_func); 17 | } 18 | void print(const String & _state) 19 | { 20 | Blinker.print(BLINKER_CMD_BUILTIN_SWITCH, _state); 21 | } 22 | 23 | private : 24 | // String sName; 25 | }; 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /src/Functions/BlinkerTable.h: -------------------------------------------------------------------------------- 1 | #ifndef BlinkerTable_H 2 | #define BlinkerTable_H 3 | 4 | #include "Blinker/BlinkerConfig.h" 5 | #include "Blinker/BlinkerUtility.h" 6 | 7 | class BlinkerTable 8 | { 9 | public : 10 | BlinkerTable(char _name[], blinker_callback_with_table_arg_t _func = NULL) 11 | { 12 | wNum = Blinker.attachWidget(_name, _func); 13 | } 14 | 15 | void attach(blinker_callback_with_table_arg_t _func) 16 | { 17 | if (wNum == 0) return; 18 | 19 | Blinker.freshAttachWidget(Blinker.widgetName_tab(wNum), _func); 20 | } 21 | 22 | void table_0() 23 | { 24 | tabSet = tabSet | (1 << 4); 25 | } 26 | 27 | void table_1() 28 | { 29 | tabSet = tabSet | (1 << 3); 30 | } 31 | 32 | void table_2() 33 | { 34 | tabSet = tabSet | (1 << 2); 35 | } 36 | 37 | void table_3() 38 | { 39 | tabSet = tabSet | (1 << 1); 40 | } 41 | 42 | void table_4() 43 | { 44 | tabSet = tabSet | (1 << 0); 45 | } 46 | 47 | void print() 48 | { 49 | if (wNum == 0) return; 50 | 51 | String tabData; 52 | 53 | tabData += BLINKER_F("{\""); 54 | tabData += BLINKER_F(BLINKER_CMD_VALUE); 55 | tabData += BLINKER_F("\":\""); 56 | 57 | BLINKER_LOG_ALL(BLINKER_F("tabSet: "), tabSet); 58 | 59 | if ((tabSet >> 4) & 0x01) { tabData += "1"; } 60 | else { tabData += "0"; } 61 | 62 | if ((tabSet >> 3) & 0x01) { tabData += "1"; } 63 | else { tabData += "0"; } 64 | 65 | if ((tabSet >> 2) & 0x01) { tabData += "1"; } 66 | else { tabData += "0"; } 67 | 68 | if ((tabSet >> 1) & 0x01) { tabData += "1"; } 69 | else { tabData += "0"; } 70 | 71 | if ((tabSet >> 0) & 0x01) { tabData += "1"; } 72 | else { tabData += "0"; } 73 | 74 | tabData += BLINKER_F("\"}"); 75 | 76 | tabSet = 0; 77 | 78 | Blinker.printArray(Blinker.widgetName_tab(wNum), tabData); 79 | } 80 | 81 | private : 82 | uint8_t wNum; 83 | uint8_t tabSet = 0; 84 | }; 85 | 86 | #endif 87 | -------------------------------------------------------------------------------- /src/Functions/BlinkerTicker.h: -------------------------------------------------------------------------------- 1 | #ifndef BLINEKR_TICKER_H 2 | #define BLINEKR_TICKER_H 3 | 4 | #if defined(ARDUINO) 5 | #if ARDUINO >= 100 6 | #include 7 | #else 8 | #include 9 | #endif 10 | #endif 11 | 12 | #include "../Blinker/BlinkerDebug.h" 13 | 14 | extern "C" { 15 | typedef void (*blinker_callback_t)(void); 16 | } 17 | 18 | class BlinkerTicker 19 | { 20 | public : 21 | BlinkerTicker() {} 22 | // : day_time(0) 23 | // , os_time(0) 24 | // {} 25 | 26 | // void freshTime(uint32_t time_s) { day_time = time_s; os_time = millis(); } 27 | 28 | void attach(uint32_t seconds, blinker_callback_t func) 29 | { 30 | aim_time = seconds; 31 | tickerFunc = func; 32 | 33 | isRun = true; 34 | } 35 | 36 | void detach() { isRun = false; } 37 | 38 | void run() 39 | { 40 | if (millis() - os_time >= 1000 && millis() - os_time < 2000) 41 | { 42 | os_time += 1000; 43 | tick_time ++; 44 | } 45 | else if (millis() - os_time >= 2000) 46 | { 47 | tick_time += (millis() - os_time) / 1000; 48 | os_time = millis(); 49 | } 50 | 51 | if (isRun) 52 | { 53 | if (tick_time - aim_time >= 0 && tick_time - aim_time < 60) 54 | { 55 | BLINKER_LOG_ALL(BLINKER_F("ticker trigged")); 56 | isRun = false; 57 | 58 | if (tickerFunc) tickerFunc(); 59 | } 60 | } 61 | } 62 | 63 | protected : 64 | uint32_t tick_time; 65 | uint32_t os_time; 66 | uint32_t aim_time; 67 | bool isRun = false; 68 | 69 | blinker_callback_t tickerFunc = NULL; 70 | }; 71 | 72 | #endif 73 | -------------------------------------------------------------------------------- /src/Server/BlinkerServer.h: -------------------------------------------------------------------------------- 1 | #ifndef BLINKER_SERVER_H 2 | #define BLINKER_SERVER_H 3 | 4 | #ifndef BLINKER_SERVER_HTTPS 5 | #ifndef BLINKER_WITHOUT_SSL 6 | #define BLINKER_SERVER_HTTPS "https://iot.diandeng.tech" 7 | #else 8 | #define BLINKER_SERVER_HTTPS "http://iot.diandeng.tech" 9 | #endif 10 | #endif 11 | 12 | #ifndef BLINKER_SERVER_HOST 13 | #define BLINKER_SERVER_HOST "iot.diandeng.tech" 14 | #endif 15 | 16 | #ifndef BLINKER_STORAGE_HTTPS 17 | #ifndef BLINKER_WITHOUT_SSL 18 | #define BLINKER_STORAGE_HTTPS "https://storage.diandeng.tech" 19 | #else 20 | #define BLINKER_STORAGE_HTTPS "http://storage.diandeng.tech" 21 | #endif 22 | #endif 23 | 24 | #endif -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson.h: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #ifdef __cplusplus 8 | 9 | # include "ArduinoJson.hpp" 10 | 11 | using namespace ArduinoJson; 12 | 13 | #else 14 | 15 | #error ArduinoJson requires a C++ compiler, please change file extension to .cc or .cpp 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Array/ArrayFunctions.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "../Collection/CollectionData.hpp" 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | 11 | inline VariantData *arrayAdd(CollectionData *arr, MemoryPool *pool) { 12 | return arr ? arr->addElement(pool) : 0; 13 | } 14 | 15 | template 16 | inline typename TVisitor::result_type arrayAccept(const CollectionData *arr, 17 | TVisitor &visitor) { 18 | if (arr) 19 | return visitor.visitArray(*arr); 20 | else 21 | return visitor.visitNull(); 22 | } 23 | 24 | inline bool arrayEquals(const CollectionData *lhs, const CollectionData *rhs) { 25 | if (lhs == rhs) 26 | return true; 27 | if (!lhs || !rhs) 28 | return false; 29 | return lhs->equalsArray(*rhs); 30 | } 31 | } // namespace ARDUINOJSON_NAMESPACE 32 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Array/ArrayImpl.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "../Object/ObjectRef.hpp" 8 | #include "ArrayRef.hpp" 9 | 10 | namespace ARDUINOJSON_NAMESPACE { 11 | 12 | template 13 | inline ArrayRef ArrayShortcuts::createNestedArray() const { 14 | return impl()->addElement().template to(); 15 | } 16 | 17 | template 18 | inline ObjectRef ArrayShortcuts::createNestedObject() const { 19 | return impl()->addElement().template to(); 20 | } 21 | 22 | template 23 | inline ElementProxy ArrayShortcuts::operator[]( 24 | size_t index) const { 25 | return ElementProxy(*impl(), index); 26 | } 27 | 28 | } // namespace ARDUINOJSON_NAMESPACE 29 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Array/ArrayShortcuts.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "../Polyfills/attributes.hpp" 8 | #include "../Polyfills/type_traits.hpp" 9 | 10 | namespace ARDUINOJSON_NAMESPACE { 11 | // Forward declarations. 12 | class ArrayRef; 13 | class ObjectRef; 14 | template 15 | class ElementProxy; 16 | 17 | template 18 | class ArrayShortcuts { 19 | public: 20 | // Returns the element at specified index if the variant is an array. 21 | FORCE_INLINE ElementProxy operator[](size_t index) const; 22 | 23 | FORCE_INLINE ObjectRef createNestedObject() const; 24 | 25 | FORCE_INLINE ArrayRef createNestedArray() const; 26 | 27 | // Adds the specified value at the end of the array. 28 | // 29 | // bool add(TValue); 30 | // TValue = bool, long, int, short, float, double, serialized, VariantRef, 31 | // std::string, String, ObjectRef 32 | template 33 | FORCE_INLINE bool add(const T &value) const { 34 | return impl()->addElement().set(value); 35 | } 36 | // 37 | // bool add(TValue); 38 | // TValue = char*, const char*, const __FlashStringHelper* 39 | template 40 | FORCE_INLINE bool add(T *value) const { 41 | return impl()->addElement().set(value); 42 | } 43 | 44 | private: 45 | const TArray *impl() const { 46 | return static_cast(this); 47 | } 48 | }; 49 | } // namespace ARDUINOJSON_NAMESPACE 50 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Collection/CollectionData.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "../Namespace.hpp" 8 | #include "../Polyfills/assert.hpp" 9 | 10 | #include // size_t 11 | 12 | namespace ARDUINOJSON_NAMESPACE { 13 | 14 | class MemoryPool; 15 | class VariantData; 16 | class VariantSlot; 17 | 18 | class CollectionData { 19 | VariantSlot *_head; 20 | VariantSlot *_tail; 21 | 22 | public: 23 | // Must be a POD! 24 | // - no constructor 25 | // - no destructor 26 | // - no virtual 27 | // - no inheritance 28 | 29 | // Array only 30 | 31 | VariantData *addElement(MemoryPool *pool); 32 | 33 | VariantData *getElement(size_t index) const; 34 | 35 | VariantData *getOrAddElement(size_t index, MemoryPool *pool); 36 | 37 | void removeElement(size_t index); 38 | 39 | bool equalsArray(const CollectionData &other) const; 40 | 41 | // Object only 42 | 43 | template 44 | VariantData *addMember(TAdaptedString key, MemoryPool *pool, TStoragePolicy); 45 | 46 | template 47 | VariantData *getMember(TAdaptedString key) const; 48 | 49 | template 50 | VariantData *getOrAddMember(TAdaptedString key, MemoryPool *pool, 51 | TStoragePolicy); 52 | 53 | template 54 | void removeMember(TAdaptedString key) { 55 | removeSlot(getSlot(key)); 56 | } 57 | 58 | template 59 | bool containsKey(const TAdaptedString &key) const; 60 | 61 | bool equalsObject(const CollectionData &other) const; 62 | 63 | // Generic 64 | 65 | void clear(); 66 | size_t memoryUsage() const; 67 | size_t nesting() const; 68 | size_t size() const; 69 | 70 | VariantSlot *addSlot(MemoryPool *); 71 | void removeSlot(VariantSlot *slot); 72 | 73 | bool copyFrom(const CollectionData &src, MemoryPool *pool); 74 | 75 | VariantSlot *head() const { 76 | return _head; 77 | } 78 | 79 | void movePointers(ptrdiff_t stringDistance, ptrdiff_t variantDistance); 80 | 81 | private: 82 | VariantSlot *getSlot(size_t index) const; 83 | 84 | template 85 | VariantSlot *getSlot(TAdaptedString key) const; 86 | 87 | VariantSlot *getPreviousSlot(VariantSlot *) const; 88 | }; 89 | } // namespace ARDUINOJSON_NAMESPACE 90 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Deserialization/ArduinoStreamReader.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2019 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #if ARDUINOJSON_ENABLE_ARDUINO_STREAM 8 | 9 | #include 10 | 11 | namespace ARDUINOJSON_NAMESPACE { 12 | 13 | struct ArduinoStreamReader { 14 | Stream& _stream; 15 | 16 | public: 17 | explicit ArduinoStreamReader(Stream& stream) : _stream(stream) {} 18 | 19 | int read() { 20 | // don't use _stream.read() as it ignores the timeout 21 | uint8_t c; 22 | return _stream.readBytes(&c, 1) ? c : -1; 23 | } 24 | }; 25 | 26 | inline ArduinoStreamReader makeReader(Stream& input) { 27 | return ArduinoStreamReader(input); 28 | } 29 | } // namespace ARDUINOJSON_NAMESPACE 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Deserialization/CharPointerReader.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2019 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | namespace ARDUINOJSON_NAMESPACE { 8 | 9 | template 10 | struct IsCharOrVoid { 11 | static const bool value = 12 | is_same::value || is_same::value || 13 | is_same::value || is_same::value; 14 | }; 15 | 16 | template 17 | struct IsCharOrVoid : IsCharOrVoid {}; 18 | 19 | class UnsafeCharPointerReader { 20 | const char* _ptr; 21 | 22 | public: 23 | explicit UnsafeCharPointerReader(const char* ptr) 24 | : _ptr(ptr ? ptr : reinterpret_cast("")) {} 25 | 26 | int read() { 27 | return static_cast(*_ptr++); 28 | } 29 | }; 30 | 31 | class SafeCharPointerReader { 32 | const char* _ptr; 33 | const char* _end; 34 | 35 | public: 36 | explicit SafeCharPointerReader(const char* ptr, size_t len) 37 | : _ptr(ptr ? ptr : reinterpret_cast("")), _end(_ptr + len) {} 38 | 39 | int read() { 40 | if (_ptr < _end) 41 | return static_cast(*_ptr++); 42 | else 43 | return -1; 44 | } 45 | }; 46 | 47 | template 48 | inline typename enable_if::value, 49 | UnsafeCharPointerReader>::type 50 | makeReader(TChar* input) { 51 | return UnsafeCharPointerReader(reinterpret_cast(input)); 52 | } 53 | 54 | template 55 | inline 56 | typename enable_if::value, SafeCharPointerReader>::type 57 | makeReader(TChar* input, size_t n) { 58 | return SafeCharPointerReader(reinterpret_cast(input), n); 59 | } 60 | 61 | #if ARDUINOJSON_ENABLE_ARDUINO_STRING 62 | inline SafeCharPointerReader makeReader(const ::String& input) { 63 | return SafeCharPointerReader(input.c_str(), input.length()); 64 | } 65 | #endif 66 | 67 | } // namespace ARDUINOJSON_NAMESPACE 68 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Deserialization/Filter.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "../Namespace.hpp" 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | 11 | class Filter { 12 | public: 13 | explicit Filter(VariantConstRef v) : _variant(v) {} 14 | 15 | bool allow() const { 16 | return _variant; 17 | } 18 | 19 | bool allowArray() const { 20 | return _variant == true || _variant.is(); 21 | } 22 | 23 | bool allowObject() const { 24 | return _variant == true || _variant.is(); 25 | } 26 | 27 | bool allowValue() const { 28 | return _variant == true; 29 | } 30 | 31 | template 32 | Filter operator[](const TKey& key) const { 33 | if (_variant == true) // "true" means "allow recursively" 34 | return *this; 35 | VariantConstRef member = _variant[key]; 36 | return Filter(member.isNull() ? _variant["*"] : member); 37 | } 38 | 39 | private: 40 | VariantConstRef _variant; 41 | }; 42 | 43 | struct AllowAllFilter { 44 | bool allow() const { 45 | return true; 46 | } 47 | 48 | bool allowArray() const { 49 | return true; 50 | } 51 | 52 | bool allowObject() const { 53 | return true; 54 | } 55 | 56 | bool allowValue() const { 57 | return true; 58 | } 59 | 60 | template 61 | AllowAllFilter operator[](const TKey&) const { 62 | return AllowAllFilter(); 63 | } 64 | }; 65 | 66 | } // namespace ARDUINOJSON_NAMESPACE 67 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Deserialization/FlashStringReader.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2019 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #if ARDUINOJSON_ENABLE_PROGMEM 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | class UnsafeFlashStringReader { 11 | const char* _ptr; 12 | 13 | public: 14 | explicit UnsafeFlashStringReader(const __FlashStringHelper* ptr) 15 | : _ptr(reinterpret_cast(ptr)) {} 16 | 17 | int read() { 18 | return pgm_read_byte_near(_ptr++); 19 | } 20 | }; 21 | 22 | class SafeFlashStringReader { 23 | const char* _ptr; 24 | const char* _end; 25 | 26 | public: 27 | explicit SafeFlashStringReader(const __FlashStringHelper* ptr, size_t size) 28 | : _ptr(reinterpret_cast(ptr)), _end(_ptr + size) {} 29 | 30 | int read() { 31 | if (_ptr < _end) 32 | return pgm_read_byte_near(_ptr++); 33 | else 34 | return -1; 35 | } 36 | }; 37 | 38 | inline UnsafeFlashStringReader makeReader(const __FlashStringHelper* input) { 39 | return UnsafeFlashStringReader(input); 40 | } 41 | 42 | inline SafeFlashStringReader makeReader(const __FlashStringHelper* input, 43 | size_t size) { 44 | return SafeFlashStringReader(input, size); 45 | } 46 | } // namespace ARDUINOJSON_NAMESPACE 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Deserialization/IteratorReader.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2019 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | namespace ARDUINOJSON_NAMESPACE { 8 | 9 | template 10 | class IteratorReader { 11 | TIterator _ptr, _end; 12 | 13 | public: 14 | explicit IteratorReader(TIterator begin, TIterator end) 15 | : _ptr(begin), _end(end) {} 16 | 17 | int read() { 18 | if (_ptr < _end) 19 | return static_cast(*_ptr++); 20 | else 21 | return -1; 22 | } 23 | }; 24 | 25 | template 26 | inline IteratorReader makeReader( 27 | const TInput& input) { 28 | return IteratorReader(input.begin(), 29 | input.end()); 30 | } 31 | } // namespace ARDUINOJSON_NAMESPACE 32 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Deserialization/NestingLimit.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "../Namespace.hpp" 8 | #include "../Polyfills/assert.hpp" 9 | 10 | namespace ARDUINOJSON_NAMESPACE { 11 | 12 | class NestingLimit { 13 | public: 14 | NestingLimit() : _value(ARDUINOJSON_DEFAULT_NESTING_LIMIT) {} 15 | explicit NestingLimit(uint8_t n) : _value(n) {} 16 | 17 | NestingLimit decrement() const { 18 | ARDUINOJSON_ASSERT(_value > 0); 19 | return NestingLimit(static_cast(_value - 1)); 20 | } 21 | 22 | bool reached() const { 23 | return _value == 0; 24 | } 25 | 26 | private: 27 | uint8_t _value; 28 | }; 29 | } // namespace ARDUINOJSON_NAMESPACE 30 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Deserialization/Reader.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "../Namespace.hpp" 8 | 9 | #include // for size_t 10 | 11 | namespace ARDUINOJSON_NAMESPACE { 12 | 13 | // The default reader is a simple wrapper for Readers that are not copiable 14 | template 15 | struct Reader { 16 | public: 17 | Reader(TSource& source) : _source(&source) {} 18 | 19 | int read() { 20 | return _source->read(); // Error here? You passed an unsupported input type 21 | } 22 | 23 | size_t readBytes(char* buffer, size_t length) { 24 | return _source->readBytes(buffer, length); 25 | } 26 | 27 | private: 28 | TSource* _source; 29 | }; 30 | 31 | template 32 | struct BoundedReader { 33 | // no default implementation because we need to pass the size to the 34 | // constructor 35 | }; 36 | } // namespace ARDUINOJSON_NAMESPACE 37 | 38 | #include "../Deserialization/Readers/IteratorReader.hpp" 39 | #include "../Deserialization/Readers/RamReader.hpp" 40 | #include "../Deserialization/Readers/VariantReader.hpp" 41 | 42 | #if ARDUINOJSON_ENABLE_ARDUINO_STREAM 43 | # include "../Deserialization/Readers/ArduinoStreamReader.hpp" 44 | #endif 45 | 46 | #if ARDUINOJSON_ENABLE_ARDUINO_STRING 47 | # include "../Deserialization/Readers/ArduinoStringReader.hpp" 48 | #endif 49 | 50 | #if ARDUINOJSON_ENABLE_PROGMEM 51 | # include "../Deserialization/Readers/FlashReader.hpp" 52 | #endif 53 | 54 | #if ARDUINOJSON_ENABLE_STD_STREAM 55 | # include "../Deserialization/Readers/StdStreamReader.hpp" 56 | #endif 57 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Deserialization/Readers/ArduinoStreamReader.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | 11 | template 12 | struct Reader::value>::type> { 14 | public: 15 | explicit Reader(Stream& stream) : _stream(&stream) {} 16 | 17 | int read() { 18 | // don't use _stream.read() as it ignores the timeout 19 | char c; 20 | return _stream->readBytes(&c, 1) ? static_cast(c) : -1; 21 | } 22 | 23 | size_t readBytes(char* buffer, size_t length) { 24 | return _stream->readBytes(buffer, length); 25 | } 26 | 27 | private: 28 | Stream* _stream; 29 | }; 30 | 31 | } // namespace ARDUINOJSON_NAMESPACE 32 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Deserialization/Readers/ArduinoStringReader.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | 11 | template 12 | struct Reader::value>::type> 14 | : BoundedReader { 15 | explicit Reader(const ::String& s) 16 | : BoundedReader(s.c_str(), s.length()) {} 17 | }; 18 | 19 | } // namespace ARDUINOJSON_NAMESPACE 20 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Deserialization/Readers/FlashReader.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | 11 | template <> 12 | struct Reader { 13 | const char* _ptr; 14 | 15 | public: 16 | explicit Reader(const __FlashStringHelper* ptr) 17 | : _ptr(reinterpret_cast(ptr)) {} 18 | 19 | int read() { 20 | return pgm_read_byte(_ptr++); 21 | } 22 | 23 | size_t readBytes(char* buffer, size_t length) { 24 | memcpy_P(buffer, _ptr, length); 25 | _ptr += length; 26 | return length; 27 | } 28 | }; 29 | 30 | template <> 31 | struct BoundedReader { 32 | const char* _ptr; 33 | const char* _end; 34 | 35 | public: 36 | explicit BoundedReader(const __FlashStringHelper* ptr, size_t size) 37 | : _ptr(reinterpret_cast(ptr)), _end(_ptr + size) {} 38 | 39 | int read() { 40 | if (_ptr < _end) 41 | return pgm_read_byte(_ptr++); 42 | else 43 | return -1; 44 | } 45 | 46 | size_t readBytes(char* buffer, size_t length) { 47 | size_t available = static_cast(_end - _ptr); 48 | if (available < length) 49 | length = available; 50 | memcpy_P(buffer, _ptr, length); 51 | _ptr += length; 52 | return length; 53 | } 54 | }; 55 | } // namespace ARDUINOJSON_NAMESPACE 56 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Deserialization/Readers/IteratorReader.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | namespace ARDUINOJSON_NAMESPACE { 8 | 9 | template 10 | class IteratorReader { 11 | TIterator _ptr, _end; 12 | 13 | public: 14 | explicit IteratorReader(TIterator begin, TIterator end) 15 | : _ptr(begin), _end(end) {} 16 | 17 | int read() { 18 | if (_ptr < _end) 19 | return static_cast(*_ptr++); 20 | else 21 | return -1; 22 | } 23 | 24 | size_t readBytes(char* buffer, size_t length) { 25 | size_t i = 0; 26 | while (i < length && _ptr < _end) buffer[i++] = *_ptr++; 27 | return i; 28 | } 29 | }; 30 | 31 | template 32 | struct void_ { 33 | typedef void type; 34 | }; 35 | 36 | template 37 | struct Reader::type> 38 | : IteratorReader { 39 | explicit Reader(const TSource& source) 40 | : IteratorReader(source.begin(), 41 | source.end()) {} 42 | }; 43 | } // namespace ARDUINOJSON_NAMESPACE 44 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Deserialization/Readers/RamReader.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "../../Polyfills/type_traits.hpp" 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | 11 | template 12 | struct IsCharOrVoid { 13 | static const bool value = 14 | is_same::value || is_same::value || 15 | is_same::value || is_same::value; 16 | }; 17 | 18 | template 19 | struct IsCharOrVoid : IsCharOrVoid {}; 20 | 21 | template 22 | struct Reader::value>::type> { 24 | const char* _ptr; 25 | 26 | public: 27 | explicit Reader(const void* ptr) 28 | : _ptr(ptr ? reinterpret_cast(ptr) : "") {} 29 | 30 | int read() { 31 | return static_cast(*_ptr++); 32 | } 33 | 34 | size_t readBytes(char* buffer, size_t length) { 35 | for (size_t i = 0; i < length; i++) buffer[i] = *_ptr++; 36 | return length; 37 | } 38 | }; 39 | 40 | template 41 | struct BoundedReader::value>::type> 43 | : public IteratorReader { 44 | public: 45 | explicit BoundedReader(const void* ptr, size_t len) 46 | : IteratorReader(reinterpret_cast(ptr), 47 | reinterpret_cast(ptr) + len) {} 48 | }; 49 | 50 | } // namespace ARDUINOJSON_NAMESPACE 51 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Deserialization/Readers/StdStreamReader.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | 11 | template 12 | struct Reader::value>::type> { 14 | public: 15 | explicit Reader(std::istream& stream) : _stream(&stream) {} 16 | 17 | int read() { 18 | return _stream->get(); 19 | } 20 | 21 | size_t readBytes(char* buffer, size_t length) { 22 | _stream->read(buffer, static_cast(length)); 23 | return static_cast(_stream->gcount()); 24 | } 25 | 26 | private: 27 | std::istream* _stream; 28 | }; 29 | } // namespace ARDUINOJSON_NAMESPACE 30 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Deserialization/Readers/VariantReader.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "../../Object/MemberProxy.hpp" 8 | #include "../../Variant/VariantRef.hpp" 9 | 10 | namespace ARDUINOJSON_NAMESPACE { 11 | 12 | template 13 | struct Reader, void> : Reader { 14 | explicit Reader(const ElementProxy& x) 15 | : Reader(x.template as()) {} 16 | }; 17 | 18 | template 19 | struct Reader, void> : Reader { 20 | explicit Reader(const MemberProxy& x) 21 | : Reader(x.template as()) {} 22 | }; 23 | 24 | template <> 25 | struct Reader : Reader { 26 | explicit Reader(VariantRef x) : Reader(x.as()) {} 27 | }; 28 | 29 | template <> 30 | struct Reader : Reader { 31 | explicit Reader(VariantConstRef x) 32 | : Reader(x.as()) {} 33 | }; 34 | } // namespace ARDUINOJSON_NAMESPACE 35 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Deserialization/StdStreamReader.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2019 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #if ARDUINOJSON_ENABLE_STD_STREAM 8 | 9 | #include 10 | 11 | namespace ARDUINOJSON_NAMESPACE { 12 | 13 | class StdStreamReader { 14 | std::istream& _stream; 15 | char _current; 16 | 17 | public: 18 | explicit StdStreamReader(std::istream& stream) 19 | : _stream(stream), _current(0) {} 20 | 21 | int read() { 22 | return _stream.get(); 23 | } 24 | 25 | private: 26 | StdStreamReader& operator=(const StdStreamReader&); // Visual Studio C4512 27 | }; 28 | 29 | inline StdStreamReader makeReader(std::istream& input) { 30 | return StdStreamReader(input); 31 | } 32 | } // namespace ARDUINOJSON_NAMESPACE 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Document/DynamicJsonDocument.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "../Document/BasicJsonDocument.hpp" 8 | 9 | #include // malloc, free 10 | 11 | namespace ARDUINOJSON_NAMESPACE { 12 | 13 | struct DefaultAllocator { 14 | void* allocate(size_t size) { 15 | return malloc(size); 16 | } 17 | 18 | void deallocate(void* ptr) { 19 | free(ptr); 20 | } 21 | 22 | void* reallocate(void* ptr, size_t new_size) { 23 | return realloc(ptr, new_size); 24 | } 25 | }; 26 | 27 | typedef BasicJsonDocument DynamicJsonDocument; 28 | 29 | } // namespace ARDUINOJSON_NAMESPACE 30 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Document/StaticJsonDocument.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "../Document/JsonDocument.hpp" 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | 11 | template 12 | class StaticJsonDocument : public JsonDocument { 13 | static const size_t _capacity = 14 | AddPadding::value>::value; 15 | 16 | public: 17 | StaticJsonDocument() : JsonDocument(_buffer, _capacity) {} 18 | 19 | StaticJsonDocument(const StaticJsonDocument& src) 20 | : JsonDocument(_buffer, _capacity) { 21 | set(src); 22 | } 23 | 24 | template 25 | StaticJsonDocument(const T& src, 26 | typename enable_if::value>::type* = 0) 27 | : JsonDocument(_buffer, _capacity) { 28 | set(src); 29 | } 30 | 31 | // disambiguate 32 | StaticJsonDocument(VariantRef src) : JsonDocument(_buffer, _capacity) { 33 | set(src); 34 | } 35 | 36 | StaticJsonDocument& operator=(const StaticJsonDocument& src) { 37 | set(src); 38 | return *this; 39 | } 40 | 41 | template 42 | StaticJsonDocument& operator=(const T& src) { 43 | set(src); 44 | return *this; 45 | } 46 | 47 | void garbageCollect() { 48 | StaticJsonDocument tmp(*this); 49 | set(tmp); 50 | } 51 | 52 | private: 53 | char _buffer[_capacity]; 54 | }; 55 | 56 | } // namespace ARDUINOJSON_NAMESPACE 57 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Json/EscapeSequence.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "../Namespace.hpp" 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | 11 | class EscapeSequence { 12 | public: 13 | // Optimized for code size on a 8-bit AVR 14 | static char escapeChar(char c) { 15 | const char *p = escapeTable(true); 16 | while (p[0] && p[1] != c) { 17 | p += 2; 18 | } 19 | return p[0]; 20 | } 21 | 22 | // Optimized for code size on a 8-bit AVR 23 | static char unescapeChar(char c) { 24 | const char *p = escapeTable(false); 25 | for (;;) { 26 | if (p[0] == '\0') 27 | return 0; 28 | if (p[0] == c) 29 | return p[1]; 30 | p += 2; 31 | } 32 | } 33 | 34 | private: 35 | static const char *escapeTable(bool excludeSolidus) { 36 | return &"//\"\"\\\\b\bf\fn\nr\rt\t"[excludeSolidus ? 2 : 0]; 37 | } 38 | }; 39 | } // namespace ARDUINOJSON_NAMESPACE 40 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Json/Latch.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "../Polyfills/assert.hpp" 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | 11 | template 12 | class Latch { 13 | public: 14 | Latch(TReader reader) : _reader(reader), _loaded(false) { 15 | #if ARDUINOJSON_DEBUG 16 | _ended = false; 17 | #endif 18 | } 19 | 20 | void clear() { 21 | _loaded = false; 22 | } 23 | 24 | int last() const { 25 | return _current; 26 | } 27 | 28 | FORCE_INLINE char current() { 29 | if (!_loaded) { 30 | load(); 31 | } 32 | return _current; 33 | } 34 | 35 | private: 36 | void load() { 37 | ARDUINOJSON_ASSERT(!_ended); 38 | int c = _reader.read(); 39 | #if ARDUINOJSON_DEBUG 40 | if (c <= 0) 41 | _ended = true; 42 | #endif 43 | _current = static_cast(c > 0 ? c : 0); 44 | _loaded = true; 45 | } 46 | 47 | TReader _reader; 48 | char _current; // NOLINT(clang-analyzer-optin.cplusplus.UninitializedObject) 49 | // Not initialized in constructor (+10 bytes on AVR) 50 | bool _loaded; 51 | #if ARDUINOJSON_DEBUG 52 | bool _ended; 53 | #endif 54 | }; 55 | 56 | } // namespace ARDUINOJSON_NAMESPACE 57 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Json/PrettyJsonSerializer.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "../Configuration.hpp" 8 | #include "JsonSerializer.hpp" 9 | #include "../Serialization/measure.hpp" 10 | #include "../Serialization/serialize.hpp" 11 | 12 | namespace ARDUINOJSON_NAMESPACE { 13 | 14 | template 15 | class PrettyJsonSerializer : public JsonSerializer { 16 | typedef JsonSerializer base; 17 | 18 | public: 19 | PrettyJsonSerializer(TWriter writer) : base(writer), _nesting(0) {} 20 | 21 | size_t visitArray(const CollectionData &array) { 22 | VariantSlot *slot = array.head(); 23 | if (slot) { 24 | base::write("[\r\n"); 25 | _nesting++; 26 | while (slot != 0) { 27 | indent(); 28 | slot->data()->accept(*this); 29 | 30 | slot = slot->next(); 31 | base::write(slot ? ",\r\n" : "\r\n"); 32 | } 33 | _nesting--; 34 | indent(); 35 | base::write("]"); 36 | } else { 37 | base::write("[]"); 38 | } 39 | return this->bytesWritten(); 40 | } 41 | 42 | size_t visitObject(const CollectionData &object) { 43 | VariantSlot *slot = object.head(); 44 | if (slot) { 45 | base::write("{\r\n"); 46 | _nesting++; 47 | while (slot != 0) { 48 | indent(); 49 | base::visitString(slot->key()); 50 | base::write(": "); 51 | slot->data()->accept(*this); 52 | 53 | slot = slot->next(); 54 | base::write(slot ? ",\r\n" : "\r\n"); 55 | } 56 | _nesting--; 57 | indent(); 58 | base::write("}"); 59 | } else { 60 | base::write("{}"); 61 | } 62 | return this->bytesWritten(); 63 | } 64 | 65 | private: 66 | void indent() { 67 | for (uint8_t i = 0; i < _nesting; i++) base::write(ARDUINOJSON_TAB); 68 | } 69 | 70 | uint8_t _nesting; 71 | }; 72 | 73 | template 74 | size_t serializeJsonPretty(const TSource &source, TDestination &destination) { 75 | return serialize(source, destination); 76 | } 77 | 78 | template 79 | size_t serializeJsonPretty(const TSource &source, void *buffer, 80 | size_t bufferSize) { 81 | return serialize(source, buffer, bufferSize); 82 | } 83 | 84 | template 85 | size_t measureJsonPretty(const TSource &source) { 86 | return measure(source); 87 | } 88 | 89 | } // namespace ARDUINOJSON_NAMESPACE 90 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Json/Utf16.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "../Namespace.hpp" 8 | 9 | #include // uint16_t, uint32_t 10 | 11 | // The high surrogate may be uninitialized if the pair is invalid, 12 | // we choose to ignore the problem to reduce the size of the code 13 | // Garbage in => Garbage out 14 | #if defined(__GNUC__) 15 | # if __GNUC__ >= 7 16 | # pragma GCC diagnostic push 17 | # pragma GCC diagnostic ignored "-Wmaybe-uninitialized" 18 | # endif 19 | #endif 20 | 21 | namespace ARDUINOJSON_NAMESPACE { 22 | 23 | namespace Utf16 { 24 | inline bool isHighSurrogate(uint16_t codeunit) { 25 | return codeunit >= 0xD800 && codeunit < 0xDC00; 26 | } 27 | 28 | inline bool isLowSurrogate(uint16_t codeunit) { 29 | return codeunit >= 0xDC00 && codeunit < 0xE000; 30 | } 31 | 32 | class Codepoint { 33 | public: 34 | Codepoint() : _highSurrogate(0), _codepoint(0) {} 35 | 36 | bool append(uint16_t codeunit) { 37 | if (isHighSurrogate(codeunit)) { 38 | _highSurrogate = codeunit & 0x3FF; 39 | return false; 40 | } 41 | 42 | if (isLowSurrogate(codeunit)) { 43 | _codepoint = 44 | uint32_t(0x10000 + ((_highSurrogate << 10) | (codeunit & 0x3FF))); 45 | return true; 46 | } 47 | 48 | _codepoint = codeunit; 49 | return true; 50 | } 51 | 52 | uint32_t value() const { 53 | return _codepoint; 54 | } 55 | 56 | private: 57 | uint16_t _highSurrogate; 58 | uint32_t _codepoint; 59 | }; 60 | } // namespace Utf16 61 | } // namespace ARDUINOJSON_NAMESPACE 62 | 63 | #if defined(__GNUC__) 64 | # if __GNUC__ >= 8 65 | # pragma GCC diagnostic pop 66 | # endif 67 | #endif 68 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Json/Utf8.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "../Namespace.hpp" 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | 11 | namespace Utf8 { 12 | template 13 | inline void encodeCodepoint(uint32_t codepoint32, TStringBuilder& str) { 14 | // this function was optimize for code size on AVR 15 | 16 | if (codepoint32 < 0x80) { 17 | str.append(char(codepoint32)); 18 | } else { 19 | // a buffer to store the string in reverse 20 | char buf[5]; 21 | char* p = buf; 22 | 23 | *(p++) = 0; 24 | *(p++) = char((codepoint32 | 0x80) & 0xBF); 25 | uint16_t codepoint16 = uint16_t(codepoint32 >> 6); 26 | if (codepoint16 < 0x20) { // 0x800 27 | *(p++) = char(codepoint16 | 0xC0); 28 | } else { 29 | *(p++) = char((codepoint16 | 0x80) & 0xBF); 30 | codepoint16 = uint16_t(codepoint16 >> 6); 31 | if (codepoint16 < 0x10) { // 0x10000 32 | *(p++) = char(codepoint16 | 0xE0); 33 | } else { 34 | *(p++) = char((codepoint16 | 0x80) & 0xBF); 35 | codepoint16 = uint16_t(codepoint16 >> 6); 36 | *(p++) = char(codepoint16 | 0xF0); 37 | } 38 | } 39 | 40 | while (*(--p)) { 41 | str.append(*p); 42 | } 43 | } 44 | } 45 | } // namespace Utf8 46 | } // namespace ARDUINOJSON_NAMESPACE 47 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Memory/Alignment.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "../Namespace.hpp" 8 | 9 | #include // size_t 10 | 11 | namespace ARDUINOJSON_NAMESPACE { 12 | 13 | #if ARDUINOJSON_ENABLE_ALIGNMENT 14 | 15 | inline bool isAligned(size_t value) { 16 | const size_t mask = sizeof(void *) - 1; 17 | size_t addr = value; 18 | return (addr & mask) == 0; 19 | } 20 | 21 | inline size_t addPadding(size_t bytes) { 22 | const size_t mask = sizeof(void *) - 1; 23 | return (bytes + mask) & ~mask; 24 | } 25 | 26 | template 27 | struct AddPadding { 28 | static const size_t mask = sizeof(void *) - 1; 29 | static const size_t value = (bytes + mask) & ~mask; 30 | }; 31 | 32 | #else 33 | 34 | inline bool isAligned(size_t) { 35 | return true; 36 | } 37 | 38 | inline size_t addPadding(size_t bytes) { 39 | return bytes; 40 | } 41 | 42 | template 43 | struct AddPadding { 44 | static const size_t value = bytes; 45 | }; 46 | 47 | #endif 48 | 49 | template 50 | inline bool isAligned(T *ptr) { 51 | return isAligned(reinterpret_cast(ptr)); 52 | } 53 | 54 | template 55 | inline T *addPadding(T *p) { 56 | size_t address = addPadding(reinterpret_cast(p)); 57 | return reinterpret_cast(address); 58 | } 59 | 60 | } // namespace ARDUINOJSON_NAMESPACE 61 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Memory/StringBuilder.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2019 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "MemoryPool.hpp" 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | 11 | class StringBuilder { 12 | public: 13 | explicit StringBuilder(MemoryPool* parent) : _parent(parent), _size(0) { 14 | _slot = _parent->allocExpandableString(); 15 | } 16 | 17 | void append(const char* s) { 18 | while (*s) append(*s++); 19 | } 20 | 21 | void append(const char* s, size_t n) { 22 | while (n-- > 0) append(*s++); 23 | } 24 | 25 | void append(char c) { 26 | if (!_slot.value) return; 27 | 28 | if (_size >= _slot.size) { 29 | _slot.value = 0; 30 | return; 31 | } 32 | 33 | _slot.value[_size++] = c; 34 | } 35 | 36 | char* complete() { 37 | append('\0'); 38 | if (_slot.value) { 39 | _parent->freezeString(_slot, _size); 40 | } 41 | return _slot.value; 42 | } 43 | 44 | private: 45 | MemoryPool* _parent; 46 | size_t _size; 47 | StringSlot _slot; 48 | }; 49 | 50 | } // namespace ARDUINOJSON_NAMESPACE 51 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Memory/StringSlot.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2019 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include // for size_t 8 | #include "../Configuration.hpp" 9 | 10 | #define JSON_STRING_SIZE(SIZE) (SIZE) 11 | 12 | namespace ARDUINOJSON_NAMESPACE { 13 | 14 | struct StringSlot { 15 | char *value; 16 | size_t size; 17 | }; 18 | } // namespace ARDUINOJSON_NAMESPACE 19 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Misc/SafeBoolIdiom.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "../Polyfills/type_traits.hpp" 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | 11 | template 12 | class SafeBoolIdom { 13 | protected: 14 | typedef void (T::*bool_type)() const; 15 | void safeBoolHelper() const {} 16 | 17 | static bool_type safe_true() { 18 | return &SafeBoolIdom::safeBoolHelper; 19 | } 20 | 21 | static bool_type safe_false() { 22 | return 0; 23 | } 24 | }; 25 | 26 | } // namespace ARDUINOJSON_NAMESPACE 27 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Misc/SerializedValue.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "../Strings/StringAdapters.hpp" 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | 11 | // A special type of data that can be used to insert pregenerated JSON portions. 12 | template 13 | class SerializedValue { 14 | public: 15 | explicit SerializedValue(T str) : _str(str) {} 16 | operator T() const { 17 | return _str; 18 | } 19 | 20 | const char* data() const { 21 | return _str.c_str(); 22 | } 23 | 24 | size_t size() const { 25 | // CAUTION: the old Arduino String doesn't have size() 26 | return _str.length(); 27 | } 28 | 29 | private: 30 | T _str; 31 | }; 32 | 33 | template 34 | class SerializedValue { 35 | public: 36 | explicit SerializedValue(TChar* p, size_t n) : _data(p), _size(n) {} 37 | operator TChar*() const { 38 | return _data; 39 | } 40 | 41 | TChar* data() const { 42 | return _data; 43 | } 44 | 45 | size_t size() const { 46 | return _size; 47 | } 48 | 49 | private: 50 | TChar* _data; 51 | size_t _size; 52 | }; 53 | 54 | template 55 | inline SerializedValue serialized(T str) { 56 | return SerializedValue(str); 57 | } 58 | 59 | template 60 | inline SerializedValue serialized(TChar* p) { 61 | return SerializedValue(p, adaptString(p).size()); 62 | } 63 | 64 | template 65 | inline SerializedValue serialized(TChar* p, size_t n) { 66 | return SerializedValue(p, n); 67 | } 68 | } // namespace ARDUINOJSON_NAMESPACE 69 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Misc/Visitable.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "../Polyfills/type_traits.hpp" 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | 11 | struct Visitable { 12 | // template 13 | // void accept(Visitor&) const; 14 | }; 15 | 16 | template 17 | struct IsVisitable : is_base_of {}; 18 | 19 | template 20 | struct IsVisitable : IsVisitable {}; 21 | } // namespace ARDUINOJSON_NAMESPACE 22 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/MsgPack/endianess.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "../Polyfills/type_traits.hpp" 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | 11 | #if ARDUINOJSON_LITTLE_ENDIAN 12 | inline void swapBytes(uint8_t &a, uint8_t &b) { 13 | uint8_t t(a); 14 | a = b; 15 | b = t; 16 | } 17 | 18 | inline void fixEndianess(uint8_t *p, integral_constant) { 19 | swapBytes(p[0], p[7]); 20 | swapBytes(p[1], p[6]); 21 | swapBytes(p[2], p[5]); 22 | swapBytes(p[3], p[4]); 23 | } 24 | 25 | inline void fixEndianess(uint8_t *p, integral_constant) { 26 | swapBytes(p[0], p[3]); 27 | swapBytes(p[1], p[2]); 28 | } 29 | 30 | inline void fixEndianess(uint8_t *p, integral_constant) { 31 | swapBytes(p[0], p[1]); 32 | } 33 | 34 | inline void fixEndianess(uint8_t *, integral_constant) {} 35 | 36 | template 37 | inline void fixEndianess(T &value) { 38 | fixEndianess(reinterpret_cast(&value), 39 | integral_constant()); 40 | } 41 | #else 42 | template 43 | inline void fixEndianess(T &) {} 44 | #endif 45 | 46 | } // namespace ARDUINOJSON_NAMESPACE 47 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/MsgPack/ieee754.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "../Namespace.hpp" 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | 11 | inline void doubleToFloat(const uint8_t d[8], uint8_t f[4]) { 12 | f[0] = uint8_t((d[0] & 0xC0) | (d[0] << 3 & 0x3f) | (d[1] >> 5)); 13 | f[1] = uint8_t((d[1] << 3) | (d[2] >> 5)); 14 | f[2] = uint8_t((d[2] << 3) | (d[3] >> 5)); 15 | f[3] = uint8_t((d[3] << 3) | (d[4] >> 5)); 16 | } 17 | 18 | } // namespace ARDUINOJSON_NAMESPACE 19 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Namespace.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "Configuration.hpp" 8 | #include "Polyfills/preprocessor.hpp" 9 | #include "version.hpp" 10 | 11 | #ifndef ARDUINOJSON_NAMESPACE 12 | 13 | # define ARDUINOJSON_NAMESPACE \ 14 | ARDUINOJSON_CONCAT4( \ 15 | ARDUINOJSON_CONCAT4(ArduinoJson, ARDUINOJSON_VERSION_MAJOR, \ 16 | ARDUINOJSON_VERSION_MINOR, \ 17 | ARDUINOJSON_VERSION_REVISION), \ 18 | _, \ 19 | ARDUINOJSON_HEX_DIGIT( \ 20 | ARDUINOJSON_ENABLE_PROGMEM, ARDUINOJSON_USE_LONG_LONG, \ 21 | ARDUINOJSON_USE_DOUBLE, ARDUINOJSON_ENABLE_STRING_DEDUPLICATION), \ 22 | ARDUINOJSON_HEX_DIGIT( \ 23 | ARDUINOJSON_ENABLE_NAN, ARDUINOJSON_ENABLE_INFINITY, \ 24 | ARDUINOJSON_ENABLE_COMMENTS, ARDUINOJSON_DECODE_UNICODE)) 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Numbers/Float.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "../Configuration.hpp" 8 | #include "../Namespace.hpp" 9 | 10 | namespace ARDUINOJSON_NAMESPACE { 11 | 12 | #if ARDUINOJSON_USE_DOUBLE 13 | typedef double Float; 14 | #else 15 | typedef float Float; 16 | #endif 17 | } // namespace ARDUINOJSON_NAMESPACE 18 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Numbers/Integer.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "../Configuration.hpp" 8 | #include "../Namespace.hpp" 9 | 10 | #include // int64_t 11 | 12 | namespace ARDUINOJSON_NAMESPACE { 13 | 14 | #if ARDUINOJSON_USE_LONG_LONG 15 | typedef int64_t Integer; 16 | typedef uint64_t UInt; 17 | #else 18 | typedef long Integer; 19 | typedef unsigned long UInt; 20 | #endif 21 | 22 | } // namespace ARDUINOJSON_NAMESPACE 23 | 24 | #if ARDUINOJSON_HAS_LONG_LONG && !ARDUINOJSON_USE_LONG_LONG 25 | # define ARDUINOJSON_ASSERT_INTEGER_TYPE_IS_SUPPORTED(T) \ 26 | static_assert(sizeof(T) <= sizeof(ARDUINOJSON_NAMESPACE::Integer), \ 27 | "To use 64-bit integers with ArduinoJson, you must set " \ 28 | "ARDUINOJSON_USE_LONG_LONG to 1. See " \ 29 | "https://arduinojson.org/v6/api/config/use_long_long/"); 30 | #else 31 | # define ARDUINOJSON_ASSERT_INTEGER_TYPE_IS_SUPPORTED(T) 32 | #endif 33 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Numbers/parseFloat.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2019 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "convertNumber.hpp" 8 | #include "parseNumber.hpp" 9 | 10 | namespace ARDUINOJSON_NAMESPACE { 11 | 12 | template 13 | inline T parseFloat(const char* s) { 14 | // try to reuse the same parameters as JsonDeserializer 15 | typedef typename choose_largest::type TFloat; 16 | return parseNumber(s).template as(); 17 | } 18 | } // namespace ARDUINOJSON_NAMESPACE 19 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Numbers/parseInteger.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2019 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "../Polyfills/type_traits.hpp" 8 | #include "convertNumber.hpp" 9 | #include "parseNumber.hpp" 10 | 11 | namespace ARDUINOJSON_NAMESPACE { 12 | template 13 | T parseInteger(const char *s) { 14 | // try to reuse the same parameters as JsonDeserializer 15 | typedef typename choose_largest::type>::type 16 | TUInt; 17 | return parseNumber(s).template as(); 18 | } 19 | } // namespace ARDUINOJSON_NAMESPACE 20 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Object/ObjectFunctions.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "../Collection/CollectionData.hpp" 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | 11 | template 12 | typename TVisitor::result_type objectAccept(const CollectionData *obj, 13 | TVisitor &visitor) { 14 | if (obj) 15 | return visitor.visitObject(*obj); 16 | else 17 | return visitor.visitNull(); 18 | } 19 | 20 | inline bool objectEquals(const CollectionData *lhs, const CollectionData *rhs) { 21 | if (lhs == rhs) 22 | return true; 23 | if (!lhs || !rhs) 24 | return false; 25 | return lhs->equalsObject(*rhs); 26 | } 27 | 28 | template 29 | inline VariantData *objectGetMember(const CollectionData *obj, 30 | TAdaptedString key) { 31 | if (!obj) 32 | return 0; 33 | return obj->getMember(key); 34 | } 35 | 36 | template 37 | void objectRemove(CollectionData *obj, TAdaptedString key) { 38 | if (!obj) 39 | return; 40 | obj->removeMember(key); 41 | } 42 | 43 | template 44 | inline VariantData *objectGetOrAddMember(CollectionData *obj, 45 | TAdaptedString key, MemoryPool *pool, 46 | TStoragePolicy storage_policy) { 47 | if (!obj) 48 | return 0; 49 | 50 | return obj->getOrAddMember(key, pool, storage_policy); 51 | } 52 | } // namespace ARDUINOJSON_NAMESPACE 53 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Object/ObjectImpl.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "../Array/ArrayRef.hpp" 8 | #include "../Object/ObjectRef.hpp" 9 | 10 | namespace ARDUINOJSON_NAMESPACE { 11 | 12 | template 13 | template 14 | inline ArrayRef ObjectShortcuts::createNestedArray( 15 | const TString& key) const { 16 | return impl()->getOrAddMember(key).template to(); 17 | } 18 | 19 | template 20 | template 21 | inline ArrayRef ObjectShortcuts::createNestedArray(TChar* key) const { 22 | return impl()->getOrAddMember(key).template to(); 23 | } 24 | 25 | template 26 | template 27 | inline ObjectRef ObjectShortcuts::createNestedObject( 28 | const TString& key) const { 29 | return impl()->getOrAddMember(key).template to(); 30 | } 31 | 32 | template 33 | template 34 | inline ObjectRef ObjectShortcuts::createNestedObject( 35 | TChar* key) const { 36 | return impl()->getOrAddMember(key).template to(); 37 | } 38 | 39 | template 40 | template 41 | inline typename enable_if::value, bool>::type 42 | ObjectShortcuts::containsKey(const TString& key) const { 43 | return !impl()->getMember(key).isUnbound(); 44 | } 45 | 46 | template 47 | template 48 | inline typename enable_if::value, bool>::type 49 | ObjectShortcuts::containsKey(TChar* key) const { 50 | return !impl()->getMember(key).isUnbound(); 51 | } 52 | 53 | template 54 | template 55 | inline typename enable_if::value, 56 | MemberProxy >::type 57 | ObjectShortcuts::operator[](TString* key) const { 58 | return MemberProxy(*impl(), key); 59 | } 60 | 61 | template 62 | template 63 | inline typename enable_if::value, 64 | MemberProxy >::type 65 | ObjectShortcuts::operator[](const TString& key) const { 66 | return MemberProxy(*impl(), key); 67 | } 68 | 69 | } // namespace ARDUINOJSON_NAMESPACE 70 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Object/Pair.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "../Strings/String.hpp" 8 | #include "../Variant/VariantRef.hpp" 9 | 10 | namespace ARDUINOJSON_NAMESPACE { 11 | // A key value pair for CollectionData. 12 | class Pair { 13 | public: 14 | Pair(MemoryPool* pool, VariantSlot* slot) { 15 | if (slot) { 16 | _key = String(slot->key(), 17 | slot->ownsKey() ? String::Copied : String::Linked); 18 | _value = VariantRef(pool, slot->data()); 19 | } 20 | } 21 | 22 | String key() const { 23 | return _key; 24 | } 25 | 26 | VariantRef value() const { 27 | return _value; 28 | } 29 | 30 | private: 31 | String _key; 32 | VariantRef _value; 33 | }; 34 | 35 | class PairConst { 36 | public: 37 | PairConst(const VariantSlot* slot) { 38 | if (slot) { 39 | _key = String(slot->key(), 40 | slot->ownsKey() ? String::Copied : String::Linked); 41 | _value = VariantConstRef(slot->data()); 42 | } 43 | } 44 | 45 | String key() const { 46 | return _key; 47 | } 48 | 49 | VariantConstRef value() const { 50 | return _value; 51 | } 52 | 53 | private: 54 | String _key; 55 | VariantConstRef _value; 56 | }; 57 | } // namespace ARDUINOJSON_NAMESPACE 58 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Operators/VariantCasts.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2019 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "../Polyfills/attributes.hpp" 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | 11 | template 12 | class VariantCasts { 13 | public: 14 | template 15 | FORCE_INLINE operator T() const { 16 | return impl()->template as(); 17 | } 18 | 19 | private: 20 | const TImpl *impl() const { 21 | return static_cast(this); 22 | } 23 | }; 24 | } // namespace ARDUINOJSON_NAMESPACE 25 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Operators/VariantOperators.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2019 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "VariantCasts.hpp" 8 | #include "VariantComparisons.hpp" 9 | #include "VariantOr.hpp" 10 | #include "VariantShortcuts.hpp" 11 | 12 | namespace ARDUINOJSON_NAMESPACE { 13 | 14 | template 15 | class VariantOperators : public VariantCasts, 16 | public VariantComparisons, 17 | public VariantOr, 18 | public VariantShortcuts {}; 19 | } // namespace ARDUINOJSON_NAMESPACE 20 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Operators/VariantOr.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2019 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "../Polyfills/attributes.hpp" 8 | #include "../Polyfills/type_traits.hpp" 9 | #include "../Variant/VariantAs.hpp" 10 | 11 | namespace ARDUINOJSON_NAMESPACE { 12 | 13 | template 14 | class VariantOr { 15 | public: 16 | // Returns the default value if the VariantRef is undefined of incompatible 17 | template 18 | T operator|(const T &defaultValue) const { 19 | if (impl()->template is()) 20 | return impl()->template as(); 21 | else 22 | return defaultValue; 23 | } 24 | 25 | // Returns the default value if the VariantRef is undefined of incompatible 26 | // Special case for string: null is treated as undefined 27 | const char *operator|(const char *defaultValue) const { 28 | const char *value = impl()->template as(); 29 | return value ? value : defaultValue; 30 | } 31 | 32 | private: 33 | const TImpl *impl() const { 34 | return static_cast(this); 35 | } 36 | }; 37 | } // namespace ARDUINOJSON_NAMESPACE 38 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Operators/VariantShortcuts.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2019 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "../Array/ArrayShortcuts.hpp" 8 | #include "../Object/ObjectShortcuts.hpp" 9 | 10 | namespace ARDUINOJSON_NAMESPACE { 11 | 12 | template 13 | class VariantShortcuts : public ObjectShortcuts, 14 | public ArrayShortcuts { 15 | public: 16 | using ArrayShortcuts::createNestedArray; 17 | using ArrayShortcuts::createNestedObject; 18 | using ArrayShortcuts::operator[]; 19 | using ObjectShortcuts::createNestedArray; 20 | using ObjectShortcuts::createNestedObject; 21 | using ObjectShortcuts::operator[]; 22 | }; 23 | } // namespace ARDUINOJSON_NAMESPACE 24 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Polyfills/alias_cast.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | #include // for size_t 9 | 10 | #include "../Configuration.hpp" 11 | #include "math.hpp" 12 | 13 | namespace ARDUINOJSON_NAMESPACE { 14 | 15 | template 16 | struct alias_cast_t { 17 | union { 18 | F raw; 19 | T data; 20 | }; 21 | }; 22 | 23 | template 24 | T alias_cast(F raw_data) { 25 | alias_cast_t ac; 26 | ac.raw = raw_data; 27 | return ac.data; 28 | } 29 | } // namespace ARDUINOJSON_NAMESPACE 30 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Polyfills/assert.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "../Configuration.hpp" 8 | 9 | #if ARDUINOJSON_DEBUG 10 | # include 11 | # define ARDUINOJSON_ASSERT(X) assert(X) 12 | #else 13 | # define ARDUINOJSON_ASSERT(X) ((void)0) 14 | #endif 15 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Polyfills/attributes.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #ifdef _MSC_VER // Visual Studio 8 | 9 | # define FORCE_INLINE // __forceinline causes C4714 when returning std::string 10 | # define NO_INLINE __declspec(noinline) 11 | 12 | # ifndef ARDUINOJSON_DEPRECATED 13 | # define ARDUINOJSON_DEPRECATED(msg) __declspec(deprecated(msg)) 14 | # endif 15 | 16 | #elif defined(__GNUC__) // GCC or Clang 17 | 18 | # define FORCE_INLINE __attribute__((always_inline)) 19 | # define NO_INLINE __attribute__((noinline)) 20 | 21 | # ifndef ARDUINOJSON_DEPRECATED 22 | # if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) 23 | # define ARDUINOJSON_DEPRECATED(msg) __attribute__((deprecated(msg))) 24 | # else 25 | # define ARDUINOJSON_DEPRECATED(msg) __attribute__((deprecated)) 26 | # endif 27 | # endif 28 | 29 | #else // Other compilers 30 | 31 | # define FORCE_INLINE 32 | # define NO_INLINE 33 | 34 | # ifndef ARDUINOJSON_DEPRECATED 35 | # define ARDUINOJSON_DEPRECATED(msg) 36 | # endif 37 | 38 | #endif 39 | 40 | #if __cplusplus >= 201103L 41 | # define NOEXCEPT noexcept 42 | #else 43 | # define NOEXCEPT throw() 44 | #endif 45 | 46 | #if defined(__has_attribute) 47 | # if __has_attribute(no_sanitize) 48 | # define ARDUINOJSON_NO_SANITIZE(check) __attribute__((no_sanitize(check))) 49 | # else 50 | # define ARDUINOJSON_NO_SANITIZE(check) 51 | # endif 52 | #else 53 | # define ARDUINOJSON_NO_SANITIZE(check) 54 | #endif 55 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Polyfills/ctype.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "../Namespace.hpp" 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | 11 | #ifndef isdigit 12 | inline bool isdigit(char c) { 13 | return '0' <= c && c <= '9'; 14 | } 15 | #endif 16 | 17 | inline bool issign(char c) { 18 | return '-' == c || c == '+'; 19 | } 20 | } // namespace ARDUINOJSON_NAMESPACE 21 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Polyfills/gsl/not_null.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2019 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "../assert.hpp" 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | 11 | template 12 | class not_null { 13 | public: 14 | explicit not_null(T ptr) : _ptr(ptr) { 15 | ARDUINOJSON_ASSERT(ptr != NULL); 16 | } 17 | 18 | T get() const { 19 | ARDUINOJSON_ASSERT(_ptr != NULL); 20 | return _ptr; 21 | } 22 | 23 | private: 24 | T _ptr; 25 | }; 26 | 27 | template 28 | not_null make_not_null(T ptr) { 29 | ARDUINOJSON_ASSERT(ptr != NULL); 30 | return not_null(ptr); 31 | } 32 | 33 | } // namespace ARDUINOJSON_NAMESPACE 34 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Polyfills/integer.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include // int8_t, int16_t 8 | 9 | #include "../Namespace.hpp" 10 | 11 | namespace ARDUINOJSON_NAMESPACE { 12 | 13 | template 14 | struct int_t; 15 | 16 | template <> 17 | struct int_t<8> { 18 | typedef int8_t type; 19 | }; 20 | 21 | template <> 22 | struct int_t<16> { 23 | typedef int16_t type; 24 | }; 25 | 26 | template <> 27 | struct int_t<32> { 28 | typedef int32_t type; 29 | }; 30 | } // namespace ARDUINOJSON_NAMESPACE 31 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Polyfills/limits.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "type_traits.hpp" 8 | 9 | #ifdef _MSC_VER 10 | # pragma warning(push) 11 | # pragma warning(disable : 4310) 12 | #endif 13 | 14 | namespace ARDUINOJSON_NAMESPACE { 15 | 16 | // Differs from standard because we can't use the symbols "min" and "max" 17 | template 18 | struct numeric_limits; 19 | 20 | template 21 | struct numeric_limits::value>::type> { 22 | static T lowest() { 23 | return 0; 24 | } 25 | static T highest() { 26 | return T(-1); 27 | } 28 | }; 29 | 30 | template 31 | struct numeric_limits< 32 | T, typename enable_if::value && is_signed::value>::type> { 33 | static T lowest() { 34 | return T(T(1) << (sizeof(T) * 8 - 1)); 35 | } 36 | static T highest() { 37 | return T(~lowest()); 38 | } 39 | }; 40 | 41 | } // namespace ARDUINOJSON_NAMESPACE 42 | 43 | #ifdef _MSC_VER 44 | # pragma warning(pop) 45 | #endif 46 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Polyfills/math.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "../Namespace.hpp" 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | 11 | // Some libraries #define isnan() and isinf() so we need to check before 12 | // using this name 13 | 14 | #ifndef isnan 15 | template 16 | bool isnan(T x) { 17 | return x != x; 18 | } 19 | #endif 20 | 21 | #ifndef isinf 22 | template 23 | bool isinf(T x) { 24 | return x != 0.0 && x * 2 == x; 25 | } 26 | #endif 27 | } // namespace ARDUINOJSON_NAMESPACE 28 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Polyfills/mpl/max.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "../../Namespace.hpp" 8 | 9 | #include // for size_t 10 | 11 | namespace ARDUINOJSON_NAMESPACE { 12 | 13 | // A meta-function that returns the highest value 14 | template Y)> 15 | struct Max {}; 16 | 17 | template 18 | struct Max { 19 | static const size_t value = X; 20 | }; 21 | 22 | template 23 | struct Max { 24 | static const size_t value = Y; 25 | }; 26 | } // namespace ARDUINOJSON_NAMESPACE 27 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Polyfills/pgmspace_generic.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "../Namespace.hpp" 8 | #include "../Polyfills/pgmspace.hpp" 9 | #include "../Polyfills/type_traits.hpp" 10 | 11 | namespace ARDUINOJSON_NAMESPACE { 12 | 13 | template 14 | typename enable_if::value, T>::type pgm_read(const void* p) { 15 | return reinterpret_cast(pgm_read_ptr(p)); 16 | } 17 | 18 | template 19 | typename enable_if::value, T>::type pgm_read( 20 | const void* p) { 21 | return pgm_read_dword(p); 22 | } 23 | 24 | } // namespace ARDUINOJSON_NAMESPACE 25 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Polyfills/preprocessor.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #define ARDUINOJSON_EXPAND6(a, b, c, d, e, f) a, b, c, d, e, f 8 | #define ARDUINOJSON_EXPAND9(a, b, c, d, e, f, g, h, i) a, b, c, d, e, f, g, h, i 9 | #define ARDUINOJSON_EXPAND18(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, \ 10 | q, r) \ 11 | a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r 12 | 13 | #define ARDUINOJSON_CONCAT_(A, B) A##B 14 | #define ARDUINOJSON_CONCAT2(A, B) ARDUINOJSON_CONCAT_(A, B) 15 | #define ARDUINOJSON_CONCAT4(A, B, C, D) \ 16 | ARDUINOJSON_CONCAT2(ARDUINOJSON_CONCAT2(A, B), ARDUINOJSON_CONCAT2(C, D)) 17 | 18 | #define ARDUINOJSON_HEX_DIGIT_0000() 0 19 | #define ARDUINOJSON_HEX_DIGIT_0001() 1 20 | #define ARDUINOJSON_HEX_DIGIT_0010() 2 21 | #define ARDUINOJSON_HEX_DIGIT_0011() 3 22 | #define ARDUINOJSON_HEX_DIGIT_0100() 4 23 | #define ARDUINOJSON_HEX_DIGIT_0101() 5 24 | #define ARDUINOJSON_HEX_DIGIT_0110() 6 25 | #define ARDUINOJSON_HEX_DIGIT_0111() 7 26 | #define ARDUINOJSON_HEX_DIGIT_1000() 8 27 | #define ARDUINOJSON_HEX_DIGIT_1001() 9 28 | #define ARDUINOJSON_HEX_DIGIT_1010() A 29 | #define ARDUINOJSON_HEX_DIGIT_1011() B 30 | #define ARDUINOJSON_HEX_DIGIT_1100() C 31 | #define ARDUINOJSON_HEX_DIGIT_1101() D 32 | #define ARDUINOJSON_HEX_DIGIT_1110() E 33 | #define ARDUINOJSON_HEX_DIGIT_1111() F 34 | #define ARDUINOJSON_HEX_DIGIT_(A, B, C, D) ARDUINOJSON_HEX_DIGIT_##A##B##C##D() 35 | #define ARDUINOJSON_HEX_DIGIT(A, B, C, D) ARDUINOJSON_HEX_DIGIT_(A, B, C, D) 36 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Polyfills/safe_strcmp.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2019 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | namespace ARDUINOJSON_NAMESPACE { 8 | 9 | inline int8_t safe_strcmp(const char* a, const char* b) { 10 | if (a == b) return 0; 11 | if (!a) return -1; 12 | if (!b) return 1; 13 | return static_cast(strcmp(a, b)); 14 | } 15 | 16 | inline int8_t safe_strncmp(const char* a, const char* b, size_t n) { 17 | if (a == b) return 0; 18 | if (!a) return -1; 19 | if (!b) return 1; 20 | return static_cast(strncmp(a, b, n)); 21 | } 22 | } // namespace ARDUINOJSON_NAMESPACE 23 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Polyfills/static_array.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "../Configuration.hpp" 8 | 9 | #if ARDUINOJSON_ENABLE_PROGMEM 10 | 11 | # include "../Polyfills/pgmspace_generic.hpp" 12 | 13 | # ifndef ARDUINOJSON_DEFINE_PROGMEM_ARRAY 14 | # define ARDUINOJSON_DEFINE_PROGMEM_ARRAY(type, name, value) \ 15 | static type const name[] PROGMEM = value; 16 | # endif 17 | 18 | # define ARDUINOJSON_DEFINE_STATIC_ARRAY ARDUINOJSON_DEFINE_PROGMEM_ARRAY 19 | 20 | # define ARDUINOJSON_READ_STATIC_ARRAY(type, name, index) \ 21 | pgm_read(name + index) 22 | 23 | #else // i.e. ARDUINOJSON_ENABLE_PROGMEM == 0 24 | 25 | # define ARDUINOJSON_DEFINE_STATIC_ARRAY(type, name, value) \ 26 | static type const name[] = value; 27 | 28 | # define ARDUINOJSON_READ_STATIC_ARRAY(type, name, index) name[index] 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Polyfills/type_traits.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "type_traits/conditional.hpp" 8 | #include "type_traits/enable_if.hpp" 9 | #include "type_traits/integral_constant.hpp" 10 | #include "type_traits/is_array.hpp" 11 | #include "type_traits/is_base_of.hpp" 12 | #include "type_traits/is_class.hpp" 13 | #include "type_traits/is_const.hpp" 14 | #include "type_traits/is_convertible.hpp" 15 | #include "type_traits/is_enum.hpp" 16 | #include "type_traits/is_floating_point.hpp" 17 | #include "type_traits/is_integral.hpp" 18 | #include "type_traits/is_pointer.hpp" 19 | #include "type_traits/is_same.hpp" 20 | #include "type_traits/is_signed.hpp" 21 | #include "type_traits/is_unsigned.hpp" 22 | #include "type_traits/make_unsigned.hpp" 23 | #include "type_traits/make_void.hpp" 24 | #include "type_traits/remove_const.hpp" 25 | #include "type_traits/remove_reference.hpp" 26 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Polyfills/type_traits/conditional.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "../../Namespace.hpp" 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | 11 | template 12 | struct conditional { 13 | typedef TrueType type; 14 | }; 15 | 16 | template 17 | struct conditional { 18 | typedef FalseType type; 19 | }; 20 | } // namespace ARDUINOJSON_NAMESPACE 21 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Polyfills/type_traits/declval.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "../../Namespace.hpp" 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | 11 | template 12 | T declval(); 13 | 14 | } // namespace ARDUINOJSON_NAMESPACE 15 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Polyfills/type_traits/enable_if.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "../../Namespace.hpp" 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | 11 | // A meta-function that return the type T if Condition is true. 12 | template 13 | struct enable_if {}; 14 | 15 | template 16 | struct enable_if { 17 | typedef T type; 18 | }; 19 | } // namespace ARDUINOJSON_NAMESPACE 20 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Polyfills/type_traits/integral_constant.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "../../Namespace.hpp" 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | 11 | template 12 | struct integral_constant { 13 | static const T value = v; 14 | }; 15 | 16 | typedef integral_constant true_type; 17 | typedef integral_constant false_type; 18 | 19 | } // namespace ARDUINOJSON_NAMESPACE 20 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Polyfills/type_traits/is_array.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "../../Namespace.hpp" 8 | 9 | #include // size_t 10 | 11 | namespace ARDUINOJSON_NAMESPACE { 12 | 13 | template 14 | struct is_array : false_type {}; 15 | 16 | template 17 | struct is_array : true_type {}; 18 | 19 | template 20 | struct is_array : true_type {}; 21 | } // namespace ARDUINOJSON_NAMESPACE 22 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Polyfills/type_traits/is_base_of.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "../../Namespace.hpp" 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | 11 | // A meta-function that returns true if Derived inherits from TBase is an 12 | // integral type. 13 | template 14 | class is_base_of { 15 | protected: // <- to avoid GCC's "all member functions in class are private" 16 | typedef char Yes[1]; 17 | typedef char No[2]; 18 | 19 | static Yes &probe(const TBase *); 20 | static No &probe(...); 21 | 22 | public: 23 | static const bool value = 24 | sizeof(probe(reinterpret_cast(0))) == sizeof(Yes); 25 | }; 26 | } // namespace ARDUINOJSON_NAMESPACE 27 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Polyfills/type_traits/is_class.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "declval.hpp" 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | 11 | template 12 | struct is_class { 13 | protected: // <- to avoid GCC's "all member functions in class are private" 14 | typedef char Yes[1]; 15 | typedef char No[2]; 16 | 17 | template 18 | static Yes &probe(void (U::*)(void)); 19 | template 20 | static No &probe(...); 21 | 22 | public: 23 | static const bool value = sizeof(probe(0)) == sizeof(Yes); 24 | }; 25 | 26 | } // namespace ARDUINOJSON_NAMESPACE 27 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Polyfills/type_traits/is_const.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "integral_constant.hpp" 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | 11 | // A meta-function that return the type T without the const modifier 12 | template 13 | struct is_const : false_type {}; 14 | 15 | template 16 | struct is_const : true_type {}; 17 | } // namespace ARDUINOJSON_NAMESPACE 18 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Polyfills/type_traits/is_convertible.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "declval.hpp" 8 | 9 | #ifdef _MSC_VER 10 | # pragma warning(push) 11 | // conversion from 'T' to 'To', possible loss of data 12 | # pragma warning(disable : 4244) 13 | #endif 14 | 15 | // clang-format off 16 | #ifdef __ICCARM__ 17 | // Suppress IAR Compiler Warning[Pa093]: implicit conversion from floating point to integer 18 | #pragma diag_suppress=Pa093 19 | #endif 20 | // clang-format on 21 | 22 | namespace ARDUINOJSON_NAMESPACE { 23 | 24 | template 25 | struct is_convertible { 26 | protected: // <- to avoid GCC's "all member functions in class are private" 27 | typedef char Yes[1]; 28 | typedef char No[2]; 29 | 30 | static Yes &probe(To); 31 | static No &probe(...); 32 | 33 | public: 34 | static const bool value = sizeof(probe(declval())) == sizeof(Yes); 35 | }; 36 | 37 | } // namespace ARDUINOJSON_NAMESPACE 38 | 39 | #ifdef _MSC_VER 40 | # pragma warning(pop) 41 | #endif 42 | 43 | // clang-format off 44 | #ifdef __ICCARM__ 45 | #pragma diag_default=Pa093 46 | #endif 47 | // clang-format on 48 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Polyfills/type_traits/is_enum.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "is_class.hpp" 8 | #include "is_convertible.hpp" 9 | #include "is_floating_point.hpp" 10 | #include "is_integral.hpp" 11 | #include "is_same.hpp" 12 | 13 | namespace ARDUINOJSON_NAMESPACE { 14 | 15 | template 16 | struct is_enum { 17 | static const bool value = is_convertible::value && 18 | !is_class::value && !is_integral::value && 19 | !is_floating_point::value; 20 | }; 21 | 22 | } // namespace ARDUINOJSON_NAMESPACE 23 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Polyfills/type_traits/is_floating_point.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "integral_constant.hpp" 8 | #include "is_same.hpp" 9 | #include "remove_cv.hpp" 10 | 11 | namespace ARDUINOJSON_NAMESPACE { 12 | 13 | template 14 | struct is_floating_point 15 | : integral_constant< 16 | bool, // 17 | is_same::type>::value || 18 | is_same::type>::value> {}; 19 | 20 | } // namespace ARDUINOJSON_NAMESPACE 21 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Polyfills/type_traits/is_integral.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "../../Configuration.hpp" 8 | 9 | #include "integral_constant.hpp" 10 | #include "is_same.hpp" 11 | #include "remove_cv.hpp" 12 | 13 | namespace ARDUINOJSON_NAMESPACE { 14 | 15 | // clang-format off 16 | template 17 | struct is_integral : integral_constant::type, signed char>::value || 19 | is_same::type, unsigned char>::value || 20 | is_same::type, signed short>::value || 21 | is_same::type, unsigned short>::value || 22 | is_same::type, signed int>::value || 23 | is_same::type, unsigned int>::value || 24 | is_same::type, signed long>::value || 25 | is_same::type, unsigned long>::value || 26 | #if ARDUINOJSON_HAS_LONG_LONG 27 | is_same::type, signed long long>::value || 28 | is_same::type, unsigned long long>::value || 29 | #endif 30 | #if ARDUINOJSON_HAS_INT64 31 | is_same::type, signed __int64>::value || 32 | is_same::type, unsigned __int64>::value || 33 | #endif 34 | is_same::type, char>::value || 35 | is_same::type, bool>::value> {}; 36 | // clang-format on 37 | } // namespace ARDUINOJSON_NAMESPACE 38 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Polyfills/type_traits/is_pointer.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "integral_constant.hpp" 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | 11 | template 12 | struct is_pointer : false_type {}; 13 | 14 | template 15 | struct is_pointer : true_type {}; 16 | } // namespace ARDUINOJSON_NAMESPACE 17 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Polyfills/type_traits/is_same.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "integral_constant.hpp" 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | 11 | // A meta-function that returns true if types T and U are the same. 12 | template 13 | struct is_same : false_type {}; 14 | 15 | template 16 | struct is_same : true_type {}; 17 | } // namespace ARDUINOJSON_NAMESPACE 18 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Polyfills/type_traits/is_signed.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "integral_constant.hpp" 8 | #include "is_same.hpp" 9 | #include "remove_cv.hpp" 10 | 11 | namespace ARDUINOJSON_NAMESPACE { 12 | 13 | // clang-format off 14 | template 15 | struct is_signed : integral_constant::type, char>::value || 17 | is_same::type, signed char>::value || 18 | is_same::type, signed short>::value || 19 | is_same::type, signed int>::value || 20 | is_same::type, signed long>::value || 21 | #if ARDUINOJSON_HAS_LONG_LONG 22 | is_same::type, signed long long>::value || 23 | #endif 24 | #if ARDUINOJSON_HAS_INT64 25 | is_same::type, signed __int64>::value || 26 | #endif 27 | is_same::type, float>::value || 28 | is_same::type, double>::value> {}; 29 | // clang-format on 30 | } // namespace ARDUINOJSON_NAMESPACE 31 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Polyfills/type_traits/is_unsigned.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "integral_constant.hpp" 8 | #include "is_same.hpp" 9 | #include "remove_cv.hpp" 10 | 11 | namespace ARDUINOJSON_NAMESPACE { 12 | 13 | // clang-format off 14 | template 15 | struct is_unsigned : integral_constant::type, unsigned char>::value || 17 | is_same::type, unsigned short>::value || 18 | is_same::type, unsigned int>::value || 19 | is_same::type, unsigned long>::value || 20 | #if ARDUINOJSON_HAS_INT64 21 | is_same::type, unsigned __int64>::value || 22 | #endif 23 | #if ARDUINOJSON_HAS_LONG_LONG 24 | is_same::type, unsigned long long>::value || 25 | #endif 26 | is_same::type, bool>::value> {}; 27 | // clang-format on 28 | } // namespace ARDUINOJSON_NAMESPACE 29 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Polyfills/type_traits/make_unsigned.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "type_identity.hpp" 8 | namespace ARDUINOJSON_NAMESPACE { 9 | 10 | template 11 | struct make_unsigned; 12 | 13 | template <> 14 | struct make_unsigned : type_identity {}; 15 | 16 | template <> 17 | struct make_unsigned : type_identity {}; 18 | template <> 19 | struct make_unsigned : type_identity {}; 20 | 21 | template <> 22 | struct make_unsigned : type_identity {}; 23 | template <> 24 | struct make_unsigned : type_identity {}; 25 | 26 | template <> 27 | struct make_unsigned : type_identity {}; 28 | template <> 29 | struct make_unsigned : type_identity {}; 30 | 31 | template <> 32 | struct make_unsigned : type_identity {}; 33 | template <> 34 | struct make_unsigned : type_identity {}; 35 | 36 | #if ARDUINOJSON_HAS_LONG_LONG 37 | template <> 38 | struct make_unsigned : type_identity {}; 39 | template <> 40 | struct make_unsigned : type_identity {}; 41 | #endif 42 | 43 | #if ARDUINOJSON_HAS_INT64 44 | template <> 45 | struct make_unsigned : type_identity {}; 46 | template <> 47 | struct make_unsigned : type_identity {}; 48 | #endif 49 | } // namespace ARDUINOJSON_NAMESPACE 50 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Polyfills/type_traits/make_void.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | namespace ARDUINOJSON_NAMESPACE { 8 | 9 | template 10 | struct make_void { 11 | typedef void type; 12 | }; 13 | 14 | } // namespace ARDUINOJSON_NAMESPACE 15 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Polyfills/type_traits/remove_const.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "../../Namespace.hpp" 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | 11 | // A meta-function that return the type T without the const modifier 12 | template 13 | struct remove_const { 14 | typedef T type; 15 | }; 16 | template 17 | struct remove_const { 18 | typedef T type; 19 | }; 20 | } // namespace ARDUINOJSON_NAMESPACE 21 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Polyfills/type_traits/remove_cv.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "../../Namespace.hpp" 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | 11 | template 12 | struct remove_cv { 13 | typedef T type; 14 | }; 15 | template 16 | struct remove_cv { 17 | typedef T type; 18 | }; 19 | template 20 | struct remove_cv { 21 | typedef T type; 22 | }; 23 | template 24 | struct remove_cv { 25 | typedef T type; 26 | }; 27 | } // namespace ARDUINOJSON_NAMESPACE 28 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Polyfills/type_traits/remove_reference.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "../../Namespace.hpp" 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | 11 | // A meta-function that return the type T without the reference modifier. 12 | template 13 | struct remove_reference { 14 | typedef T type; 15 | }; 16 | template 17 | struct remove_reference { 18 | typedef T type; 19 | }; 20 | } // namespace ARDUINOJSON_NAMESPACE 21 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Polyfills/type_traits/type_identity.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "integral_constant.hpp" 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | 11 | template 12 | struct type_identity { 13 | typedef T type; 14 | }; 15 | } // namespace ARDUINOJSON_NAMESPACE 16 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Polyfills/utility.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2019 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | namespace ARDUINOJSON_NAMESPACE { 8 | template 9 | inline void swap(T& a, T& b) { 10 | T t(a); 11 | a = b; 12 | b = t; 13 | } 14 | } // namespace ARDUINOJSON_NAMESPACE 15 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Serialization/CountingDecorator.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "../Namespace.hpp" 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | 11 | template 12 | class CountingDecorator { 13 | public: 14 | explicit CountingDecorator(TWriter& writer) : _writer(writer), _count(0) {} 15 | 16 | void write(uint8_t c) { 17 | _count += _writer.write(c); 18 | } 19 | 20 | void write(const uint8_t* s, size_t n) { 21 | _count += _writer.write(s, n); 22 | } 23 | 24 | size_t count() const { 25 | return _count; 26 | } 27 | 28 | private: 29 | TWriter _writer; 30 | size_t _count; 31 | }; 32 | 33 | } // namespace ARDUINOJSON_NAMESPACE 34 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Serialization/DummyWriter.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2019 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | namespace ARDUINOJSON_NAMESPACE { 8 | 9 | class DummyWriter { 10 | public: 11 | size_t write(uint8_t) { 12 | return 1; 13 | } 14 | 15 | size_t write(const uint8_t*, size_t n) { 16 | return n; 17 | } 18 | }; 19 | } // namespace ARDUINOJSON_NAMESPACE 20 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Serialization/DynamicStringWriter.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2019 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "../Polyfills/type_traits.hpp" 8 | 9 | #if ARDUINOJSON_ENABLE_ARDUINO_STRING 10 | #include 11 | #endif 12 | 13 | #if ARDUINOJSON_ENABLE_STD_STRING 14 | #include 15 | #endif 16 | 17 | namespace ARDUINOJSON_NAMESPACE { 18 | 19 | template 20 | struct IsWriteableString : false_type {}; 21 | 22 | // A Print implementation that allows to write in a String 23 | template 24 | class DynamicStringWriter {}; 25 | 26 | #if ARDUINOJSON_ENABLE_ARDUINO_STRING 27 | template <> 28 | struct IsWriteableString : true_type {}; 29 | 30 | template <> 31 | class DynamicStringWriter { 32 | public: 33 | DynamicStringWriter(String &str) : _str(&str) {} 34 | 35 | size_t write(uint8_t c) { 36 | _str->operator+=(static_cast(c)); 37 | return 1; 38 | } 39 | 40 | size_t write(const uint8_t *s, size_t n) { 41 | // CAUTION: Arduino String doesn't have append() 42 | // and old version doesn't have size() either 43 | _str->reserve(_str->length() + n); 44 | while (n > 0) { 45 | _str->operator+=(static_cast(*s++)); 46 | n--; 47 | } 48 | return n; 49 | } 50 | 51 | private: 52 | String *_str; 53 | }; 54 | #endif 55 | 56 | #if ARDUINOJSON_ENABLE_STD_STRING 57 | template <> 58 | struct IsWriteableString : true_type {}; 59 | 60 | template <> 61 | class DynamicStringWriter { 62 | public: 63 | DynamicStringWriter(std::string &str) : _str(&str) {} 64 | 65 | size_t write(uint8_t c) { 66 | _str->operator+=(static_cast(c)); 67 | return 1; 68 | } 69 | 70 | size_t write(const uint8_t *s, size_t n) { 71 | _str->append(reinterpret_cast(s), n); 72 | return n; 73 | } 74 | 75 | private: 76 | std::string *_str; 77 | }; 78 | #endif 79 | } // namespace ARDUINOJSON_NAMESPACE 80 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Serialization/StaticStringWriter.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2019 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | namespace ARDUINOJSON_NAMESPACE { 8 | 9 | // A Print implementation that allows to write in a char[] 10 | class StaticStringWriter { 11 | public: 12 | StaticStringWriter(char *buf, size_t size) : end(buf + size - 1), p(buf) { 13 | *p = '\0'; 14 | } 15 | 16 | size_t write(uint8_t c) { 17 | if (p >= end) return 0; 18 | *p++ = static_cast(c); 19 | *p = '\0'; 20 | return 1; 21 | } 22 | 23 | size_t write(const uint8_t *s, size_t n) { 24 | char *begin = p; 25 | while (p < end && n > 0) { 26 | *p++ = static_cast(*s++); 27 | n--; 28 | } 29 | *p = '\0'; 30 | return size_t(p - begin); 31 | } 32 | 33 | private: 34 | char *end; 35 | char *p; 36 | }; 37 | } // namespace ARDUINOJSON_NAMESPACE 38 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Serialization/StreamWriter.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2019 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "../Configuration.hpp" 8 | 9 | #if ARDUINOJSON_ENABLE_STD_STREAM 10 | 11 | #include 12 | 13 | namespace ARDUINOJSON_NAMESPACE { 14 | 15 | class StreamWriter { 16 | public: 17 | explicit StreamWriter(std::ostream& os) : _os(os) {} 18 | 19 | size_t write(uint8_t c) { 20 | _os << c; 21 | return 1; 22 | } 23 | 24 | size_t write(const uint8_t* s, size_t n) { 25 | _os.write(reinterpret_cast(s), 26 | static_cast(n)); 27 | return n; 28 | } 29 | 30 | private: 31 | // cannot be assigned 32 | StreamWriter& operator=(const StreamWriter&); 33 | 34 | std::ostream& _os; 35 | }; 36 | } // namespace ARDUINOJSON_NAMESPACE 37 | 38 | #endif // ARDUINOJSON_ENABLE_STD_STREAM 39 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Serialization/Writer.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "../Namespace.hpp" 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | 11 | // The default writer is a simple wrapper for Writers that are not copiable 12 | template 13 | class Writer { 14 | public: 15 | explicit Writer(TDestination& dest) : _dest(&dest) {} 16 | 17 | size_t write(uint8_t c) { 18 | return _dest->write(c); 19 | } 20 | 21 | size_t write(const uint8_t* s, size_t n) { 22 | return _dest->write(s, n); 23 | } 24 | 25 | private: 26 | TDestination* _dest; 27 | }; 28 | 29 | } // namespace ARDUINOJSON_NAMESPACE 30 | 31 | #include "../Serialization/Writers/StaticStringWriter.hpp" 32 | 33 | #if ARDUINOJSON_ENABLE_STD_STRING 34 | # include "../Serialization/Writers/StdStringWriter.hpp" 35 | #endif 36 | 37 | #if ARDUINOJSON_ENABLE_ARDUINO_STRING 38 | # include "../Serialization/Writers/ArduinoStringWriter.hpp" 39 | #endif 40 | 41 | #if ARDUINOJSON_ENABLE_STD_STREAM 42 | # include "../Serialization/Writers/StdStreamWriter.hpp" 43 | #endif 44 | 45 | #if ARDUINOJSON_ENABLE_ARDUINO_PRINT 46 | # include "../Serialization/Writers/PrintWriter.hpp" 47 | #endif 48 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Serialization/Writers/ArduinoStringWriter.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | 11 | template <> 12 | class Writer< ::String, void> { 13 | static const size_t bufferCapacity = ARDUINOJSON_STRING_BUFFER_SIZE; 14 | 15 | public: 16 | explicit Writer(::String &str) : _destination(&str) { 17 | _size = 0; 18 | } 19 | 20 | ~Writer() { 21 | flush(); 22 | } 23 | 24 | size_t write(uint8_t c) { 25 | if (_size + 1 >= bufferCapacity) 26 | if (flush() != 0) 27 | return 0; 28 | _buffer[_size++] = static_cast(c); 29 | return 1; 30 | } 31 | 32 | size_t write(const uint8_t *s, size_t n) { 33 | for (size_t i = 0; i < n; i++) { 34 | write(s[i]); 35 | } 36 | return n; 37 | } 38 | 39 | size_t flush() { 40 | ARDUINOJSON_ASSERT(_size < bufferCapacity); 41 | _buffer[_size] = 0; 42 | if (_destination->concat(_buffer)) 43 | _size = 0; 44 | return _size; 45 | } 46 | 47 | private: 48 | ::String *_destination; 49 | char _buffer[bufferCapacity]; 50 | size_t _size; 51 | }; 52 | 53 | } // namespace ARDUINOJSON_NAMESPACE 54 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Serialization/Writers/DummyWriter.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "../../Namespace.hpp" 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | 11 | class DummyWriter { 12 | public: 13 | size_t write(uint8_t) { 14 | return 1; 15 | } 16 | 17 | size_t write(const uint8_t*, size_t n) { 18 | return n; 19 | } 20 | }; 21 | } // namespace ARDUINOJSON_NAMESPACE 22 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Serialization/Writers/PrintWriter.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | 11 | template 12 | class Writer< 13 | TDestination, 14 | typename enable_if::value>::type> { 15 | public: 16 | explicit Writer(::Print& print) : _print(&print) {} 17 | 18 | size_t write(uint8_t c) { 19 | return _print->write(c); 20 | } 21 | 22 | size_t write(const uint8_t* s, size_t n) { 23 | return _print->write(s, n); 24 | } 25 | 26 | private: 27 | ::Print* _print; 28 | }; 29 | 30 | } // namespace ARDUINOJSON_NAMESPACE 31 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Serialization/Writers/StaticStringWriter.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "../../Namespace.hpp" 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | 11 | class StaticStringWriter { 12 | public: 13 | StaticStringWriter(char *buf, size_t size) : end(buf + size), p(buf) {} 14 | 15 | size_t write(uint8_t c) { 16 | if (p >= end) 17 | return 0; 18 | *p++ = static_cast(c); 19 | return 1; 20 | } 21 | 22 | size_t write(const uint8_t *s, size_t n) { 23 | char *begin = p; 24 | while (p < end && n > 0) { 25 | *p++ = static_cast(*s++); 26 | n--; 27 | } 28 | return size_t(p - begin); 29 | } 30 | 31 | private: 32 | char *end; 33 | char *p; 34 | }; 35 | } // namespace ARDUINOJSON_NAMESPACE 36 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Serialization/Writers/StdStreamWriter.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | 11 | template 12 | class Writer< 13 | TDestination, 14 | typename enable_if::value>::type> { 15 | public: 16 | explicit Writer(std::ostream& os) : _os(&os) {} 17 | 18 | size_t write(uint8_t c) { 19 | _os->put(static_cast(c)); 20 | return 1; 21 | } 22 | 23 | size_t write(const uint8_t* s, size_t n) { 24 | _os->write(reinterpret_cast(s), 25 | static_cast(n)); 26 | return n; 27 | } 28 | 29 | private: 30 | std::ostream* _os; 31 | }; 32 | } // namespace ARDUINOJSON_NAMESPACE 33 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Serialization/Writers/StdStringWriter.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "../../Namespace.hpp" 8 | #include "../../Polyfills/type_traits.hpp" 9 | 10 | #include 11 | 12 | namespace ARDUINOJSON_NAMESPACE { 13 | 14 | template 15 | struct is_std_string : false_type {}; 16 | 17 | template 18 | struct is_std_string > 19 | : true_type {}; 20 | 21 | template 22 | class Writer::value>::type> { 24 | public: 25 | Writer(TDestination &str) : _str(&str) {} 26 | 27 | size_t write(uint8_t c) { 28 | _str->operator+=(static_cast(c)); 29 | return 1; 30 | } 31 | 32 | size_t write(const uint8_t *s, size_t n) { 33 | _str->append(reinterpret_cast(s), n); 34 | return n; 35 | } 36 | 37 | private: 38 | TDestination *_str; 39 | }; 40 | } // namespace ARDUINOJSON_NAMESPACE 41 | -------------------------------------------------------------------------------- /src/modules/ArduinoJson/ArduinoJson/Serialization/measure.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - https://arduinojson.org 2 | // Copyright © 2014-2022, Benoit BLANCHON 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "../Serialization/Writers/DummyWriter.hpp" 8 | 9 | namespace ARDUINOJSON_NAMESPACE { 10 | 11 | template