File tree 1 file changed +32
-1
lines changed
1 file changed +32
-1
lines changed Original file line number Diff line number Diff line change 18
18
#ifndef MacAddress8_h
19
19
#define MacAddress8_h
20
20
21
+ #include < stdint.h>
21
22
#include < WString.h>
23
+ #include < Printable.h>
22
24
23
25
// A class to make it easier to handle and pass around 8-byte EUI-64(used for IEEE 802.15.4) addresses. See <esp_mac.h>.
24
- class MacAddress8 {
26
+ class MacAddress8 : public Printable {
25
27
private:
26
28
union {
27
29
uint8_t bytes[8 ];
@@ -45,6 +47,35 @@ class MacAddress8 {
45
47
MacAddress8& operator =(uint64_t macval);
46
48
bool operator ==(const uint8_t *mac) const ;
47
49
bool operator ==(const MacAddress8& mac2) const ;
50
+
51
+ // Overloaded index operator to allow getting and setting individual octets of the address
52
+ uint8_t operator [](int index) const
53
+ {
54
+ return _mac.bytes [index ];
55
+ }
56
+ uint8_t & operator [](int index)
57
+ {
58
+ return _mac.bytes [index ];
59
+ }
60
+
61
+ operator const uint8_t *() const
62
+ {
63
+ return _mac.bytes ;
64
+ }
65
+ operator const uint64_t *() const
66
+ {
67
+ return &_mac.val ;
68
+ }
69
+
70
+ virtual size_t printTo (Print& p) const ;
71
+
72
+ // future use in Arduino Networking
73
+ friend class EthernetClass ;
74
+ friend class UDP ;
75
+ friend class Client ;
76
+ friend class Server ;
77
+ friend class DhcpClass ;
78
+ friend class DNSClient ;
48
79
};
49
80
50
81
#endif
You can’t perform that action at this time.
0 commit comments