Own fork of MbedSmartRest

Dependents:   MbedSmartRestMain MbedSmartRestMain

Fork of MbedSmartRest by Cumulocity Official

Files at this revision

API Documentation at this revision

Comitter:
xinlei
Date:
Thu May 07 09:57:32 2015 +0000
Parent:
23:0529d6779ab1
Child:
25:b8a080f5e578
Commit message:
In the process of deprecation.

Changed in this revision

AbstractSmartRest.h Show annotated file Show diff for this revision Revisions of this file
MbedClient.cpp Show annotated file Show diff for this revision Revisions of this file
SmartRest.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/AbstractSmartRest.h	Mon Apr 27 13:02:37 2015 +0000
+++ b/AbstractSmartRest.h	Thu May 07 09:57:32 2015 +0000
@@ -145,12 +145,6 @@
 		 * Closes the connection.
 		 */
 		virtual void stop() = 0;
-
-		/*
-		 * Retrieves the template identifier.
-		 * @return template identifier
-		 */
-//		virtual const char * getIdentifier() const = 0;
 };
 
 #endif
--- a/MbedClient.cpp	Mon Apr 27 13:02:37 2015 +0000
+++ b/MbedClient.cpp	Thu May 07 09:57:32 2015 +0000
@@ -42,8 +42,9 @@
 #define STATE_REQ_COMPLETE 4
 #define STATE_RECVD_RESPONSE 5
 #define STATE_INTERNAL_ERROR 6
+
 #define MBCL_DBG(...) aDebug(__VA_ARGS__)
-//#define MBCL_DBG(fmt, ...)
+
 #define DNS_ENTRY_DURATION 50
 
 MbedClient::MbedClient(uint8_t tries) :
@@ -199,16 +200,16 @@
     uint8_t tries = _tries;
     do {
         if (cachedIPValid == 0) {
-            MDMParser::IP ip = pMdm->gethostbyname(getHost());
+            MDMParser::IP ip = pMdm->gethostbyname(srHost);
             if (ip == NOIP)
                 continue;
             const unsigned char *c = (const unsigned char*)&ip;
             snprintf(cachedIP, sizeof(cachedIP), "%u.%u.%u.%u", c[3], c[2], c[1], c[0]);
-            aInfo("\033[32mThread %p:\033[39m Connect to %s:%u (IP: %s)\n", Thread::gettid(), getHost(), getPort(), cachedIP);
+            aInfo("\033[32mThread %p:\033[39m Connect to %s:%d (IP: %s)\n", Thread::gettid(), srHost, ::srPort, cachedIP);
         } else {
-            aDebug("\033[32mMThread %p:\033[39m Connect to %s:%u\n", Thread::gettid(), cachedIP, getPort());
+            aDebug("\033[32mMThread %p:\033[39m Connect to %s:%d\n", Thread::gettid(), cachedIP, ::srPort);
         }
-        if (_sock.connect(cachedIP, getPort()) >= 0)
+        if (_sock.connect(cachedIP, ::srPort) >= 0)
             break;
         cachedIPValid = 0;
         _sock.close();
@@ -231,7 +232,7 @@
         (!send(uri)) ||
         (!send(" HTTP/1.0\r\n")) ||
         (!send("Host: ")) ||
-        (!send(getHost())) ||
+        (!send(srHost)) ||
         (!send("\r\n")))
         return false;
     
@@ -241,8 +242,8 @@
 bool MbedClient::sendBasicAuth()
 {
     // no need to send authorization if not specified
-    const char* _username = getUsername();
-    const char* _password = getPassword();
+    const char* _username = srUsername;
+    const char* _password = srPassword;
     if ((_username == NULL) || (strlen(_username) == 0) ||
         (_password == NULL) || (strlen(_password) == 0))
         return true;
@@ -250,7 +251,7 @@
     if (!send("Authorization: Basic "))
         return false;
 
-    if (!send(getAuthStr()))
+    if (!send(srAuthStr))
         return false;
 
     if (!send("\r\n"))
--- a/SmartRest.cpp	Mon Apr 27 13:02:37 2015 +0000
+++ b/SmartRest.cpp	Thu May 07 09:57:32 2015 +0000
@@ -185,7 +185,7 @@
         if (_client.sendIdentifier(overrideIdentifier) != CLIENT_OK)
             return SMARTREST_INTERNAL_ERROR;
     } else {
-        if (_client.sendIdentifier(::getIdentifier()) != CLIENT_OK)
+        if (_client.sendIdentifier(srX_ID) != CLIENT_OK)
             return SMARTREST_INTERNAL_ERROR;
     }
     return SMARTREST_SUCCESS;