diff --git a/.github/workflows/compile-examples.yml b/.github/workflows/compile-examples.yml index 7040b20bd..48e3bbf7f 100644 --- a/.github/workflows/compile-examples.yml +++ b/.github/workflows/compile-examples.yml @@ -70,6 +70,8 @@ jobs: type: renesas_uno - fqbn: arduino:esp32:nano_nora type: arduino_esp32 + - fqbn: arduino:mbed_edge:edge_control + type: mbed_edge # make board type-specific customizations to the matrix jobs @@ -212,6 +214,12 @@ jobs: - name: Arduino_ESP32_OTA sketch-paths: | - examples/ArduinoIoTCloud-DeferredOTA + # Edge Control + - board: + type: mbed_edge + platforms: | + # Install mbed_edge platform via Boards Manager + - name: arduino:mbed_edge # ESP8266 boards - board: type: esp8266 diff --git a/examples/ArduinoIoTCloud-Advanced/arduino_secrets.h b/examples/ArduinoIoTCloud-Advanced/arduino_secrets.h index 09ea8323a..fc43514f9 100644 --- a/examples/ArduinoIoTCloud-Advanced/arduino_secrets.h +++ b/examples/ArduinoIoTCloud-Advanced/arduino_secrets.h @@ -14,8 +14,8 @@ #define SECRET_DEVICE_KEY "my-device-password" #endif -/* MKR GSM 1400 */ -#if defined(BOARD_HAS_GSM) +/* MKR GSM 1400 */ /* MKR NB 1500 */ /* Portenta CAT.M1/NB IoT GNSS Shield */ +#if defined(BOARD_HAS_GSM) || defined(BOARD_HAS_NB) || defined(BOARD_HAS_CATM1_NBIOT) #define SECRET_PIN "" #define SECRET_APN "" #define SECRET_LOGIN "" @@ -28,14 +28,6 @@ #define SECRET_APP_KEY "" #endif -/* MKR NB 1500 */ -#if defined(BOARD_HAS_NB) - #define SECRET_PIN "" - #define SECRET_APN "" - #define SECRET_LOGIN "" - #define SECRET_PASS "" -#endif - /* Portenta H7 + Ethernet shield */ #if defined(BOARD_HAS_ETHERNET) #define SECRET_OPTIONAL_IP "" diff --git a/examples/ArduinoIoTCloud-Advanced/thingProperties.h b/examples/ArduinoIoTCloud-Advanced/thingProperties.h index fd4b2ce69..97ffee9d6 100644 --- a/examples/ArduinoIoTCloud-Advanced/thingProperties.h +++ b/examples/ArduinoIoTCloud-Advanced/thingProperties.h @@ -1,9 +1,5 @@ -#if defined(BOARD_HAS_WIFI) -#elif defined(BOARD_HAS_GSM) -#elif defined(BOARD_HAS_LORA) -#elif defined(BOARD_HAS_NB) -#elif defined(BOARD_HAS_ETHERNET) -#else +#if !(defined(BOARD_HAS_WIFI) || defined(BOARD_HAS_GSM) || defined(BOARD_HAS_LORA) || \ + defined(BOARD_HAS_NB) || defined(BOARD_HAS_ETHERNET) || defined(BOARD_HAS_CATM1_NBIOT)) #error "Please check Arduino IoT Cloud supported boards list: https://github.com/arduino-libraries/ArduinoIoTCloud/#what" #endif @@ -23,7 +19,7 @@ void initProperties() { ArduinoCloud.setBoardId(BOARD_ID); ArduinoCloud.setSecretDeviceKey(SECRET_DEVICE_KEY); #endif -#if defined(BOARD_HAS_WIFI) || defined(BOARD_HAS_GSM) || defined(BOARD_HAS_NB) +#if defined(BOARD_HAS_WIFI) || defined(BOARD_HAS_GSM) || defined(BOARD_HAS_NB) || defined(BOARD_HAS_ETHERNET) || defined(BOARD_HAS_CATM1_NBIOT) ArduinoCloud.addProperty(switchButton, WRITE, ON_CHANGE, onSwitchButtonChange); ArduinoCloud.addProperty(location, READ, ON_CHANGE); ArduinoCloud.addProperty(color, READWRITE, ON_CHANGE, onColorChange); @@ -42,6 +38,8 @@ void initProperties() { LoRaConnectionHandler ArduinoIoTPreferredConnection(SECRET_APP_EUI, SECRET_APP_KEY, _lora_band::EU868, NULL, _lora_class::CLASS_A); #elif defined(BOARD_HAS_NB) NBConnectionHandler ArduinoIoTPreferredConnection(SECRET_PIN, SECRET_APN, SECRET_LOGIN, SECRET_PASS); +#elif defined(BOARD_HAS_CATM1_NBIOT) + CatM1ConnectionHandler ArduinoIoTPreferredConnection(SECRET_PIN, SECRET_APN, SECRET_LOGIN, SECRET_PASS); #elif defined(BOARD_HAS_ETHERNET) /* DHCP mode */ //EthernetConnectionHandler ArduinoIoTPreferredConnection; diff --git a/examples/ArduinoIoTCloud-Basic/arduino_secrets.h b/examples/ArduinoIoTCloud-Basic/arduino_secrets.h index 09ea8323a..fc43514f9 100644 --- a/examples/ArduinoIoTCloud-Basic/arduino_secrets.h +++ b/examples/ArduinoIoTCloud-Basic/arduino_secrets.h @@ -14,8 +14,8 @@ #define SECRET_DEVICE_KEY "my-device-password" #endif -/* MKR GSM 1400 */ -#if defined(BOARD_HAS_GSM) +/* MKR GSM 1400 */ /* MKR NB 1500 */ /* Portenta CAT.M1/NB IoT GNSS Shield */ +#if defined(BOARD_HAS_GSM) || defined(BOARD_HAS_NB) || defined(BOARD_HAS_CATM1_NBIOT) #define SECRET_PIN "" #define SECRET_APN "" #define SECRET_LOGIN "" @@ -28,14 +28,6 @@ #define SECRET_APP_KEY "" #endif -/* MKR NB 1500 */ -#if defined(BOARD_HAS_NB) - #define SECRET_PIN "" - #define SECRET_APN "" - #define SECRET_LOGIN "" - #define SECRET_PASS "" -#endif - /* Portenta H7 + Ethernet shield */ #if defined(BOARD_HAS_ETHERNET) #define SECRET_OPTIONAL_IP "" diff --git a/examples/ArduinoIoTCloud-Basic/thingProperties.h b/examples/ArduinoIoTCloud-Basic/thingProperties.h index b10ac85fc..31d49b656 100644 --- a/examples/ArduinoIoTCloud-Basic/thingProperties.h +++ b/examples/ArduinoIoTCloud-Basic/thingProperties.h @@ -1,9 +1,5 @@ -#if defined(BOARD_HAS_WIFI) -#elif defined(BOARD_HAS_GSM) -#elif defined(BOARD_HAS_LORA) -#elif defined(BOARD_HAS_NB) -#elif defined(BOARD_HAS_ETHERNET) -#else +#if !(defined(BOARD_HAS_WIFI) || defined(BOARD_HAS_GSM) || defined(BOARD_HAS_LORA) || \ + defined(BOARD_HAS_NB) || defined(BOARD_HAS_ETHERNET) || defined(BOARD_HAS_CATM1_NBIOT)) #error "Please check Arduino IoT Cloud supported boards list: https://github.com/arduino-libraries/ArduinoIoTCloud/#what" #endif @@ -22,7 +18,7 @@ void initProperties() { ArduinoCloud.setBoardId(BOARD_ID); ArduinoCloud.setSecretDeviceKey(SECRET_DEVICE_KEY); #endif -#if defined(BOARD_HAS_WIFI) || defined(BOARD_HAS_GSM) || defined(BOARD_HAS_NB) || defined(BOARD_HAS_ETHERNET) +#if defined(BOARD_HAS_WIFI) || defined(BOARD_HAS_GSM) || defined(BOARD_HAS_NB) || defined(BOARD_HAS_ETHERNET) || defined(BOARD_HAS_CATM1_NBIOT) ArduinoCloud.addProperty(led, Permission::Write).onUpdate(onLedChange); ArduinoCloud.addProperty(potentiometer, Permission::Read).publishOnChange(10); ArduinoCloud.addProperty(seconds, Permission::Read).publishOnChange(1); @@ -46,4 +42,6 @@ void initProperties() { LoRaConnectionHandler ArduinoIoTPreferredConnection(SECRET_APP_EUI, SECRET_APP_KEY, _lora_band::EU868, NULL, _lora_class::CLASS_A); #elif defined(BOARD_HAS_NB) NBConnectionHandler ArduinoIoTPreferredConnection(SECRET_PIN, SECRET_APN, SECRET_LOGIN, SECRET_PASS); +#elif defined(BOARD_HAS_CATM1_NBIOT) + CatM1ConnectionHandler ArduinoIoTPreferredConnection(SECRET_PIN, SECRET_APN, SECRET_LOGIN, SECRET_PASS); #endif diff --git a/examples/ArduinoIoTCloud-Callbacks/arduino_secrets.h b/examples/ArduinoIoTCloud-Callbacks/arduino_secrets.h index 09ea8323a..fc43514f9 100644 --- a/examples/ArduinoIoTCloud-Callbacks/arduino_secrets.h +++ b/examples/ArduinoIoTCloud-Callbacks/arduino_secrets.h @@ -14,8 +14,8 @@ #define SECRET_DEVICE_KEY "my-device-password" #endif -/* MKR GSM 1400 */ -#if defined(BOARD_HAS_GSM) +/* MKR GSM 1400 */ /* MKR NB 1500 */ /* Portenta CAT.M1/NB IoT GNSS Shield */ +#if defined(BOARD_HAS_GSM) || defined(BOARD_HAS_NB) || defined(BOARD_HAS_CATM1_NBIOT) #define SECRET_PIN "" #define SECRET_APN "" #define SECRET_LOGIN "" @@ -28,14 +28,6 @@ #define SECRET_APP_KEY "" #endif -/* MKR NB 1500 */ -#if defined(BOARD_HAS_NB) - #define SECRET_PIN "" - #define SECRET_APN "" - #define SECRET_LOGIN "" - #define SECRET_PASS "" -#endif - /* Portenta H7 + Ethernet shield */ #if defined(BOARD_HAS_ETHERNET) #define SECRET_OPTIONAL_IP "" diff --git a/examples/ArduinoIoTCloud-Callbacks/thingProperties.h b/examples/ArduinoIoTCloud-Callbacks/thingProperties.h index f3de1a2ed..59eff5857 100644 --- a/examples/ArduinoIoTCloud-Callbacks/thingProperties.h +++ b/examples/ArduinoIoTCloud-Callbacks/thingProperties.h @@ -1,9 +1,5 @@ -#if defined(BOARD_HAS_WIFI) -#elif defined(BOARD_HAS_GSM) -#elif defined(BOARD_HAS_LORA) -#elif defined(BOARD_HAS_NB) -#elif defined(BOARD_HAS_ETHERNET) -#else +#if !(defined(BOARD_HAS_WIFI) || defined(BOARD_HAS_GSM) || defined(BOARD_HAS_LORA) || \ + defined(BOARD_HAS_NB) || defined(BOARD_HAS_ETHERNET) || defined(BOARD_HAS_CATM1_NBIOT)) #error "Please check Arduino IoT Cloud supported boards list: https://github.com/arduino-libraries/ArduinoIoTCloud/#what" #endif @@ -26,6 +22,8 @@ void initProperties() { LoRaConnectionHandler ArduinoIoTPreferredConnection(SECRET_APP_EUI, SECRET_APP_KEY, _lora_band::EU868, NULL, _lora_class::CLASS_A); #elif defined(BOARD_HAS_NB) NBConnectionHandler ArduinoIoTPreferredConnection(SECRET_PIN, SECRET_APN, SECRET_LOGIN, SECRET_PASS); +#elif defined(BOARD_HAS_CATM1_NBIOT) + CatM1ConnectionHandler ArduinoIoTPreferredConnection(SECRET_PIN, SECRET_APN, SECRET_LOGIN, SECRET_PASS); #elif defined(BOARD_HAS_ETHERNET) /* DHCP mode */ //EthernetConnectionHandler ArduinoIoTPreferredConnection; diff --git a/examples/ArduinoIoTCloud-DeferredOTA/arduino_secrets.h b/examples/ArduinoIoTCloud-DeferredOTA/arduino_secrets.h index 09ea8323a..1b0bb7fcb 100644 --- a/examples/ArduinoIoTCloud-DeferredOTA/arduino_secrets.h +++ b/examples/ArduinoIoTCloud-DeferredOTA/arduino_secrets.h @@ -14,28 +14,6 @@ #define SECRET_DEVICE_KEY "my-device-password" #endif -/* MKR GSM 1400 */ -#if defined(BOARD_HAS_GSM) - #define SECRET_PIN "" - #define SECRET_APN "" - #define SECRET_LOGIN "" - #define SECRET_PASS "" -#endif - -/* MKR WAN 1300/1310 */ -#if defined(BOARD_HAS_LORA) - #define SECRET_APP_EUI "" - #define SECRET_APP_KEY "" -#endif - -/* MKR NB 1500 */ -#if defined(BOARD_HAS_NB) - #define SECRET_PIN "" - #define SECRET_APN "" - #define SECRET_LOGIN "" - #define SECRET_PASS "" -#endif - /* Portenta H7 + Ethernet shield */ #if defined(BOARD_HAS_ETHERNET) #define SECRET_OPTIONAL_IP "" diff --git a/examples/ArduinoIoTCloud-DeferredOTA/thingProperties.h b/examples/ArduinoIoTCloud-DeferredOTA/thingProperties.h index 1570e4a1b..525de5aa4 100644 --- a/examples/ArduinoIoTCloud-DeferredOTA/thingProperties.h +++ b/examples/ArduinoIoTCloud-DeferredOTA/thingProperties.h @@ -1,9 +1,4 @@ -#if defined(BOARD_HAS_WIFI) -#elif defined(BOARD_HAS_GSM) -#elif defined(BOARD_HAS_LORA) -#elif defined(BOARD_HAS_NB) -#elif defined(BOARD_HAS_ETHERNET) -#else +#if !(defined(BOARD_HAS_WIFI) || defined(BOARD_HAS_ETHERNET)) #error "Please check Arduino IoT Cloud supported boards list: https://github.com/arduino-libraries/ArduinoIoTCloud/#what" #endif @@ -20,21 +15,12 @@ void initProperties() { ArduinoCloud.setBoardId(BOARD_ID); ArduinoCloud.setSecretDeviceKey(SECRET_DEVICE_KEY); #endif -#if defined(BOARD_HAS_WIFI) || defined(BOARD_HAS_GSM) || defined(BOARD_HAS_NB) || defined(BOARD_HAS_ETHERNET) + ArduinoCloud.addProperty(led, Permission::Write).onUpdate(onLedChange); -#elif defined(BOARD_HAS_LORA) - ArduinoCloud.addProperty(led, 1, READWRITE, ON_CHANGE, onLedChange); -#endif } #if defined(BOARD_HAS_WIFI) WiFiConnectionHandler ArduinoIoTPreferredConnection(SECRET_SSID, SECRET_PASS); -#elif defined(BOARD_HAS_GSM) - GSMConnectionHandler ArduinoIoTPreferredConnection(SECRET_PIN, SECRET_APN, SECRET_LOGIN, SECRET_PASS); -#elif defined(BOARD_HAS_LORA) - LoRaConnectionHandler ArduinoIoTPreferredConnection(SECRET_APP_EUI, SECRET_APP_KEY, _lora_band::EU868, NULL, _lora_class::CLASS_A); -#elif defined(BOARD_HAS_NB) - NBConnectionHandler ArduinoIoTPreferredConnection(SECRET_PIN, SECRET_APN, SECRET_LOGIN, SECRET_PASS); #elif defined(BOARD_HAS_ETHERNET) /* DHCP mode */ //EthernetConnectionHandler ArduinoIoTPreferredConnection; diff --git a/examples/ArduinoIoTCloud-Schedule/arduino_secrets.h b/examples/ArduinoIoTCloud-Schedule/arduino_secrets.h index 09ea8323a..fc43514f9 100644 --- a/examples/ArduinoIoTCloud-Schedule/arduino_secrets.h +++ b/examples/ArduinoIoTCloud-Schedule/arduino_secrets.h @@ -14,8 +14,8 @@ #define SECRET_DEVICE_KEY "my-device-password" #endif -/* MKR GSM 1400 */ -#if defined(BOARD_HAS_GSM) +/* MKR GSM 1400 */ /* MKR NB 1500 */ /* Portenta CAT.M1/NB IoT GNSS Shield */ +#if defined(BOARD_HAS_GSM) || defined(BOARD_HAS_NB) || defined(BOARD_HAS_CATM1_NBIOT) #define SECRET_PIN "" #define SECRET_APN "" #define SECRET_LOGIN "" @@ -28,14 +28,6 @@ #define SECRET_APP_KEY "" #endif -/* MKR NB 1500 */ -#if defined(BOARD_HAS_NB) - #define SECRET_PIN "" - #define SECRET_APN "" - #define SECRET_LOGIN "" - #define SECRET_PASS "" -#endif - /* Portenta H7 + Ethernet shield */ #if defined(BOARD_HAS_ETHERNET) #define SECRET_OPTIONAL_IP "" diff --git a/examples/ArduinoIoTCloud-Schedule/thingProperties.h b/examples/ArduinoIoTCloud-Schedule/thingProperties.h index 5949d8900..4f03c20ce 100644 --- a/examples/ArduinoIoTCloud-Schedule/thingProperties.h +++ b/examples/ArduinoIoTCloud-Schedule/thingProperties.h @@ -1,9 +1,5 @@ -#if defined(BOARD_HAS_WIFI) -#elif defined(BOARD_HAS_GSM) -#elif defined(BOARD_HAS_LORA) -#elif defined(BOARD_HAS_NB) -#elif defined(BOARD_HAS_ETHERNET) -#else +#if !(defined(BOARD_HAS_WIFI) || defined(BOARD_HAS_GSM) || defined(BOARD_HAS_LORA) || \ + defined(BOARD_HAS_NB) || defined(BOARD_HAS_ETHERNET) || defined(BOARD_HAS_CATM1_NBIOT)) #error "Please check Arduino IoT Cloud supported boards list: https://github.com/arduino-libraries/ArduinoIoTCloud/#what" #endif @@ -27,7 +23,7 @@ void initProperties() { ArduinoCloud.setBoardId(BOARD_ID); ArduinoCloud.setSecretDeviceKey(SECRET_DEVICE_KEY); #endif -#if defined(BOARD_HAS_WIFI) || defined(BOARD_HAS_GSM) || defined(BOARD_HAS_NB) || defined(BOARD_HAS_ETHERNET) +#if defined(BOARD_HAS_WIFI) || defined(BOARD_HAS_GSM) || defined(BOARD_HAS_NB) || defined(BOARD_HAS_ETHERNET) || defined(BOARD_HAS_CATM1_NBIOT) ArduinoCloud.addProperty(switchButton, WRITE, ON_CHANGE); ArduinoCloud.addProperty(oneShot, READWRITE, ON_CHANGE); ArduinoCloud.addProperty(minute, READWRITE, ON_CHANGE); @@ -49,6 +45,8 @@ void initProperties() { LoRaConnectionHandler ArduinoIoTPreferredConnection(SECRET_APP_EUI, SECRET_APP_KEY, _lora_band::EU868, NULL, _lora_class::CLASS_A); #elif defined(BOARD_HAS_NB) NBConnectionHandler ArduinoIoTPreferredConnection(SECRET_PIN, SECRET_APN, SECRET_LOGIN, SECRET_PASS); +#elif defined(BOARD_HAS_CATM1_NBIOT) + CatM1ConnectionHandler ArduinoIoTPreferredConnection(SECRET_PIN, SECRET_APN, SECRET_LOGIN, SECRET_PASS); #elif defined(BOARD_HAS_ETHERNET) /* DHCP mode */ //EthernetConnectionHandler ArduinoIoTPreferredConnection; diff --git a/examples/utility/ArduinoIoTCloud_Travis_CI/arduino_secrets.h b/examples/utility/ArduinoIoTCloud_Travis_CI/arduino_secrets.h index 09ea8323a..fc43514f9 100644 --- a/examples/utility/ArduinoIoTCloud_Travis_CI/arduino_secrets.h +++ b/examples/utility/ArduinoIoTCloud_Travis_CI/arduino_secrets.h @@ -14,8 +14,8 @@ #define SECRET_DEVICE_KEY "my-device-password" #endif -/* MKR GSM 1400 */ -#if defined(BOARD_HAS_GSM) +/* MKR GSM 1400 */ /* MKR NB 1500 */ /* Portenta CAT.M1/NB IoT GNSS Shield */ +#if defined(BOARD_HAS_GSM) || defined(BOARD_HAS_NB) || defined(BOARD_HAS_CATM1_NBIOT) #define SECRET_PIN "" #define SECRET_APN "" #define SECRET_LOGIN "" @@ -28,14 +28,6 @@ #define SECRET_APP_KEY "" #endif -/* MKR NB 1500 */ -#if defined(BOARD_HAS_NB) - #define SECRET_PIN "" - #define SECRET_APN "" - #define SECRET_LOGIN "" - #define SECRET_PASS "" -#endif - /* Portenta H7 + Ethernet shield */ #if defined(BOARD_HAS_ETHERNET) #define SECRET_OPTIONAL_IP "" diff --git a/examples/utility/ArduinoIoTCloud_Travis_CI/thingProperties.h b/examples/utility/ArduinoIoTCloud_Travis_CI/thingProperties.h index 8a9ed4a28..a93e83052 100644 --- a/examples/utility/ArduinoIoTCloud_Travis_CI/thingProperties.h +++ b/examples/utility/ArduinoIoTCloud_Travis_CI/thingProperties.h @@ -1,9 +1,5 @@ -#if defined(BOARD_HAS_WIFI) -#elif defined(BOARD_HAS_GSM) -#elif defined(BOARD_HAS_LORA) -#elif defined(BOARD_HAS_NB) -#elif defined(BOARD_HAS_ETHERNET) -#else +#if !(defined(BOARD_HAS_WIFI) || defined(BOARD_HAS_GSM) || defined(BOARD_HAS_LORA) || \ + defined(BOARD_HAS_NB) || defined(BOARD_HAS_ETHERNET) || defined(BOARD_HAS_CATM1_NBIOT)) #error "Please check Arduino IoT Cloud supported boards list: https://github.com/arduino-libraries/ArduinoIoTCloud/#what" #endif @@ -58,6 +54,8 @@ String str_property_8; LoRaConnectionHandler ArduinoIoTPreferredConnection(SECRET_APP_EUI, SECRET_APP_KEY, EU868); #elif defined(BOARD_HAS_NB) NBConnectionHandler ArduinoIoTPreferredConnection(SECRET_PIN, SECRET_APN, SECRET_LOGIN, SECRET_PASS); +#elif defined(BOARD_HAS_CATM1_NBIOT) + CatM1ConnectionHandler ArduinoIoTPreferredConnection(SECRET_PIN, SECRET_APN, SECRET_LOGIN, SECRET_PASS); #elif defined(BOARD_HAS_ETHERNET) /* DHCP mode */ //EthernetConnectionHandler ArduinoIoTPreferredConnection; @@ -77,7 +75,7 @@ void onStringPropertyChange(); /****************************************************************************** FUNCTIONS ******************************************************************************/ -#if defined(BOARD_HAS_WIFI) || defined(BOARD_HAS_GSM) || defined (BOARD_HAS_NB) +#if defined(BOARD_HAS_WIFI) || defined(BOARD_HAS_GSM) || defined (BOARD_HAS_NB) || defined (BOARD_HAS_CATM1_NBIOT) void initProperties() { #if defined(BOARD_HAS_SECRET_KEY) ArduinoCloud.setBoardId(BOARD_ID); diff --git a/library.properties b/library.properties index 81d8a2440..5a1f0c3ec 100644 --- a/library.properties +++ b/library.properties @@ -6,6 +6,6 @@ sentence=This library allows connecting to the Arduino IoT Cloud service. paragraph=It provides a ConnectionManager to handle connection/disconnection, property-change updates and events callbacks. The supported boards are MKR GSM, MKR1000 and WiFi101. category=Communication url=https://github.com/arduino-libraries/ArduinoIoTCloud -architectures=mbed,samd,esp8266,mbed_nano,mbed_portenta,mbed_nicla,esp32,mbed_opta,mbed_giga,renesas_portenta,renesas_uno +architectures=mbed,samd,esp8266,mbed_nano,mbed_portenta,mbed_nicla,esp32,mbed_opta,mbed_giga,renesas_portenta,renesas_uno,mbed_edge includes=ArduinoIoTCloud.h depends=Arduino_ConnectionHandler,Arduino_DebugUtils,ArduinoMqttClient,ArduinoECCX08,RTCZero,Adafruit SleepyDog Library,Arduino_ESP32_OTA,Arduino_Portenta_OTA diff --git a/src/AIoTC_Config.h b/src/AIoTC_Config.h index c22609ee9..e62b1617e 100644 --- a/src/AIoTC_Config.h +++ b/src/AIoTC_Config.h @@ -151,7 +151,7 @@ #define BOARD_STM32H7 #endif -#if defined(ARDUINO_UNOR4_WIFI) +#if defined(ARDUINO_UNOR4_WIFI) || defined(ARDUINO_EDGE_CONTROL) #define BOARD_HAS_SECRET_KEY #define HAS_TCP #endif diff --git a/src/ArduinoIoTCloudTCP.cpp b/src/ArduinoIoTCloudTCP.cpp index 2ebd373f0..9e018d600 100644 --- a/src/ArduinoIoTCloudTCP.cpp +++ b/src/ArduinoIoTCloudTCP.cpp @@ -39,7 +39,7 @@ #include "tls/utility/CryptoUtil.h" #endif -#ifdef ARDUINO_ARCH_ESP32 +#ifdef BOARD_HAS_SECRET_KEY #include "tls/AIoTCUPCert.h" #endif @@ -172,6 +172,8 @@ int ArduinoIoTCloudTCP::begin(bool const enable_watchdog, String brokerAddress, #else _sslClient.setCACertBundle(x509_crt_bundle); #endif +#elif defined(ARDUINO_EDGE_CONTROL) + _sslClient.appendCustomCACert(AIoTUPCert); #endif _mqttClient.setClient(_sslClient); diff --git a/src/ArduinoIoTCloudTCP.h b/src/ArduinoIoTCloudTCP.h index f15f019da..e50f9a076 100644 --- a/src/ArduinoIoTCloudTCP.h +++ b/src/ArduinoIoTCloudTCP.h @@ -152,6 +152,8 @@ class ArduinoIoTCloudTCP: public ArduinoIoTCloudClass WiFiClientSecure _sslClient; #elif defined(ARDUINO_UNOR4_WIFI) WiFiSSLClient _sslClient; + #elif defined(ARDUINO_EDGE_CONTROL) + GSMSSLClient _sslClient; #elif defined(ARDUINO_PORTENTA_C33) ArduinoIoTCloudCertClass _cert; SSLClient _sslClient; diff --git a/src/tls/AIoTCUPCert.h b/src/tls/AIoTCUPCert.h index 58a01737d..ac3daa707 100644 --- a/src/tls/AIoTCUPCert.h +++ b/src/tls/AIoTCUPCert.h @@ -226,6 +226,116 @@ static const unsigned char x509_crt_bundle[] = { }; unsigned int x509_crt_bundle_len = 2164; +#elif defined (ARDUINO_EDGE_CONTROL) + /* + * https://www.amazontrust.com/repository/AmazonRootCA1.pem + * https://www.amazontrust.com/repository/AmazonRootCA2.pem + * https://www.amazontrust.com/repository/AmazonRootCA3.pem + * https://www.amazontrust.com/repository/AmazonRootCA4.pem + * https://www.amazontrust.com/repository/SFSRootCAG2.pem + */ +static const char AIoTUPCert[] = +"-----BEGIN CERTIFICATE-----\n" +"MIIDQTCCAimgAwIBAgITBmyfz5m/jAo54vB4ikPmljZbyjANBgkqhkiG9w0BAQsF\n" +"ADA5MQswCQYDVQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6\n" +"b24gUm9vdCBDQSAxMB4XDTE1MDUyNjAwMDAwMFoXDTM4MDExNzAwMDAwMFowOTEL\n" +"MAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZMBcGA1UEAxMQQW1hem9uIFJv\n" +"b3QgQ0EgMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALJ4gHHKeNXj\n" +"ca9HgFB0fW7Y14h29Jlo91ghYPl0hAEvrAIthtOgQ3pOsqTQNroBvo3bSMgHFzZM\n" +"9O6II8c+6zf1tRn4SWiw3te5djgdYZ6k/oI2peVKVuRF4fn9tBb6dNqcmzU5L/qw\n" +"IFAGbHrQgLKm+a/sRxmPUDgH3KKHOVj4utWp+UhnMJbulHheb4mjUcAwhmahRWa6\n" +"VOujw5H5SNz/0egwLX0tdHA114gk957EWW67c4cX8jJGKLhD+rcdqsq08p8kDi1L\n" +"93FcXmn/6pUCyziKrlA4b9v7LWIbxcceVOF34GfID5yHI9Y/QCB/IIDEgEw+OyQm\n" +"jgSubJrIqg0CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC\n" +"AYYwHQYDVR0OBBYE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elnNXkoOrJupmHN5fLT0zLm4BwyydFy4x2+IoZCn9Kr5v2c69BoVYh63\n" +"n749sSmvZ6ES8lgQGVMDMBu4Gon2nL2XA46jCfMdiyHxtN/kHNGfZQIG6lzWE7OE\n" +"76KlXIx3KadowGuuQNKotOrN8I1LOJwZmhsoVLiJkO/KdYE+HvJkJMcYr07/R54H\n" +"9jVlpNMKVv/1F2Rs76giJUmTtt8AF9pYfl3uxRuw0dFfIRDH+fO6AgonB8Xx1sfT\n" +"4PsJYGw=\n" +"-----END CERTIFICATE-----\n" +"-----BEGIN CERTIFICATE-----\n" +"MIIBtjCCAVugAwIBAgITBmyf1XSXNmY/Owua2eiedgPySjAKBggqhkjOPQQDAjA5\n" +"MQswCQYDVQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24g\n" +"Um9vdCBDQSAzMB4XDTE1MDUyNjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkG\n" +"A1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZMBcGA1UEAxMQQW1hem9uIFJvb3Qg\n" +"Q0EgMzBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABCmXp8ZBf8ANm+gBG1bG8lKl\n" +"ui2yEujSLtf6ycXYqm0fc4E7O5hrOXwzpcVOho6AF2hiRVd9RFgdszflZwjrZt6j\n" +"QjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBSr\n" +"ttvXBp43rDCGB5Fwx5zEGbF4wDAKBggqhkjOPQQDAgNJADBGAiEA4IWSoxe3jfkr\n" +"BqWTrBqYaGFy+uGh0PsceGCmQ5nFuMQCIQCcAu/xlJyzlvnrxir4tiz+OpAUFteM\n" +"YyRIHN8wfdVoOw==\n" +"-----END CERTIFICATE-----\n" +"-----BEGIN CERTIFICATE-----\n" +"MIIB8jCCAXigAwIBAgITBmyf18G7EEwpQ+Vxe3ssyBrBDjAKBggqhkjOPQQDA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mV3HaIPzBSlCN\n" +"sSi6\n" +"-----END CERTIFICATE-----\n"; +#else #endif /* #ifdef ARDUINO_ARCH_ESP32 */ diff --git a/src/utility/watchdog/Watchdog.cpp b/src/utility/watchdog/Watchdog.cpp index 21cf7374c..aeb27abdc 100644 --- a/src/utility/watchdog/Watchdog.cpp +++ b/src/utility/watchdog/Watchdog.cpp @@ -34,8 +34,9 @@ #ifdef ARDUINO_ARCH_MBED # include -# define PORTENTA_H7_WATCHDOG_MAX_TIMEOUT_ms (32760) -# define NANO_RP2040_WATCHDOG_MAX_TIMEOUT_ms (8389) +# define PORTENTA_H7_WATCHDOG_MAX_TIMEOUT_ms (32760) +# define NANO_RP2040_WATCHDOG_MAX_TIMEOUT_ms (8389) +# define EDGE_CONTROL_WATCHDOG_MAX_TIMEOUT_ms (65536) #endif /* ARDUINO_ARCH_MBED */ #include @@ -97,6 +98,8 @@ static void mbed_watchdog_enable() cfg.timeout_ms = PORTENTA_H7_WATCHDOG_MAX_TIMEOUT_ms; #elif defined(ARDUINO_NANO_RP2040_CONNECT) cfg.timeout_ms = NANO_RP2040_WATCHDOG_MAX_TIMEOUT_ms; +#elif defined(ARDUINO_EDGE_CONTROL) + cfg.timeout_ms = EDGE_CONTROL_WATCHDOG_MAX_TIMEOUT_ms; #else # error "You need to define the maximum possible timeout for this architecture." #endif @@ -132,13 +135,7 @@ static void mbed_watchdog_enable_network_feed(const bool use_ethernet) void mbed_watchdog_trigger_reset() { watchdog_config_t cfg; -#if defined(BOARD_STM32H7) - cfg.timeout_ms = 1; -#elif defined(ARDUINO_NANO_RP2040_CONNECT) cfg.timeout_ms = 1; -#else -# error "You need to define the maximum possible timeout for this architecture." -#endif if (hal_watchdog_init(&cfg) == WATCHDOG_STATUS_OK) { is_watchdog_enabled = true;