diff --git a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/data/publisher/mqtt/AndroidSenseMQTTHandler.java b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/data/publisher/mqtt/AndroidSenseMQTTHandler.java index 5edab5a61..5d607546f 100644 --- a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/data/publisher/mqtt/AndroidSenseMQTTHandler.java +++ b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/data/publisher/mqtt/AndroidSenseMQTTHandler.java @@ -159,7 +159,7 @@ public class AndroidSenseMQTTHandler extends MQTTTransportHandler { */ @Override public void publishDeviceData(String... publishData) throws TransportHandlerException { - if (publishData.length != 3) { + if (publishData.length != 4) { String errorMsg = "Incorrect number of arguments received to SEND-MQTT Message. " + "Need to be [owner, deviceId, content]"; Log.e(TAG, errorMsg); diff --git a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/util/LocalRegistry.java b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/util/LocalRegistry.java index db69af68f..8f26a91b9 100644 --- a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/util/LocalRegistry.java +++ b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/util/LocalRegistry.java @@ -251,7 +251,7 @@ public class LocalRegistry { SharedPreferences sharedpreferences = context.getSharedPreferences(SENSE_SHARED_PREFERENCES, Context.MODE_PRIVATE); LocalRegistry.tenantDomain = sharedpreferences.getString(TENANT_DOMAIN_KEY, ""); } - return LocalRegistry.mqttEndpoint; + return LocalRegistry.tenantDomain; } public static String getServerHost(Context context) { diff --git a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/Android_Sense/EventReceiver_AndroidSense_1.0.0/EventReceiver_AndroidSense.xml b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/Android_Sense/EventReceiver_AndroidSense_1.0.0/EventReceiver_AndroidSense.xml index aad8f354f..ab4c8385a 100644 --- a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/Android_Sense/EventReceiver_AndroidSense_1.0.0/EventReceiver_AndroidSense.xml +++ b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/Android_Sense/EventReceiver_AndroidSense_1.0.0/EventReceiver_AndroidSense.xml @@ -19,9 +19,9 @@ - wso2/android_sense/+/data + wso2/carbon.super/android_sense/+/data admin - device_id_json_path:event.metaData.deviceId,device_id_topic_hierarchy_index:2 + device_id_json_path:event.metaData.deviceId,device_id_topic_hierarchy_index:3 default https://localhost:9443/dynamic-client-web/register tcp://localhost:1883 diff --git a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/plugin/constants/AndroidSenseConstants.java b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/plugin/constants/AndroidSenseConstants.java index e68e50a43..a467bcdc2 100644 --- a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/plugin/constants/AndroidSenseConstants.java +++ b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/plugin/constants/AndroidSenseConstants.java @@ -47,7 +47,7 @@ public class AndroidSenseConstants { public static final String SENSOR_ROTATION = "rotation"; public static final String SENSOR_WORDCOUNT = "wordcounter"; //MQTT Subscribe topic - public static final String MQTT_SUBSCRIBE_WORDS_TOPIC = "wso2/android_sense/+/data"; + public static final String MQTT_SUBSCRIBE_WORDS_TOPIC = "wso2/+/android_sense/+/data"; public static final String DATA_SOURCE_NAME = "jdbc/AndroidSenseDM_DB"; public final static String DEVICE_TYPE_PROVIDER_DOMAIN = "carbon.super"; } diff --git a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.type-view/public/asset/androidsense.apk b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.type-view/public/asset/androidsense.apk index 462742400..04bcd4746 100644 Binary files a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.type-view/public/asset/androidsense.apk and b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.type-view/public/asset/androidsense.apk differ diff --git a/components/iot-plugins/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/src/main/java/org/wso2/carbon/device/mgt/iot/arduino/service/impl/ArduinoControllerService.java b/components/iot-plugins/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/src/main/java/org/wso2/carbon/device/mgt/iot/arduino/service/impl/ArduinoControllerService.java index f82ff603a..85c02752b 100644 --- a/components/iot-plugins/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/src/main/java/org/wso2/carbon/device/mgt/iot/arduino/service/impl/ArduinoControllerService.java +++ b/components/iot-plugins/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/src/main/java/org/wso2/carbon/device/mgt/iot/arduino/service/impl/ArduinoControllerService.java @@ -47,8 +47,7 @@ public interface ArduinoControllerService { @Path("device/{deviceId}/bulb") @POST @Feature(code = "bulb", name = "Control Bulb", type = "operation", description = "Control Bulb on Arduino Uno") - Response switchBulb(@PathParam("deviceId") String deviceId, @QueryParam("protocol") String protocol, - @FormParam("state") String state); + Response switchBulb(@PathParam("deviceId") String deviceId, @QueryParam("state") String state); @Path("device/sensor") @POST @@ -57,12 +56,12 @@ public interface ArduinoControllerService { @Path("device/{deviceId}/controls") @GET - Response readControls(@PathParam("deviceId") String deviceId, @QueryParam("protocol") String protocol); + Response readControls(@PathParam("deviceId") String deviceId); @Path("device/temperature") @POST @Consumes(MediaType.APPLICATION_JSON) - Response pushTemperatureData(final DeviceData dataMsg, @Context HttpServletRequest request); + Response pushTemperatureData(final DeviceData dataMsg); /** * Retreive Sensor data for the device type diff --git a/components/iot-plugins/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/src/main/java/org/wso2/carbon/device/mgt/iot/arduino/service/impl/ArduinoControllerServiceImpl.java b/components/iot-plugins/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/src/main/java/org/wso2/carbon/device/mgt/iot/arduino/service/impl/ArduinoControllerServiceImpl.java index ce40e39ef..c322315e2 100644 --- a/components/iot-plugins/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/src/main/java/org/wso2/carbon/device/mgt/iot/arduino/service/impl/ArduinoControllerServiceImpl.java +++ b/components/iot-plugins/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/src/main/java/org/wso2/carbon/device/mgt/iot/arduino/service/impl/ArduinoControllerServiceImpl.java @@ -76,12 +76,9 @@ public class ArduinoControllerServiceImpl implements ArduinoControllerService { @Override @Path("device/{deviceId}/bulb") @POST - public Response switchBulb(@PathParam("deviceId") String deviceId, @QueryParam("protocol") String protocol, - @FormParam("state") String state) { - + public Response switchBulb(@PathParam("deviceId") String deviceId, @QueryParam("state") String state) { LinkedList deviceControlList = internalControlsQueue.get(deviceId); String operation = "BULB:" + state.toUpperCase(); - log.info(operation); if (deviceControlList == null) { deviceControlList = new LinkedList<>(); deviceControlList.add(operation); @@ -99,7 +96,6 @@ public class ArduinoControllerServiceImpl implements ArduinoControllerService { public Response pushData(DeviceData dataMsg) { String owner = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername(); String deviceId = dataMsg.deviceId; - float pinData = dataMsg.value; if (!ArduinoServiceUtils.publishToDAS(dataMsg.deviceId, dataMsg.value)) { log.warn("An error occured whilst trying to publish pin data of Arduino with ID [" + deviceId + "] of owner [" + owner + "]"); @@ -111,7 +107,7 @@ public class ArduinoControllerServiceImpl implements ArduinoControllerService { @Override @Path("device/{deviceId}/controls") @GET - public Response readControls(@PathParam("deviceId") String deviceId, @QueryParam("protocol") String protocol) { + public Response readControls(@PathParam("deviceId") String deviceId) { String result; LinkedList deviceControlList = internalControlsQueue.get(deviceId); String owner = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername(); @@ -142,10 +138,9 @@ public class ArduinoControllerServiceImpl implements ArduinoControllerService { @Path("device/temperature") @POST @Consumes(MediaType.APPLICATION_JSON) - public Response pushTemperatureData(final DeviceData dataMsg, @Context HttpServletRequest request) { + public Response pushTemperatureData(final DeviceData dataMsg) { String owner = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername(); String deviceId = dataMsg.deviceId; - float temperature = dataMsg.value; if (!ArduinoServiceUtils.publishToDAS(dataMsg.deviceId, dataMsg.value)) { log.warn("An error occured whilst trying to publish temperature data of Arduino with ID [" + deviceId + "] of owner [" + owner + "]"); diff --git a/components/iot-plugins/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/src/main/java/org/wso2/carbon/device/mgt/iot/arduino/service/impl/ArduinoManagerService.java b/components/iot-plugins/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/src/main/java/org/wso2/carbon/device/mgt/iot/arduino/service/impl/ArduinoManagerService.java index cd0e196fd..d161127ac 100644 --- a/components/iot-plugins/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/src/main/java/org/wso2/carbon/device/mgt/iot/arduino/service/impl/ArduinoManagerService.java +++ b/components/iot-plugins/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/src/main/java/org/wso2/carbon/device/mgt/iot/arduino/service/impl/ArduinoManagerService.java @@ -34,7 +34,6 @@ import javax.ws.rs.core.Response; @Path("enrollment") @API(name = "arduino_mgt", version = "1.0.0", context = "/arduino_mgt", tags = {"arduino"}) -@DeviceType(value = "arduino") public interface ArduinoManagerService { @Path("devices/{device_id}") @@ -61,9 +60,4 @@ public interface ArduinoManagerService { @GET @Produces("application/octet-stream") Response downloadSketch(@QueryParam("deviceName") String customDeviceName); - - @Path("devices/generate_link") - @GET - Response generateSketchLink(@QueryParam("deviceName") String deviceName); - } diff --git a/components/iot-plugins/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/src/main/java/org/wso2/carbon/device/mgt/iot/arduino/service/impl/ArduinoManagerServiceImpl.java b/components/iot-plugins/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/src/main/java/org/wso2/carbon/device/mgt/iot/arduino/service/impl/ArduinoManagerServiceImpl.java index 291508f3c..716b58c2d 100644 --- a/components/iot-plugins/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/src/main/java/org/wso2/carbon/device/mgt/iot/arduino/service/impl/ArduinoManagerServiceImpl.java +++ b/components/iot-plugins/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/src/main/java/org/wso2/carbon/device/mgt/iot/arduino/service/impl/ArduinoManagerServiceImpl.java @@ -167,29 +167,6 @@ public class ArduinoManagerServiceImpl implements ArduinoManagerService { } } - @Override - @Path("devices/generate_link") - @GET - public Response generateSketchLink(@QueryParam("deviceName") String deviceName) { - try { - ZipArchive zipFile = createDownloadFile(APIUtil.getAuthenticatedUser(), deviceName); - Response.ResponseBuilder rb = Response.ok(zipFile.getDeviceId()); - return rb.build(); - } catch (IllegalArgumentException ex) { - return Response.status(400).entity(ex.getMessage()).build();//bad request - } catch (DeviceManagementException ex) { - return Response.status(500).entity(ex.getMessage()).build(); - } catch (JWTClientException ex) { - return Response.status(500).entity(ex.getMessage()).build(); - } catch (DeviceControllerException ex) { - return Response.status(500).entity(ex.getMessage()).build(); - } catch (APIManagerException ex) { - return Response.status(500).entity(ex.getMessage()).build(); - } catch (UserStoreException ex) { - return Response.status(500).entity(ex.getMessage()).build(); - } - } - private ZipArchive createDownloadFile(String owner, String deviceName) throws DeviceManagementException, JWTClientException, DeviceControllerException, APIManagerException, UserStoreException {