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.
IPAddress.cpp
00001 #include "IPAddress.h" 00002 00003 using namespace SmartLabMuRata; 00004 IPAddress::IPAddress() 00005 {} 00006 00007 IPAddress::IPAddress(const char * ipString) 00008 { 00009 if (ipString == NULL) 00010 return; 00011 00012 int size = strlen(ipString) + 1; 00013 char temp[size]; 00014 00015 memcpy(temp, ipString, size); 00016 00017 int i = 0; 00018 char * pch = strtok (temp, "."); 00019 while (pch != NULL) { 00020 address[i++] = atoi(pch); 00021 pch = strtok (NULL, "."); 00022 00023 if (i >= 4) 00024 break; 00025 } 00026 } 00027 00028 void IPAddress::SetValue(const char * data, int offset) 00029 { 00030 memcpy(address, data + offset, 4); 00031 } 00032 00033 const char * IPAddress::GetValue() 00034 { 00035 return address; 00036 } 00037 int IPAddress::GetValueLength() 00038 { 00039 return 4; 00040 } 00041 00042 const char * IPAddress::ToString() 00043 { 00044 sprintf (ip, "%d.%d.%d.%d", address[0], address[1], address[2], address[3]); 00045 return ip; 00046 }
Generated on Fri Jul 15 2022 01:02:11 by
1.7.2