EthernetNetIf Compatibility.

Dependents:   XBeeWiFi_SPI_example

Fork of NetServicesSource by Donatien Garnier

Revision:
2:a4f97773c90f
Parent:
0:632c9925f013
Child:
3:95e0bc00a1bb
diff -r abb442332fa8 -r a4f97773c90f if/lwip/LwipNetIf.cpp
--- a/if/lwip/LwipNetIf.cpp	Mon Jun 14 10:33:54 2010 +0000
+++ b/if/lwip/LwipNetIf.cpp	Fri Jun 18 09:22:54 2010 +0000
@@ -31,16 +31,15 @@
 
 //See doc/rawapi.txt for details
 
-LwipNetIf::LwipNetIf() : NetIf(), m_tcpTicker(), m_dnsTicker(), m_init(false)
+LwipNetIf::LwipNetIf() : NetIf(), m_tcpTimer(), m_init(false)
 {  
-
+  m_tcpTimer.start();
 }
 
 
 LwipNetIf::~LwipNetIf()
 {
-  m_tcpTicker.detach();
-  m_dnsTicker.detach();
+
 }
 
 void LwipNetIf::init()
@@ -51,8 +50,9 @@
   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_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 +77,11 @@
 
 void LwipNetIf::poll()
 {
+  if(m_init && m_tcpTimer.read_ms()>=TCP_TMR_INTERVAL)
+  {
+    m_tcpTimer.reset();
+    tcp_tmr(); //Poll LwIP
+  }
   //Do some stuff...
 }