| 
						
						
							
								
							
						
						
					 | 
					@ -112,7 +112,7 @@ class PubMqtt { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        void loop() { | 
					 | 
					 | 
					        void loop() { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            std::queue<message_s> queue; | 
					 | 
					 | 
					            std::queue<message_s> queue; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            xSemaphoreTake(mutex, portMAX_DELAY); | 
					 | 
					 | 
					            xSemaphoreTake(mutex, portMAX_DELAY); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					            std::swap(queue, mReceiveQueue); | 
					 | 
					 | 
					            queue.swap(mReceiveQueue); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					            xSemaphoreGive(mutex); | 
					 | 
					 | 
					            xSemaphoreGive(mutex); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            while (!queue.empty()) { | 
					 | 
					 | 
					            while (!queue.empty()) { | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					@ -662,29 +662,59 @@ class PubMqtt { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    private: | 
					 | 
					 | 
					    private: | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        enum {MQTT_STATUS_OFFLINE = 0, MQTT_STATUS_PARTIAL, MQTT_STATUS_ONLINE}; | 
					 | 
					 | 
					        enum {MQTT_STATUS_OFFLINE = 0, MQTT_STATUS_PARTIAL, MQTT_STATUS_ONLINE}; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					
 | 
					 | 
					 | 
					        struct message_s | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        struct message_s { | 
					 | 
					 | 
					        { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					            char *topic; | 
					 | 
					 | 
					            char *topic; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            uint8_t *payload; | 
					 | 
					 | 
					            uint8_t *payload; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            size_t len; | 
					 | 
					 | 
					            size_t len; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            size_t index; | 
					 | 
					 | 
					            size_t index; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            size_t total; | 
					 | 
					 | 
					            size_t total; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					            message_s(const char* topic, const uint8_t* payload, size_t len, size_t index, size_t total) { | 
					 | 
					 | 
					            message_s() : topic { nullptr },  payload { nullptr },  len { 0 }, index { 0}, total { 0 } {} | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                this->topic = new char[strlen(topic) + 1]; | 
					 | 
					 | 
					
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            message_s(const char* topic, const uint8_t* payload, size_t len, size_t index, size_t total) | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                uint8_t topic_len = strlen(topic) + 1; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                this->topic = new char[topic_len]; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                this->payload = new uint8_t[len]; | 
					 | 
					 | 
					                this->payload = new uint8_t[len]; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					                memcpy(this->topic, topic, strlen(topic)); | 
					 | 
					 | 
					                memcpy(this->topic, topic, topic_len); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					                memcpy(this->payload, payload, len); | 
					 | 
					 | 
					                memcpy(this->payload, payload, len); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                this->len = len; | 
					 | 
					 | 
					                this->len = len; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                this->index = index; | 
					 | 
					 | 
					                this->index = index; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                this->total = total; | 
					 | 
					 | 
					                this->total = total; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            } | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					            ~message_s() { | 
					 | 
					 | 
					            message_s(const message_s &) = delete; | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            message_s(message_s && other) : message_s {} | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                this->swap( other ); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            ~message_s() | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                delete[] this->topic; | 
					 | 
					 | 
					                delete[] this->topic; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                delete[] this->payload; | 
					 | 
					 | 
					                delete[] this->payload; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            } | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            message_s  &operator = (const message_s &) = delete; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            message_s  &operator = (message_s &&other) | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                this->swap(other); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                return *this; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            void swap(message_s &other) | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                std::swap(this->topic, other.topic); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                std::swap(this->payload, other.payload); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                std::swap(this->len, other.len); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                std::swap(this->index, other.index); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                std::swap(this->total, other.total); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        }; | 
					 | 
					 | 
					        }; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    private: | 
					 | 
					 | 
					    private: | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					
  |