Rev 1.0 4/26/2016 Paul Jaeger - Multitech, Brian Huey - Sprint Changed post interval to 2000ms added temp, analoguv and pressure to http post added alias: TEMP ANALOG-UV PRESSURE concatenated http post, to post all within the same routine and check for error after the post confirmed that data is published to Exosite
Dependencies: MbedJSONValue mbed mtsas
Fork of UUU_MultiTech_Dragonfly_Sprint by
Diff: main.cpp
- Revision:
- 12:9942995476ef
- Parent:
- 11:d2ac3fa6f2d3
- Child:
- 13:cc2f24b260ab
--- a/main.cpp Tue Apr 19 14:21:51 2016 +0000 +++ b/main.cpp Tue Apr 26 16:21:12 2016 +0000 @@ -47,6 +47,16 @@ Additional Resources: ROHM Sensor Shield GitHub Repository: https://github.com/ROHMUSDC/ROHM_SensorPlatform_Multi-Sensor-Shield + +Rev 1.0 4/26/2016 Paul Jaeger - Multitech, Brian Huey - Sprint + Changed post interval to 2000ms + added temp, analoguv and pressure to http post + added alias: + TEMP + ANALOG-UV + PRESSURE + concatenated http post, to post all within the same routine and check for error after the post + confirmed that data is published to Exosite */ @@ -55,7 +65,7 @@ #include <string> #include <sstream> -#define EXOSITE_CIK "1e05228e50762cc29cf414bc518259a3ab5dc247" +#define EXOSITE_CIK "41de7cf671184e2838c8f185e8aa60ed1c07639e" char EXOSITE_HEADER[] = "X-Exosite-CIK: " EXOSITE_CIK "\r\nAccept: application/x-www-form-urlencoded; charset=utf-8\r\n"; const char EXOSITE_URL[] = "https://m2.exosite.com:443/onep:v1/stack/alias"; @@ -91,7 +101,7 @@ // misc variables static char wall_of_dash[] = "--------------------------------------------------"; -static int post_interval_ms = 30000; +static int post_interval_ms = 2000; /* was set to 30000, but huey changed to 2000 */ int debug_baud = 115200; @@ -401,23 +411,42 @@ //*******************************************************************************************************/ if (radio->connect()) { - int sensor_data = RPR0521_ALS[0]; + int sensor_data_light = RPR0521_ALS[0]; + int sensor_data_temp = BM1383[0] ; + int sensor_data_analoguv = ML8511_output; + int sensor_data_pressure = BM1383[1]; + logDebug("posting sensor data"); - logDebug("%d",sensor_data); - - std::string sensor_data_str = patch::to_string(sensor_data); - logDebug("Sensor data string: %s",sensor_data_str.c_str()); - - http_tx.clear(); - http_tx.put("ALS", sensor_data_str.c_str()); + logDebug("%d",sensor_data_light); + logDebug("%d",sensor_data_temp); + logDebug("%d",sensor_data_analoguv); + logDebug("%d",sensor_data_pressure); + + std::string sensor_data_light_str = patch::to_string(sensor_data_light); + logDebug("Sensor data string: %s",sensor_data_light_str.c_str()); + std::string sensor_data_temp_str = patch::to_string(sensor_data_temp); + logDebug("Sensor temp data string: %s",sensor_data_temp_str.c_str()); + std::string sensor_data_analoguv_str = patch::to_string(sensor_data_analoguv); + logDebug("Sensor analoguv data string: %s",sensor_data_analoguv_str.c_str()); + std::string sensor_data_pressure_str = patch::to_string(sensor_data_pressure); + logDebug("Sensor pressure data string: %s",sensor_data_pressure_str.c_str()); // Make HTTP POST request + http_tx.clear(); + http_tx.put("ALS", sensor_data_light_str.c_str()); + http_tx.put("TEMP", sensor_data_temp_str.c_str()); + http_tx.put("ANALOG-UV", sensor_data_analoguv_str.c_str()); + http_tx.put("PRESSURE", sensor_data_pressure_str.c_str()); + + // Check HTTP Post Result result = http.post(EXOSITE_URL, http_tx, &http_rx); if (result != HTTP_OK) { logError("HTTP POST failed [%d][%s]", result, httpResToStr(result)); } else { logInfo("HTTP POST succeeded [%d]\r\n%s", http.getHTTPResponseCode(), http_rx_buf); } + + radio->disconnect(); } else {