The extracted NTP client from Segundos NetServices library, for use with the [[http://mbed.org/users/hlipka/libraries/NetServicesMin|NetServicesMin]] library. The only fixed bug is the memory leak / OOM problem. Needs the [[http://mbed.org/users/hlipka/libraries/DNSResolver|DNSResolver]] library as well.
Dependents: SPIVFDclock LPC1768_AppBoard_Internet_LCD_Clock
Diff: NTPClient.h
- Revision:
- 1:63ded11b8fa2
- Parent:
- 0:ebea15f18f84
--- a/NTPClient.h Mon Jan 10 22:38:49 2011 +0000 +++ b/NTPClient.h Mon Jan 24 23:07:27 2011 +0000 @@ -31,7 +31,6 @@ #include "core/net.h" #include "core/netservice.h" #include "api/UDPSocket.h" -#include "api/DNSRequest.h" #include "mbed.h" ///NTP Client results @@ -108,13 +107,14 @@ void resetTimeout(); void onTimeout(); //Connection has timed out - void onDNSReply(DNSReply r); void onUDPSocketEvent(UDPSocketEvent e); void onResult(NTPResult r); //Called when exchange completed or on failure NTPResult blockingProcess(); //Called in blocking mode, calls Net::poll() until return code is available - UDPSocket* m_pUDPSocket; + UDPSocket* _pUDPSocket; + + enum NTPStep { @@ -122,20 +122,18 @@ NTP_PONG }; - NTPStep m_state; + NTPStep _state; - NTPPacket m_pkt; - - Timer *m_watchdog; - int m_timeout; + NTPPacket _pkt; - bool m_closed; - - Host m_host; + Timer *_watchdog; + int _timeout; - DNSRequest* m_pDnsReq; + bool _closed; - NTPResult m_blockingResult; //Result if blocking mode + Host _host; + + NTPResult _blockingResult; //Result if blocking mode };