Class MacAddress

Class Documentation

class MacAddress

A simple wrapper class for internal C-API HebiMacAddress objects to allow interfacing with API calls that use MAC addresses.

Public Functions

MacAddress()

Creates MAC address 00:00:00:00:00:00.

bool setToHexString(std::string mac_str)

Sets the value of the current MacAddress to the value given in ‘mac_str’.

This value must be a valid string of format dd:dd:dd:dd:dd:dd, where ‘d’ is a hex digit (0-F, uppercase or lowercase).

Returns:

‘true’ on success (valid mac_str), ‘false’ on failure.

uint8_t &operator[](std::size_t idx)
const uint8_t &operator[](std::size_t idx) const

Public Members

HebiMacAddress internal_

C-style mac address object; this is a plain struct, so it is OK to rely on default copy/move constructors. NOTE: this should not be used except by library functions!

Public Static Functions

static MacAddress fromBytes(uint8_t a, uint8_t b, uint8_t c, uint8_t d, uint8_t e, uint8_t f)

Creates a MacAddress from individual bytes.

static bool isHexStringValid(std::string mac_str)

Is mac_str a valid string of format dd:dd:dd:dd:dd:dd, where ‘d’ is a hex digit 0-F. Lowercase values accepted. 1 if yes, 0 if no.

Returns:

‘true’ if mac_str is valid, ‘false’ otherwise.