Add new helper to convert IP to str

Add new helper to convert IP to str
This commit is contained in:
luc lebosse 2015-04-20 20:35:58 +08:00
parent 3db280e18e
commit b71cab9830
2 changed files with 9 additions and 0 deletions

View File

@ -69,6 +69,14 @@ char * WIFI_CONFIG::mac2str(uint8_t mac [WL_MAC_ADDR_LENGTH])
return macstr;
}
//just simple helper to convert IP address to string
char * WIFI_CONFIG::ip2str(IPAddress Ip )
{
static char ipstr [16];
if (0>sprintf(ipstr, "%i.%i.%i.%i",Ip[0],Ip[1],Ip[2],Ip[3])) strcpy (ipstr, "0.0.0.0");
return ipstr;
}
//Read configuration settings and apply them
bool WIFI_CONFIG::Setup()
{

View File

@ -29,6 +29,7 @@ class WIFI_CONFIG
public:
bool Setup();
char * mac2str(uint8_t mac [WL_MAC_ADDR_LENGTH]);
char * ip2str(IPAddress Ip );
void configAP(IPAddress local_ip, IPAddress gateway, IPAddress subnet);
private:
byte split_ip (char * ptr,byte * part);