Skip to content

Commit

Permalink
Supporting latest HTTP lib for sample POST
Browse files Browse the repository at this point in the history
  • Loading branch information
johnmckerrell committed Sep 26, 2012
1 parent 6f6aaec commit fed922f
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions YAHMS_Sampler.cpp
Expand Up @@ -41,8 +41,10 @@ FLASH_STRING(SUBMITTING_SAMPLES_TO,"Submitting samples to http://");
FLASH_STRING(HTTP_SUBMIT_CONNECTION_FAILED,"HTTP Connection Failed\n");
FLASH_STRING(HTTP_SUBMIT_REQUEST_FAILED,"HTTP Request Failed with: ");
#endif
FLASH_STRING(CONTENT_LENGTH,"Content-Length: ");
FLASH_STRING(SAMPLE_CONTENT_TYPE,"Content-Type: application/x-www-form-urlencoded");
//FLASH_STRING(CONTENT_LENGTH,"Content-Length: ");
//FLASH_STRING(SAMPLE_CONTENT_TYPE,"Content-Type: application/x-www-form-urlencoded");
#define CONTENT_LENGTH "Content-Length"
#define SAMPLE_CONTENT_TYPE "Content-Type: application/x-www-form-urlencoded"

unsigned long int lastSampleSubmission = 0;
byte samplesBeforeSubmit = NUM_SAMPLES * 2;
Expand Down Expand Up @@ -207,17 +209,21 @@ void CheckAndSubmitSamples() {
Serial.print(YAHMS_SERVER);
Serial.println(configPath);
#endif
http.beginRequest();
if (http.post(YAHMS_SERVER, 80, configPath, USERAGENT) == 0)
{
// Request sent okay
#ifdef LOGGING
CONTENT_LENGTH.print(Serial);
Serial.println(contentLength);
#endif
CONTENT_LENGTH.print(http);
http.println(contentLength);
SAMPLE_CONTENT_TYPE.print(http);
http.println();
// #ifdef LOGGING
// CONTENT_LENGTH.print(Serial);
// Serial.println(contentLength);
// #endif
// CONTENT_LENGTH.print(http);
// http.println(contentLength);
// SAMPLE_CONTENT_TYPE.print(http);
// http.println();
http.sendHeader(CONTENT_LENGTH,contentLength);
http.sendHeader(SAMPLE_CONTENT_TYPE);
http.endRequest();

for (int i = 0; i < NUM_ANALOG_PINS; ++i) {
if (submitSamples[i] != -1) {
Expand Down

0 comments on commit fed922f

Please sign in to comment.