|
|
@ -142,15 +142,10 @@ public class ControllerService {
|
|
|
|
@POST
|
|
|
|
@POST
|
|
|
|
@Consumes(MediaType.APPLICATION_JSON)
|
|
|
|
@Consumes(MediaType.APPLICATION_JSON)
|
|
|
|
public void pushData(final DeviceJSON agentInfo, @Context HttpServletResponse response) {
|
|
|
|
public void pushData(final DeviceJSON agentInfo, @Context HttpServletResponse response) {
|
|
|
|
String owner = agentInfo.owner;
|
|
|
|
if (!ServiceUtils.publishToDASSensorValue(agentInfo.owner, agentInfo.deviceId, agentInfo.sensorValue)) {
|
|
|
|
String deviceId = agentInfo.deviceId;
|
|
|
|
|
|
|
|
float pinData = agentInfo.sensorValue;
|
|
|
|
|
|
|
|
log.warn(pinData);
|
|
|
|
|
|
|
|
log.warn(String.valueOf(pinData));
|
|
|
|
|
|
|
|
if (!ServiceUtils.publishToDASSensorValue(agentInfo.owner, agentInfo.deviceId, pinData)) {
|
|
|
|
|
|
|
|
response.setStatus(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode());
|
|
|
|
response.setStatus(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode());
|
|
|
|
log.warn("An error occurred whilst trying to publish pin data of go Data with ID [" + deviceId +
|
|
|
|
log.warn("An error occurred whilst trying to publish pin data of go Data with ID [" + agentInfo.deviceId +
|
|
|
|
"] of owner [" + owner + "]");
|
|
|
|
"] of owner [" + agentInfo.owner + "]");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -170,7 +165,6 @@ public class ControllerService {
|
|
|
|
@Context HttpServletResponse response) {
|
|
|
|
@Context HttpServletResponse response) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
mqttConnector.sendCommandViaMQTT(owner, deviceId, "Sensor:", state.toUpperCase());
|
|
|
|
mqttConnector.sendCommandViaMQTT(owner, deviceId, "Sensor:", state.toUpperCase());
|
|
|
|
|
|
|
|
|
|
|
|
response.setStatus(Response.Status.OK.getStatusCode());
|
|
|
|
response.setStatus(Response.Status.OK.getStatusCode());
|
|
|
|
} catch (DeviceManagementException e) {
|
|
|
|
} catch (DeviceManagementException e) {
|
|
|
|
log.error(e);
|
|
|
|
log.error(e);
|
|
|
|