From 1b6dcca4081cf19df3995cc416962aee944510a8 Mon Sep 17 00:00:00 2001 From: megala21 Date: Thu, 10 Aug 2017 22:19:58 +0530 Subject: [PATCH] Fixing geo fencing issue when having multiple devices --- .../resources/alerts/Geo-ExecutionPlan-Exit_alert.siddhiql | 3 +++ .../resources/alerts/Geo-ExecutionPlan-Speed_alert.siddhiql | 3 +++ .../resources/alerts/Geo-ExecutionPlan-Within_alert.siddhiql | 3 +++ 3 files changed, 9 insertions(+) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/resources/alerts/Geo-ExecutionPlan-Exit_alert.siddhiql b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/resources/alerts/Geo-ExecutionPlan-Exit_alert.siddhiql index 7f391b530b7..0b93582f3aa 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/resources/alerts/Geo-ExecutionPlan-Exit_alert.siddhiql +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/resources/alerts/Geo-ExecutionPlan-Exit_alert.siddhiql @@ -18,3 +18,6 @@ insert into dataOut; from dataIn[geo:within(longitude,latitude,"$geoFenceGeoJSON")!=false and id == "$deviceId"] select id , latitude, longitude,timeStamp, type, speed, heading ,eventId , "NORMAL" as state, "" as information insert into dataOut; +from dataIn[id != "$deviceId"] +select id , latitude, longitude,timeStamp, type, speed, heading ,eventId , "NORMAL" as state, "" as information +insert into dataOut; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/resources/alerts/Geo-ExecutionPlan-Speed_alert.siddhiql b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/resources/alerts/Geo-ExecutionPlan-Speed_alert.siddhiql index 65dad468d5e..dd63dc2e52c 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/resources/alerts/Geo-ExecutionPlan-Speed_alert.siddhiql +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/resources/alerts/Geo-ExecutionPlan-Speed_alert.siddhiql @@ -18,3 +18,6 @@ insert into dataOut; from dataIn[speed < $speedAlertValue and id == "$deviceId"] select id , latitude, longitude,timeStamp, type ,speed, heading ,eventId , "NORMAL" as state, "This device movement is normal" as information insert into dataOut; +from dataIn[id != "$deviceId"] +select id , latitude, longitude,timeStamp, type, speed, heading ,eventId , "NORMAL" as state, "" as information +insert into dataOut; \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/resources/alerts/Geo-ExecutionPlan-Within_alert.siddhiql b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/resources/alerts/Geo-ExecutionPlan-Within_alert.siddhiql index b58fd59e334..78db10a6796 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/resources/alerts/Geo-ExecutionPlan-Within_alert.siddhiql +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/resources/alerts/Geo-ExecutionPlan-Within_alert.siddhiql @@ -18,3 +18,6 @@ insert into dataOut; from dataIn[geo:within(longitude,latitude,"$geoFenceGeoJSON")!=true and id == "$deviceId"] select id , latitude, longitude,timeStamp, type, speed, heading ,eventId , "NORMAL" as state, "" as information insert into dataOut; +from dataIn[id != "$deviceId"] +select id , latitude, longitude,timeStamp, type, speed, heading ,eventId , "NORMAL" as state, "" as information +insert into dataOut;