13 auto it = std::find_if(this->begin(), this->end(), [&](
const MACAddress& address) {
14 return address == *
reinterpret_cast<const MACAddress*
>(mac);
17 return it != this->end();
22 auto it = std::find_if(this->begin(), this->end(), [&](
const MACAddress& address) {
23 return address == mac;
26 return it != this->end();
31 this->push_back(*
reinterpret_cast<const MACAddress*
>(mac));
41 if (sscanf(macStr.c_str(),
"%02hhX:%02hhX:%02hhX:%02hhX:%02hhX:%02hhX",
42 &newAddress[0], &newAddress[1], &newAddress[2], &newAddress[3], &newAddress[4], &newAddress[5]) == 6) {
48 for (
const auto& macStr : macArray)
53 for (
const auto& mac : macArray)
59 auto it = std::find_if(this->begin(), this->end(), [&](
const MACAddress& address) {
60 return address == *
reinterpret_cast<const MACAddress*
>(mac);
63 if (it != this->end()) {
73 auto it = std::find_if(this->begin(), this->end(), [&](
const MACAddress& address) {
74 return address == mac;
77 if (it != this->end()) {
91 for (
const auto& mac : *
this) {
93 snprintf(macChar,
sizeof(macChar),
"%02X:%02X:%02X:%02X:%02X:%02X",
94 mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
95 result = result + macChar +
"\n";
std::array< uint8_t, 6 > MACAddress
Represents a MAC address as an array of 6 bytes.
bool isInList(const uint8_t *mac) const
Checks if a MAC address is in the list.
bool removeFromList(const uint8_t *mac)
Removes a MAC address from the list.
void addArrayToList(const std::vector< String > &macArray)
Adds multiple MAC addresses from an array to the list.
String getAddressListAsString() const
Returns a string representation of all MAC addresses in the list.
void addToList(const uint8_t *mac)
Adds a MAC address to the list if it is not already present.
void clearList()
Clears all the MAC addresses of the list.