File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1919
2020#include < Arduino.h>
2121#include < IPAddress.h>
22+ #include < Print.h>
2223
2324IPAddress::IPAddress ()
2425{
@@ -72,3 +73,15 @@ size_t IPAddress::printTo(Print& p) const
7273 return n;
7374}
7475
76+ String IPAddress::toString ()
77+ {
78+ String str = String (_address.bytes [0 ]);
79+ str += " ." ;
80+ str += String (_address.bytes [1 ]);
81+ str += " ." ;
82+ str += String (_address.bytes [2 ]);
83+ str += " ." ;
84+ str += String (_address.bytes [3 ]);
85+ return str;
86+ }
87+
Original file line number Diff line number Diff line change 2121#define IPAddress_h
2222
2323#include < stdint.h>
24+ #include < WString.h>
2425#include < Printable.h>
2526
2627// A class to make it easier to handle and pass around IP addresses
@@ -60,6 +61,7 @@ class IPAddress : public Printable {
6061 IPAddress& operator =(uint32_t address);
6162
6263 virtual size_t printTo (Print& p) const ;
64+ String toString ();
6365
6466 friend class EthernetClass ;
6567 friend class UDP ;
You can’t perform that action at this time.
0 commit comments