@@ -98,7 +98,7 @@ static uint8_t *stringprint(uint8_t *p, const char *s, uint16_t maxlen = 0) {
9898
9999// Adafruit_MQTT Definition ////////////////////////////////////////////////////
100100
101- Adafruit_MQTT::Adafruit_MQTT (const char *server, uint16_t port, const char *cid,
101+ Adafruit_MQTT::Adafruit_MQTT (const char *server, uint16_t port, char *cid,
102102 const char *user, const char *pass) {
103103 servername = server;
104104 portnum = port;
@@ -845,55 +845,55 @@ bool Adafruit_MQTT_Publish::publish(uint8_t *payload, uint16_t bLen) {
845845 return mqtt->publish (topic, payload, bLen, qos);
846846}
847847
848- bool Adafruit_MQTT::readMessage (char * msg)
849- {
850- uint16_t i, topiclen, datalen;
848+ // bool Adafruit_MQTT::readMessage(char* msg)
849+ // {
850+ // uint16_t i, topiclen, datalen;
851851
852- // Check if data is available to read.
853- uint16_t len =
854- readFullPacket (buffer, MAXBUFFERSIZE, 6000 ); // return one full packet
855- if (!len)
856- return false ; // No data available, just quit.
852+ // // Check if data is available to read.
853+ // uint16_t len =
854+ // readFullPacket(buffer, MAXBUFFERSIZE, 6000); // return one full packet
855+ // if (!len)
856+ // return false; // No data available, just quit.
857857
858- if (len < 3 )
859- return NULL ;
860- if ((buffer[0 ] & 0xF0 ) != (MQTT_CTRL_PUBLISH) << 4 )
861- return NULL ;
862-
863- // Parse out length of packet.
864- topiclen = buffer[3 ];
865-
866- uint8_t packet_id_len = 0 ;
867- uint16_t packetid = 0 ;
868- // Check if it is QoS 1, TODO: we dont support QoS 2
869- if ((buffer[0 ] & 0x6 ) == 0x2 ) {
870- packet_id_len = 2 ;
871- packetid = buffer[topiclen + 4 ];
872- packetid <<= 8 ;
873- packetid |= buffer[topiclen + 5 ];
874- }
875-
876- // zero out the old data
877- memset (msg, 0 , SUBSCRIPTIONDATALEN);
878-
879- datalen = len - topiclen - packet_id_len - 4 ;
880- if (datalen > SUBSCRIPTIONDATALEN) {
881- datalen = SUBSCRIPTIONDATALEN - 1 ; // cut it off
882- }
883- // extract out just the data, into the subscription object itself
884- memmove (msg, buffer + 4 + topiclen + packet_id_len,
885- datalen);
886-
887- return true ;
888- }
889-
890- bool Adafruit_MQTT::subscribeTopic (char * topic)
891- {
892- uint8_t len = subscribePacket (buffer, topic,
893- 0 );
894- if (!sendPacket (buffer, len))
895- return -1 ;
896- }
858+ // if (len < 3)
859+ // return NULL;
860+ // if ((buffer[0] & 0xF0) != (MQTT_CTRL_PUBLISH) << 4)
861+ // return NULL;
862+
863+ // // Parse out length of packet.
864+ // topiclen = buffer[3];
865+
866+ // uint8_t packet_id_len = 0;
867+ // uint16_t packetid = 0;
868+ // // Check if it is QoS 1, TODO: we dont support QoS 2
869+ // if ((buffer[0] & 0x6) == 0x2) {
870+ // packet_id_len = 2;
871+ // packetid = buffer[topiclen + 4];
872+ // packetid <<= 8;
873+ // packetid |= buffer[topiclen + 5];
874+ // }
875+
876+ // // zero out the old data
877+ // memset(msg, 0, SUBSCRIPTIONDATALEN);
878+
879+ // datalen = len - topiclen - packet_id_len - 4;
880+ // if (datalen > SUBSCRIPTIONDATALEN) {
881+ // datalen = SUBSCRIPTIONDATALEN - 1; // cut it off
882+ // }
883+ // // extract out just the data, into the subscription object itself
884+ // memmove(msg, buffer + 4 + topiclen + packet_id_len,
885+ // datalen);
886+
887+ // return true;
888+ // }
889+
890+ // bool Adafruit_MQTT::subscribeTopic(char* topic)
891+ // {
892+ // uint8_t len = subscribePacket(buffer, topic,
893+ // 0);
894+ // if (!sendPacket(buffer, len))
895+ // return -1;
896+ // }
897897
898898// Adafruit_MQTT_Subscribe Definition //////////////////////////////////////////
899899
0 commit comments