SmartREST client reference implementation for the u-blox C027 mbed compatible device.

Dependencies:   C027 C027_Support mbed mbed-rtos MbedSmartRest LM75B MMA7660 C12832

Fork of MbedSmartRestTest by Vincent Wochnik

Revision:
10:d5cd4a7ada7b
Parent:
9:5e182f6e5e9b
Child:
11:6f8f70a6dd46
--- a/program.cpp	Wed Feb 12 12:23:41 2014 +0000
+++ b/program.cpp	Wed Feb 12 12:52:48 2014 +0000
@@ -88,18 +88,22 @@
 
     if (client.send(newMoRec) != SMARTREST_SUCCESS) {
         puts("Send failed.");
+        client.stop();
         return 0;
     }
 
     if (client.receive(received) != SMARTREST_SUCCESS) {
         puts("No device found.");
+        client.stop();
         return 0;
     }
 
     if (received.values() == 0) {
         puts("Received no values.");
+        client.stop();
         return 0;
     }
+
     if (received.value(0).integerValue() == 50) {
         client.stop();
         return 0;
@@ -107,6 +111,7 @@
     
     if (received.value(0).integerValue() != 200) {
         puts("Bad response.");
+        client.stop();
         return 0;
     }
 
@@ -125,21 +130,25 @@
 
     if (client.send(newMoRec) != SMARTREST_SUCCESS) {
         puts("Send failed.");
+        client.stop();
         return 0;
     }
 
     if (client.receive(received) != SMARTREST_SUCCESS) {
         puts("No device found.");
+        client.stop();
         return 0;
     }
 
     if (received.values() != 3) {
         puts("Bad received data.");
+        client.stop();
         return 0;
     }
     
     if (received.value(0).integerValue() != 201) {
         puts("Bad received data.");
+        client.stop();
         return 0;
     }
 
@@ -158,21 +167,25 @@
 
     if (client.send(newMoRec) != SMARTREST_SUCCESS) {
         puts("Sending failed.");
+        client.stop();
         return false;
     }
 
     if (client.receive(received) != SMARTREST_SUCCESS) {
         puts("Failed.");
+        client.stop();
         return false;
     }
 
     if (received.values() != 3) {
         puts("Received bad data.");
+        client.stop();
         return false;
     }
     
     if (received.value(0).integerValue() != 200) {
         puts("Received bad data.");
+        client.stop();
         return false;
     }
 
@@ -191,21 +204,25 @@
 
     if (client.send(newMoRec) != SMARTREST_SUCCESS) {
         puts("Send failed.");
+        client.stop();
         return false;
     }
 
     if (client.receive(received) != SMARTREST_SUCCESS) {
         puts("Update failed.");
+        client.stop();
         return false;
     }
 
     if (received.values() != 3) {
         puts("Bad received data.");
+        client.stop();
         return false;
     }
     
     if (received.value(0).integerValue() != 201) {
         puts("Bad received data.");
+        client.stop();
         return false;
     }
 
@@ -230,9 +247,10 @@
 
     if (client.send(newMoRec) != SMARTREST_SUCCESS) {
         puts("Send failed.");
+        client.stop();
         return false;
     }
 
     client.stop();
     return true;
-}
\ No newline at end of file
+}