Own fork of MbedSmartRest

Dependents:   MbedSmartRestMain MbedSmartRestMain

Fork of MbedSmartRest by Cumulocity Official

Revision:
24:11fd6fd14c28
Parent:
23:0529d6779ab1
Child:
25:b8a080f5e578
--- 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"))