Improved geo fencing

revert-dabc3590
charitha 6 years ago
parent 7766055d17
commit d1fb11a0c0

@ -17,11 +17,8 @@ define stream alertsOut ( id string, state string, information string, timeStamp
@Export('iot.per.device.stream.geo.FusedSpatialEvent:1.0.0') @Export('iot.per.device.stream.geo.FusedSpatialEvent:1.0.0')
define stream dataOut ( id string, latitude double, longitude double, timeStamp long, type string, speed float, heading float, state string, information string, notify bool ); define stream dataOut ( id string, latitude double, longitude double, timeStamp long, type string, speed float, heading float, state string, information string, notify bool );
from dataIn#window.geodashboard:eventsFusion(eventId, state, information) from dataIn
insert into innerStream; select id, latitude, longitude, timeStamp, type, speed, heading, state , information, (str:strcmp("ALERTED", state) == 0) as notify
from innerStream
select id, latitude, longitude, timeStamp, type, speed, heading, state , information, geodashboard:needToNotify(id,information) as notify
insert into dataOut; insert into dataOut;
from dataOut[notify == true] from dataOut[notify == true]

@ -12,6 +12,6 @@ define stream dataIn (id string, latitude double, longitude double, timeStamp lo
@Export('org.wso2.geo.ProcessedSpatialEvents:1.0.0') @Export('org.wso2.geo.ProcessedSpatialEvents:1.0.0')
define stream dataOut (id string, latitude double, longitude double, timeStamp long, type string, speed float, heading float, eventId string, state string, information string); define stream dataOut (id string, latitude double, longitude double, timeStamp long, type string, speed float, heading float, eventId string, state string, information string);
from dataIn#geodashboard:subscribe() from dataIn
select id , latitude, longitude,timeStamp, type ,speed, heading ,eventId , "NORMAL" as state, "Normal driving pattern" as information select id , latitude, longitude,timeStamp, type ,speed, heading ,eventId , "NORMAL" as state, "Normal driving pattern" as information
insert into dataOut; insert into dataOut;

@ -12,8 +12,11 @@
define stream dataIn (meta_deviceId string, meta_deviceType string, timeStamp long, latitude double, longitude double); define stream dataIn (meta_deviceId string, meta_deviceType string, timeStamp long, latitude double, longitude double);
@Export('org.wso2.geo.StandardSpatialEvents:1.0.0') @Export('org.wso2.geo.StandardSpatialEvents:1.0.0')
define stream dataOut ( id string, latitude double, longitude double, timeStamp long, type string, speed float, heading float, eventId string ); define stream dataOut (id string, latitude double, longitude double, timeStamp long, type string, speed float, heading float, eventId string);
from dataIn from every fs1=dataIn -> fs2=dataIn[fs2.timeStamp > fs1.timeStamp and fs1.meta_deviceId == fs2.meta_deviceId]
select meta_deviceId as id, latitude, longitude, timeStamp, select fs1.meta_deviceId as id, fs2.latitude, fs2.longitude, fs2.timeStamp, fs1.meta_deviceType as type,
meta_deviceType as type, 0.0f as speed, 0.0f as heading, UUID() as eventId insert into dataOut convert(geo:distance(fs2.latitude, fs2.longitude, fs1.latitude, fs1.longitude) * 3600/(fs2.timeStamp - fs1.timeStamp), 'float') as speed,
0.0f as heading, UUID() as eventId
group by fs1.meta_deviceId
insert into dataOut
Loading…
Cancel
Save