Salesforce Case Generator for mbed

Revision:
10:ebdae744ee07
Parent:
9:6ab83a3326dc
Child:
11:57f6f0f286c0
--- a/SalesForceCaseGenerator.cpp	Fri Aug 29 03:39:15 2014 +0000
+++ b/SalesForceCaseGenerator.cpp	Fri Aug 29 04:23:25 2014 +0000
@@ -21,8 +21,9 @@
  #include "MbedJSONValue.h"
  
  // constructor
- SalesForceCaseGenerator::SalesForceCaseGenerator(ErrorHandler *logger) : m_http() {
+ SalesForceCaseGenerator::SalesForceCaseGenerator(ErrorHandler *logger,void *transport) {
      this->m_logger = logger;
+     this->m_http = (HTTPClient *)transport;
  }
  
  // destructor
@@ -50,13 +51,13 @@
      HTTPText http_result(result,BUFFER_LENGTH);
         
      //this->m_http.basicAuth("<username>", "<password>");
-     this->m_http.setHeader(headers) ;
-     this->m_http.setSSLversion(1) ; /* TLSv1.0 */
+     this->m_http->setHeader(headers) ;
+     this->m_http->setSSLversion(1) ; /* TLSv1.0 */
           
      // POST the case and check the response
      this->m_logger->log("Posting new Case...");
      this->m_logger->blinkTransportTxLED();
-     int ret = this->m_http.post(DF_CASE_GEN_URL,new_case,&http_result);
+     int ret = this->m_http->post(DF_CASE_GEN_URL,new_case,&http_result,7500);
      if (!ret) {
         this->m_logger->log("Parsing Reply...");
         success = this->contains(result,"status","ok");
@@ -64,10 +65,10 @@
         if (success) 
             this->m_logger->log("Case generation SUCCESS");
         else 
-            this->m_logger->log("Case generation FAILED");
+            this->m_logger->log("Case generation FAILED: %s",result);
      }
      else {
-        this->m_logger->log("Failed to post case");
+        this->m_logger->log("Failed to post case (%d)",ret);
      }
      
      // return our status