MQTT lib for WISEAgent
Fork of MQTT by
Diff: MQTTAsync.h
- Revision:
- 45:bd3567993b26
- Parent:
- 23:05fc7de97d4a
--- a/MQTTAsync.h Mon Oct 06 11:41:05 2014 +0000
+++ b/MQTTAsync.h Wed Aug 12 02:38:46 2015 +0000
@@ -21,6 +21,8 @@
#include "MQTTPacket.h"
#include "stdio.h"
+
+
namespace MQTT
{
@@ -62,7 +64,7 @@
limits()
{
- MAX_MQTT_PACKET_SIZE = 100;
+ MAX_MQTT_PACKET_SIZE = ADV_MAX_PACKET_SIZE;
MAX_MESSAGE_HANDLERS = 5;
MAX_CONCURRENT_OPERATIONS = 1; // 1 indicates single-threaded mode - set to >1 for multithreaded mode
command_timeout_ms = 30000;
@@ -203,6 +205,7 @@
this->ping_outstanding = 0;
// How to make these memory allocations portable? I was hoping to avoid the heap
+ printf("size=%d\n",limits.MAX_MQTT_PACKET_SIZE);
buf = new char[limits.MAX_MQTT_PACKET_SIZE];
readbuf = new char[limits.MAX_MQTT_PACKET_SIZE];
this->operations = new struct Operations[limits.MAX_CONCURRENT_OPERATIONS];
@@ -553,7 +556,7 @@
if (message->qos == QOS1 || message->qos == QOS2)
message->id = packetid.getNext();
-
+
int len = MQTTSerialize_publish(buf, limits.MAX_MQTT_PACKET_SIZE, 0, message->qos, message->retained, message->id, topic, (char*)message->payload, message->payloadlen);
int rc = sendPacket(len, atimer.left_ms()); // send the subscribe packet
if (rc != len)
