trying to make telnetserver repo public

Dependents:   Telnet_server

Fork of NTPClient_NetServices by Donatien Garnier

Files at this revision

API Documentation at this revision

Comitter:
donatien
Date:
Fri Jun 18 09:21:27 2010 +0000
Parent:
0:de37f60b4d0f
Child:
2:88b9b7173dba
Commit message:

Changed in this revision

LPC1768/NTPClient.ar Show annotated file Show diff for this revision Revisions of this file
LPC1768/dbg/dbg.h Show annotated file Show diff for this revision Revisions of this file
LPC1768/services/ntp/NTPClient.h Show annotated file Show diff for this revision Revisions of this file
LPC2368/NTPClient.ar Show annotated file Show diff for this revision Revisions of this file
LPC2368/dbg/dbg.h Show annotated file Show diff for this revision Revisions of this file
LPC2368/services/ntp/NTPClient.h Show annotated file Show diff for this revision Revisions of this file
Binary file LPC1768/NTPClient.ar has changed
--- a/LPC1768/dbg/dbg.h	Fri Jun 11 16:27:11 2010 +0000
+++ b/LPC1768/dbg/dbg.h	Fri Jun 18 09:21:27 2010 +0000
@@ -39,21 +39,26 @@
 public:
 static void debug(const char* format, ...);
 static void release();
+static void breakPoint(const char* file, int line);
 private:
 
 };
 
 #undef DBG
 #undef DBG_END
+#undef BREAK
 #define DBG DebugStream::debug
 #define DBG_END DebugStream::release
+#define BREAK() DebugStream::breakPoint(__FILE__, __LINE__)
 #endif
 
 #else
 #undef DBG
 #undef DBG_END
+#undef BREAK
 #define DBG(...)
 #define DBG_END()
+#define BREAK()
 #endif
 
 #ifdef __LWIP_DEBUG
--- a/LPC1768/services/ntp/NTPClient.h	Fri Jun 11 16:27:11 2010 +0000
+++ b/LPC1768/services/ntp/NTPClient.h	Fri Jun 18 09:21:27 2010 +0000
@@ -38,7 +38,7 @@
   NTP_DNS //Could not resolve DNS Addr
 };
 
-class NTPClient
+class NTPClient : protected NetService
 {
 public:
   NTPClient();
@@ -66,10 +66,15 @@
     m_pCbMeth = (void (CDummy::*)(NTPResult)) pMethod;
   }
   
-  void init();
   void close();
   
+protected:
+  virtual void poll(); //Called by NetServices
+  
 private:
+  void init();
+  void open();
+  
   __packed struct NTPPacket //See RFC 4330 for Simple NTP
   {
     //WARN: We are in LE! Network is BE!
@@ -119,12 +124,14 @@
   
   NTPStep m_state;
   
+  NTPPacket m_pkt;
+  
   CDummy* m_pCbItem;
   void (CDummy::*m_pCbMeth)(NTPResult);
   
   void (*m_pCb)(NTPResult);
   
-  Timeout m_watchdog;
+  Timer m_watchdog;
   int m_timeout;
   
   bool m_closed;
Binary file LPC2368/NTPClient.ar has changed
--- a/LPC2368/dbg/dbg.h	Fri Jun 11 16:27:11 2010 +0000
+++ b/LPC2368/dbg/dbg.h	Fri Jun 18 09:21:27 2010 +0000
@@ -39,21 +39,26 @@
 public:
 static void debug(const char* format, ...);
 static void release();
+static void breakPoint(const char* file, int line);
 private:
 
 };
 
 #undef DBG
 #undef DBG_END
+#undef BREAK
 #define DBG DebugStream::debug
 #define DBG_END DebugStream::release
+#define BREAK() DebugStream::breakPoint(__FILE__, __LINE__)
 #endif
 
 #else
 #undef DBG
 #undef DBG_END
+#undef BREAK
 #define DBG(...)
 #define DBG_END()
+#define BREAK()
 #endif
 
 #ifdef __LWIP_DEBUG
--- a/LPC2368/services/ntp/NTPClient.h	Fri Jun 11 16:27:11 2010 +0000
+++ b/LPC2368/services/ntp/NTPClient.h	Fri Jun 18 09:21:27 2010 +0000
@@ -38,7 +38,7 @@
   NTP_DNS //Could not resolve DNS Addr
 };
 
-class NTPClient
+class NTPClient : protected NetService
 {
 public:
   NTPClient();
@@ -66,10 +66,15 @@
     m_pCbMeth = (void (CDummy::*)(NTPResult)) pMethod;
   }
   
-  void init();
   void close();
   
+protected:
+  virtual void poll(); //Called by NetServices
+  
 private:
+  void init();
+  void open();
+  
   __packed struct NTPPacket //See RFC 4330 for Simple NTP
   {
     //WARN: We are in LE! Network is BE!
@@ -119,12 +124,14 @@
   
   NTPStep m_state;
   
+  NTPPacket m_pkt;
+  
   CDummy* m_pCbItem;
   void (CDummy::*m_pCbMeth)(NTPResult);
   
   void (*m_pCb)(NTPResult);
   
-  Timeout m_watchdog;
+  Timer m_watchdog;
   int m_timeout;
   
   bool m_closed;