#pragma once #include #include #include #include #ifndef MILIGHT_MAX_QUEUED_PACKETS #define MILIGHT_MAX_QUEUED_PACKETS 20 #endif struct QueuedPacket { uint8_t packet[MILIGHT_MAX_PACKET_LENGTH]; const MiLightRemoteConfig* remoteConfig; size_t repeatsOverride; }; class PacketQueue { public: PacketQueue(); void push(const uint8_t* packet, const MiLightRemoteConfig* remoteConfig, const size_t repeatsOverride); std::shared_ptr pop(); bool isEmpty() const; size_t size() const; size_t getDroppedPacketCount() const; private: size_t droppedPackets; std::shared_ptr checkoutPacket(); void checkinPacket(std::shared_ptr packet); LinkedList> queue; };