Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: C12832 hw4f HW4 MQTT
Fork of HW4 by
Diff: main.cpp
- Revision:
- 16:28d062c5522b
- Parent:
- 12:086a9314e8a5
- Child:
- 17:0811bdbdd78a
diff -r d8a31b66a85d -r 28d062c5522b main.cpp
--- 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);
}
