mbed based IoT Gateway More details http://blog.thiseldo.co.uk/wp-filez/IoTGateway.pdf
Dependencies: NetServices FatFileSystem csv_parser mbed MQTTClient RF12B DNSResolver SDFileSystem
Diff: Outputs/OutputPachube.cpp
- Revision:
- 5:0dbc27a7af55
- Parent:
- 4:d460406ac780
--- a/Outputs/OutputPachube.cpp Tue May 01 21:43:40 2012 +0000 +++ b/Outputs/OutputPachube.cpp Wed May 09 20:29:30 2012 +0000 @@ -70,7 +70,7 @@ int OutputPachube::send( void ) { - char urlBuf[64]; + char urlBuf[API_URL_LENGTH]; HTTPClient http; if ( strlen( dataBuffer ) > 1 ) { @@ -81,24 +81,25 @@ csvContent.set(std::string(dataBuffer)); // uri for post includes feed ID and datastream ID - snprintf(urlBuf, 64, PACHUBE_URL, currentFeed ); - printf("URL: %s\n",urlBuf); + snprintf(urlBuf, API_URL_LENGTH, apiUrl, currentFeed ); +// printf("URL: %s\n",urlBuf); activityLED = 1; // result should be 0 and response should be 200 for successful post - printf("Pachube Send count %d\n", ++sendCount); + sendCount++; +// printf("Pachube Send count %d\n", sendCount); - printf("\nHEAP STATS\n"); +/* printf("\nHEAP STATS\n"); __heapstats((__heapprt)fprintf,stderr); printf("\nHEAP CHECK\n"); __heapvalid((__heapprt)fprintf,stderr, 0); printf("\nStackP: %ld\n",__current_sp()); printf("---------------\n"); - +*/ HTTPResult result = http.post(urlBuf, csvContent, NULL); int response = http.getHTTPResponseCode(); - printf("updateDataStream(%d)\n", response ); +// printf("updateDataStream(%d)\n", response ); activityLED = 0; } @@ -109,3 +110,6 @@ } +int OutputPachube::getSendCount( void ) { + return sendCount; +}