Yield function call with timeout works, there was an issue with blockant socket.
Fork of HelloMQTT by
Revision 16:28d062c5522b, committed 2014-10-06
- Comitter:
- icraggs
- Date:
- Mon Oct 06 11:42:25 2014 +0000
- Parent:
- 15:d8a31b66a85d
- Child:
- 17:0811bdbdd78a
- Commit message:
- Update to latest MQTT library - change some pointers to references
Changed in this revision
MQTT.lib | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/MQTT.lib Fri Aug 01 23:46:08 2014 +0000 +++ b/MQTT.lib Mon Oct 06 11:42:25 2014 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/teams/mqtt/code/MQTT/#9623a2c9c8ac +http://mbed.org/teams/mqtt/code/MQTT/#c299463ae853
--- a/main.cpp Fri Aug 01 23:46:08 2014 +0000 +++ b/main.cpp Mon Oct 06 11:42:25 2014 +0000 @@ -69,7 +69,7 @@ data.clientID.cstring = "mbed-sample"; data.username.cstring = "testuser"; data.password.cstring = "testpassword"; - if ((rc = client.connect(&data)) != 0) + if ((rc = client.connect(data)) != 0) lcd.printf("rc from MQTT connect is %d\n", rc); if ((rc = client.subscribe(topic, MQTT::QOS1, messageArrived)) != 0) @@ -85,7 +85,7 @@ message.dup = false; message.payload = (void*)buf; message.payloadlen = strlen(buf)+1; - rc = client.publish(topic, &message); + rc = client.publish(topic, message); while (arrivedcount < 1) client.yield(100); @@ -93,7 +93,7 @@ sprintf(buf, "Hello World! QoS 1 message from app version %f\n", version); message.qos = MQTT::QOS1; message.payloadlen = strlen(buf)+1; - rc = client.publish(topic, &message); + rc = client.publish(topic, message); while (arrivedcount < 2) client.yield(100); @@ -101,7 +101,7 @@ sprintf(buf, "Hello World! QoS 2 message from app version %f\n", version); message.qos = MQTT::QOS2; message.payloadlen = strlen(buf)+1; - rc = client.publish(topic, &message); + rc = client.publish(topic, message); while (arrivedcount < 3) client.yield(100); @@ -111,7 +111,7 @@ sprintf(buf, "Hello World! QoS 2 message number %d from app version %f\n", i, version); message.qos = MQTT::QOS2; message.payloadlen = strlen(buf)+1; - rc = client.publish(topic, &message); + rc = client.publish(topic, message); while (arrivedcount < i + 3) client.yield(100); }