AsyncTcp
This commit is contained in:
hsaturn
2021-04-10 14:03:36 +02:00
parent 3e8d34e4e7
commit 6711f30ad0
6 changed files with 6 additions and 13 deletions

View File

@@ -672,6 +672,7 @@ void MqttMessage::add(const char* p, size_t len, bool addLength)
{
if (addLength)
{
buffer.reserve(buffer.length()+addLength+2);
incoming(len>>8);
incoming(len & 0xFF);
}

View File

@@ -80,23 +80,15 @@ class MqttMessage
// output buff+=2, len=length(str)
static void getString(const char* &buff, uint16_t& len);
Type type() const
{
return state == Complete ? static_cast<Type>(buffer[0]) : Unknown;
}
// shouldn't exist because it breaks constness :-(
// but this saves memory so ...
void changeType(Type type) const
{
buffer[0] = type;
}
void create(Type type)
{
buffer=(char)type;
buffer+='\0';
buffer+='\0'; // reserved for msg length
vheader=2;
size=0;
state=Create;