Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
NTPClient Class Reference
A NTP Client. More...
#include <NTPClient.h>
Inherits NetService.
Public Member Functions | |
NTPClient () | |
Instantiates the NTP client. | |
NTPResult | setTime (const Host &host) |
Gets current time (blocking) | |
NTPResult | setTime (const Host &host, void(*pMethod)(NTPResult)) |
Gets current time (non-blocking) | |
template<class T > | |
NTPResult | setTime (const Host &host, T *pItem, void(T::*pMethod)(NTPResult)) |
Gets current time (non-blocking) | |
void | doSetTime (const Host &host) |
Gets current time (non-blocking) | |
void | setOnResult (void(*pMethod)(NTPResult)) |
Setups the result callback. | |
void | close () |
This flags the service as to be destructed if owned by the pool. | |
Protected Member Functions | |
virtual void | poll () |
This method can be inherited so that it is called on each Net::poll() call. |
Detailed Description
A NTP Client.
The NTP client is a simple UDP client that will update the mbed's RTC
Definition at line 51 of file NTPClient.h.
Constructor & Destructor Documentation
NTPClient | ( | ) |
Instantiates the NTP client.
Definition at line 45 of file NTPClient.cpp.
Member Function Documentation
void close | ( | ) |
This flags the service as to be destructed if owned by the pool.
Reimplemented from NetService.
Definition at line 107 of file NTPClient.cpp.
void doSetTime | ( | const Host & | host ) |
Gets current time (non-blocking)
Updates the time using the server host The function returns immediately and calls the previously set callback on completion or error
- Parameters:
-
host : NTP server
Definition at line 81 of file NTPClient.cpp.
void poll | ( | ) | [protected, virtual] |
This method can be inherited so that it is called on each Net::poll() call.
Reimplemented from NetService.
Definition at line 124 of file NTPClient.cpp.
void setOnResult | ( | void(*)(NTPResult) | pMethod ) |
Setups the result callback.
- Parameters:
-
pMethod : callback function
Definition at line 102 of file NTPClient.cpp.
Gets current time (non-blocking)
Updates the time using the server host The function returns immediately and calls the callback on completion or error
- Parameters:
-
host : NTP server pMethod : callback function
Definition at line 64 of file NTPClient.cpp.
Gets current time (blocking)
Updates the time using the server host Blocks until completion
- Parameters:
-
host : NTP server
Definition at line 58 of file NTPClient.cpp.
Gets current time (non-blocking)
Updates the time
- Parameters:
-
host : NTP server pItem : instance of class on which to execute the callback method pMethod : callback method The function returns immediately and calls the callback on completion or error
Definition at line 88 of file NTPClient.h.
Generated on Tue Jul 12 2022 15:26:31 by
