SNTPClinet
Dependents: SSD1306_smart_watch smart_watch smart_watch
SNTPClient Class Reference
SNTPClient client Class. More...
#include <SNTPClient.h>
Public Member Functions | |
| SNTPClient (char *url, uint8_t time_zone) | |
| Constructor. | |
| bool | connect () |
| Connect to the SNTPClient url. | |
| bool | getTime (datetime *time) |
| Read a SNTPClient message. | |
| bool | close () |
| Close the SNTPClient connection. | |
Detailed Description
SNTPClient client Class.
Example (ethernet network):
#include "mbed.h" #include "EthernetInterface.h" #include "SNTPClient.h" int main() { EthernetInterface eth; eth.init(); //Use DHCP eth.connect(); printf("IP Address is %s\n\r", eth.getIPAddress()); SNTPClient ws("ws://sockets.mbed.org:443/ws/demo/rw"); ws.connect(); while (1) { int res = ws.send("SNTPClient Hello World!"); if (ws.read(recv)) { printf("rcv: %s\r\n", recv); } wait(0.1); } }
Definition at line 122 of file SNTPClient.h.
Constructor & Destructor Documentation
| SNTPClient | ( | char * | url, |
| uint8_t | time_zone | ||
| ) |
Member Function Documentation
| bool close | ( | ) |
Close the SNTPClient connection.
- Returns:
- true if the connection has been closed, false otherwise
Definition at line 85 of file SNTPClient.cpp.
| bool connect | ( | ) |
Connect to the SNTPClient url.
- Returns:
- true if the connection is established, false otherwise
Definition at line 28 of file SNTPClient.cpp.
| bool getTime | ( | datetime * | time ) |
Read a SNTPClient message.
- Parameters:
-
message pointer to the string to be read (null if drop frame)
- Returns:
- true if a SNTPClient frame has been read
Definition at line 62 of file SNTPClient.cpp.
Generated on Sat Jul 16 2022 19:00:30 by
1.7.2