A network hardware (MAC) address. More...

#include <MacAddress.h>

Inheritance diagram for MacAddress:
[legend]
Collaboration diagram for MacAddress:
[legend]

Public Types

using Octets = uint8_t[6]
 

Public Member Functions

 MacAddress ()=default
 
 MacAddress (const Octets &octets)
 
void getOctets (Octets &octets) const
 Get the octets of the MAC address. More...
 
void setOctets (const Octets &octets)
 Set the octets of the MAC address. More...
 
uint8_t operator[] (unsigned index) const
 Get the octet at the given index in the MAC address. More...
 
uint8_t & operator[] (unsigned index)
 Get a reference to the octet at the given index in the MAC address. More...
 
String toString (char sep=':') const
 Return a String representation of the MacAddress. More...
 
bool operator== (const MacAddress &other) const
 Equality operator. More...
 
bool operator!= (const MacAddress &other) const
 Inequality operator. More...
 
bool operator! () const
 Test if this is a null address (00:00:00:00:00:00). More...
 
 operator bool_type () const
 Safe bool operator, returns true if address is non-null. More...
 
void clear ()
 Clear address to null value. More...
 
uint32_t getHash () const
 Generate a simple 32-bit hash from the MAC address. More...
 
size_t printTo (Print &p) const override
 
- Public Member Functions inherited from Printable
virtual ~Printable ()
 

Detailed Description

A network hardware (MAC) address.

Author
Mark Lindner
mikee47 mike@.nosp@m.sill.nosp@m.yhous.nosp@m.e.ne.nosp@m.t Sming integration

Member Typedef Documentation

◆ Octets

using MacAddress::Octets = uint8_t[6]

Constructor & Destructor Documentation

◆ MacAddress() [1/2]

MacAddress::MacAddress ( )
default

◆ MacAddress() [2/2]

MacAddress::MacAddress ( const Octets octets)
inline

Member Function Documentation

◆ clear()

void MacAddress::clear ( void  )
inline

Clear address to null value.

◆ getHash()

uint32_t MacAddress::getHash ( ) const

Generate a simple 32-bit hash from the MAC address.

Return values
uint32_tThe hash
Note
This does not uniquely identify the key

◆ getOctets()

void MacAddress::getOctets ( Octets octets) const
inline

Get the octets of the MAC address.

◆ operator bool_type()

MacAddress::operator bool_type ( ) const
inline

Safe bool operator, returns true if address is non-null.

◆ operator!()

bool MacAddress::operator! ( ) const

Test if this is a null address (00:00:00:00:00:00).

◆ operator!=()

bool MacAddress::operator!= ( const MacAddress other) const
inline

Inequality operator.

◆ operator==()

bool MacAddress::operator== ( const MacAddress other) const
inline

Equality operator.

◆ operator[]() [1/2]

uint8_t MacAddress::operator[] ( unsigned  index) const

Get the octet at the given index in the MAC address.

Parameters
indexThe index.
Returns
The octet at the given index.

◆ operator[]() [2/2]

uint8_t& MacAddress::operator[] ( unsigned  index)

Get a reference to the octet at the given index in the MAC address.

Parameters
indexThe index.
Returns
A reference to the octet at the given index.

◆ printTo()

size_t MacAddress::printTo ( Print p) const
inlineoverridevirtual

Implements Printable.

◆ setOctets()

void MacAddress::setOctets ( const Octets octets)
inline

Set the octets of the MAC address.

◆ toString()

String MacAddress::toString ( char  sep = ':') const

Return a String representation of the MacAddress.

Parameters
sepCharacter to insert between octets
Note
Various conventions exist for display MAC addresses.
  • The IEEE standard specifies '-', "01-02-03-04-05-06"
  • A more common convention (as used in linux) is ':', "01:02:03:04:05:06"
  • To omit the separator use '\0', "010203040506"

The documentation for this class was generated from the following file: