diff --git a/modules/distribution/pom.xml b/modules/distribution/pom.xml
index fdb98b9d..481e8af6 100644
--- a/modules/distribution/pom.xml
+++ b/modules/distribution/pom.xml
@@ -249,8 +249,6 @@
-
-
@@ -273,11 +271,21 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
@@ -343,8 +351,8 @@
toFile="target/wso2carbon-core-${carbon.kernel.version}/samples/arduino/build.xml.disable"/>
-
+
+
diff --git a/modules/p2-profile-gen/pom.xml b/modules/p2-profile-gen/pom.xml
index a460e1e0..026931e9 100644
--- a/modules/p2-profile-gen/pom.xml
+++ b/modules/p2-profile-gen/pom.xml
@@ -100,9 +100,15 @@
-
-
-
+
+ org.wso2.carbon:org.wso2.carbon.core.feature:${carbon.kernel.version}
+
+
+ org.wso2.carbon:org.wso2.carbon.core.runtime.feature:${carbon.kernel.version}
+
+
+ org.wso2.carbon:org.wso2.carbon.core.ui.feature:${carbon.kernel.version}
+
@@ -713,10 +719,18 @@
true
-
-
-
-
+
+ org.wso2.carbon.core.feature.group
+ ${carbon.kernel.version}
+
+
+ org.wso2.carbon.core.runtime.feature.group
+ ${carbon.kernel.version}
+
+
+ org.wso2.carbon.core.ui.feature.group
+ ${carbon.kernel.version}
+
diff --git a/modules/samples/android_sense/src/org.wso2.carbon.device.mgt.iot.sample.android.sense.service.impl/pom.xml b/modules/samples/android_sense/src/org.wso2.carbon.device.mgt.iot.sample.android.sense.service.impl/pom.xml
index cc0e34c8..66bdda1f 100644
--- a/modules/samples/android_sense/src/org.wso2.carbon.device.mgt.iot.sample.android.sense.service.impl/pom.xml
+++ b/modules/samples/android_sense/src/org.wso2.carbon.device.mgt.iot.sample.android.sense.service.impl/pom.xml
@@ -83,6 +83,21 @@
jsr311-api
provided
+
+
+ org.wso2.carbon.devicemgt
+ org.wso2.carbon.device.mgt.analytics
+
+
+
+ commons-httpclient.wso2
+ commons-httpclient
+
+
+
+ org.wso2.carbon
+ org.wso2.carbon.utils
+
diff --git a/modules/samples/android_sense/src/org.wso2.carbon.device.mgt.iot.sample.android.sense.service.impl/src/main/java/org/wso2/carbon/device/mgt/iot/sample/android/sense/service/impl/AndroidSenseControllerService.java b/modules/samples/android_sense/src/org.wso2.carbon.device.mgt.iot.sample.android.sense.service.impl/src/main/java/org/wso2/carbon/device/mgt/iot/sample/android/sense/service/impl/AndroidSenseControllerService.java
index 146a4051..81dc7ebb 100644
--- a/modules/samples/android_sense/src/org.wso2.carbon.device.mgt.iot.sample.android.sense.service.impl/src/main/java/org/wso2/carbon/device/mgt/iot/sample/android/sense/service/impl/AndroidSenseControllerService.java
+++ b/modules/samples/android_sense/src/org.wso2.carbon.device.mgt.iot.sample.android.sense.service.impl/src/main/java/org/wso2/carbon/device/mgt/iot/sample/android/sense/service/impl/AndroidSenseControllerService.java
@@ -17,12 +17,23 @@
package org.wso2.carbon.device.mgt.iot.sample.android.sense.service.impl;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.wso2.carbon.context.PrivilegedCarbonContext;
+import org.wso2.carbon.device.mgt.analytics.exception.DataPublisherConfigurationException;
+import org.wso2.carbon.device.mgt.analytics.service.DeviceAnalyticsService;
+import org.wso2.carbon.device.mgt.iot.common.exception.DeviceControllerException;
+import org.wso2.carbon.device.mgt.iot.common.sensormgt.SensorDataManager;
+import org.wso2.carbon.device.mgt.iot.common.sensormgt.SensorRecord;
+import org.wso2.carbon.device.mgt.iot.sample.android.sense.plugin.constants.AndroidSenseConstants;
import org.wso2.carbon.device.mgt.iot.sample.android.sense.service.impl.util.DeviceJSON;
+import org.wso2.carbon.device.mgt.iot.sample.android.sense.service.impl.util.SensorJSON;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.HeaderParam;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
@@ -32,6 +43,10 @@ public class AndroidSenseControllerService {
private static Log log = LogFactory.getLog(AndroidSenseControllerService.class);
@Context //injected response proxy supporting multiple thread
private HttpServletResponse response;
+ private static final String BATTERY_STREAM_DEFINITION = "org.wso2.iot.devices.battery";
+ private static final String LIGHT_STREAM_DEFINITION = "org.wso2.iot.devices.light";
+ private static final String GPS_STREAM_DEFINITION = "org.wso2.iot.devices.gps";
+ private static final String MAGNETIC_STREAM_DEFINITION = "org.wso2.iot.devices.magnetic";
/* Service to push all the sensor data collected by the Android
Called by the Android device */
@@ -41,29 +56,150 @@ public class AndroidSenseControllerService {
public void pushSensorData(final DeviceJSON dataMsg, @Context HttpServletResponse response) {
+ PrivilegedCarbonContext.startTenantFlow();
+ PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext();
+ ctx.setTenantDomain("carbon.super", true);
+ DeviceAnalyticsService deviceAnalyticsService = (DeviceAnalyticsService) ctx.getOSGiService(
+ DeviceAnalyticsService.class, null);
- String temperature = dataMsg.owner; //TEMP
- log.info("Recieved Sensor Data Values: " + temperature);
+ SensorJSON[] sensorData = dataMsg.values;
+ String streamDef = null;
+ Object payloadData[] = null;
- if (log.isDebugEnabled()) {
- log.debug("Recieved Temperature Data Value: " + temperature + " degrees C");
- }
- //try {
- boolean result = false;
-// result=DeviceController.pushBamData(dataMsg.owner, AndroidSenseConstants.DEVICE_TYPE,
-// dataMsg.deviceId,
-// System.currentTimeMillis(), "DeviceData",
-// temperature, "TEMPERATURE");
+ for(SensorJSON sensor: sensorData){
+ switch (sensor.key){
+ case "light" : streamDef = LIGHT_STREAM_DEFINITION;
+ payloadData = new Object[]{Float.parseFloat(sensor.value)};
+ SensorDataManager.getInstance().setSensorRecord(dataMsg.deviceId,"light",sensor.value,sensor.time);
+ break;
+ case "battery" : streamDef = BATTERY_STREAM_DEFINITION;
+ payloadData = new Object[]{Float.parseFloat(sensor.value)};
+ SensorDataManager.getInstance().setSensorRecord(dataMsg.deviceId,"battery",sensor.value,sensor.time);
+ break;
+ case "GPS" : streamDef = GPS_STREAM_DEFINITION;
+ String gpsValue =sensor.value;
+ String gpsValues[]=gpsValue.split(",");
+ Float gpsValuesF[]= new Float[2];
+ gpsValuesF[0] = Float.parseFloat(gpsValues[0]);
+ gpsValuesF[1] = Float.parseFloat(gpsValues[0]);
+ payloadData = gpsValuesF;
+ SensorDataManager.getInstance().setSensorRecord(dataMsg.deviceId,"gps",sensor.value,sensor.time);
+ break;
+ default :
+ try {
+ int androidSensorId = Integer.parseInt(sensor.key);
+
+ if(androidSensorId==2){
+ streamDef = MAGNETIC_STREAM_DEFINITION;
+ String value =sensor.value;
+ String valuesM[]=value.split(",");
+ Float gValuesF[]= new Float[1];
+ gValuesF[0] = Float.parseFloat(valuesM[0])*Float.parseFloat(valuesM[0])*Float.parseFloat(valuesM[0]);
- if (!result) {
- response.setStatus(Response.Status.NOT_ACCEPTABLE.getStatusCode());
+ payloadData = gValuesF;
+ SensorDataManager.getInstance().setSensorRecord(dataMsg.deviceId,"magnetic",sensor.value,sensor.time);
+ }
+ }catch(NumberFormatException e){
+ continue;
+ }
}
- //return result;
-// } catch (UnauthorizedException e) {
-// response.setStatus(HttpStatus.SC_UNAUTHORIZED);
-//
-// }
+ Object metdaData[] = {dataMsg.owner, AndroidSenseConstants.DEVICE_TYPE, dataMsg.deviceId, sensor.time};
+
+ if(streamDef!=null && payloadData!=null && payloadData.length > 0) {
+ try {
+ deviceAnalyticsService.publishEvent(streamDef, "1.0.0",
+ metdaData, new Object[0], payloadData);
+ } catch (DataPublisherConfigurationException e) {
+ response.setStatus(Response.Status.UNSUPPORTED_MEDIA_TYPE.getStatusCode());
+ }
+ }
+
+ }
+
+ }
+
+ @Path("controller/readgps")
+ @GET
+ @Consumes("application/json")
+ @Produces("application/json")
+ public SensorRecord requestTemperature(@HeaderParam("owner") String owner,
+ @HeaderParam("deviceId") String deviceId,
+ @HeaderParam("protocol") String protocol,
+ @Context HttpServletResponse response) {
+ SensorRecord sensorRecord = null;
+
+ try {
+ return SensorDataManager.getInstance().getSensorRecord(deviceId,"gps");
+ } catch (DeviceControllerException e) {
+ response.setStatus(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode());
+ }
+
+
+ return sensorRecord;
+ }
+
+
+ @Path("controller/readlight")
+ @GET
+ @Consumes("application/json")
+ @Produces("application/json")
+ public SensorRecord readLight(@HeaderParam("owner") String owner,
+ @HeaderParam("deviceId") String deviceId,
+ @HeaderParam("protocol") String protocol,
+ @Context HttpServletResponse response) {
+ SensorRecord sensorRecord = null;
+
+ try {
+ return SensorDataManager.getInstance().getSensorRecord(deviceId,"light");
+ } catch (DeviceControllerException e) {
+ response.setStatus(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode());
+ }
+
+
+ return sensorRecord;
+ }
+
+ @Path("controller/readmagnetic")
+ @GET
+ @Consumes("application/json")
+ @Produces("application/json")
+ public SensorRecord readMagnetic(@HeaderParam("owner") String owner,
+ @HeaderParam("deviceId") String deviceId,
+ @HeaderParam("protocol") String protocol,
+ @Context HttpServletResponse response) {
+ SensorRecord sensorRecord = null;
+
+ try {
+ return SensorDataManager.getInstance().getSensorRecord(deviceId,"magnetic");
+ } catch (DeviceControllerException e) {
+ response.setStatus(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode());
+ }
+
+
+ return sensorRecord;
}
+
+ @Path("controller/readbattery")
+ @GET
+ @Consumes("application/json")
+ @Produces("application/json")
+ public SensorRecord readBattery(@HeaderParam("owner") String owner,
+ @HeaderParam("deviceId") String deviceId,
+ @HeaderParam("protocol") String protocol,
+ @Context HttpServletResponse response) {
+ SensorRecord sensorRecord = null;
+
+ try {
+ return SensorDataManager.getInstance().getSensorRecord(deviceId,"battery");
+ } catch (DeviceControllerException e) {
+ response.setStatus(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode());
+ }
+
+
+ return sensorRecord;
+ }
+
+
}
diff --git a/modules/samples/virtual_firealarm/src/org.wso2.carbon.device.mgt.iot.sample.virtual.firealarm.service.impl/pom.xml b/modules/samples/virtual_firealarm/src/org.wso2.carbon.device.mgt.iot.sample.virtual.firealarm.service.impl/pom.xml
index 3db470bd..366b7526 100644
--- a/modules/samples/virtual_firealarm/src/org.wso2.carbon.device.mgt.iot.sample.virtual.firealarm.service.impl/pom.xml
+++ b/modules/samples/virtual_firealarm/src/org.wso2.carbon.device.mgt.iot.sample.virtual.firealarm.service.impl/pom.xml
@@ -92,6 +92,64 @@
org.wso2.carbon
org.wso2.carbon.utils
+
+
+ org.bouncycastle.wso2
+ bcprov-jdk15on
+
+
+ org.wso2.carbon
+ org.wso2.carbon.user.api
+
+
+ org.wso2.carbon
+ org.wso2.carbon.queuing
+
+
+ org.wso2.carbon
+ org.wso2.carbon.base
+
+
+ org.apache.axis2.wso2
+ axis2
+
+
+ org.igniterealtime.smack.wso2
+ smack
+
+
+ org.igniterealtime.smack.wso2
+ smackx
+
+
+ jaxen
+ jaxen
+
+
+ commons-fileupload.wso2
+ commons-fileupload
+
+
+ org.apache.ant.wso2
+ ant
+
+
+ org.apache.ant.wso2
+ ant
+
+
+ commons-httpclient.wso2
+ commons-httpclient
+
+
+ org.eclipse.equinox
+ javax.servlet
+
+
+ org.wso2.carbon
+ org.wso2.carbon.registry.api
+
+
org.wso2.carbon.devicemgt
diff --git a/pom.xml b/pom.xml
index d126352f..6a00fdbe 100644
--- a/pom.xml
+++ b/pom.xml
@@ -824,7 +824,7 @@
4.4.2
- [4.4.1, 4.5.0)
+ [4.4.2, 4.5.0)
4.4.2
@@ -873,7 +873,7 @@
1.1.1
- 4.4.7
+ 4.4.8
4.5.2
@@ -886,7 +886,7 @@
4.4.8
- [4.4.1, 4.5.0)
+ [4.4.8, 4.5.0)
4.5.8
@@ -899,7 +899,7 @@
1.0.0-SNAPSHOT
- 4.4.10
+ 4.4.11-SNAPSHOT
4.3.0-SNAPSHOT
@@ -918,10 +918,10 @@
1.0.4-SNAPSHOT
- 5.0.5-SNAPSHOT
+ 5.0.5
1.0.0-wso2v3
1.0.0
- 2.0.7
+ 2.0.8
4.3.2