Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of libMiMic by
cpp/NetConfig.h
- Committer:
- nyatla
- Date:
- 2013-04-24
- Revision:
- 14:4618692ec239
- Parent:
- 13:a71705c5e6fd
File content as of revision 14:4618692ec239:
#pragma once
////////////////////////////////////////////////////////////////////////////////
// NetConfig.h
////////////////////////////////////////////////////////////////////////////////
#include "NyLPC_net.h"
namespace MiMic
{
/**
* Network configulation class.
* The class is used for argument of NetConfig constructor.
*/
class NetConfig
{
public:
NyLPC_TcNetConfig_t _inst;
public:
/**
* The constructor.
* This function initializes instance by onchip configulation data.
* @param i_is_factory_default
* Factory default flag.
* <ul>
* <li>true - The function sets factory default setting.
* <li>false -The function sets onchip memory configulation (default)
* </ul>
*/
NetConfig(bool i_is_factory_default=false);
virtual ~NetConfig();
/**
* Set IPv4 ip address to instance.
*/
void setIpAddr(unsigned char ip4,unsigned char ip3,unsigned char ip2,unsigned char ip1);
/**
* Set IPv4 network mask value to instance.
*/
void setNetMask(unsigned char ip4,unsigned char ip3,unsigned char ip2,unsigned char ip1);
/**
* Set IPv4 default gateway address to instance.
*/
void setGateway(unsigned char ip4,unsigned char ip3,unsigned char ip2,unsigned char ip1);
/**
* Set ethernet mac address to instance.
*/
void setEmac(unsigned char ip6,unsigned char ip5,unsigned char ip4,unsigned char ip3,unsigned char ip2,unsigned char ip1);
/**
* Load configulation from text file.
* <p>File format example
* <pre>
* macaddr=00:00:00:00:00:00
* ipaddr=192.168.0.1
* netmask=255.255.255.0
* gateway=192.168.0.254
* </pre>
* <p>Keys
* <ul>
* <li>macaddr=[:macaddr:] - 48bit ethernet mac address that are separated by ':'</li>
* <li>ipaddr=[:ip:] - 32 bit IP address</li>
* <li>netmask=[:ip:]- 32 bit network mask value.</li>
* <li>gateway=[:ip:] - 32 bit default gateway address.</li>
* </ul>
* </p>
* Maximum line length is 31.
* Specified values are override on-chip setting value.
* If the same value appeared, then the last one is enabled.
* </p>
* @return
* true if file read. false is not read.
*/
bool loadFromFile(const char* i_file);
};
}
