This is Webservice SDK for mbed. LPCXpresso1769/LPC1768/FRDM-K64F/LPC4088

Dependents:   MbedFileServer_1768MiniDK2 RedWireBridge IssueDebug_gcc MiMicRemoteMCU-for-Mbed ... more

Embed: (wiki syntax)

« Back to documentation index

NetConfig Class Reference

NetConfig Class Reference

Network configulation class. More...

#include <NetConfig.h>

Public Member Functions

NyLPC_TcNetConfig_trefBaseInstance ()
 wrapped base LPC class.
struct NyLPC_TUPnPDevDescDevice * refUPnPDevDesc () const
 internal UPnP description
struct NyLPC_TDnsRecordrefMdnsRecord () const
 internal dns record
unsigned short getHttpPort () const
 Thi sfunction returnes recommended HTTP service port number.
 NetConfig (bool i_is_factory_default=false)
 The constructor.
void setIpAddr (unsigned char ip4, unsigned char ip3, unsigned char ip2, unsigned char ip1)
 Set IPv4 ip address to instance.
void setNetMask (unsigned char ip4, unsigned char ip3, unsigned char ip2, unsigned char ip1)
 Set IPv4 network mask value to instance.
void setGateway (unsigned char ip4, unsigned char ip3, unsigned char ip2, unsigned char ip1)
 Set IPv4 default gateway address to instance.
void setZeroconf (bool v)
 Set Zero configuration enable flag.
void setSrvHttpPort (unsigned short port)
 This function set a recommended HTTP port number to the application.
void setSrvMdns (bool i_enable)
 Set mDNS operation flag.
void setSrvUPnP (bool i_enable)
 Set UPnP operation flag.
void setHostName (const char *i_hostname)
 This function sets host name for mDNS.
void setHostName (const char *i_hostname, int len)
 This function sets host name for mDNS.
void setEmac (unsigned char ip6, unsigned char ip5, unsigned char ip4, unsigned char ip3, unsigned char ip2, unsigned char ip1)
 Set ethernet mac address to instance.
void setFriendlyName (const char *i_name)
 Set FrendlyName to instance.
void setUPnPUdn (unsigned long i_time_l, unsigned short i_time_m, unsigned short i_time_h, unsigned short i_sq)
 Set Time base UDN value.
void setCustomUPnPDescription (const struct NyLPC_TUPnPDevDescDevice *i_ref_description)
 This function sets a custom UPnP device description to instance.
void setCustomMdnsRecord (const struct NyLPC_TDnsRecord *i_ref_record)
 This function sets a custom mDNS record to instance.
bool loadFromFile (const char *i_file)
 Load configulation from text file.

Detailed Description

Network configulation class.

The class is used by Net constructor.

Definition at line 17 of file NetConfig.h.


Constructor & Destructor Documentation

NetConfig ( bool  i_is_factory_default = false )

The constructor.

This function initializes instance by onchip configulation data.

Parameters:
i_is_factory_defaultFactory default flag.

  • true - The function sets factory default setting.
  • false -The function sets onchip memory configulation (default)

Definition at line 74 of file NetConfig.cpp.


Member Function Documentation

unsigned short getHttpPort (  ) const

Thi sfunction returnes recommended HTTP service port number.

Definition at line 38 of file NetConfig.h.

bool loadFromFile ( const char *  i_file )

Load configulation from text file.

File format example

 macaddr=00:00:00:00:00:00
 host=MiMic01
 ipaddr=192.168.0.1
 netmask=255.255.255.0
 gateway=192.168.0.254
 srv_http_port=80
 srv_mdns=yes
 

Keys

  • macaddr=[:macaddr:] - 48bit ethernet mac address that are separated by ':'
  • ipaddr=[:ip:] || AUTO
    • 32 bit IP address or auto detection. AUTO will be to try DHCP and AUTOIP.
  • netmask=[:ip:]- 32 bit network mask value.
  • gateway=[:ip:] - 32 bit default gateway address.
  • srv_http_port=[:UINT16:] - 16bit http service port number(not ZERO)
  • srv_mdns=[yes|no] - mDNS service flag.

Default setting

  • macaddr=02:01:02:03:04:05 (In case of mbed it is preset value.)
  • host=MiMic020102030405
  • ipaddr =192.168.0.39
  • netmask=255.255.255.0
  • gateway=192.168.0.254
  • srv_http_port=80
  • srv_mdns=yes

