mbed.org implementation of the abstract SmartREST library for the Cumulocity Platform SmartREST protocol.

Dependents:   MbedSmartRestMain MbedSmartRestMain

Revision:
7:8159a2d12e4e
Parent:
6:cd7ba1ddb664
Child:
11:e1bee9a77652
--- a/SmartRest.cpp	Mon Jul 28 12:11:02 2014 +0200
+++ b/SmartRest.cpp	Wed Oct 22 16:17:22 2014 +0200
@@ -161,6 +161,13 @@
     _client.stop();
 }
 
+const char * SmartRest::getIdentifier()
+{
+    if (*_mogid)
+        return _mogid;
+    return _identifier;
+}
+
 uint8_t SmartRest::beginRequest(const char *overrideIdentifier)
 {
     int res;
@@ -174,11 +181,8 @@
     if (overrideIdentifier != NULL) {
         if (_client.sendIdentifier(overrideIdentifier) != CLIENT_OK)
             return SMARTREST_INTERNAL_ERROR;
-    } else if (strlen(_mogid)) {
-        if (_client.sendIdentifier(_mogid) != CLIENT_OK)
-            return SMARTREST_INTERNAL_ERROR;
     } else {
-        if (_client.sendIdentifier(_identifier) != CLIENT_OK)
+        if (_client.sendIdentifier(getIdentifier()) != CLIENT_OK)
             return SMARTREST_INTERNAL_ERROR;
     }
     return SMARTREST_SUCCESS;