#pragma once #include #include #include #include class Port; class Device { public: friend std::ostream& operator<<(std::ostream& os, const Device& device); public: Device(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 Create(const std::string& macAddress) { return std::make_shared(macAddress); } inline static std::shared_ptr Create() { return std::make_shared(rand() % 256, rand() % 256, rand() % 256, rand() % 256, rand() % 256, rand() % 256); } void Connect(std::shared_ptr other); void Send(); void Receive(); private: void parseAndSetMac(const std::string& macAddress); private: std::shared_ptr port; public: uint8_t macAddress[6]; };