MeshNet  1.0.0
Public Member Functions | Static Public Member Functions | Data Fields
MeshMAC Struct Reference

Structure that represents physical MAC address used in MeshNEt protocol. MeshMAC address unlike MAC address used in TCP/IP protocol has just 4 octets. More...

#include <meshHelper.h>

Public Member Functions

 MeshMAC ()=default
 Default constructor. More...
 
 MeshMAC (uint8_t octet1, uint8_t octet2, uint8_t octet3, uint8_t octet4)
 Constructor with octets. More...
 
 MeshMAC (uint32_t mac)
 Constructor with raw value. More...
 
 MeshMAC (const MeshMAC &mac)=default
 Default copy constructor. More...
 
bool isValid () const
 Checks if Mesh MAC address is valid. More...
 
uint32_t getRaw () const
 Gets raw form of Mesh MAC address. More...
 
void setRaw (const uint32_t mac)
 Sets Mesh MAC address from raw form. More...
 
size_t printTo (Print &p) const
 Pretty prints MeshMAC. More...
 
void operator= (const uint32_t &val)
 
 operator uint32_t () const
 
 operator uint32_t ()
 

Static Public Member Functions

static char digitToHex (uint8_t digit, bool low=true)
 Converts one HEX digit (0-15) to HEX character (0-F). More...
 

Data Fields

uint8_t octet4 = 0
 Fourth octet of MeshMAC address. More...
 
uint8_t octet3 = 0
 Third octet of MeshMAC address. More...
 
uint8_t octet2 = 0
 Second octet of MeshMAC address. More...
 
uint8_t octet1 = 0
 First octet of MeshMAC address. More...
 

Detailed Description

Structure that represents physical MAC address used in MeshNEt protocol. MeshMAC address unlike MAC address used in TCP/IP protocol has just 4 octets.

Constructor & Destructor Documentation

◆ MeshMAC() [1/4]

MeshMAC::MeshMAC ( )
default

Default constructor.

◆ MeshMAC() [2/4]

MeshMAC::MeshMAC ( uint8_t  octet1,
uint8_t  octet2,
uint8_t  octet3,
uint8_t  octet4 
)

Constructor with octets.

Parameters
octet1First MeshMAC octet.
octet2Second MeshMAC octet.
octet3Third MeshMAC octet.
octet4Fourth MeshMAC octet.

◆ MeshMAC() [3/4]

MeshMAC::MeshMAC ( uint32_t  mac)

Constructor with raw value.

Parameters
macRepresentation of MeshMAC as raw value 32-bit value.

◆ MeshMAC() [4/4]

MeshMAC::MeshMAC ( const MeshMAC mac)
default

Default copy constructor.

Member Function Documentation

◆ digitToHex()

char MeshMAC::digitToHex ( uint8_t  digit,
bool  low = true 
)
static

Converts one HEX digit (0-15) to HEX character (0-F).

Parameters
digitDigit to convert (0-15).
lowSet to true to return low case characters.
Returns
Returns HEX character of digit.

◆ getRaw()

uint32_t MeshMAC::getRaw ( ) const
inline

Gets raw form of Mesh MAC address.

Returns
Returns raw form of Mesh MAC address.

◆ isValid()

bool MeshMAC::isValid ( ) const
inline

Checks if Mesh MAC address is valid.

Returns
Returns true when Mesh MAC address is valid.

◆ operator uint32_t() [1/2]

MeshMAC::operator uint32_t ( )
inline

◆ operator uint32_t() [2/2]

MeshMAC::operator uint32_t ( ) const
inline

◆ operator=()

void MeshMAC::operator= ( const uint32_t &  val)
inline

◆ printTo()

size_t MeshMAC::printTo ( Print &  p) const

Pretty prints MeshMAC.

Parameters
pStream, where to print data.
Returns
Returns number of printed characters.

◆ setRaw()

void MeshMAC::setRaw ( const uint32_t  mac)
inline

Sets Mesh MAC address from raw form.

Parameters
macMesh MAC address to set.

Field Documentation

◆ octet1

uint8_t MeshMAC::octet1 = 0

First octet of MeshMAC address.

◆ octet2

uint8_t MeshMAC::octet2 = 0

Second octet of MeshMAC address.

◆ octet3

uint8_t MeshMAC::octet3 = 0

Third octet of MeshMAC address.

◆ octet4

uint8_t MeshMAC::octet4 = 0

Fourth octet of MeshMAC address.


The documentation for this struct was generated from the following files: