You are viewing an older revision! See the latest version

NetServicesTribute

This documentation is for the NetServices tribute library.

This library is based on Donatien's source V1.04 (5 August 2010).

The following changes are made:

#pragma diag_remark directives are added to the following files to turn compiler warnings into remarks (which are not normally displayed)

  • EthernetNetIf.cpp
  • lwipNetUdpSocket.cpp
  • igmp.c
  • mem.c
  • RPCHandler.cpp
  • MySQLClient.cpp
  • NTPClient.cpp

EthernetNetIf.cpp / .h

  • turn off debug (uncomment line 34 in .cpp if required), IP address can be printed instead using getIp() method

IpAddr ethIp = eth.getIp();
printf("Connected ok, IP : %d.%d.%d.%d\n", ethIp[0], ethIp[1], ethIp[2], ethIp[3]);
  • optional hostname in DHCP constructor

// set hostname ready for DHCP
EthernetNetIf eth("mbedSE");

Import library

Public Member Functions

EthernetNetIf (const char *hostname=NULL)
Instantiates the Interface and register it against the stack, DHCP will be used.
EthernetNetIf ( IpAddr ip, IpAddr netmask, IpAddr gateway, IpAddr dns)
Instantiates the Interface and register it against the stack, DHCP will not be used.
EthernetErr setup (int timeout_ms=15000)
Brings the interface up.
const char * getHwAddr () const
Returns an array containing the hardware address.
const char * getHostname () const
Returns a pointer to the hostname set in the constructor.
IpAddr getIp () const
Returns the IP of the interface once it's connected.

mem.c

  • added MEM_POSITION to ram_heap

memp.c

  • added MEM_POSITION to memp
  • added MEM_POSITION to memp_bases
  • added MEM_POSITION to memp_memory

lwipopts.h

  • turned off SIO_FIFO_DEBUG and TCPDUMP_DEBUG
  • defined LWIP_NETIF_HOSTNAME in DHCP options section

Warning

MEM_POSITION becomes effective (due to mem.c and memp.c changes) and is defined as AHBSRAM1 (not AHBSRAM0)

lwipopts2.h

  • deleted (not used)

netCfg.h

  • disabled all options apart from NET_ETH and NET_LWIP_STACK

NTPClient.cpp

  • modified code (line 150) so that time is adjusted to limit offset range only if necessary (otherwise unconditional adjustment to end of July 2010 is undesirable since NTP could subsequently fail)

if ((int)time(NULL) < 1280000000) set_time( 1280000000 ); //End of July 2010... just there to limit offset range

All wikipages