Official reference client implementation for Cumulocity SmartREST on u-blox C027.

Dependencies:   C027_Support C12832 LM75B MMA7660 MbedSmartRest mbed-rtos mbed

Fork of MbedSmartRestMain by Vincent Wochnik

Files at this revision

API Documentation at this revision

Comitter:
xinlei
Date:
Wed May 13 15:00:24 2015 +0000
Parent:
109:2ec12f10ebf4
Child:
111:ee9ae4a5e55c
Commit message:
small fix for when there are no pending operations

Changed in this revision

DeviceBootstrap.cpp Show annotated file Show diff for this revision Revisions of this file
DeviceBootstrap.h Show annotated file Show diff for this revision Revisions of this file
DeviceIntegration.cpp 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
operation/OperationSupport.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/DeviceBootstrap.cpp	Wed May 13 13:54:17 2015 +0000
+++ b/DeviceBootstrap.cpp	Wed May 13 15:00:24 2015 +0000
@@ -28,13 +28,6 @@
 
 bool DeviceBootstrap::setUpCredentials()
 {
-//    if ((*_username == '\0' || *_password == '\0') &&
-//        (!obtainFromStorage())) {
-//        if (!obtainFromPlatform())
-//            return false;
-//        if (!writeToStorage())
-//            aError("Can not write credentials!\n");
-//    }
     if (loadCredential(_username, _password, CREDENTIAL_LENGTH)) {
         return true;
     } else if (obtainFromPlatform()) {
@@ -46,21 +39,6 @@
     }
 }
 
-const char * DeviceBootstrap::username()
-{
-    return _username;
-}
-
-const char * DeviceBootstrap::password()
-{
-    return _password;
-}
-
-bool DeviceBootstrap::obtainFromStorage()
-{
-    return loadCredential(_username, _password, CREDENTIAL_LENGTH);
-}
-
 bool DeviceBootstrap::obtainFromPlatform()
 {
     ComposedRecord record;
@@ -111,11 +89,6 @@
     return false;
 }
 
-bool DeviceBootstrap::writeToStorage()
-{
-    return saveCredential(_username, _password, CREDENTIAL_LENGTH);
-}
-
 void DeviceBootstrap::setCredentials(const char *tenant, const char *username, const char *password)
 {
     *_username = '\0';
--- a/DeviceBootstrap.h	Wed May 13 13:54:17 2015 +0000
+++ b/DeviceBootstrap.h	Wed May 13 15:00:24 2015 +0000
@@ -13,15 +13,13 @@
     DeviceBootstrap(AbstractSmartRest&, DeviceInfo&);
 
     bool setUpCredentials();
-    const char * username();
-    const char * password();
+    const char* username() const { return _username; }
+    const char* password() const { return _password; }
 
 protected:
-    bool obtainFromStorage();
     bool obtainFromPlatform();
 
 private:
-    bool writeToStorage();
     void setCredentials(const char *, const char*, const char*);
 
 private:
--- a/DeviceIntegration.cpp	Wed May 13 13:54:17 2015 +0000
+++ b/DeviceIntegration.cpp	Wed May 13 15:00:24 2015 +0000
@@ -8,11 +8,11 @@
 
 DeviceIntegration::DeviceIntegration(AbstractSmartRest& client, SmartRestTemplate& tpl,
     DeviceInfo& deviceInfo) :
+    _init(false),
     _tpl(tpl),
     _client(client),
     _deviceInfo(deviceInfo)
 {
-    _init = false;
 }
 
 bool DeviceIntegration::init()
--- a/mbed.bld	Wed May 13 13:54:17 2015 +0000
+++ b/mbed.bld	Wed May 13 15:00:24 2015 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/8ab26030e058
\ No newline at end of file
+http://mbed.org/users/mbed_official/code/mbed/builds/dbbf35b96557
\ No newline at end of file
--- a/operation/OperationSupport.cpp	Wed May 13 13:54:17 2015 +0000
+++ b/operation/OperationSupport.cpp	Wed May 13 15:00:24 2015 +0000
@@ -81,7 +81,9 @@
                 } else
                         break;
         }
-        if (i >= N)
+        if (i == 0)
+                return true;
+        else if (i >= N)
                 aWarning("Over %u pending operations.\n", N);
         ControlParser cp(opool);
         bool flag = true;