IBM IoT Client Example with extra debug in the menu.
Dependencies: C12832 EthernetInterface LM75B MMA7660 MQTT mbed-rtos mbed
Fork of IBMIoTClientEthernetExample-MACfix by
Revision 16:b4dbbe57d453, committed 2015-08-13
- Comitter:
- jsutton
- Date:
- Thu Aug 13 09:37:49 2015 +0000
- Parent:
- 15:09458079f4bb
- Commit message:
- Stop the menu from flashing
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 09458079f4bb -r b4dbbe57d453 main.cpp --- a/main.cpp Mon Jul 27 09:03:30 2015 +0000 +++ b/main.cpp Thu Aug 13 09:37:49 2015 +0000 @@ -249,13 +249,8 @@ void menu_loop(void const *args) { - int count = 0; while(true){ setMenu(); - if(++count % 10 == 0) - { - printMenu(menuItem); - } Thread::wait(100); } @@ -284,6 +279,7 @@ EthernetInterface& eth = ipstack->getEth(); ip_addr = eth.getIPAddress(); gateway_addr = eth.getGateway(); + printMenu(menuItem); // Construct clientId - d:org:type:id char clientId[strlen(org) + strlen(type) + strlen(id) + 5]; @@ -301,6 +297,7 @@ LOG("=====================================\n"); netConnecting = true; + printMenu(menuItem); int rc = ipstack->connect(hostname, IBM_IOT_PORT, connectTimeout); if (rc != 0){ WARN("IP Stack returned: %d\n", rc); @@ -308,10 +305,12 @@ } netConnected = true; netConnecting = false; + printMenu(menuItem); // MQTT Connect mqttConnecting = true; + printMenu(menuItem); MQTTPacket_connectData data = MQTTPacket_connectData_initializer; data.MQTTVersion = 3; data.clientID.cstring = clientId; @@ -325,6 +324,7 @@ if ((rc = client->connect(data)) == 0) { connected = true; + printMenu(menuItem); green(); displayMessage("Connected"); wait(1); @@ -332,6 +332,7 @@ } mqttConnecting = false; + printMenu(menuItem); return rc; } @@ -347,6 +348,7 @@ { connected = false; + printMenu(menuItem); // make sure a cable is connected before starting to connect while (!linkStatus()) { @@ -455,6 +457,7 @@ LOG("***** IBM IoT Client Ethernet Example *****\n"); MQTTEthernet ipstack; ethernetInitialising = false; + printMenu(menuItem); MQTT::Client<MQTTEthernet, Countdown, MQTT_MAX_PACKET_SIZE> client(ipstack); LOG("Ethernet Initialised.\n");