An AirVantage layer for MQTT

Dependencies:   niMQTT picojson

Dependents:   AV_MQTT_example

Files at this revision

API Documentation at this revision

Comitter:
Nim65s
Date:
Tue Aug 13 13:36:45 2013 +0000
Parent:
6:b251f6276497
Commit message:
call_callback is now virtual from niMQTT

Changed in this revision

AV_MQTT.cpp Show annotated file Show diff for this revision Revisions of this file
AV_MQTT.h Show annotated file Show diff for this revision Revisions of this file
niMQTT.lib Show annotated file Show diff for this revision Revisions of this file
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));
diff -r b251f6276497 -r da5d90052cec AV_MQTT.h
--- a/AV_MQTT.h	Tue Aug 13 12:31:37 2013 +0000
+++ b/AV_MQTT.h	Tue Aug 13 13:36:45 2013 +0000
@@ -12,7 +12,7 @@
     
     protected:
         char *topic;
-        void call_callback(const char *topic, const char *message);
+        virtual void call_callback(const char *topic, const char *message);
 };
 
 #endif
\ No newline at end of file
diff -r b251f6276497 -r da5d90052cec niMQTT.lib
--- a/niMQTT.lib	Tue Aug 13 12:31:37 2013 +0000
+++ b/niMQTT.lib	Tue Aug 13 13:36:45 2013 +0000
@@ -1,1 +1,1 @@
-https://mbed.org/users/Nim65s/code/niMQTT/#661892e00fe1
+https://mbed.org/users/Nim65s/code/niMQTT/#438958bb9df3