File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -42,3 +42,13 @@ bool IPAddress::operator==(const uint8_t* addr)
42
42
return memcmp (addr, _address, sizeof (_address)) == 0 ;
43
43
}
44
44
45
+ void IPAddress::printTo (Print& p) const
46
+ {
47
+ for (int i =0 ; i < 3 ; i++)
48
+ {
49
+ p.print (_address[i], DEC);
50
+ p.print (' .' );
51
+ }
52
+ p.print (_address[3 ], DEC);
53
+ }
54
+
Original file line number Diff line number Diff line change 26
26
#ifndef IPAddress_h
27
27
#define IPAddress_h
28
28
29
+ #include < Printable.h>
30
+
29
31
// A class to make it easier to handle and pass around IP addresses
30
32
31
- class IPAddress {
33
+ class IPAddress : public Printable {
32
34
private:
33
35
uint8_t _address[4 ]; // IPv4 address
34
36
// Access the raw byte array containing the address. Because this returns a pointer
@@ -58,6 +60,8 @@ class IPAddress {
58
60
IPAddress& operator =(const uint8_t *address);
59
61
IPAddress& operator =(uint32_t address);
60
62
63
+ virtual void printTo (Print& p) const ;
64
+
61
65
friend class EthernetClass ;
62
66
friend class UDP ;
63
67
friend class Client ;
You can’t perform that action at this time.
0 commit comments