From f730c73f066c6dc988d1f266a290d854ad73d2de Mon Sep 17 00:00:00 2001 From: Nirothipan Date: Tue, 27 Jun 2017 17:19:45 +0530 Subject: [PATCH 1/2] adding default policy --- .../src/main/resources/cep_query.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/src/main/resources/cep_query.txt b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/src/main/resources/cep_query.txt index 17546ece2c..01f6f7d315 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/src/main/resources/cep_query.txt +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/src/main/resources/cep_query.txt @@ -1,5 +1,5 @@ define stream fireAlarmEventStream (deviceID string, temp int); -from fireAlarmEventStream#window.time(7886776 sec) +from fireAlarmEventStream#window.time(10 sec) select deviceID, max(temp) as maxValue group by deviceID insert into analyzeStream for expired-events; @@ -8,4 +8,4 @@ select maxValue insert into bulbOnStream; from fireAlarmEventStream[temp > 1093] select deviceID, temp -insert into bulbOffStream; \ No newline at end of file +insert into bulbOffStream; From 31ec5092b077f62c2712e9c91b8fb9380ca5d214 Mon Sep 17 00:00:00 2001 From: Nirothipan Date: Tue, 27 Jun 2017 17:21:48 +0530 Subject: [PATCH 2/2] adding VirtualFireAlarmConstants.CLIENT_JID_PROPERTY_KEY --- .../communication/mqtt/FireAlarmMQTTCommunicator.java | 5 ++--- .../service/impl/VirtualFireAlarmServiceImpl.java | 1 - 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/advanced/communication/mqtt/FireAlarmMQTTCommunicator.java b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/advanced/communication/mqtt/FireAlarmMQTTCommunicator.java index 82fa7eb325..4ad4706717 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/advanced/communication/mqtt/FireAlarmMQTTCommunicator.java +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/advanced/communication/mqtt/FireAlarmMQTTCommunicator.java @@ -108,7 +108,6 @@ public class FireAlarmMQTTCommunicator extends MQTTTransportHandler { public void processIncomingMessage(MqttMessage message, String... messageParams) { final AgentManager agentManager = AgentManager.getInstance(); String tenantDomain = agentManager.getAgentConfigs().getTenantDomain(); - String deviceOwner = agentManager.getAgentConfigs().getDeviceOwner(); String deviceID = agentManager.getAgentConfigs().getDeviceId(); String receivedMessage; String replyMessage; @@ -219,7 +218,7 @@ public class FireAlarmMQTTCommunicator extends MQTTTransportHandler { } catch (TransportHandlerException e) { log.warn(AgentConstants.LOG_APPENDER + "Data Publish attempt to topic - [" + - AgentConstants.MQTT_PUBLISH_TOPIC + "] failed for payload [" + message + "]"); + AgentConstants.MQTT_PUBLISH_TOPIC + "] failed for payload [" + message + "]"); } catch (AgentCoreOperationException e) { log.warn(AgentConstants.LOG_APPENDER + "Preparing Secure payload failed", e); } @@ -255,7 +254,7 @@ public class FireAlarmMQTTCommunicator extends MQTTTransportHandler { Thread.sleep(timeoutInterval); } catch (InterruptedException e1) { log.error(AgentConstants.LOG_APPENDER + - "MQTT-Terminator: Thread Sleep Interrupt Exception"); + "MQTT-Terminator: Thread Sleep Interrupt Exception"); } } } diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/impl/VirtualFireAlarmServiceImpl.java b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/impl/VirtualFireAlarmServiceImpl.java index 69cee65883..0e540978b0 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/impl/VirtualFireAlarmServiceImpl.java +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/impl/VirtualFireAlarmServiceImpl.java @@ -103,7 +103,6 @@ public class VirtualFireAlarmServiceImpl implements VirtualFireAlarmService { commandOp.setPayLoad(actualMessage); Properties props = new Properties(); - props.setProperty(VirtualFireAlarmConstants.MQTT_ADAPTER_TOPIC_PROPERTY_NAME, publishTopic); props.setProperty(VirtualFireAlarmConstants.CLIENT_JID_PROPERTY_KEY, deviceId + "@" + XmppConfig .getInstance().getServerName()); props.setProperty(VirtualFireAlarmConstants.SUBJECT_PROPERTY_KEY, "CONTROL-REQUEST");