A simple wrapper class for internal C-API HebiMacAddress objects to allow interfacing with API calls that use MAC addresses. More...
#include <mac_address.hpp>
Public Member Functions | |
MacAddress () | |
Creates MAC address 00:00:00:00:00:00. More... | |
uint8_t & | operator[] (std::size_t idx) |
const uint8_t & | operator[] (std::size_t idx) const |
bool | setToHexString (std::string mac_str) |
Sets the value of the current MacAddress to the value given in 'mac_str'. More... | |
Static Public Member 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. More... | |
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. More... | |
Public Attributes | |
HebiMacAddress | internal_ |
Static Private Member Functions | |
static uint8_t | byteFromHexPair (char c1, char c2) |
static uint8_t | hexToInt (char c) |
static bool | isHexDigitValid (char c) |
A simple wrapper class for internal C-API HebiMacAddress objects to allow interfacing with API calls that use MAC addresses.
Definition at line 12 of file mac_address.hpp.
hebi::MacAddress::MacAddress | ( | ) |
Creates MAC address 00:00:00:00:00:00.
Definition at line 21 of file mac_address.cpp.
|
staticprivate |
Converts a hex pair to a byte (0-255 possible). Assumes valid digits.
Definition at line 16 of file mac_address.cpp.
|
static |
Creates a MacAddress from individual bytes.
Definition at line 31 of file mac_address.cpp.
|
staticprivate |
Converts a hex digit to a byte (highest value possible is 15). Assumes valid digit.
Definition at line 5 of file mac_address.cpp.
|
staticprivate |
Definition at line 66 of file mac_address.cpp.
|
static |
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.
Definition at line 74 of file mac_address.cpp.
uint8_t & hebi::MacAddress::operator[] | ( | std::size_t | idx | ) |
Definition at line 56 of file mac_address.cpp.
const uint8_t & hebi::MacAddress::operator[] | ( | std::size_t | idx | ) | const |
Definition at line 61 of file mac_address.cpp.
bool hebi::MacAddress::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).
Definition at line 43 of file mac_address.cpp.
HebiMacAddress hebi::MacAddress::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!
Definition at line 21 of file mac_address.hpp.