LoboMQ
Loading...
Searching...
No Matches
MACAddrList.h
Go to the documentation of this file.
1
9#ifndef MACADDRLIST_H
10
11#define MACADDRLIST_H
12
13#include <Arduino.h>
14#include <cstdint>
15#include <vector>
16
21using MACAddress = std::array<uint8_t, 6>;
22
27class MACAddrList : public std::vector<MACAddress> {
28 public:
29
38 bool isInList(const uint8_t *mac) const;
39
48 bool isInList(const MACAddress &mac) const;
49
57 void addToList(const uint8_t *mac);
58
67 void addToList(const MACAddress &mac);
68
77 void addToList(const String &macStr);
78
87 void addArrayToList(const std::vector<String>& macArray);
88
97 void addArrayToList(const std::vector<MACAddress>& macArray);
98
108 bool removeFromList(const uint8_t *mac);
109
120 bool removeFromList(const MACAddress &mac);
121
128 void clearList();
129
138 String getAddressListAsString() const;
139};
140
141#endif
std::array< uint8_t, 6 > MACAddress
Represents a MAC address as an array of 6 bytes.
Definition MACAddrList.h:21
A class for managing a list of MAC addresses.
Definition MACAddrList.h:27
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.