First step: AutoIP compiled in and working

Dependencies:   mbed

Revision:
1:4218cacaf696
Parent:
0:55a05330f8cc
--- a/if/lwip/LwipNetIf.cpp	Fri Jun 18 09:11:35 2010 +0000
+++ b/if/lwip/LwipNetIf.cpp	Fri Jun 18 15:54:21 2010 +0000
@@ -31,7 +31,7 @@
 
 //See doc/rawapi.txt for details
 
-LwipNetIf::LwipNetIf() : NetIf(), m_tcpTicker(), m_dnsTicker(), m_init(false)
+LwipNetIf::LwipNetIf() : NetIf(), m_tcpTimer(), m_dnsTimer(), m_init(false)
 {  
 
 }
@@ -39,8 +39,7 @@
 
 LwipNetIf::~LwipNetIf()
 {
-  m_tcpTicker.detach();
-  m_dnsTicker.detach();
+
 }
 
 void LwipNetIf::init()
@@ -51,8 +50,10 @@
   lwip_init(); //init lwip, see init.c for details
   
   //Setup Clocks
-  m_tcpTicker.attach_us( tcp_tmr, TCP_TMR_INTERVAL * 1000 ); //TCP_TMR_INTERVAL = 250 ms in tcp_impl.h
-  m_dnsTicker.attach_us( dns_tmr, DNS_TMR_INTERVAL * 1000 ); //DNS_TMR_INTERVAL = 1000 ms in dns.h
+  m_tcpTimer.start();
+  m_dnsTimer.start();
+  //m_tcpTicker.attach_us( tcp_tmr, TCP_TMR_INTERVAL * 1000 ); //TCP_TMR_INTERVAL = 250 ms in tcp_impl.h
+  //m_dnsTicker.attach_us( dns_tmr, DNS_TMR_INTERVAL * 1000 ); //DNS_TMR_INTERVAL = 1000 ms in dns.h
 }
 
 NetTcpSocket* LwipNetIf::tcpSocket()  //Create a new tcp socket
@@ -77,6 +78,16 @@
 
 void LwipNetIf::poll()
 {
+  if(m_init && m_tcpTimer.read_ms() >= TCP_TMR_INTERVAL)
+  {
+    m_tcpTimer.reset();
+    tcp_tmr(); //Poll LwIP
+  }
+  if(m_init && m_dnsTimer.read_ms() >= DNS_TMR_INTERVAL)
+  {
+    m_dnsTimer.reset();
+    dns_tmr();
+  }
   //Do some stuff...
 }