### CMake project setup with FetchContent Source: https://github.com/arduino-libraries/arduinoiotcloud/blob/master/extras/test/CMakeLists.txt Defines the project 'testArduinoIoTCloud' and fetches Catch2 v3.4.0, Arduino_CloudUtils (main), and Arduino_ConnectionHandler (master) using FetchContent. ```cmake cmake_minimum_required(VERSION 3.5) project(testArduinoIoTCloud) Include(FetchContent) FetchContent_Declare( Catch2 GIT_REPOSITORY https://github.com/catchorg/Catch2.git GIT_TAG v3.4.0 ) FetchContent_Declare( cloudutils GIT_REPOSITORY https://github.com/arduino-libraries/Arduino_CloudUtils.git GIT_TAG main ) FetchContent_Declare( connectionhandler GIT_REPOSITORY https://github.com/arduino-libraries/Arduino_ConnectionHandler.git GIT_TAG master ) FetchContent_MakeAvailable(Catch2) FetchContent_MakeAvailable(cloudutils) FetchContent_MakeAvailable(connectionhandler) ``` -------------------------------- ### ArduinoCloud.getBrokerAddress() Source: https://github.com/arduino-libraries/arduinoiotcloud/blob/master/docs/api.md Gets the MQTT broker address used. ```APIDOC ## ArduinoCloud.getBrokerAddress() ### Description Get the MQTT broker address used. ### Syntax ``` ArduinoCloud.getBrokerAddress() ``` ### Parameters None. ### Returns - String - the MQTT broker address. ``` -------------------------------- ### ArduinoCloud.getConnection() syntax Source: https://github.com/arduino-libraries/arduinoiotcloud/blob/master/docs/api.md Gets the connection handler used. ```arduino ArduinoCloud.getConnection() ``` -------------------------------- ### sketch.ota hex dump sample Source: https://github.com/arduino-libraries/arduinoiotcloud/blob/master/extras/tools/README.md Example of the content of sketch.ota after bin2ota.py, showing the OTA header and compressed data. ```bash 0 3bca0100 7e1c3a2b 54804123 00000000 16 00000040 80602012 0a0cbe01 0094bfa2 ``` -------------------------------- ### ArduinoCloud.getBrokerAddress() syntax Source: https://github.com/arduino-libraries/arduinoiotcloud/blob/master/docs/api.md Gets the MQTT broker address used. Returns a String. ```arduino ArduinoCloud.getBrokerAddress() ``` -------------------------------- ### ArduinoCloud.getBrokerPort() Source: https://github.com/arduino-libraries/arduinoiotcloud/blob/master/docs/api.md Gets the MQTT broker port used. ```APIDOC ## ArduinoCloud.getBrokerPort() ### Description Get the MQTT broker port used. ### Syntax ``` ArduinoCloud.getBrokerPort() ``` ### Parameters None. ### Returns - int - the MQTT broker port. ``` -------------------------------- ### sketch.lzss hex dump sample Source: https://github.com/arduino-libraries/arduinoiotcloud/blob/master/extras/tools/README.md Example of the content of sketch.lzss after compression, showing the first 32 bytes. ```bash 0 80602012 0a0cbe01 0094bfa2 bff7807c 16 bfdd00d9 655fd240 cfc11065 a071e0b2 ``` -------------------------------- ### ArduinoCloud.getConnection() Source: https://github.com/arduino-libraries/arduinoiotcloud/blob/master/docs/api.md Gets the connection handler used for the cloud connection. ```APIDOC ## ArduinoCloud.getConnection() ### Description Gets the connection handler used. ### Method getConnection ### Syntax ArduinoCloud.getConnection() ### Parameters None. ``` -------------------------------- ### ArduinoCloud.getThingId() syntax Source: https://github.com/arduino-libraries/arduinoiotcloud/blob/master/docs/api.md Gets the Thing ID. Returns a String. ```arduino ArduinoCloud.getThingId() ``` -------------------------------- ### ArduinoCloud.getBrokerPort() syntax Source: https://github.com/arduino-libraries/arduinoiotcloud/blob/master/docs/api.md Gets the MQTT broker port used. Returns an int. ```arduino ArduinoCloud.getBrokerPort() ``` -------------------------------- ### ArduinoCloud.getDeviceId() syntax Source: https://github.com/arduino-libraries/arduinoiotcloud/blob/master/docs/api.md Gets the Device ID. Returns a String. ```arduino ArduinoCloud.getDeviceId() ``` -------------------------------- ### ArduinoCloud.getInternalTime() Source: https://github.com/arduino-libraries/arduinoiotcloud/blob/master/docs/api.md Gets the internal time maintained by the cloud library. ```APIDOC ## ArduinoCloud.getInternalTime() ### Description Gets the internal time. ### Method getInternalTime ### Syntax ArduinoCloud.getInternalTime() ### Parameters None. ### Returns - unsigned long - internal time ``` -------------------------------- ### ArduinoCloud.getThingId() Source: https://github.com/arduino-libraries/arduinoiotcloud/blob/master/docs/api.md Gets the Thing ID associated with the cloud connection. ```APIDOC ## ArduinoCloud.getThingId() ### Description Gets the Thing ID. ### Method getThingId ### Syntax ArduinoCloud.getThingId() ### Parameters None. ### Returns - String - Thing ID. ``` -------------------------------- ### WiFiConnectionHandler ArduinoIoTPreferredConnection declaration Source: https://github.com/arduino-libraries/arduinoiotcloud/blob/master/docs/api.md Example of the ArduinoIoTPreferredConnection object created in thingProperties.h when using the WiFiConnectionHandler. Uses SSID and PASS parameters defined in arduino_secrets.h. ```arduino WiFiConnectionHandler ArduinoIoTPreferredConnection(SSID, PASS); ``` -------------------------------- ### ArduinoCloud.getLocalTime() Source: https://github.com/arduino-libraries/arduinoiotcloud/blob/master/docs/api.md Gets the local time based on the configured time zone. ```APIDOC ## ArduinoCloud.getLocalTime() ### Description Gets the local time (based on your time zone). ### Method getLocalTime ### Syntax ArduinoCloud.getLocalTime() ### Parameters None. ### Returns - unsigned long - local time ``` -------------------------------- ### ArduinoCloud.getDeviceId() Source: https://github.com/arduino-libraries/arduinoiotcloud/blob/master/docs/api.md Gets the Device ID associated with the cloud connection. ```APIDOC ## ArduinoCloud.getDeviceId() ### Description Gets the Device ID. ### Method getDeviceId ### Syntax ArduinoCloud.getDeviceId() ### Parameters None. ### Returns - String - Device ID. ``` -------------------------------- ### ArduinoCloud.getInternalTime() syntax Source: https://github.com/arduino-libraries/arduinoiotcloud/blob/master/docs/api.md Gets the internal time. Returns an unsigned long. ```arduino ArduinoCloud.getInternalTime() ``` -------------------------------- ### ArduinoCloud.getLocalTime() syntax Source: https://github.com/arduino-libraries/arduinoiotcloud/blob/master/docs/api.md Gets the local time based on your time zone. Returns an unsigned long. ```arduino ArduinoCloud.getLocalTime() ``` -------------------------------- ### ArduinoCloud.addCallback() syntax Source: https://github.com/arduino-libraries/arduinoiotcloud/blob/master/docs/api.md Adds a callback function for IoT Cloud events. Parameters: event (CONNECT, SYNC, DISCONNECT) and callback function. See the ArduinoIoTCloud-Callbacks example for usage. ```arduino ArduinoCloud.addCallback(ArduinoIoTCloudEvent::CONNECT, doThisOnConnect); ArduinoCloud.addCallback(ArduinoIoTCloudEvent::SYNC, doThisOnSync); ArduinoCloud.addCallback(ArduinoIoTCloudEvent::DISCONNECT, doThisOnDisconnect); ``` -------------------------------- ### ArduinoCloud.begin() Source: https://github.com/arduino-libraries/arduinoiotcloud/blob/master/docs/api.md Initialises the library with the connection handler specified in thingProperties.h. This is automatically generated based on the type of device. ```APIDOC ## ArduinoCloud.begin() ### Description Initialises the library with the connection handler specified in thingProperties.h. This is automatically generated based on the type of device. ### Syntax ``` ArduinoCloud.begin() ``` ### Parameters None. The ArduinoIoTPreferredConnection object is created automatically inside a thingProperties.h file when configuring a Thing and depends on what type of device you use. The connection handler classes are not part of the Arduino IoT Cloud, but exists inside the Arduino_ConnectionHandler library (listed as a dependency). For example, using the WiFiConnectionHandler, we use the SSID, PASS parameters which are defined in the arduino_secrets.h file, also generated based on what you input in the Arduino IoT Cloud interface. ### Returns Nothing. ``` -------------------------------- ### begin() (LPWAN) Source: https://github.com/arduino-libraries/arduinoiotcloud/blob/master/docs/api.md Initializes the ArduinoIoTCloudLPWAN library with the specified connection handler and retry settings. ```APIDOC ## begin() (LPWAN) ### Description This function initializes the ArduinoIoTCloudLPWAN library with the specified connection handler and retry settings. ### Parameters - `ConnectionHandler` - object containing `APPEUI`, `APPKEY` and frequency band (e.g. `_lora_band::EU868`) - `bool` - a boolean value that decides whether retry functionality is enabled (`true`) or disabled (`false`) ### Returns - `int` - returns `1` on successful initialization. ``` -------------------------------- ### ArduinoCloud.begin() syntax Source: https://github.com/arduino-libraries/arduinoiotcloud/blob/master/docs/api.md Initialises the library with the connection handler specified in thingProperties.h. The ArduinoIoTPreferredConnection object is created automatically based on the device type. ```arduino ArduinoCloud.begin() ``` -------------------------------- ### Implement MyCloudApplication.ino Source: https://github.com/arduino-libraries/arduinoiotcloud/blob/master/README.md Main application file that initializes the cloud connection and handles property updates in the loop. ```C++ #include "thingProperties.h" void setup() { Serial.begin(9600); while(!Serial) { } pinMode(LED_BUILTIN, OUTPUT); initProperties(); ArduinoCloud.begin(ArduinoIoTPreferredConnection); } void loop() { ArduinoCloud.update(); seconds = millis() / 1000; } void onLedChange() { digitalWrite(LED_BUILTIN, led); } ``` -------------------------------- ### Build and prepare OTA firmware from Arduino IDE Source: https://github.com/arduino-libraries/arduinoiotcloud/blob/master/extras/tools/README.md Steps to copy an exported compiled binary into the tools directory, compress it with lzss.py, and convert to OTA format for the specified board. ```bash cp sketch.bin ~/Arduino/libraries/ArduinoIoTCloud/extras/tools/ ``` ```bash cd ~/Arduino/libraries/ArduinoIoTCloud/extras/tools ``` ```bash ./lzss.py --encode sketch.bin sketch.lzss ``` ```bash ./bin2ota.py [MKR_WIFI_1010 | NANO_33_IOT] sketch.lzss sketch.ota ``` -------------------------------- ### Build executable and link libraries Source: https://github.com/arduino-libraries/arduinoiotcloud/blob/master/extras/test/CMakeLists.txt Creates the test executable and links it against connectionhandler, cloudutils, and Catch2WithMain. ```cmake add_executable( ${TEST_TARGET} ${TEST_TARGET_SRCS} ) target_link_libraries( ${TEST_TARGET} connectionhandler) target_link_libraries( ${TEST_TARGET} cloudutils) target_link_libraries( ${TEST_TARGET} Catch2WithMain ) ``` -------------------------------- ### Configure thingProperties.h Source: https://github.com/arduino-libraries/arduinoiotcloud/blob/master/README.md Defines the cloud properties and connection handler for the Arduino IoT Cloud. ```C++ void onLedChange(); /* ... */ bool led; int seconds; /* ... */ void initProperties() { ArduinoCloud.setThingId("ARDUINO-THING-ID"); ArduinoCloud.addProperty(led, WRITE, ON_CHANGE, onLedChange); ArduinoCloud.addProperty(seconds, READ, ON_CHANGE); } /* ... */ WiFiConnectionHandler ArduinoIoTPreferredConnection("SECRET_SSID", "SECRET_PASS"); ``` -------------------------------- ### ArduinoCloud.method() syntax Source: https://github.com/arduino-libraries/arduinoiotcloud/blob/master/docs/api.md General syntax for calling methods on the ArduinoCloud object. Replace 'method' with the specific method name. ```arduino ArduinoCloud.method() ``` -------------------------------- ### ArduinoCloud.push() syntax Source: https://github.com/arduino-libraries/arduinoiotcloud/blob/master/docs/api.md Pushes data to the IoT Cloud. No parameters and returns nothing. ```arduino ArduinoCloud.push() ``` -------------------------------- ### Include directories and interface libraries Source: https://github.com/arduino-libraries/arduinoiotcloud/blob/master/extras/test/CMakeLists.txt Adds include directories for the project and defines interface libraries 'cloudutils' and 'connectionhandler' with their source include paths. ```cmake include_directories(include) include_directories(../../src) include_directories(../../src/message) include_directories(../../src/cbor) include_directories(../../src/property) include_directories(../../src/utility/time) # add_library(cloudutils STATIC IMPORTED GLOBAL) add_library(cloudutils INTERFACE) target_include_directories( cloudutils INTERFACE ${cloudutils_SOURCE_DIR}/src/ ) target_include_directories( cloudutils INTERFACE ${cloudutils_SOURCE_DIR}/src/cbor ) target_include_directories( cloudutils INTERFACE ${cloudutils_SOURCE_DIR}/src/cbor/utils ) target_include_directories( cloudutils INTERFACE ${cloudutils_SOURCE_DIR}/src/interfaces ) add_library(connectionhandler INTERFACE) target_include_directories( connectionhandler INTERFACE ${connectionhandler_SOURCE_DIR}/src/ ) target_include_directories( connectionhandler INTERFACE ${connectionhandler_SOURCE_DIR}/src/connectionHandlerModels ) ``` -------------------------------- ### Set C++ standard and output directory Source: https://github.com/arduino-libraries/arduinoiotcloud/blob/master/extras/test/CMakeLists.txt Sets the C++ standard to 11 and the runtime output directory to ${CMAKE_BINARY_DIR}/bin. ```cmake set(CMAKE_CXX_STANDARD 11) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) ``` -------------------------------- ### Compile definitions and options Source: https://github.com/arduino-libraries/arduinoiotcloud/blob/master/extras/test/CMakeLists.txt Adds compile definitions for various board types and host, enables warnings as errors, and sets coverage flags. ```cmake add_compile_definitions(BOARD_HAS_LORA BOARD_HAS_CATM1_NBIOT BOARD_HAS_WIFI BOARD_HAS_ETHERNET BOARD_HAS_CELLULAR BOARD_HAS_NB BOARD_HAS_GSM) add_compile_definitions(HOST HAS_TCP) add_compile_options(-Wall -Wextra -Wpedantic -Werror) add_compile_options(-Wno-cast-function-type) set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} "--coverage") set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "--coverage -Wno-deprecated-copy -Wno-missing-field-initializers") ``` -------------------------------- ### Compress binary with lzss.py Source: https://github.com/arduino-libraries/arduinoiotcloud/blob/master/extras/tools/README.md Compress a binary file using the LZSS algorithm. The input file is sketch.bin and the output is sketch.lzss. ```bash ./lzss.py --encode sketch.bin sketch.lzss ``` -------------------------------- ### ArduinoCloud.printDebugInfo() Source: https://github.com/arduino-libraries/arduinoiotcloud/blob/master/docs/api.md Prints any available debug information. ```APIDOC ## ArduinoCloud.printDebugInfo() ### Description Print any available debug information. ### Parameters None. ### Returns Nothing. ``` -------------------------------- ### printDebugInfo() (LPWAN) Source: https://github.com/arduino-libraries/arduinoiotcloud/blob/master/docs/api.md Prints any available debug information. ```APIDOC ## printDebugInfo() (LPWAN) ### Description Print any available debug information. ### Parameters None. ### Returns Nothing. ``` -------------------------------- ### Extend binary for OTA update with bin2ota.py Source: https://github.com/arduino-libraries/arduinoiotcloud/blob/master/extras/tools/README.md Prefixes a binary with length, CRC, magic number, and version required for OTA update. Specify board type as MKR_WIFI_1010 or NANO_33_IOT. ```bash ./bin2ota.py [MKR_WIFI_1010 | NANO_33_IOT] sketch.lzss sketch.ota ``` -------------------------------- ### Define test target and source lists Source: https://github.com/arduino-libraries/arduinoiotcloud/blob/master/extras/test/CMakeLists.txt Defines the test target name and lists test source files, utility sources, and device-under-test sources including CBOR and property implementations. ```cmake set(TEST_TARGET ${CMAKE_PROJECT_NAME}) set(TEST_SRCS src/test_addPropertyReal.cpp src/test_callback.cpp src/test_CloudColor.cpp src/test_CloudFloat.cpp src/test_CloudWrapperFloat.cpp src/test_CloudLocation.cpp src/test_CloudSchedule.cpp src/test_decode.cpp src/test_encode.cpp src/test_command_decode.cpp src/test_command_encode.cpp src/test_publishEvery.cpp src/test_publishOnChange.cpp src/test_publishOnChangeRateLimit.cpp src/test_readOnly.cpp src/test_writeOnly.cpp src/test_writeOnDemand.cpp src/test_writeOnChange.cpp ) set(TEST_UTIL_SRCS src/util/CBORTestUtil.cpp src/util/PropertyTestUtil.cpp ) set(TEST_DUT_SRCS ../../src/property/Property.cpp ../../src/property/PropertyContainer.cpp ../../src/cbor/CBORDecoder.cpp ../../src/cbor/CBOREncoder.cpp ../../src/cbor/IoTCloudMessageDecoder.cpp ../../src/cbor/IoTCloudMessageEncoder.cpp ${cloudutils_SOURCE_DIR}/src/cbor/tinycbor/src/cborencoder.c ${cloudutils_SOURCE_DIR}/src/cbor/tinycbor/src/cborencoder_close_container_checked.c ${cloudutils_SOURCE_DIR}/src/cbor/tinycbor/src/cborerrorstrings.c ${cloudutils_SOURCE_DIR}/src/cbor/tinycbor/src/cborparser.c ${cloudutils_SOURCE_DIR}/src/cbor/tinycbor/src/cborparser_dup_string.c ${cloudutils_SOURCE_DIR}/src/cbor/tinycbor/src/cborpretty.c ${cloudutils_SOURCE_DIR}/src/cbor/tinycbor/src/cborpretty_stdio.c ${cloudutils_SOURCE_DIR}/src/cbor/tinycbor/src/cbortojson.c ${cloudutils_SOURCE_DIR}/src/cbor/tinycbor/src/cborvalidation.c ${cloudutils_SOURCE_DIR}/src/cbor/tinycbor/src/open_memstream.c ${cloudutils_SOURCE_DIR}/src/cbor/MessageDecoder.cpp ${cloudutils_SOURCE_DIR}/src/cbor/MessageEncoder.cpp ) ``` -------------------------------- ### ArduinoCloud.addProperty() Source: https://github.com/arduino-libraries/arduinoiotcloud/blob/master/docs/api.md Adds a variable/property with a set of parameters. ```APIDOC ## ArduinoCloud.addProperty() ### Description Adds a variable/property with a set of parameters. ### Syntax ``` ArduinoCloud.addProperty(cloudVariable, tag, permission, policy, callbackFunction) ``` ### Parameters - cloudVariable - name of the variable/property. - permission - can either be READ / WRITE or READWRITE - policy - ON_CHANGE (whenever variable data changes) or * SECONDS. is specified in the Thing configuration. - callBackFunction - by default, a callback function is added to a variable with WRITE permissions. A variable called test will automatically be added as onTestChange which also is added to your sketch. ### Returns Nothing. ``` -------------------------------- ### ArduinoCloud.connected() syntax Source: https://github.com/arduino-libraries/arduinoiotcloud/blob/master/docs/api.md Checks the connection status and returns an integer representing the connection status. ```arduino ArduinoCloud.connected() ``` -------------------------------- ### update() (LPWAN) Source: https://github.com/arduino-libraries/arduinoiotcloud/blob/master/docs/api.md Handles the update between the board and the IoT Cloud. ```APIDOC ## update() (LPWAN) ### Description This method handles the update between the board and the IoT Cloud. ### Syntax ``` ArduinoCloud.update() ``` ### Parameters None. ### Returns Nothing. ``` -------------------------------- ### ArduinoCloud.connected() Source: https://github.com/arduino-libraries/arduinoiotcloud/blob/master/docs/api.md Checks the connection status and returns an integer representing the connection status. ```APIDOC ## ArduinoCloud.connected() ### Description Checks the connection status and returns an integer the connection status (int). ### Syntax ``` ArduinoCloud.connected() ``` ### Parameters None. ### Returns - int - status of connection ``` -------------------------------- ### Combine all test sources Source: https://github.com/arduino-libraries/arduinoiotcloud/blob/master/extras/test/CMakeLists.txt Combines the test sources, utility sources, and device-under-test sources into the TEST_TARGET_SRCS variable. ```cmake set(TEST_TARGET_SRCS src/Arduino.cpp src/test_main.cpp ${TEST_SRCS} ${TEST_UTIL_SRCS} ${TEST_DUT_SRCS} ) ``` -------------------------------- ### addProperty() (LPWAN) Source: https://github.com/arduino-libraries/arduinoiotcloud/blob/master/docs/api.md Adds a variable/property with a set of parameters. ```APIDOC ## addProperty() (LPWAN) ### Description Adds a variable/property with a set of parameters. ### Syntax ``` ArduinoCloud.addProperty(cloudVariable, tag, permission, policy, callbackFunction) ``` ### Parameters - `cloudVariable` - name of the variable/property. - `permission` - can either be `READ` / `WRITE` or `READWRITE` - `tag` - matches the cloud and local variables with a number. E.g. adding a second variable will have the tag `2`. - `policy` - `ON_CHANGE` (whenever variable data changes) or ` * SECONDS`. `` is specified in the Thing configuration. - `callBackFunction` - by default, a callback function is added to a variable with **WRITE** permissions. A variable called `test` will automatically be added as `onTestChange` which also is added to your sketch. ### Returns Nothing. ``` -------------------------------- ### ArduinoCloud.push() Source: https://github.com/arduino-libraries/arduinoiotcloud/blob/master/docs/api.md Pushes data to the IoT Cloud. This method is used to synchronize local data with the cloud. ```APIDOC ## ArduinoCloud.push() ### Description Pushes data to the IoT Cloud. ### Method push ### Syntax ArduinoCloud.push() ### Parameters None. ### Returns Nothing. ``` -------------------------------- ### connected() (LPWAN) Source: https://github.com/arduino-libraries/arduinoiotcloud/blob/master/docs/api.md Checks the connection status and returns an integer representing the connection status. ```APIDOC ## connected() (LPWAN) ### Description Checks the connection status and returns an integer the connection status (int). ### Syntax ``` ArduinoCloud.connected() ``` ### Parameters None. ### Returns - `int` - status of connection ``` -------------------------------- ### ArduinoCloud.addProperty() syntax Source: https://github.com/arduino-libraries/arduinoiotcloud/blob/master/docs/api.md Adds a variable/property with parameters: cloudVariable, tag, permission, policy, and callbackFunction. Permission can be READ, WRITE, or READWRITE. Policy can be ON_CHANGE or * SECONDS. A callback function is automatically added for WRITE variables. ```arduino ArduinoCloud.addProperty(cloudVariable, tag, permission, policy, callbackFunction) ``` -------------------------------- ### ArduinoCloud.setThingId() Source: https://github.com/arduino-libraries/arduinoiotcloud/blob/master/docs/api.md Method call to set the Thing ID. ```cpp ArduinoCloud.setThingId(thingId) ``` -------------------------------- ### ArduinoCloud.addCallback() Source: https://github.com/arduino-libraries/arduinoiotcloud/blob/master/docs/api.md Adds a callback function for IoT Cloud events such as connect, sync, and disconnect. ```APIDOC ## ArduinoCloud.addCallback() ### Description Adds a callback function for IoT Cloud events. ### Method addCallback ### Syntax ArduinoCloud.addCallback(ArduinoIoTCloudEvent::CONNECT, doThisOnConnect); ArduinoCloud.addCallback(ArduinoIoTCloudEvent::SYNC, doThisOnSync); ArduinoCloud.addCallback(ArduinoIoTCloudEvent::DISCONNECT, doThisOnDisconnect); ### Parameters - Event (ArduinoIoTCloudEvent) - Required - Event type (CONNECT, SYNC, DISCONNECT) - Callback function (function) - Required - Callback function to be invoked ``` -------------------------------- ### ArduinoCloud.update() syntax Source: https://github.com/arduino-libraries/arduinoiotcloud/blob/master/docs/api.md Updates the IoT Cloud connection: feeds a watchdog timer, sends variable updates, and checks for new data. Must be called continuously in loop() to avoid timeout and reset. Do not use delay() in the sketch. ```arduino ArduinoCloud.update() ``` -------------------------------- ### Decompress binary with lzss.py Source: https://github.com/arduino-libraries/arduinoiotcloud/blob/master/extras/tools/README.md Decompress an LZSS-compressed file back to the original binary. ```bash ./lzss.py --decode sketch.lzss sketch.bin ``` -------------------------------- ### enableRetry() Source: https://github.com/arduino-libraries/arduinoiotcloud/blob/master/docs/api.md Enables or disables retry functionality. ```APIDOC ## enableRetry() ### Description This method is used to enable or disable retry functionality. ### Parameters - `bool` - if `true`, retry functionality is enabled; if `false`, retry functionality is disabled. ### Returns Nothing. ``` -------------------------------- ### ArduinoCloud.update() Source: https://github.com/arduino-libraries/arduinoiotcloud/blob/master/docs/api.md Responsible for updating the IoT Cloud connection. It feeds a watchdog timer, sends variable updates to the IoT Cloud via MQTT, and checks for new data from the IoT Cloud. Any IoT Cloud sketch needs to continuously call this function. ```APIDOC ## ArduinoCloud.update() ### Description Responsible for updating the IoT Cloud connection. First it feeds a watchdog timer, making sure it is not stuck anywhere, then sends variable updates to the IoT Cloud (via MQTT client), and finally checks for new data from the IoT Cloud (via the MQTT client). Any IoT Cloud sketch needs to continuously call the update() function, as it will otherwise time out and reset. The update() is by default placed inside of the loop(). Note: do not use the delay() function in the sketch, as the watchdog timer will cause the board to reset and attempt to reconnect. ### Syntax ``` ArduinoCloud.update() ``` ### Parameters None. ### Returns Nothing. ``` -------------------------------- ### setThingId() Source: https://github.com/arduino-libraries/arduinoiotcloud/blob/master/docs/api.md Sets the Thing ID. ```APIDOC ## setThingId() ### Description Sets the Thing ID. ### Syntax ``` ArduinoCloud.setThingId(thingId) ``` ### Parameters - `String` - your Thing's ID. Obtainable in the IoT Cloud interface. ``` -------------------------------- ### MQTT Subscription Error Log Source: https://github.com/arduino-libraries/arduinoiotcloud/blob/master/README.md This error message indicates a failure to subscribe to a specific THING_ID. It typically occurs due to incorrect device association in the Arduino IoT Cloud GUI or a typo in the ID. ```text ArduinoIoTCloudTCP::handle_SubscribeMqttTopics could not subscribe to /a/t/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/e/i ``` -------------------------------- ### ArduinoCloud.setDeviceId() syntax Source: https://github.com/arduino-libraries/arduinoiotcloud/blob/master/docs/api.md Sets the Device ID. Parameter: String deviceId. ```arduino ArduinoCloud.setDeviceId(deviceId) ``` -------------------------------- ### ArduinoCloud.setBoardId() syntax Source: https://github.com/arduino-libraries/arduinoiotcloud/blob/master/docs/api.md Sets the board/device ID. Only enabled for ESP32/ESP8266 based boards, including Arduino UNO R4 WiFi and Arduino Nano ESP32. ```arduino ArduinoCloud.setBoardId(DEVICE_LOGIN_NAME); ``` -------------------------------- ### ArduinoCloud.setTimestamp() Source: https://github.com/arduino-libraries/arduinoiotcloud/blob/master/docs/api.md Sets a timestamp for a cloud variable. This is used to associate a timestamp with a specific property. ```APIDOC ## ArduinoCloud.setTimestamp() ### Description Sets a timestamp for a cloud variable. ### Method setTimestamp ### Syntax ArduinoCloud.setTimestamp(cloudVariable, timestamp) ### Parameters - cloudVariable (String) - Required - Property name - timestamp (unsigned long const) - Required - Timestamp value ``` -------------------------------- ### ArduinoCloud.setTimestamp() syntax Source: https://github.com/arduino-libraries/arduinoiotcloud/blob/master/docs/api.md Sets a timestamp for a cloud variable. Parameters: String property name and unsigned long const timestamp. ```arduino ArduinoCloud.setTimestamp(cloudVariable, timestamp) ``` -------------------------------- ### setMaxRetry() Source: https://github.com/arduino-libraries/arduinoiotcloud/blob/master/docs/api.md Sets the maximum number of retry attempts. ```APIDOC ## setMaxRetry() ### Description Used to set the maximum number of retry attempts. ### Parameters - `int` - the maximum number of retry attempts to set. ### Returns Nothing. ``` -------------------------------- ### ArduinoCloud.setBoardId() Source: https://github.com/arduino-libraries/arduinoiotcloud/blob/master/docs/api.md Sets the board/device id. This method is only enabled if you are using an ESP32/ESP8266 board. ```APIDOC ## ArduinoCloud.setBoardId() ### Description This method is only enabled if you are using an ESP32/ESP8266 board, and sets the board/device id. Currently, the following official Arduino boards uses this method: Arduino UNO R4 WiFi, Arduino Nano ESP32. ### Syntax ``` ArduinoCloud.setBoardId(DEVICE_LOGIN_NAME); ``` ``` -------------------------------- ### ArduinoCloud.setSecretDeviceKey() syntax Source: https://github.com/arduino-libraries/arduinoiotcloud/blob/master/docs/api.md Sets the secret device key for the device. Only enabled for ESP32/ESP8266 based boards. The secret key is only obtainable from the Arduino IoT Cloud during device configuration. ```arduino ArduinoCloud.setSecretDeviceKey(DEVICE_KEY); ``` -------------------------------- ### ArduinoCloud.setDeviceId() Source: https://github.com/arduino-libraries/arduinoiotcloud/blob/master/docs/api.md Sets the Device ID for the cloud connection. ```APIDOC ## ArduinoCloud.setDeviceId() ### Description Sets the Device ID. ### Method setDeviceId ### Syntax ArduinoCloud.setDeviceId(deviceId) ### Parameters - deviceId (String) - Required - Device ID. ``` -------------------------------- ### ArduinoCloud.setSecretDeviceKey() Source: https://github.com/arduino-libraries/arduinoiotcloud/blob/master/docs/api.md Sets the secret device key for the device. This method is only enabled if you are using an ESP32/ESP8266 based board. ```APIDOC ## ArduinoCloud.setSecretDeviceKey() ### Description This method is only enabled if you are using an ESP32/ESP8266 based board, and sets the secret device key for the device. The secret key is only obtainable from the Arduino IoT Cloud during device configuration. ### Syntax ``` ArduinoCloud.setSecretDeviceKey(DEVICE_KEY); ``` ``` -------------------------------- ### Disable Watchdog Timer Source: https://github.com/arduino-libraries/arduinoiotcloud/blob/master/README.md The watchdog timer is enabled by default on supported boards. Use this command to disable it by setting the second parameter of ArduinoCloud.begin to false. ```C++ ArduinoCloud.begin(ArduinoIoTPreferredConnection, false). ``` -------------------------------- ### getMaxRetry() Source: https://github.com/arduino-libraries/arduinoiotcloud/blob/master/docs/api.md Retrieves the maximum number of retry attempts. ```APIDOC ## getMaxRetry() ### Description This method is used to retrieve the maximum number of retry attempts. ### Parameters None. ### Returns - `int` - returns the maximum number of retry attempts as an integer. ``` -------------------------------- ### getIntervalRetry() Source: https://github.com/arduino-libraries/arduinoiotcloud/blob/master/docs/api.md Retrieves the interval in milliseconds between retry attempts. ```APIDOC ## getIntervalRetry() ### Description This method is used to retrieve the interval in milliseconds between the retry attempts. ### Parameters None. ### Returns - `long` - returns the interval between retry attempts in milliseconds. ``` -------------------------------- ### setIntervalRetry() Source: https://github.com/arduino-libraries/arduinoiotcloud/blob/master/docs/api.md Sets the interval in milliseconds between retry attempts. ```APIDOC ## setIntervalRetry() ### Description Sets the interval in milliseconds between retry attempts. ### Parameters - `long` - the interval between retry attempts in milliseconds to set. ### Returns Nothing. ``` -------------------------------- ### isRetryEnabled() Source: https://github.com/arduino-libraries/arduinoiotcloud/blob/master/docs/api.md Checks whether retry functionality is enabled. ```APIDOC ## isRetryEnabled() ### Description This method is used to check whether retry functionality is enabled. ### Parameters None. ### Returns - `bool` - returns `true` if retry functionality is enabled, otherwise returns `false`. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.