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 f6f0a4897e..3699154040 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 @@ -29,16 +29,29 @@ import org.wso2.carbon.device.mgt.iot.DeviceManagement; import org.wso2.carbon.device.mgt.iot.androidsense.plugin.constants.AndroidSenseConstants; import org.wso2.carbon.device.mgt.iot.androidsense.service.impl.util.DeviceJSON; import org.wso2.carbon.device.mgt.iot.androidsense.service.impl.util.SensorJSON; +import org.wso2.carbon.device.mgt.iot.apimgt.AccessTokenInfo; +import org.wso2.carbon.device.mgt.iot.apimgt.TokenClient; +import org.wso2.carbon.device.mgt.iot.controlqueue.xmpp.XmppAccount; +import org.wso2.carbon.device.mgt.iot.controlqueue.xmpp.XmppConfig; +import org.wso2.carbon.device.mgt.iot.controlqueue.xmpp.XmppServerClient; +import org.wso2.carbon.device.mgt.iot.exception.AccessTokenException; import org.wso2.carbon.device.mgt.iot.exception.DeviceControllerException; import org.wso2.carbon.device.mgt.iot.sensormgt.SensorDataManager; import org.wso2.carbon.device.mgt.iot.sensormgt.SensorRecord; +import org.wso2.carbon.device.mgt.iot.util.ZipArchive; +import org.wso2.carbon.device.mgt.iot.util.ZipUtil; +import org.wso2.carbon.utils.CarbonUtils; import javax.servlet.http.HttpServletResponse; import javax.ws.rs.*; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; +import java.io.File; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; import java.util.Date; +import java.util.UUID; public class AndroidSenseService { @@ -206,6 +219,27 @@ public class AndroidSenseService { } + @Path("manager/device/{sketch_type}/download") + @GET + @Produces("application/octet-stream") + public Response downloadSketch(@PathParam("sketch_type") String sketchType) { + //TODO:: null check customDeviceName at UI level + try { + + String sep = File.separator; + String sketchFolder = "repository" + sep + "resources" + sep + "sketches" + sep + "android_sense" + sep; + String archivesPath = CarbonUtils.getCarbonHome() + sep + sketchFolder; + + Response.ResponseBuilder rb = Response.ok(new File(archivesPath+sep+"androidsense.apk")); + rb.header("Content-Disposition", + "attachment; filename=\"" + "androidsense.apk" + "\""); + return rb.build(); + } catch (IllegalArgumentException ex) { + return Response.status(400).entity(ex.getMessage()).build();//bad request + } + + } + /* Service to push all the sensor data collected by the Android Called by the Android device */ @Path("controller/sensordata") diff --git a/components/device-mgt-iot-androidsense/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/webapp/WEB-INF/cxf-servlet.xml b/components/device-mgt-iot-androidsense/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/webapp/WEB-INF/cxf-servlet.xml index 8b00045b87..4a40628a99 100644 --- a/components/device-mgt-iot-androidsense/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/webapp/WEB-INF/cxf-servlet.xml +++ b/components/device-mgt-iot-androidsense/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/webapp/WEB-INF/cxf-servlet.xml @@ -18,14 +18,16 @@ + xmlns:jaxrs="http://cxf.apache.org/jaxrs" xmlns:cxf="http://cxf.apache.org/core" + xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd + http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd"> + + + diff --git a/components/device-mgt-iot-androidsense/org.wso2.carbon.device.mgt.iot.androidsense/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/plugin/impl/AndroidSenseManagerService.java b/components/device-mgt-iot-androidsense/org.wso2.carbon.device.mgt.iot.androidsense/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/plugin/impl/AndroidSenseManagerService.java index 765ddd2ee2..8ed1eb2bac 100644 --- a/components/device-mgt-iot-androidsense/org.wso2.carbon.device.mgt.iot.androidsense/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/plugin/impl/AndroidSenseManagerService.java +++ b/components/device-mgt-iot-androidsense/org.wso2.carbon.device.mgt.iot.androidsense/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/plugin/impl/AndroidSenseManagerService.java @@ -19,17 +19,17 @@ public class AndroidSenseManagerService implements DeviceManagementService { return AndroidSenseConstants.DEVICE_TYPE; } - @Override +// @Override public String getProviderTenantDomain() { return "carbon.super"; } - @Override +// @Override public boolean isSharedWithAllTenants() { return true; } - @Override +// @Override public String[] getSharedTenantsDomain() { return new String[0]; } diff --git a/features/device-mgt-iot-androidsense-feature/org.wso2.carbon.device.mgt.iot.androidsense.analytics/Light/Eventstream_light_1.0.0/org.wso2.iot.devices.light_1.0.0.json b/features/device-mgt-iot-androidsense-feature/org.wso2.carbon.device.mgt.iot.androidsense.analytics/Light/Eventstream_light_1.0.0/org.wso2.iot.devices.light_1.0.0.json index 253f0b0c0d..f9da446f8a 100644 --- a/features/device-mgt-iot-androidsense-feature/org.wso2.carbon.device.mgt.iot.androidsense.analytics/Light/Eventstream_light_1.0.0/org.wso2.iot.devices.light_1.0.0.json +++ b/features/device-mgt-iot-androidsense-feature/org.wso2.carbon.device.mgt.iot.androidsense.analytics/Light/Eventstream_light_1.0.0/org.wso2.iot.devices.light_1.0.0.json @@ -1,8 +1,8 @@ { "name": "org.wso2.iot.devices.light", "version": "1.0.0", - "nickName": "light Data", - "description": "light data received from the Device", + "nickName": "Light Data", + "description": "Light data received from the Device", "metaData": [ {"name":"owner","type":"STRING"}, {"name":"deviceType","type":"STRING"}, diff --git a/features/device-mgt-iot-androidsense-feature/org.wso2.carbon.device.mgt.iot.androidsense.feature/src/main/resources/agent/androidsene.apk b/features/device-mgt-iot-androidsense-feature/org.wso2.carbon.device.mgt.iot.androidsense.feature/src/main/resources/agent/androidsense.apk similarity index 100% rename from features/device-mgt-iot-androidsense-feature/org.wso2.carbon.device.mgt.iot.androidsense.feature/src/main/resources/agent/androidsene.apk rename to features/device-mgt-iot-androidsense-feature/org.wso2.carbon.device.mgt.iot.androidsense.feature/src/main/resources/agent/androidsense.apk diff --git a/features/device-mgt-iot-androidsense-feature/org.wso2.carbon.device.mgt.iot.androidsense.feature/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.type-view/public/js/download.js b/features/device-mgt-iot-androidsense-feature/org.wso2.carbon.device.mgt.iot.androidsense.feature/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.type-view/public/js/download.js index ec7a6f642a..decb8e9e53 100644 --- a/features/device-mgt-iot-androidsense-feature/org.wso2.carbon.device.mgt.iot.androidsense.feature/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.type-view/public/js/download.js +++ b/features/device-mgt-iot-androidsense-feature/org.wso2.carbon.device.mgt.iot.androidsense.feature/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.type-view/public/js/download.js @@ -132,20 +132,10 @@ function attachEvents() { }); } +//Device owner removed. function downloadAgent() { $('#downloadForm').submit(); - var deviceName; - $('.new-device-name').each(function () { - if (this.value != "") { - deviceName = this.value; - } - }); - if (deviceName && deviceName.length >= 4) { - setTimeout(function () { - hidePopup(); - }, 1000); - } } function doAction(data) { diff --git a/features/device-mgt-iot-androidsense-feature/org.wso2.carbon.device.mgt.iot.androidsense.feature/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.type-view/type-view.hbs b/features/device-mgt-iot-androidsense-feature/org.wso2.carbon.device.mgt.iot.androidsense.feature/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.type-view/type-view.hbs index b5e1d650e3..557597b0c4 100644 --- a/features/device-mgt-iot-androidsense-feature/org.wso2.carbon.device.mgt.iot.androidsense.feature/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.type-view/type-view.hbs +++ b/features/device-mgt-iot-androidsense-feature/org.wso2.carbon.device.mgt.iot.androidsense.feature/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.type-view/type-view.hbs @@ -1,64 +1,27 @@

Android Sense


-

Connect your Android device to the WSO2 device cloud.

+

Connect your Android device + to the WSO2 device cloud.

-

Ingredients


Hardware Requirements


    -
  • - Raspberry Pi (Internet Enabled)
  • -
  • - DHT11 Temperature Sensor
  • -
  • - LED
  • -
  • - Buzzer(3v)
  • -
-
- - Download +
  • + Android device
  • -
    - -
    +
    + + Enroll Device +

    -