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')
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)
insert into innerStream;
from innerStream
select id, latitude, longitude, timeStamp, type, speed, heading, state , information, geodashboard:needToNotify(id,information) as notify
from dataIn
select id, latitude, longitude, timeStamp, type, speed, heading, state , information, (str:strcmp("ALERTED", state) == 0) as notify
insert into dataOut;
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')
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
insert into dataOut;

@ -12,8 +12,11 @@
define stream dataIn (meta_deviceId string, meta_deviceType string, timeStamp long, latitude double, longitude double);
@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
select meta_deviceId as id, latitude, longitude, timeStamp,
meta_deviceType as type, 0.0f as speed, 0.0f as heading, UUID() as eventId insert into dataOut
from every fs1=dataIn -> fs2=dataIn[fs2.timeStamp > fs1.timeStamp and fs1.meta_deviceId == fs2.meta_deviceId]
select fs1.meta_deviceId as id, fs2.latitude, fs2.longitude, fs2.timeStamp, fs1.meta_deviceType as type,
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