diff --git a/Source/Meadow.Contracts/Hardware/INtpClient.cs b/Source/Meadow.Contracts/Hardware/INtpClient.cs index fe22365e..26f36233 100644 --- a/Source/Meadow.Contracts/Hardware/INtpClient.cs +++ b/Source/Meadow.Contracts/Hardware/INtpClient.cs @@ -1,31 +1,38 @@ using System; +using System.Threading.Tasks; -namespace Meadow +namespace Meadow; + +/// +/// Delegate representing a time changed event handler. +/// +/// The updated UTC time. +public delegate void TimeChangedEventHandler(DateTime utcTime); + +/// +/// Interface for a Network Time Protocol (NTP) client object. +/// +public interface INtpClient { /// - /// Delegate representing a time changed event handler. + /// Event called when the time is changed. /// - /// The updated UTC time. - public delegate void TimeChangedEventHandler(DateTime utcTime); + event TimeChangedEventHandler TimeChanged; /// - /// Interface for a Network Time Protocol (NTP) client object. + /// Gets a value indicating whether the NTP client is enabled. /// - public interface INtpClient - { - /// - /// Event called when the time is changed. - /// - event TimeChangedEventHandler TimeChanged; + bool Enabled { get; } - /// - /// Gets a value indicating whether the NTP client is enabled. - /// - bool Enabled { get; } + /// + /// Gets or sets the poll period for NTP synchronization. + /// + TimeSpan PollPeriod { get; set; } - /// - /// Gets or sets the poll period for NTP synchronization. - /// - TimeSpan PollPeriod { get; set; } - } + /// + /// Start an NTP time synchronization + /// + /// An optional NTP server address. If null, the device will use the platform-configured NTP server address + /// true if successful, otherwise false + Task Synchronize(string? ntpServer = null); } diff --git a/Source/Meadow.Contracts/ISleepAwarePeripheral.cs b/Source/Meadow.Contracts/ISleepAwarePeripheral.cs index 27bbb6a4..fdacc72e 100644 --- a/Source/Meadow.Contracts/ISleepAwarePeripheral.cs +++ b/Source/Meadow.Contracts/ISleepAwarePeripheral.cs @@ -12,13 +12,11 @@ public interface ISleepAwarePeripheral /// Called before the platform goes into Sleep state /// /// - /// public Task BeforeSleep(CancellationToken cancellationToken); /// /// Called after the platform returns to Wake state /// /// - /// public Task AfterWake(CancellationToken cancellationToken); } diff --git a/Source/Meadow.Contracts/Platform OS/IPlatformOS.Configuration.cs b/Source/Meadow.Contracts/Platform OS/IPlatformOS.Configuration.cs index 7f9070b9..19fb5150 100644 --- a/Source/Meadow.Contracts/Platform OS/IPlatformOS.Configuration.cs +++ b/Source/Meadow.Contracts/Platform OS/IPlatformOS.Configuration.cs @@ -229,5 +229,10 @@ public enum NetworkConnectionType /// /// This should be a semicolon list of pin names that will be reserved for OS use. public string ReservedPins { get; } + + /// + /// Gets a list of NTP servers used for time synchronization + /// + public string[] NtpServers { get; } } }