NTP Client for the "old" NetServices libraries

Dependents:   NTPClientExample server1 server2 RFID2Twitter ... more

Revision:
4:7c3f1199256a
Parent:
1:1f436e56925f
--- a/LPC1768/services/ntp/NTPClient.h	Fri Jul 09 14:46:52 2010 +0000
+++ b/LPC1768/services/ntp/NTPClient.h	Thu Aug 05 15:16:59 2010 +0000
@@ -21,32 +21,69 @@
 THE SOFTWARE.
 */
 
+/** \file
+NTP Client header file
+*/
+
 #ifndef NTP_CLIENT_H
 #define NTP_CLIENT_H
 
-#include "if/net/net.h"
+#include "core/net.h"
+#include "core/netservice.h"
 #include "api/UDPSocket.h"
 #include "api/DNSRequest.h"
 #include "mbed.h"
 
+///NTP Client results
 enum NTPResult
 {
-  NTP_OK,
-  NTP_PROCESSING,
-  NTP_PRTCL, //Protocol error
-  NTP_TIMEOUT, //Connection timeout
-  NTP_DNS //Could not resolve DNS Addr
+  NTP_OK, ///<Success
+  NTP_PROCESSING, ///<Processing
+  NTP_PRTCL, ///<Protocol error
+  NTP_TIMEOUT, ///<Connection timeout
+  NTP_DNS ///<Could not resolve DNS hostname
 };
 
+///A NTP Client
+/**
+The NTP client is a simple UDP client that will update the mbed's RTC
+*/
 class NTPClient : protected NetService
 {
 public:
+  /**
+  Instantiates the NTP client
+  */
   NTPClient();
   virtual ~NTPClient();
   
   //High level setup functions
+  
+  ///Gets current time (blocking)
+  /**
+  Updates the time using the server host
+  Blocks until completion
+  @param host : NTP server
+  */
   NTPResult setTime(const Host& host); //Blocking
+  
+  ///Gets current time (non-blocking)
+  /**
+  Updates the time using the server host
+  The function returns immediately and calls the callback on completion or error
+  @param host : NTP server
+  @param pMethod : callback function
+  */
   NTPResult setTime(const Host& host, void (*pMethod)(NTPResult)); //Non blocking
+  
+  ///Gets current time (non-blocking)
+  /**
+  Updates the time
+  @param host : NTP server
+  @param pItem : instance of class on which to execute the callback method
+  @param pMethod : callback method
+  The function returns immediately and calls the callback on completion or error
+  */
   template<class T> 
   NTPResult setTime(const Host& host, T* pItem, void (T::*pMethod)(NTPResult)) //Non blocking
   {
@@ -55,9 +92,25 @@
     return NTP_PROCESSING;
   }
   
+  ///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
+  @param host : NTP server
+  */
   void doSetTime(const Host& host);
   
+  ///Setups the result callback
+  /**
+  @param pMethod : callback function
+  */
   void setOnResult( void (*pMethod)(NTPResult) );
+  
+  ///Setups the result callback
+  /**
+  @param pItem : instance of class on which to execute the callback method
+  @param pMethod : callback method
+  */
   class CDummy;
   template<class T> 
   void setOnResult( T* pItem, void (T::*pMethod)(NTPResult) )