IBM IoT example

Dependencies:   C12832 EthernetInterface LM75B MMA7660 MQTT mbed-rtos mbed

Fork of IBMIoTClientEthernetExample by IBM Watson IoT

Files at this revision

API Documentation at this revision

Comitter:
chris
Date:
Thu Jul 09 14:35:57 2015 +0000
Parent:
11:7a6df9a2dcdc
Child:
13:85801e3b83d3
Commit message:
Updated mbed-RTOS, Ethernet Interface and mbed library. Updates main.cpp to add threaded LED control and removed conditional compilation

Changed in this revision

EthernetInterface.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
mbed-rtos.lib Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- a/EthernetInterface.lib	Tue Mar 10 08:24:52 2015 +0000
+++ b/EthernetInterface.lib	Thu Jul 09 14:35:57 2015 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/EthernetInterface/#5887ae6c0c2c
+http://mbed.org/users/mbed_official/code/EthernetInterface/#2fc406e2553f
--- a/main.cpp	Tue Mar 10 08:24:52 2015 +0000
+++ b/main.cpp	Thu Jul 09 14:35:57 2015 +0000
@@ -30,7 +30,7 @@
 #include "rtos.h"
 
 // Update this to the next number *before* a commit
-#define __APP_SW_REVISION__ "10"
+#define __APP_SW_REVISION__ "11"
 
 // Configuration values needed to connect to IBM IoT Cloud
 #define ORG "quickstart"             // For a registered connection, replace with your org
@@ -250,11 +250,8 @@
         
     while (connect(client, ipstack) != 0) 
     {    
-#if defined(TARGET_K64F)
-        red();
-#else
         Thread red_thread(flashing_red);
-#endif
+
         int timeout = getConnTimeout(++retryAttempt);
         WARN("Retry attempt number %d waiting %d\n", retryAttempt, timeout);
         
@@ -290,29 +287,7 @@
 }
 
 
-#if defined(TARGET_K64F)
-int getUUID48(char* buf, int buflen) 
-{
-    unsigned int UUID_LOC_WORD0 = 0x40048060;
-    unsigned int UUID_LOC_WORD1 = 0x4004805C;
- 
-    // Fetch word 0
-    uint32_t word0 = *(uint32_t *)UUID_LOC_WORD0;
- 
-    // Fetch word 1
-    // we only want bottom 16 bits of word1 (MAC bits 32-47)
-    // and bit 9 forced to 1, bit 8 forced to 0
-    // Locally administered MAC, reduced conflicts
-    // http://en.wikipedia.org/wiki/MAC_address
-    uint32_t word1 = *(uint32_t *)UUID_LOC_WORD1;
-    word1 |= 0x00000200;
-    word1 &= 0x0000FEFF;
- 
-    int rc = snprintf(buf, buflen, "%4x%08x", word1, word0);   // Device id must be in lower case
-    
-    return rc;
-}
-#else
+
 char* getMac(EthernetInterface& eth, char* buf, int buflen)    // Obtain MAC address
 {   
     strncpy(buf, eth.getMACAddress(), buflen);
@@ -322,7 +297,7 @@
         memmove(pos, pos + 1, strlen(pos) + 1);
     return buf;
 }
-#endif
+
 
 
 void messageArrived(MQTT::MessageData& md)
@@ -368,22 +343,14 @@
     led2 = LED2_OFF; // K64F: turn off the main board LED 
     
     displayMessage("Connecting");
-#if defined(TARGET_K64F)
-    yellow();  // Don't flash on the K64F, because starting a thread causes the EthernetInterface init call to hang
-#else
     Thread yellow_thread(flashing_yellow);  
-#endif
-    
+    printf("connecting...");
     MQTTEthernet ipstack;
     MQTT::Client<MQTTEthernet, Countdown, MQTT_MAX_PACKET_SIZE> client(ipstack);
     
     if (quickstartMode)
     {
-#if defined(TARGET_K64F)
-        getUUID48(id, sizeof(id));  // getMac doesn't work on the K64F
-#else
         getMac(ipstack.getEth(), id, sizeof(id));
-#endif
     }
     
     attemptConnect(&client, &ipstack);
--- a/mbed-rtos.lib	Tue Mar 10 08:24:52 2015 +0000
+++ b/mbed-rtos.lib	Thu Jul 09 14:35:57 2015 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed-rtos/#aaa1b2c7c64c
+http://mbed.org/users/mbed_official/code/mbed-rtos/#a21475017ae2
--- a/mbed.bld	Tue Mar 10 08:24:52 2015 +0000
+++ b/mbed.bld	Thu Jul 09 14:35:57 2015 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/552587b429a1
\ No newline at end of file
+http://mbed.org/users/mbed_official/code/mbed/builds/da0ca467f8b5
\ No newline at end of file