From 897b91452213dbfbd71f75eb0951c6cdebfe7352 Mon Sep 17 00:00:00 2001 From: Menaka Madushanka Date: Mon, 21 Dec 2015 13:38:38 +0530 Subject: [PATCH 1/3] Fixed light, proximity and pressure problem. --- .../iot/androidsense/service/impl/AndroidSenseService.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/device-mgt-iot-androidsense/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/AndroidSenseService.java b/components/device-mgt-iot-androidsense/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/AndroidSenseService.java index 3003d898c1..8dbefa3d03 100644 --- a/components/device-mgt-iot-androidsense/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/AndroidSenseService.java +++ b/components/device-mgt-iot-androidsense/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/AndroidSenseService.java @@ -308,17 +308,17 @@ public class AndroidSenseService { case 5: streamDef = LIGHT_STREAM_DEFINITION; sensorName = SENSOR_LIGHT; - payloadData = new Float[]{Float.parseFloat(sensor.value)}; + payloadData = new Float[]{Float.parseFloat(valuesM[0])}; break; case 6: streamDef = PRESSURE_STREAM_DEFINITION; sensorName = SENSOR_PRESSURE; - payloadData = new Float[]{Float.parseFloat(sensor.value)}; + payloadData = new Float[]{Float.parseFloat(valuesM[0])}; break; case 8: streamDef = PROXIMITY_STREAM_DEFINITION; sensorName = SENSOR_PROXIMITY; - payloadData = new Float[]{Float.parseFloat(sensor.value)}; + payloadData = new Float[]{Float.parseFloat(valuesM[0])}; break; case 9: streamDef = GRAVITY_STREAM_DEFINITION; From eeb6a9a35d34a755feef5648d981e03b5c7542cf Mon Sep 17 00:00:00 2001 From: Menaka Madushanka Date: Mon, 21 Dec 2015 13:39:08 +0530 Subject: [PATCH 2/3] Fixed light, proximity and pressure problem. --- .../mgt/iot/androidsense/service/impl/AndroidSenseService.java | 1 - 1 file changed, 1 deletion(-) diff --git a/components/device-mgt-iot-androidsense/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/AndroidSenseService.java b/components/device-mgt-iot-androidsense/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/AndroidSenseService.java index 8dbefa3d03..02a8d2ad87 100644 --- a/components/device-mgt-iot-androidsense/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/AndroidSenseService.java +++ b/components/device-mgt-iot-androidsense/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/AndroidSenseService.java @@ -285,7 +285,6 @@ public class AndroidSenseService { switch (androidSensorId){ case 1: streamDef = ACCELEROMETER_STREAM_DEFINITION; - gValuesF[0] = Float.parseFloat(valuesM[0]) * Float.parseFloat(valuesM[0]) * Float .parseFloat(valuesM[0]); payloadData = gValuesF; From d31b91df28bbb6209a9bf305809557408edf8c64 Mon Sep 17 00:00:00 2001 From: Menaka Madushanka Date: Mon, 21 Dec 2015 13:39:45 +0530 Subject: [PATCH 3/3] matadata typo fixed --- .../iot/androidsense/service/impl/AndroidSenseService.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/device-mgt-iot-androidsense/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/AndroidSenseService.java b/components/device-mgt-iot-androidsense/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/AndroidSenseService.java index 02a8d2ad87..b99470644a 100644 --- a/components/device-mgt-iot-androidsense/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/AndroidSenseService.java +++ b/components/device-mgt-iot-androidsense/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/AndroidSenseService.java @@ -340,13 +340,13 @@ public class AndroidSenseService { } } - Object metdaData[] = {dataMsg.owner, AndroidSenseConstants.DEVICE_TYPE, dataMsg.deviceId, sensor.time}; + Object metaData[] = {dataMsg.owner, AndroidSenseConstants.DEVICE_TYPE, dataMsg.deviceId, sensor.time}; if (streamDef != null && payloadData != null && payloadData.length > 0) { try { SensorDataManager.getInstance() .setSensorRecord(dataMsg.deviceId, sensorName, sensor.value, sensor.time); - deviceAnalyticsService.publishEvent(streamDef, "1.0.0", metdaData, new Object[0], payloadData); + deviceAnalyticsService.publishEvent(streamDef, "1.0.0", metaData, new Object[0], payloadData); } catch (DataPublisherConfigurationException e) { response.setStatus(Response.Status.UNSUPPORTED_MEDIA_TYPE.getStatusCode()); }