aboutsummaryrefslogtreecommitdiff
path: root/setup
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2016-05-26 16:14:52 +0500
committerAbyss777 <abyss@fox5.ru>2016-05-26 16:14:52 +0500
commitc6cc8a87eb593dbf765814d1aaa09d5d231fa7fe (patch)
tree8b0cddcc79476a3252c8aec0946bd6e8e016b475 /setup
parentaa12e5c750e771016545269ffa39409b06b47eee (diff)
downloadtraccar-server-c6cc8a87eb593dbf765814d1aaa09d5d231fa7fe.tar.gz
traccar-server-c6cc8a87eb593dbf765814d1aaa09d5d231fa7fe.tar.bz2
traccar-server-c6cc8a87eb593dbf765814d1aaa09d5d231fa7fe.zip
Events subsystem
Diffstat (limited to 'setup')
-rw-r--r--setup/unix/traccar.xml26
-rw-r--r--setup/windows/traccar.xml26
2 files changed, 50 insertions, 2 deletions
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 @@
<entry key='logger.level'>all</entry>
<entry key='logger.file'>/opt/traccar/logs/tracker-server.log</entry>
+ <entry key='event.suppressrepeated'>60</entry>
+
+ <entry key='event.overspeedhandler'>true</entry>
+ <entry key='event.globalspeedlimit'>90</entry>
+
+ <entry key='event.motionhandler'>true</entry>
+
<!-- DATABASE CONFIG -->
<entry key='database.driver'>org.h2.Driver</entry>
@@ -109,7 +116,7 @@
</entry>
<entry key='database.updateDeviceStatus'>
- UPDATE devices SET status = :status, lastUpdate = :lastUpdate WHERE id = :id;
+ UPDATE devices SET status = :status, lastUpdate = :lastUpdate, motion = :motion WHERE id = :id;
</entry>
<entry key='database.deleteDevice'>
@@ -165,6 +172,23 @@
UPDATE devices SET positionId = :id WHERE id = :deviceId;
</entry>
+ <entry key='database.selectEvent'>
+ SELECT * FROM events WHERE id = :id;
+ </entry>
+
+ <entry key='database.insertEvent'>
+ INSERT INTO events (type, eventTime, deviceId, positionId, attributes)
+ VALUES (:type, :eventTime, :deviceId, :positionId, :attributes);
+ </entry>
+
+ <entry key='database.selectEvents'>
+ SELECT * FROM events WHERE deviceId = :deviceId AND type LIKE :type AND eventTime BETWEEN :from AND :to ORDER BY eventTime DESC;
+ </entry>
+
+ <entry key='database.selectLastEvents'>
+ SELECT * FROM events WHERE deviceId = :deviceId AND type LIKE :type AND eventTime >= NOW() - INTERVAL :interval SECOND ORDER BY eventTime DESC;
+ </entry>
+
<!-- PROTOCOL CONFIG -->
<entry key='gps103.port'>5001</entry>
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 @@
<entry key='logger.level'>all</entry>
<entry key='logger.file'>[LOG]</entry>
+ <entry key='event.suppressrepeated'>60</entry>
+
+ <entry key='event.overspeedhandler'>true</entry>
+ <entry key='event.globalspeedlimit'>90</entry>
+
+ <entry key='event.motionhandler'>true</entry>
+
<!-- DATABASE CONFIG -->
<entry key='database.driver'>org.h2.Driver</entry>
@@ -109,7 +116,7 @@
</entry>
<entry key='database.updateDeviceStatus'>
- UPDATE devices SET status = :status, lastUpdate = :lastUpdate WHERE id = :id;
+ UPDATE devices SET status = :status, lastUpdate = :lastUpdate, motion = :motion WHERE id = :id;
</entry>
<entry key='database.deleteDevice'>
@@ -165,6 +172,23 @@
UPDATE devices SET positionId = :id WHERE id = :deviceId;
</entry>
+ <entry key='database.selectEvent'>
+ SELECT * FROM events WHERE id = :id;
+ </entry>
+
+ <entry key='database.insertEvent'>
+ INSERT INTO events (type, eventTime, deviceId, positionId, attributes)
+ VALUES (:type, :eventTime, :deviceId, :positionId, :attributes);
+ </entry>
+
+ <entry key='database.selectEvents'>
+ SELECT * FROM events WHERE deviceId = :deviceId AND type LIKE :type AND eventTime BETWEEN :from AND :to ORDER BY eventTime DESC;
+ </entry>
+
+ <entry key='database.selectLastEvents'>
+ SELECT * FROM events WHERE deviceId = :deviceId AND type LIKE :type AND eventTime >= NOW() - INTERVAL :interval SECOND ORDER BY eventTime DESC;
+ </entry>
+
<!-- PROTOCOL CONFIG -->
<entry key='gps103.port'>5001</entry>