Skip to content

Commit f9946bb

Browse files
defining MQTT_TX_BUFFER_SIZE and STRING_PROPERTY_MAX_SIZE in cofig file
1 parent d436b80 commit f9946bb

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

src/AIoTC_Config.h

+15
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,21 @@
156156
#define HAS_TCP
157157
#endif
158158

159+
#ifdef HAS_TCP
160+
#ifndef MQTT_TX_BUFFER_SIZE
161+
#define MQTT_TX_BUFFER_SIZE 256
162+
#endif // MQTT_TX_BUFFER_SIZE
163+
164+
#ifndef STRING_PROPERTY_MAX_SIZE
165+
// 6 represents the expected overhead of a string property inside a cbor
166+
#define STRING_PROPERTY_MAX_SIZE MQTT_TX_BUFFER_SIZE - 6
167+
#endif // STRING_PROPERTY_MAX_SIZE
168+
#else
169+
#ifndef STRING_PROPERTY_MAX_SIZE
170+
#define STRING_PROPERTY_MAX_SIZE 50
171+
#endif // STRING_PROPERTY_MAX_SIZE
172+
#endif // HAS_TCP
173+
159174
/******************************************************************************
160175
* CONSTANTS
161176
******************************************************************************/

src/ArduinoIoTCloudTCP.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ class ArduinoIoTCloudTCP: public ArduinoIoTCloudClass
106106
#endif
107107

108108
private:
109-
static const int MQTT_TRANSMIT_BUFFER_SIZE = 256;
109+
static const int MQTT_TRANSMIT_BUFFER_SIZE = MQTT_TX_BUFFER_SIZE;
110110

111111
enum class State
112112
{

0 commit comments

Comments
 (0)