Core Base Classes for the Light Endpoints

Dependencies:   BufferedSerial

Dependents:   mbed_mqtt_endpoint_ublox_ethernet mbed_mqtt_endpoint_ublox_cellular mbed_nsp_endpoint_ublox_cellular mbed_nsp_endpoint_ublox_ethernet ... more

Revision:
183:2f586f91ff23
Parent:
177:fa93eacedd3d
Child:
192:54b758a8eaaa
--- a/HTTPTransport.cpp	Sat Sep 13 02:56:10 2014 +0000
+++ b/HTTPTransport.cpp	Sat Sep 13 04:27:19 2014 +0000
@@ -45,19 +45,24 @@
  // default destructor
  HTTPTransport::~HTTPTransport() {
  }
+ 
+ // Basic Auth
+ void HTTPTransport::basicAuth(char *username,char *pw) { this->m_http->basicAuth(username,pw); }
          
  // HTTP Get
- bool HTTPTransport::httpGet(char *url,char *result,int result_length) {
+ bool HTTPTransport::httpGet(char *url,char *result,int result_length,int timeout) {
     this->logger()->blinkTransportTxLED();
  #ifdef NETWORK_MUTEX
     if (network_mutex != NULL) network_mutex->lock();
  #endif
-    int status = this->m_http->get(url,result,result_length);
+    int status = 0;
+    if (timeout > 0) status = this->m_http->get(url,result,result_length,timeout);
+    else status = this->m_http->get(url,result,result_length);
  #ifdef NETWORK_MUTEX
     if (network_mutex != NULL) network_mutex->unlock();
  #endif
     this->logger()->blinkTransportRxLED();
-    this->logger()->log("httpGet: Status: %d",status);
+    //this->logger()->log("httpGet: Status: %d",status);
     return (status == 0);
  }
  
@@ -74,7 +79,7 @@
      if (network_mutex != NULL) network_mutex->unlock();
  #endif
      this->logger()->blinkTransportRxLED();
-     this->logger()->log("httpPut: Status: %d",status);
+     //this->logger()->log("httpPut: Status: %d",status);
      return (status == 0);
  }
  
@@ -91,7 +96,7 @@
      if (network_mutex != NULL) network_mutex->unlock();
  #endif
      this->logger()->blinkTransportRxLED();
-     this->logger()->log("httpPost: Status: %d",status);
+     //this->logger()->log("httpPost: Status: %d",status);
      return (status == 0);
  }
  
@@ -107,6 +112,6 @@
      if (network_mutex != NULL) network_mutex->unlock();
  #endif
      this->logger()->blinkTransportRxLED();
-     this->logger()->log("httpDelete: Status: %d",status);
+     //this->logger()->log("httpDelete: Status: %d",status);
      return (status == 0);
  }
\ No newline at end of file