Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of SalesforceCaseGenerator by
Revision 12:8603f9ff1336, committed 2014-09-24
- Comitter:
- ansond
- Date:
- Wed Sep 24 18:52:45 2014 +0000
- Parent:
- 11:57f6f0f286c0
- Child:
- 13:1e06a3a4740d
- Commit message:
- updates for temp and lat/long inclusion into case
Changed in this revision
| SalesForceCaseGenerator.cpp | Show annotated file Show diff for this revision Revisions of this file |
| SalesForceCaseGenerator.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/SalesForceCaseGenerator.cpp Sun Sep 21 07:28:37 2014 +0000
+++ b/SalesForceCaseGenerator.cpp Wed Sep 24 18:52:45 2014 +0000
@@ -31,26 +31,33 @@
}
// create a case through APEX
- bool SalesForceCaseGenerator::createCase(char *subject,char *description) {
+ bool SalesForceCaseGenerator::createCase(char *subject,char *description,char *condition,int temperature,char *latitude,char *longitude) {
bool success = false;
// data buffer and result buffer
- char data[MAX_BUFFER_LENGTH+1];
char result[MAX_BUFFER_LENGTH+1];
- memset(data,0,MAX_BUFFER_LENGTH+1);
memset(result,0,MAX_BUFFER_LENGTH+1);
// set addl header information
char headers[] = "User-Agent: curl/7.33.0\nAccept: */*\n" ;
- // build the new SF case
- sprintf(data,"{\"subject\":\"%s\",\"description\":\"%s\"}",subject,description);
-
+ // build the new Salesforce.com report
+ MbedJSONValue report;
+ report["subject"] = subject;
+ report["description"] = description;
+ report["condition"] = condition;
+ report["temperature"] = temperature;
+ report["latitude"] = latitude;
+ report["longitude"] = longitude;
+
// covert to the HTTP data types
+ char data[MAX_BUFFER_LENGTH+1];
+ memset(data,0,MAX_BUFFER_LENGTH+1);
+ strcpy(data,report.serialize().c_str());
+ this->m_logger->log("Case JSON: %s",data);
HTTPJson new_case(data,strlen(data)+1);
HTTPText http_result(result,MAX_BUFFER_LENGTH);
- //this->m_http.basicAuth("<username>", "<password>");
this->m_http->setHeader(headers) ;
this->m_http->setSSLversion(1) ; /* TLSv1.0 */
@@ -68,7 +75,7 @@
this->m_logger->log("Case generation FAILED: %s",result);
}
else {
- this->m_logger->log("Failed to post case (%d)",ret);
+ this->m_logger->log("Failed to post case (%d) (%s)",ret,result);
}
// return our status
--- a/SalesForceCaseGenerator.h Sun Sep 21 07:28:37 2014 +0000
+++ b/SalesForceCaseGenerator.h Wed Sep 24 18:52:45 2014 +0000
@@ -32,7 +32,7 @@
virtual ~SalesForceCaseGenerator();
// create a case (via APEX)
- bool createCase(char *subject, char *description);
+ bool createCase(char *subject, char *description, char *condition, int temperature, char *latitude, char *longitude);
protected:
