Commit b18d9b3e by Adi Amir

publish startTime & endTime to public-safety

parent 4cdc3108
Showing with 18 additions and 5 deletions
...@@ -29,6 +29,7 @@ import java.io.InputStream; ...@@ -29,6 +29,7 @@ import java.io.InputStream;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.text.DecimalFormat;
import java.util.Deque; import java.util.Deque;
import java.util.Map; import java.util.Map;
...@@ -239,10 +240,22 @@ public class GEManager { ...@@ -239,10 +240,22 @@ public class GEManager {
logger.info("getSensorDetails() activated. camId=" + sensorId); logger.info("getSensorDetails() activated. camId=" + sensorId);
// execute the request ... // execute the request ...
// envType
String envType = requestContext.getParameter("envType"); String envType = requestContext.getParameter("envType");
Long tsEndTime = System.currentTimeMillis(); if (envType == null)
Long tsStartTime = tsEndTime - ONE_DAY_IN_MILLI_SECS; return errorResponse("missing mandatory parameter: envType");
req = buildSensorDetailsRequest(sensorId, envType, tsStartTime,tsEndTime); // endTime
String endTime = requestContext.getParameter("endTime"); //System.currentTimeMillis(); // 1486758673000L;
if (endTime == null)
return errorResponse("missing mandatory parameter: endTime");
Long tsEndTime = Long.parseLong(endTime);
// start time
String startTime = requestContext.getParameter("startTime"); //tsEndTime - ONE_DAY_IN_MILLI_SECS; //1486755073000L;
if (startTime == null)
return errorResponse("missing mandatory parameter: startTime");
Long tsStartTime = Long.parseLong(startTime);
req = buildSensorDetailsRequest(sensorId, envType, tsStartTime, tsEndTime);
try { try {
httpResp = httpClient.processRequest(req); httpResp = httpClient.processRequest(req);
if(httpResp.getStatusCode() == 200) if(httpResp.getStatusCode() == 200)
...@@ -274,8 +287,8 @@ public class GEManager { ...@@ -274,8 +287,8 @@ public class GEManager {
// query string // query string
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("eventType=").append(envType).append("&") sb.append("eventType=").append(envType).append("&")
.append("startTime=").append(1486755073000L).append("&") .append("startTime=").append(tsStartTime).append("&")
.append("endTime=").append(1486758673000L); .append("endTime=").append(tsEndTime);
String queryStr = sb.toString(); String queryStr = sb.toString();
request.setQueryString(queryStr); request.setQueryString(queryStr);
request.addHeader("Authorization", "Bearer " + TOKEN); request.addHeader("Authorization", "Bearer " + TOKEN);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment