experimental mqtt client supporting large packets

This commit is contained in:
proddy
2021-02-27 14:45:51 +01:00
parent 333c5c16c0
commit ce45374b54
28 changed files with 1358 additions and 1046 deletions

View File

@@ -0,0 +1,44 @@
#include "OutPacket.hpp"
using AsyncMqttClientInternals::OutPacket;
OutPacket::OutPacket()
: next(nullptr)
, timeout(0)
, noTries(0)
, _released(true)
, _packetId(0) {}
OutPacket::~OutPacket() {}
bool OutPacket::released() const {
return _released;
}
uint8_t OutPacket::packetType() const {
return data(0)[0] >> 4;
}
uint16_t OutPacket::packetId() const {
return _packetId;
}
uint8_t OutPacket::qos() const {
if (packetType() == AsyncMqttClientInternals::PacketType.PUBLISH) {
return (data()[1] & 0x06) >> 1;
}
return 0;
}
void OutPacket::release() {
_released = true;
}
uint16_t OutPacket::_nextPacketId = 0;
uint16_t OutPacket::_getNextPacketId() {
if (++_nextPacketId == 0) {
++_nextPacketId;
}
return _nextPacketId;
}