From 0cfa757c0a50099a94534d34055c86e76a38ef86 Mon Sep 17 00:00:00 2001 From: Ace Date: Tue, 22 Aug 2017 16:25:24 +0530 Subject: [PATCH] Fixing stats display issue for virtual fire-alarm in MT mode --- .../agent/virtual/VirtualHardwareManager.java | 9 +++++---- .../receiver/virtualfirealarm_receiver.xml | 2 +- .../org.wso2.iot.virtualfirealarm_1.0.0.json | 16 ---------------- .../src/main/resources/devicetypes/android.xml | 6 +++--- 4 files changed, 9 insertions(+), 24 deletions(-) delete mode 100644 features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.backend.feature/src/main/resources/streams/org.wso2.iot.virtualfirealarm_1.0.0.json diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/virtual/VirtualHardwareManager.java b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/virtual/VirtualHardwareManager.java index 61135c58a4..fdb271e79a 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/virtual/VirtualHardwareManager.java +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/virtual/VirtualHardwareManager.java @@ -199,8 +199,11 @@ public class VirtualHardwareManager { try { sequence = MidiSystem.getSequence(audioSrc); sequencer = MidiSystem.getSequencer(); - sequencer.open(); - sequencer.setSequence(sequence); + if(sequencer != null) { + sequencer.open(); + sequencer.setSequence(sequence); + sequencer.setLoopCount(Clip.LOOP_CONTINUOUSLY); + } } catch (InvalidMidiDataException e) { log.error("AudioReader: Error whilst setting MIDI Audio reader sequence"); } catch (IOException e) { @@ -208,8 +211,6 @@ public class VirtualHardwareManager { } catch (MidiUnavailableException e) { log.error("AudioReader: Error whilst openning MIDI Audio reader sequencer"); } - - sequencer.setLoopCount(Clip.LOOP_CONTINUOUSLY); } } diff --git a/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.backend.feature/src/main/resources/receiver/virtualfirealarm_receiver.xml b/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.backend.feature/src/main/resources/receiver/virtualfirealarm_receiver.xml index 98ee47d867..b1951058e5 100644 --- a/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.backend.feature/src/main/resources/receiver/virtualfirealarm_receiver.xml +++ b/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.backend.feature/src/main/resources/receiver/virtualfirealarm_receiver.xml @@ -21,5 +21,5 @@ ${tenant-domain}/virtual_firealarm/+/temperature - + diff --git a/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.backend.feature/src/main/resources/streams/org.wso2.iot.virtualfirealarm_1.0.0.json b/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.backend.feature/src/main/resources/streams/org.wso2.iot.virtualfirealarm_1.0.0.json deleted file mode 100644 index 0ba70911ef..0000000000 --- a/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.backend.feature/src/main/resources/streams/org.wso2.iot.virtualfirealarm_1.0.0.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "org.wso2.iot.virtualfirealarm", - "version": "1.0.0", - "nickName": "virtual_firealarm", - "description": "Temperature data received from the virtual_firealarm", - "metaData": [ - {"name":"owner","type":"STRING"}, - {"name":"deviceId","type":"STRING"}, - {"name":"time","type":"LONG"} - ], - "payloadData": [ - { - "name": "temperature","type": "FLOAT" - } - ] -} \ No newline at end of file diff --git a/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/src/main/resources/devicetypes/android.xml b/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/src/main/resources/devicetypes/android.xml index 38d88d3dba..00084f14fc 100644 --- a/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/src/main/resources/devicetypes/android.xml +++ b/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/src/main/resources/devicetypes/android.xml @@ -338,13 +338,13 @@ Unlock the device - //Name needs to be decided + true - 60000 //Name needs to be decided + 60000 DEVICE_INFO - 1 //Name needs to be decided + 1 APPLICATION_LIST