From 39530b1972dfe24e1b68d312e2c1a171bb187ec2 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Sun, 2 Apr 2023 15:06:01 +0100 Subject: [PATCH 01/13] Make the class static. Add update interval --- nanoFramework.Networking.Sntp/Sntp.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/nanoFramework.Networking.Sntp/Sntp.cs b/nanoFramework.Networking.Sntp/Sntp.cs index 84ea55b..fa21c10 100644 --- a/nanoFramework.Networking.Sntp/Sntp.cs +++ b/nanoFramework.Networking.Sntp/Sntp.cs @@ -14,7 +14,7 @@ namespace nanoFramework.Networking /// For a list of some public NTP servers, see this link : /// http://support.ntp.org/bin/view/Servers/NTPPoolServers /// - public class Sntp + public static class Sntp { /// /// Starts the SNTP client. @@ -74,5 +74,18 @@ public static extern string Server2 [MethodImpl(MethodImplOptions.InternalCall)] set; } + + /// + /// Gets, sets the update interval of the SNTP client (in minutes). + /// + /// This method is specific to nanoFramework. + public static extern int UpdateInterval + { + [MethodImpl(MethodImplOptions.InternalCall)] + get; + + [MethodImpl(MethodImplOptions.InternalCall)] + set; + } } } From 99f97cddf524b1d256814a128ebf338f74a0a5f3 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Sun, 2 Apr 2023 17:35:15 +0100 Subject: [PATCH 02/13] Add startup delay and retry attempt properties. Improve documentation. --- nanoFramework.Networking.Sntp/Sntp.cs | 55 +++++++++++++++++++++------ 1 file changed, 44 insertions(+), 11 deletions(-) diff --git a/nanoFramework.Networking.Sntp/Sntp.cs b/nanoFramework.Networking.Sntp/Sntp.cs index fa21c10..a06b9e9 100644 --- a/nanoFramework.Networking.Sntp/Sntp.cs +++ b/nanoFramework.Networking.Sntp/Sntp.cs @@ -8,21 +8,21 @@ namespace nanoFramework.Networking { /// - /// Provides a set of methods that help developers to manage the SNTP (Simple Network Time Protocol) client on the target device. + /// Provides a set of methods that help manage the Simple Network Time Protocol (SNTP) client on the target device. /// /// - /// For a list of some public NTP servers, see this link : - /// http://support.ntp.org/bin/view/Servers/NTPPoolServers + /// This class is specific to nanoFramework. /// public static class Sntp { /// /// Starts the SNTP client. - /// After this method returns a periodic call to the set SNTP servers is performed providing time synchronization. - /// The system time is updated immediately after each successful execution. - /// The time synchronization occurs on a hourly rate. + /// After this method returns, a periodic call to the set SNTP servers is performed providing time synchronization. /// - /// This method is specific to nanoFramework. + /// + /// The system time is updated immediately after each successful execution. + /// By default the time synchronization occurs on a hourly rate. + /// [MethodImpl(MethodImplOptions.InternalCall)] public static extern void Start(); @@ -52,8 +52,13 @@ public static extern bool IsStarted } /// - /// Gets, sets the address of the SNTP server 1. + /// Gets, sets the host address of the main SNTP server. + /// By default it uses the server '0.pool.ntp.org' /// + /// + /// For a list of some public NTP servers, see this link : + /// http://support.ntp.org/bin/view/Servers/NTPPoolServers + /// public static extern string Server1 { [MethodImpl(MethodImplOptions.InternalCall)] @@ -64,8 +69,13 @@ public static extern string Server1 } /// - /// Gets, sets the address of the SNTP server 2. + /// Gets, sets the host address of the backup SNTP server. + /// By default it uses the server '1.pool.ntp.org' /// + /// + /// For a list of some public NTP servers, see this link : + /// http://support.ntp.org/bin/view/Servers/NTPPoolServers + /// public static extern string Server2 { [MethodImpl(MethodImplOptions.InternalCall)] @@ -76,9 +86,8 @@ public static extern string Server2 } /// - /// Gets, sets the update interval of the SNTP client (in minutes). + /// Gets or Sets the update interval of the SNTP client (in milliseconds) from when the service was started. /// - /// This method is specific to nanoFramework. public static extern int UpdateInterval { [MethodImpl(MethodImplOptions.InternalCall)] @@ -87,5 +96,29 @@ public static extern int UpdateInterval [MethodImpl(MethodImplOptions.InternalCall)] set; } + + /// + /// Gets or Sets the Startup delay of the SNTP client (in milliseconds) when the service is started. + /// + public static extern int StartupDelay + { + [MethodImpl(MethodImplOptions.InternalCall)] + get; + + [MethodImpl(MethodImplOptions.InternalCall)] + set; + } + + /// + /// Gets or Sets the amount of retry attempts of the SNTP client will use. + /// + public static extern short RetryAttempts + { + [MethodImpl(MethodImplOptions.InternalCall)] + get; + + [MethodImpl(MethodImplOptions.InternalCall)] + set; + } } } From dfcca65192ec9b9452846895c5cbb36a7d7ac3bf Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Sun, 2 Apr 2023 23:27:24 +0100 Subject: [PATCH 03/13] Comment out "new" functions so we dont break the existing lib. --- nanoFramework.Networking.Sntp/Sntp.cs | 60 +++++++++++++-------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/nanoFramework.Networking.Sntp/Sntp.cs b/nanoFramework.Networking.Sntp/Sntp.cs index a06b9e9..04d37a8 100644 --- a/nanoFramework.Networking.Sntp/Sntp.cs +++ b/nanoFramework.Networking.Sntp/Sntp.cs @@ -85,40 +85,40 @@ public static extern string Server2 set; } - /// - /// Gets or Sets the update interval of the SNTP client (in milliseconds) from when the service was started. - /// - public static extern int UpdateInterval - { - [MethodImpl(MethodImplOptions.InternalCall)] - get; + // /// + // /// Gets or Sets the update interval of the SNTP client (in milliseconds) from when the service was started. + // /// + // public static extern int UpdateInterval + // { + // [MethodImpl(MethodImplOptions.InternalCall)] + // get; - [MethodImpl(MethodImplOptions.InternalCall)] - set; - } + // [MethodImpl(MethodImplOptions.InternalCall)] + // set; + // } - /// - /// Gets or Sets the Startup delay of the SNTP client (in milliseconds) when the service is started. - /// - public static extern int StartupDelay - { - [MethodImpl(MethodImplOptions.InternalCall)] - get; + // /// + // /// Gets or Sets the Startup delay of the SNTP client (in milliseconds) when the service is started. + // /// + // public static extern int StartupDelay + // { + // [MethodImpl(MethodImplOptions.InternalCall)] + // get; - [MethodImpl(MethodImplOptions.InternalCall)] - set; - } + // [MethodImpl(MethodImplOptions.InternalCall)] + // set; + // } - /// - /// Gets or Sets the amount of retry attempts of the SNTP client will use. - /// - public static extern short RetryAttempts - { - [MethodImpl(MethodImplOptions.InternalCall)] - get; + // /// + // /// Gets or Sets the Retry period (in milliseconds) the SNTP client will use. + // /// + // public static extern short RetryPeriod + // { + // [MethodImpl(MethodImplOptions.InternalCall)] + // get; - [MethodImpl(MethodImplOptions.InternalCall)] - set; - } + // [MethodImpl(MethodImplOptions.InternalCall)] + // set; + // } } } From 04037a885a9863571f63734efd29d53e52efe023 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Tue, 4 Apr 2023 14:20:08 +0100 Subject: [PATCH 04/13] Update nanoFramework.Networking.Sntp/Sntp.cs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: José Simões --- nanoFramework.Networking.Sntp/Sntp.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nanoFramework.Networking.Sntp/Sntp.cs b/nanoFramework.Networking.Sntp/Sntp.cs index 04d37a8..fa587f2 100644 --- a/nanoFramework.Networking.Sntp/Sntp.cs +++ b/nanoFramework.Networking.Sntp/Sntp.cs @@ -11,7 +11,7 @@ namespace nanoFramework.Networking /// Provides a set of methods that help manage the Simple Network Time Protocol (SNTP) client on the target device. /// /// - /// This class is specific to nanoFramework. + /// This class is specific to .NET nanoFramework. /// public static class Sntp { From e89f4285b753d7bb120384243ec6c2f6caf6efd5 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Tue, 4 Apr 2023 14:20:16 +0100 Subject: [PATCH 05/13] Update nanoFramework.Networking.Sntp/Sntp.cs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: José Simões --- nanoFramework.Networking.Sntp/Sntp.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nanoFramework.Networking.Sntp/Sntp.cs b/nanoFramework.Networking.Sntp/Sntp.cs index fa587f2..a7a10d8 100644 --- a/nanoFramework.Networking.Sntp/Sntp.cs +++ b/nanoFramework.Networking.Sntp/Sntp.cs @@ -20,7 +20,9 @@ public static class Sntp /// After this method returns, a periodic call to the set SNTP servers is performed providing time synchronization. /// /// - /// The system time is updated immediately after each successful execution. + /// + /// The system time is updated immediately after each successful execution. + /// /// By default the time synchronization occurs on a hourly rate. /// [MethodImpl(MethodImplOptions.InternalCall)] From ad2da01fd909f63698e0b8357fff1226c367b582 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Tue, 4 Apr 2023 14:20:24 +0100 Subject: [PATCH 06/13] Update nanoFramework.Networking.Sntp/Sntp.cs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: José Simões --- nanoFramework.Networking.Sntp/Sntp.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nanoFramework.Networking.Sntp/Sntp.cs b/nanoFramework.Networking.Sntp/Sntp.cs index a7a10d8..6ce1965 100644 --- a/nanoFramework.Networking.Sntp/Sntp.cs +++ b/nanoFramework.Networking.Sntp/Sntp.cs @@ -23,7 +23,9 @@ public static class Sntp /// /// The system time is updated immediately after each successful execution. /// + /// /// By default the time synchronization occurs on a hourly rate. + /// /// [MethodImpl(MethodImplOptions.InternalCall)] public static extern void Start(); From 0276821ec0999caaeeb456cd374b0e7fe6130e4e Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Tue, 4 Apr 2023 14:20:35 +0100 Subject: [PATCH 07/13] Update nanoFramework.Networking.Sntp/Sntp.cs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: José Simões --- nanoFramework.Networking.Sntp/Sntp.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nanoFramework.Networking.Sntp/Sntp.cs b/nanoFramework.Networking.Sntp/Sntp.cs index 6ce1965..1dd2c5f 100644 --- a/nanoFramework.Networking.Sntp/Sntp.cs +++ b/nanoFramework.Networking.Sntp/Sntp.cs @@ -57,7 +57,7 @@ public static extern bool IsStarted /// /// Gets, sets the host address of the main SNTP server. - /// By default it uses the server '0.pool.ntp.org' + /// By default it uses the server '0.pool.ntp.org'. /// /// /// For a list of some public NTP servers, see this link : From 6554ed77a90f485755f195533c8c8b7d875973e4 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Tue, 4 Apr 2023 14:20:44 +0100 Subject: [PATCH 08/13] Update nanoFramework.Networking.Sntp/Sntp.cs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: José Simões --- nanoFramework.Networking.Sntp/Sntp.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nanoFramework.Networking.Sntp/Sntp.cs b/nanoFramework.Networking.Sntp/Sntp.cs index 1dd2c5f..2f1ef4a 100644 --- a/nanoFramework.Networking.Sntp/Sntp.cs +++ b/nanoFramework.Networking.Sntp/Sntp.cs @@ -60,7 +60,7 @@ public static extern bool IsStarted /// By default it uses the server '0.pool.ntp.org'. /// /// - /// For a list of some public NTP servers, see this link : + /// For a list of some public NTP servers, see this link: /// http://support.ntp.org/bin/view/Servers/NTPPoolServers /// public static extern string Server1 From 0dfd0c150495970c287a08496492a9f675c68708 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Tue, 4 Apr 2023 14:20:51 +0100 Subject: [PATCH 09/13] Update nanoFramework.Networking.Sntp/Sntp.cs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: José Simões --- nanoFramework.Networking.Sntp/Sntp.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nanoFramework.Networking.Sntp/Sntp.cs b/nanoFramework.Networking.Sntp/Sntp.cs index 2f1ef4a..3a64dd5 100644 --- a/nanoFramework.Networking.Sntp/Sntp.cs +++ b/nanoFramework.Networking.Sntp/Sntp.cs @@ -74,7 +74,7 @@ public static extern string Server1 /// /// Gets, sets the host address of the backup SNTP server. - /// By default it uses the server '1.pool.ntp.org' + /// By default it uses the server '1.pool.ntp.org'. /// /// /// For a list of some public NTP servers, see this link : From ae8daacb134eddf67757c73ef8b3e54bcdeaf614 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Tue, 4 Apr 2023 14:21:00 +0100 Subject: [PATCH 10/13] Update nanoFramework.Networking.Sntp/Sntp.cs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: José Simões --- nanoFramework.Networking.Sntp/Sntp.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nanoFramework.Networking.Sntp/Sntp.cs b/nanoFramework.Networking.Sntp/Sntp.cs index 3a64dd5..000c90a 100644 --- a/nanoFramework.Networking.Sntp/Sntp.cs +++ b/nanoFramework.Networking.Sntp/Sntp.cs @@ -77,7 +77,7 @@ public static extern string Server1 /// By default it uses the server '1.pool.ntp.org'. /// /// - /// For a list of some public NTP servers, see this link : + /// For a list of some public NTP servers, see this link: /// http://support.ntp.org/bin/view/Servers/NTPPoolServers /// public static extern string Server2 From 5651c494567fa3537aa4143ea1cc7b88f57e1f8b Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Tue, 4 Apr 2023 14:23:35 +0100 Subject: [PATCH 11/13] Resolve comment. --- nanoFramework.Networking.Sntp/Sntp.cs | 36 --------------------------- 1 file changed, 36 deletions(-) diff --git a/nanoFramework.Networking.Sntp/Sntp.cs b/nanoFramework.Networking.Sntp/Sntp.cs index 000c90a..49987f6 100644 --- a/nanoFramework.Networking.Sntp/Sntp.cs +++ b/nanoFramework.Networking.Sntp/Sntp.cs @@ -88,41 +88,5 @@ public static extern string Server2 [MethodImpl(MethodImplOptions.InternalCall)] set; } - - // /// - // /// Gets or Sets the update interval of the SNTP client (in milliseconds) from when the service was started. - // /// - // public static extern int UpdateInterval - // { - // [MethodImpl(MethodImplOptions.InternalCall)] - // get; - - // [MethodImpl(MethodImplOptions.InternalCall)] - // set; - // } - - // /// - // /// Gets or Sets the Startup delay of the SNTP client (in milliseconds) when the service is started. - // /// - // public static extern int StartupDelay - // { - // [MethodImpl(MethodImplOptions.InternalCall)] - // get; - - // [MethodImpl(MethodImplOptions.InternalCall)] - // set; - // } - - // /// - // /// Gets or Sets the Retry period (in milliseconds) the SNTP client will use. - // /// - // public static extern short RetryPeriod - // { - // [MethodImpl(MethodImplOptions.InternalCall)] - // get; - - // [MethodImpl(MethodImplOptions.InternalCall)] - // set; - // } } } From 6545b209e00ef531e30ad185a9dc4d07895bb6de Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Tue, 4 Apr 2023 14:33:17 +0100 Subject: [PATCH 12/13] Add new parameters UpdateInterval StartupDelay RetryPeriod --- nanoFramework.Networking.Sntp/Sntp.cs | 36 +++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/nanoFramework.Networking.Sntp/Sntp.cs b/nanoFramework.Networking.Sntp/Sntp.cs index 49987f6..0ae9de9 100644 --- a/nanoFramework.Networking.Sntp/Sntp.cs +++ b/nanoFramework.Networking.Sntp/Sntp.cs @@ -88,5 +88,41 @@ public static extern string Server2 [MethodImpl(MethodImplOptions.InternalCall)] set; } + + /// + /// Gets or Sets the update interval of the SNTP client (in milliseconds) from when the service was started. + /// + public static extern int UpdateInterval + { + [MethodImpl(MethodImplOptions.InternalCall)] + get; + + [MethodImpl(MethodImplOptions.InternalCall)] + set; + } + + /// + /// Gets or Sets the Startup delay of the SNTP client (in milliseconds) when the service is started. + /// + public static extern int StartupDelay + { + [MethodImpl(MethodImplOptions.InternalCall)] + get; + + [MethodImpl(MethodImplOptions.InternalCall)] + set; + } + + /// + /// Gets or Sets the Retry period (in milliseconds) the SNTP client will use. + /// + public static extern short RetryPeriod + { + [MethodImpl(MethodImplOptions.InternalCall)] + get; + + [MethodImpl(MethodImplOptions.InternalCall)] + set; + } } } From c7eae7f2fa444929429bc40d8a3db14c909cb460 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Tue, 4 Apr 2023 15:32:46 +0100 Subject: [PATCH 13/13] Fix type for retry period. Bump version. --- nanoFramework.Networking.Sntp/Properties/AssemblyInfo.cs | 2 +- nanoFramework.Networking.Sntp/Sntp.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/nanoFramework.Networking.Sntp/Properties/AssemblyInfo.cs b/nanoFramework.Networking.Sntp/Properties/AssemblyInfo.cs index 51fe3ae..6d32d6d 100644 --- a/nanoFramework.Networking.Sntp/Properties/AssemblyInfo.cs +++ b/nanoFramework.Networking.Sntp/Properties/AssemblyInfo.cs @@ -11,7 +11,7 @@ //////////////////////////////////////////////////////////////// // update this whenever the native assembly signature changes // -[assembly: AssemblyNativeVersion("100.0.4.4")] +[assembly: AssemblyNativeVersion("100.0.5.0")] //////////////////////////////////////////////////////////////// // Setting ComVisible to false makes the types in this assembly not visible diff --git a/nanoFramework.Networking.Sntp/Sntp.cs b/nanoFramework.Networking.Sntp/Sntp.cs index 0ae9de9..b13b777 100644 --- a/nanoFramework.Networking.Sntp/Sntp.cs +++ b/nanoFramework.Networking.Sntp/Sntp.cs @@ -116,7 +116,7 @@ public static extern int StartupDelay /// /// Gets or Sets the Retry period (in milliseconds) the SNTP client will use. /// - public static extern short RetryPeriod + public static extern int RetryPeriod { [MethodImpl(MethodImplOptions.InternalCall)] get;