These are the pre-v12 classes, kept so existing code keeps building. New code should use the modern API — see Migration Guide: v11 to v12.
optris::MacAddress
A MAC address is usually specified by six bytes in hex notation separated by colons, like this: 12:34:56:78:9a:bc
Public functions
MacAddress
OTC_SDK_API MacAddress() noexcept
Constructor. All MAC address bytes are set to 0.
MacAddress
OTC_SDK_API MacAddress(std::uint64_t mac)
Constructor.
Parameters
| Name | Description |
|---|---|
mac |
address as an unsigned 64 bit integer. |
Exceptions
| Name | Description |
|---|---|
SDKException |
if the given value is outside [0x00, 0xffffffffffff]. |
MacAddress
OTC_SDK_API MacAddress(const std::string &mac)
Constructor.
Parameters
| Name | Description |
|---|---|
mac |
address string in colon notation (a:b:c:d:e:f). |
Exceptions
| Name | Description |
|---|---|
SDKException |
if the given string does not contain a valid MAC address. |
MacAddress
OTC_SDK_API MacAddress(std::uint8_t a, std::uint8_t b, std::uint8_t c, std::uint8_t d, std::uint8_t e, std::uint8_t f) noexcept
Constructor.
Parameters
| Name | Description |
|---|---|
a |
byte from an a:b:c:d:e:f MAC address. |
b |
byte from an a:b:c:d:e:f MAC address. |
c |
byte from an a:b:c:d:e:f MAC address. |
d |
byte from an a:b:c:d:e:f MAC address. |
e |
byte from an a:b:c:d:e:f MAC address. |
f |
byte from an a:b:c:d:e:f MAC address. |
reset
OTC_SDK_API void reset() noexcept
Resets all the bytes of the MAC address to 0 (0:0:0:0:0:0).
setFromUInt64
OTC_SDK_API void setFromUInt64(std::uint64_t mac)
Sets the MAC address from an unsigned 64 bit integer.
Parameters
| Name | Description |
|---|---|
mac |
address as an unsigned 64 bit integer. |
Exceptions
| Name | Description |
|---|---|
SDKException |
if the given value is outside [0x00, 0xffffffffffff]. |
toUInt64
OTC_SDK_API std::uint64_t toUInt64() const noexcept
Returns the MAC address as an unsigned 64 bit integer.
Returns: MAC address as an unsigned 64 bit integer.
setFromString
OTC_SDK_API void setFromString(const std::string &mac)
Sets the MAC address from the given string.
Parameters
| Name | Description |
|---|---|
mac |
address string in colon notation (a:b:c:d:e:f). |
Exceptions
| Name | Description |
|---|---|
SDKException |
if the given string does not contain a valid mac address. |
toString
OTC_SDK_API std::string toString() const noexcept
Returns the MAC address as a string in colon notation (a:b:c:d:e:f).
Returns: MAC address as a string in colon notation (a:b:c:d:e:f).
setByte
OTC_SDK_API void setByte(int index, std::uint8_t value)
Sets the value of the byte with the given index.
Parameters
| Name | Description |
|---|---|
index |
of the byte to set. |
value |
to set. |
Exceptions
| Name | Description |
|---|---|
SDKException |
if index is out of range. |
getByte
OTC_SDK_API std::uint8_t getByte(int index) const
Returns the value of the byte with the given index.
Parameters
| Name | Description |
|---|---|
index |
of the desired byte. |
Returns: value of the byte with the given index.
Exceptions
| Name | Description |
|---|---|
SDKException |
if the index is out of range. |
operator==
bool operator==(const MacAddress &rhs) const noexcept
Equality operator.
operator==
bool operator==(const std::uint64_t &rhs) const
Equality operator.
operator!=
bool operator!=(const MacAddress &rhs) const noexcept
Unequality operator.