From c6cc8a87eb593dbf765814d1aaa09d5d231fa7fe Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Thu, 26 May 2016 16:14:52 +0500 Subject: Events subsystem --- setup/unix/traccar.xml | 26 +++++++++++++++++++++++++- setup/windows/traccar.xml | 26 +++++++++++++++++++++++++- 2 files changed, 50 insertions(+), 2 deletions(-) (limited to 'setup') diff --git a/setup/unix/traccar.xml b/setup/unix/traccar.xml index 2ddf6551f..a27c9790b 100644 --- a/setup/unix/traccar.xml +++ b/setup/unix/traccar.xml @@ -17,6 +17,13 @@ all /opt/traccar/logs/tracker-server.log + 60 + + true + 90 + + true + org.h2.Driver @@ -109,7 +116,7 @@ - UPDATE devices SET status = :status, lastUpdate = :lastUpdate WHERE id = :id; + UPDATE devices SET status = :status, lastUpdate = :lastUpdate, motion = :motion WHERE id = :id; @@ -165,6 +172,23 @@ UPDATE devices SET positionId = :id WHERE id = :deviceId; + + SELECT * FROM events WHERE id = :id; + + + + INSERT INTO events (type, eventTime, deviceId, positionId, attributes) + VALUES (:type, :eventTime, :deviceId, :positionId, :attributes); + + + + SELECT * FROM events WHERE deviceId = :deviceId AND type LIKE :type AND eventTime BETWEEN :from AND :to ORDER BY eventTime DESC; + + + + SELECT * FROM events WHERE deviceId = :deviceId AND type LIKE :type AND eventTime >= NOW() - INTERVAL :interval SECOND ORDER BY eventTime DESC; + + 5001 diff --git a/setup/windows/traccar.xml b/setup/windows/traccar.xml index bf1b216af..d60640375 100644 --- a/setup/windows/traccar.xml +++ b/setup/windows/traccar.xml @@ -17,6 +17,13 @@ all [LOG] + 60 + + true + 90 + + true + org.h2.Driver @@ -109,7 +116,7 @@ - UPDATE devices SET status = :status, lastUpdate = :lastUpdate WHERE id = :id; + UPDATE devices SET status = :status, lastUpdate = :lastUpdate, motion = :motion WHERE id = :id; @@ -165,6 +172,23 @@ UPDATE devices SET positionId = :id WHERE id = :deviceId; + + SELECT * FROM events WHERE id = :id; + + + + INSERT INTO events (type, eventTime, deviceId, positionId, attributes) + VALUES (:type, :eventTime, :deviceId, :positionId, :attributes); + + + + SELECT * FROM events WHERE deviceId = :deviceId AND type LIKE :type AND eventTime BETWEEN :from AND :to ORDER BY eventTime DESC; + + + + SELECT * FROM events WHERE deviceId = :deviceId AND type LIKE :type AND eventTime >= NOW() - INTERVAL :interval SECOND ORDER BY eventTime DESC; + + 5001 -- cgit v1.2.3