From 20bcfe4c6a1aba0ee293d0c3c49fc65d68b76125 Mon Sep 17 00:00:00 2001 From: Sandeep Mistry Date: Tue, 12 Apr 2016 10:45:21 -0400 Subject: [PATCH] Add end() API --- NTPClient.cpp | 4 ++++ NTPClient.h | 5 +++++ keywords.txt | 1 + 3 files changed, 10 insertions(+) diff --git a/NTPClient.cpp b/NTPClient.cpp index f3f73e0..09fe04b 100644 --- a/NTPClient.cpp +++ b/NTPClient.cpp @@ -128,6 +128,10 @@ String NTPClient::getFormattedTime() { return hoursStr + ":" + minuteStr + ":" + secondStr; } +void NTPClient::end() { + this->_udp->stop(); +} + void NTPClient::sendNTPPacket() { // set all bytes in the buffer to 0 memset(this->_packetBuffer, 0, NTP_PACKET_SIZE); diff --git a/NTPClient.h b/NTPClient.h index 2e1b3ca..8ac4077 100644 --- a/NTPClient.h +++ b/NTPClient.h @@ -67,4 +67,9 @@ class NTPClient { * @return time as raw seconds */ unsigned long getRawTime(); + + /** + * Stops the underlying UDP client + */ + void end(); }; diff --git a/keywords.txt b/keywords.txt index d64a538..5570658 100644 --- a/keywords.txt +++ b/keywords.txt @@ -9,6 +9,7 @@ NTPClient KEYWORD1 ####################################### begin KEYWORD2 +end KEYWORD2 update KEYWORD2 forceUpdate KEYWORD2 getDay KEYWORD2