An AirVantage layer for MQTT
Diff: AV_MQTT.cpp
- Revision:
- 7:da5d90052cec
- Parent:
- 6:b251f6276497
diff -r b251f6276497 -r da5d90052cec AV_MQTT.cpp --- a/AV_MQTT.cpp Tue Aug 13 12:31:37 2013 +0000 +++ b/AV_MQTT.cpp Tue Aug 13 13:36:45 2013 +0000 @@ -20,33 +20,6 @@ niMQTT::pub(topic, json); } -void AV_MQTT::publish_received() { - //remaining length - int remaining_length = decode_remaining_length(); - - // topic - char mqtt_utf8_length[2]; - socket->receive(mqtt_utf8_length, 2); - int utf8_length = mqtt_utf8_length[0] * 256 + mqtt_utf8_length[1]; - - if (debug) printf("PUBLISH Received: %i, %i\r\n", remaining_length, utf8_length); - - char topic[utf8_length + 1]; - socket->receive(topic, utf8_length); - topic[utf8_length] = 0; - - // payload - int message_length = remaining_length - utf8_length - 2; - char message[message_length + 1]; - socket->receive(message, message_length); - message[message_length] = 0; - - waiting_new_packet = true; - - call_callback(topic, message); -// ^^^^^ only 5 characters that differs from niMQTT::publish_received... TODO -} - void AV_MQTT::call_callback(const char *topic, const char *message) { picojson::value v; picojson::parse(v, message, message + strlen(message));