diff --git a/library.properties b/library.properties index a7836cd..425233c 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=AzureIoTUtility -version=1.5.0 +version=1.6.0 author=Microsoft maintainer=Microsoft sentence=Azure C shared utility library for Arduino. For the Arduino MKR1000 or Zero and WiFi Shield 101, Adafruit Huzzah and Feather M0, or SparkFun Thing. diff --git a/src/AzureIoTUtility.h b/src/AzureIoTUtility.h index 1e198e6..36d0e41 100644 --- a/src/AzureIoTUtility.h +++ b/src/AzureIoTUtility.h @@ -12,6 +12,6 @@ #include "azure_c_shared_utility/tlsio.h" #include "azure_c_shared_utility/xlogging.h" -#define AzureIoTUtilityVersion "1.5.0" +#define AzureIoTUtilityVersion "1.6.0" #endif //AZUREIOTUTILITY_H diff --git a/src/adapters/sslClient_arduino.cpp b/src/adapters/sslClient_arduino.cpp index d98e3ba..7cebc7a 100644 --- a/src/adapters/sslClient_arduino.cpp +++ b/src/adapters/sslClient_arduino.cpp @@ -15,6 +15,10 @@ static BearSSL::X509List cert(certificates); #include "WiFi.h" #include "WiFiClientSecure.h" static WiFiClientSecure sslClient; // for ESP32 +#elif WIO_TERMINAL +#include "WiFi.h" +#include "WiFiClientSecure.h" +static WiFiClientSecure sslClient; // for Wio Terminal variant of SAMD #else #include "WiFi101.h" #include "WiFiSSLClient.h" diff --git a/src/samd/NTPClientAz.cpp b/src/samd/NTPClientAz.cpp index c90c5ed..844f51e 100644 --- a/src/samd/NTPClientAz.cpp +++ b/src/samd/NTPClientAz.cpp @@ -58,7 +58,13 @@ void NTPClientAz::prepareRequest() void NTPClientAz::sendRequest(const char* host, int port) { _udp.beginPacket(host, port); + +#if WIO_TERMINAL + _udp.write((const uint8_t*)_buffer, NTP_PACKET_SIZE); +#else _udp.write(_buffer, NTP_PACKET_SIZE); +#endif + _udp.endPacket(); } diff --git a/src/samd/NTPClientAz.h b/src/samd/NTPClientAz.h index 050bcef..5fa331f 100644 --- a/src/samd/NTPClientAz.h +++ b/src/samd/NTPClientAz.h @@ -6,7 +6,12 @@ #ifndef NTPCLIENT_AZ_H #define NTPCLIENT_AZ_H +#if WIO_TERMINAL +#include +#else #include +#endif + #include #define NTP_PACKET_SIZE 48 diff --git a/src/samd/sample_init.cpp b/src/samd/sample_init.cpp index e3908de..45a0525 100644 --- a/src/samd/sample_init.cpp +++ b/src/samd/sample_init.cpp @@ -9,7 +9,16 @@ #include #include #include + +#if WIO_TERMINAL +#include +#include "WiFiClientSecure.h" +static WiFiClientSecure sslClient; // for Wio Terminal variant of SAMD +#else #include +static WiFiSSLClient sslClient; +#endif + #include #include "NTPClientAz.h" @@ -79,7 +88,15 @@ static void initTime() { delay(2000); } else { Serial.print("Fetched NTP epoch time is: "); + +#if WIO_TERMINAL + char buff[32]; + sprintf(buff, "%.f", difftime(epochTime, (time_t) 0)); + Serial.println(buff); +#else Serial.println(epochTime); +#endif + break; } } diff --git a/src/samd/time.cpp b/src/samd/time.cpp index a36df8d..a160c1a 100644 --- a/src/samd/time.cpp +++ b/src/samd/time.cpp @@ -1,7 +1,7 @@ // Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -#if defined(ARDUINO_ARCH_SAMD) +#if defined(ARDUINO_ARCH_SAMD) && !defined(WIO_TERMINAL) #include #include