This commit is contained in:
Dane Walton 2021-05-06 13:20:08 -07:00
Родитель 14c7ba8b71
Коммит 38443d8c60
7 изменённых файлов: 35 добавлений и 3 удалений

Просмотреть файл

@ -1,5 +1,5 @@
name=AzureIoTUtility name=AzureIoTUtility
version=1.5.0 version=1.6.0
author=Microsoft author=Microsoft
maintainer=Microsoft <iotcert@microsoft.com> maintainer=Microsoft <iotcert@microsoft.com>
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. 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.

Просмотреть файл

@ -12,6 +12,6 @@
#include "azure_c_shared_utility/tlsio.h" #include "azure_c_shared_utility/tlsio.h"
#include "azure_c_shared_utility/xlogging.h" #include "azure_c_shared_utility/xlogging.h"
#define AzureIoTUtilityVersion "1.5.0" #define AzureIoTUtilityVersion "1.6.0"
#endif //AZUREIOTUTILITY_H #endif //AZUREIOTUTILITY_H

Просмотреть файл

@ -15,6 +15,10 @@ static BearSSL::X509List cert(certificates);
#include "WiFi.h" #include "WiFi.h"
#include "WiFiClientSecure.h" #include "WiFiClientSecure.h"
static WiFiClientSecure sslClient; // for ESP32 static WiFiClientSecure sslClient; // for ESP32
#elif WIO_TERMINAL
#include "WiFi.h"
#include "WiFiClientSecure.h"
static WiFiClientSecure sslClient; // for Wio Terminal variant of SAMD
#else #else
#include "WiFi101.h" #include "WiFi101.h"
#include "WiFiSSLClient.h" #include "WiFiSSLClient.h"

Просмотреть файл

@ -58,7 +58,13 @@ void NTPClientAz::prepareRequest()
void NTPClientAz::sendRequest(const char* host, int port) void NTPClientAz::sendRequest(const char* host, int port)
{ {
_udp.beginPacket(host, port); _udp.beginPacket(host, port);
#if WIO_TERMINAL
_udp.write((const uint8_t*)_buffer, NTP_PACKET_SIZE);
#else
_udp.write(_buffer, NTP_PACKET_SIZE); _udp.write(_buffer, NTP_PACKET_SIZE);
#endif
_udp.endPacket(); _udp.endPacket();
} }

Просмотреть файл

@ -6,7 +6,12 @@
#ifndef NTPCLIENT_AZ_H #ifndef NTPCLIENT_AZ_H
#define NTPCLIENT_AZ_H #define NTPCLIENT_AZ_H
#if WIO_TERMINAL
#include <WiFi.h>
#else
#include <WiFi101.h> #include <WiFi101.h>
#endif
#include <WiFiUdp.h> #include <WiFiUdp.h>
#define NTP_PACKET_SIZE 48 #define NTP_PACKET_SIZE 48

Просмотреть файл

@ -9,7 +9,16 @@
#include <time.h> #include <time.h>
#include <sys/time.h> #include <sys/time.h>
#include <SPI.h> #include <SPI.h>
#if WIO_TERMINAL
#include <WiFi.h>
#include "WiFiClientSecure.h"
static WiFiClientSecure sslClient; // for Wio Terminal variant of SAMD
#else
#include <WiFi101.h> #include <WiFi101.h>
static WiFiSSLClient sslClient;
#endif
#include <WiFiUdp.h> #include <WiFiUdp.h>
#include "NTPClientAz.h" #include "NTPClientAz.h"
@ -79,7 +88,15 @@ static void initTime() {
delay(2000); delay(2000);
} else { } else {
Serial.print("Fetched NTP epoch time is: "); 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); Serial.println(epochTime);
#endif
break; break;
} }
} }

Просмотреть файл

@ -1,7 +1,7 @@
// Copyright (c) Microsoft. All rights reserved. // Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information. // 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 <time.h> #include <time.h>
#include <sys/time.h> #include <sys/time.h>