Maximum line length is 31. Specified values are override on-chip setting value. If the same value appeared, then the last one is enabled. In case of ipaddr=AUTO, gateway and netmask are ignored.

Returns:
true if file read. false is not read.

Definition at line 291 of file NetConfig.cpp.

NyLPC_TcNetConfig_t* refBaseInstance (  )

wrapped base LPC class.

Definition at line 32 of file NetConfig.h.

struct NyLPC_TDnsRecord * refMdnsRecord (  ) const [read]

internal dns record

Definition at line 145 of file NetConfig.cpp.

struct NyLPC_TUPnPDevDescDevice * refUPnPDevDesc (  ) const [read]

internal UPnP description

Definition at line 140 of file NetConfig.cpp.

void setCustomMdnsRecord ( const struct NyLPC_TDnsRecord i_ref_record )

This function sets a custom mDNS record to instance.

All mDNS record will be overwritten if set it.

Parameters:
i_ref_recordPerfect DNS record structure.

Definition at line 286 of file NetConfig.cpp.

void setCustomUPnPDescription ( const struct NyLPC_TUPnPDevDescDevice *  i_ref_description )

This function sets a custom UPnP device description to instance.

All UPnP description will be overwritten if set it.

Parameters:
i_ref_descriptionPerfect description structure.

Definition at line 282 of file NetConfig.cpp.

void setEmac ( unsigned char  ip6,
unsigned char  ip5,
unsigned char  ip4,
unsigned char  ip3,
unsigned char  ip2,
unsigned char  ip1 
)

Set ethernet mac address to instance.

Definition at line 195 of file NetConfig.cpp.

void setFriendlyName ( const char *  i_name )

Set FrendlyName to instance.

This value has effect to the mDNS name and UPnP frendlyName.

Definition at line 240 of file NetConfig.cpp.

void setGateway ( unsigned char  ip4,
unsigned char  ip3,
unsigned char  ip2,
unsigned char  ip1 
)

Set IPv4 default gateway address to instance.

Definition at line 183 of file NetConfig.cpp.

void setHostName ( const char *  i_hostname,
int  len 
)

This function sets host name for mDNS.

This is effective for mDNS a record.

Parameters:
i_hostnamehost name.
i_lenlength of host name. maximum length is NyLPC_TcNetConfig_HOSTNAME_LEN-1

Definition at line 229 of file NetConfig.cpp.

void setHostName ( const char *  i_hostname )

This function sets host name for mDNS.

This value has effect to the mDNS a record.

Parameters:
i_hostnamehost name. NULL terminated string.

Definition at line 225 of file NetConfig.cpp.

void setIpAddr ( unsigned char  ip4,
unsigned char  ip3,
unsigned char  ip2,
unsigned char  ip1 
)

Set IPv4 ip address to instance.

Definition at line 158 of file NetConfig.cpp.

void setNetMask ( unsigned char  ip4,
unsigned char  ip3,
unsigned char  ip2,
unsigned char  ip1 
)

Set IPv4 network mask value to instance.

Definition at line 171 of file NetConfig.cpp.

void setSrvHttpPort ( unsigned short  port )

This function set a recommended HTTP port number to the application.

Definition at line 204 of file NetConfig.cpp.

void setSrvMdns ( bool  i_enable )

Set mDNS operation flag.

This function recommends to the application to provide mDNS service to network.

Definition at line 208 of file NetConfig.cpp.

void setSrvUPnP ( bool  i_enable )

Set UPnP operation flag.

This function recommends to the application to provide UPnP service to network.

Definition at line 216 of file NetConfig.cpp.

void setUPnPUdn ( unsigned long  i_time_l,
unsigned short  i_time_m,
unsigned short  i_time_h,
unsigned short  i_sq 
)

Set Time base UDN value.

UDN is expressed as follows. The value of the UDN, must be different for each device. [i_time_l]-[i_time_m]-[i_time_h|0x80]-[i_sq&0x3F|0x80]-[MAC ADDRESS]

Definition at line 260 of file NetConfig.cpp.

void setZeroconf ( bool  v )

Set Zero configuration enable flag.

Parameters:
vTrue, Zero configuration mode. The mimic will try DHCP and AutoIP configuration. ipaddress,netmask,gateway are ignored. False, Manual mode. The mimic will set ip address from on chip data.

Definition at line 151 of file NetConfig.cpp.