@@ -562,12 +562,12 @@ void ArduinoIoTCloudTCP::handleMessage(int length)
562
562
}
563
563
}
564
564
565
- void ArduinoIoTCloudTCP::sendPropertiesToCloud ( )
565
+ void ArduinoIoTCloudTCP::sendPropertyContainerToCloud (PropertyContainer & property_container )
566
566
{
567
567
int bytes_encoded = 0 ;
568
568
uint8_t data[MQTT_TRANSMIT_BUFFER_SIZE];
569
569
570
- if (CBOREncoder::encode (_property_container , data, sizeof (data), bytes_encoded, false ) == CborNoError)
570
+ if (CBOREncoder::encode (property_container , data, sizeof (data), bytes_encoded, false ) == CborNoError)
571
571
if (bytes_encoded > 0 )
572
572
{
573
573
/* If properties have been encoded store them in the back-up buffer
@@ -580,11 +580,13 @@ void ArduinoIoTCloudTCP::sendPropertiesToCloud()
580
580
}
581
581
}
582
582
583
- void ArduinoIoTCloudTCP::sendOTAPropertiesToCloud ()
583
+ void ArduinoIoTCloudTCP::sendPropertiesToCloud ()
584
584
{
585
- int bytes_encoded = 0 ;
586
- uint8_t data[MQTT_TRANSMIT_BUFFER_SIZE];
585
+ sendPropertyContainerToCloud (_property_container) ;
586
+ }
587
587
588
+ void ArduinoIoTCloudTCP::sendOTAPropertiesToCloud ()
589
+ {
588
590
PropertyContainer ota_property_container;
589
591
590
592
std::list<String> const ota_property_list {" OTA_CAP" , " OTA_ERROR" , " OTA_SHA256" , " OTA_URL" , " OTA_REQ" };
@@ -598,17 +600,7 @@ void ArduinoIoTCloudTCP::sendOTAPropertiesToCloud()
598
600
}
599
601
);
600
602
601
- if (CBOREncoder::encode (ota_property_container, data, sizeof (data), bytes_encoded, false ) == CborNoError)
602
- if (bytes_encoded > 0 )
603
- {
604
- /* If properties have been encoded store them in the back-up buffer
605
- * in order to allow retransmission in case of failure.
606
- */
607
- _mqtt_data_len = bytes_encoded;
608
- memcpy (_mqtt_data_buf, data, _mqtt_data_len);
609
- /* Transmit the properties to the MQTT broker */
610
- write (_dataTopicOut, _mqtt_data_buf, _mqtt_data_len);
611
- }
603
+ sendPropertyContainerToCloud (ota_property_container);
612
604
}
613
605
614
606
void ArduinoIoTCloudTCP::requestLastValue ()
0 commit comments