randomize MACs

This commit is contained in:
Robert 2023-07-01 14:39:27 +02:00
parent c295b13018
commit dc966782b5
3 changed files with 16 additions and 4 deletions

View file

@ -1,6 +1,7 @@
#pragma once
#include <cstdint>
#include <array>
#include <string>
#include <memory>
@ -10,7 +11,15 @@ public:
public:
Device(const std::string& macAddress);
static std::shared_ptr<Device> create(const std::string& macAddress);
Device(uint8_t a, uint8_t b, uint8_t c, uint8_t d, uint8_t e, uint8_t f);
inline static std::shared_ptr<Device> create(const std::string& macAddress) {
return std::make_shared<Device>(macAddress);
}
inline static std::shared_ptr<Device> create() {
return std::make_shared<Device>(rand() % 256, rand() % 256, rand() % 256, rand() % 256, rand() % 256, rand() % 256);
}
private:
void parseAndSetMac(const std::string& macAddress);