aboutsummaryrefslogtreecommitdiff
path: root/setup
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-06-18 11:56:59 +1200
committerGitHub <noreply@github.com>2016-06-18 11:56:59 +1200
commitb3b0cd9d6f2d26cef2e64ef38e23203f1f3fa51a (patch)
tree2e8deb61d372095aebb8270f740501c8124ea8c4 /setup
parentd801cba474cd05bb088348f04e8557ca638cd74f (diff)
parent82a78ff77a076231a8429f0dd84678d61c31d44a (diff)
downloadtrackermap-server-b3b0cd9d6f2d26cef2e64ef38e23203f1f3fa51a.tar.gz
trackermap-server-b3b0cd9d6f2d26cef2e64ef38e23203f1f3fa51a.tar.bz2
trackermap-server-b3b0cd9d6f2d26cef2e64ef38e23203f1f3fa51a.zip
Merge pull request #2012 from Abyss777/master
Implement Geofences on server side
Diffstat (limited to 'setup')
-rw-r--r--setup/unix/traccar.xml69
-rw-r--r--setup/windows/traccar.xml69
2 files changed, 134 insertions, 4 deletions
diff --git a/setup/unix/traccar.xml b/setup/unix/traccar.xml
index d8d4a1084..ab739e4d6 100644
--- a/setup/unix/traccar.xml
+++ b/setup/unix/traccar.xml
@@ -24,6 +24,8 @@
<entry key='event.motionHandler'>true</entry>
+ <entry key='event.geofenceHandler'>true</entry>
+
<!-- DATABASE CONFIG -->
<entry key='database.driver'>org.h2.Driver</entry>
@@ -177,14 +179,77 @@
</entry>
<entry key='database.insertEvent'>
- INSERT INTO events (type, serverTime, deviceId, positionId, attributes)
- VALUES (:type, :serverTime, :deviceId, :positionId, :attributes);
+ INSERT INTO events (type, serverTime, deviceId, positionId, geofenceId, attributes)
+ VALUES (:type, :serverTime, :deviceId, :positionId, :geofenceId, :attributes);
</entry>
<entry key='database.selectEvents'>
SELECT * FROM events WHERE deviceId = :deviceId AND type LIKE :type AND serverTime BETWEEN :from AND :to ORDER BY serverTime DESC;
</entry>
+ <entry key='database.selectGeofence'>
+ SELECT * FROM geofences
+ WHERE id = :id;
+ </entry>
+
+ <entry key='database.selectGeofencesAll'>
+ SELECT * FROM geofences;
+ </entry>
+
+ <entry key='database.insertGeofence'>
+ INSERT INTO geofences (name, description, area, attributes)
+ VALUES (:name, :description, :area, :attributes);
+ </entry>
+
+ <entry key='database.updateGeofence'>
+ UPDATE geofences SET
+ name = :name,
+ description = :description,
+ area = :area,
+ attributes = :attributes
+ WHERE id = :id;
+ </entry>
+
+ <entry key='database.deleteGeofence'>
+ DELETE FROM geofences WHERE id = :id;
+ </entry>
+
+ <entry key='database.selectGeofencePermissions'>
+ SELECT userId, geofenceId FROM user_geofence;
+ </entry>
+
+ <entry key='database.linkGeofence'>
+ INSERT INTO user_geofence (userId, geofenceId) VALUES (:userId, :geofenceId);
+ </entry>
+
+ <entry key='database.unlinkGeofence'>
+ DELETE FROM user_geofence WHERE userId = :userId AND geofenceId = :geofenceId;
+ </entry>
+
+ <entry key='database.selectGroupGeofences'>
+ SELECT groupId, geofenceId FROM group_geofence;
+ </entry>
+
+ <entry key='database.linkGroupGeofence'>
+ INSERT INTO group_geofence (groupId, geofenceId) VALUES (:groupId, :geofenceId);
+ </entry>
+
+ <entry key='database.unlinkGroupGeofence'>
+ DELETE FROM group_geofence WHERE groupId = :groupId AND geofenceId = :geofenceId;
+ </entry>
+
+ <entry key='database.selectDeviceGeofences'>
+ SELECT deviceId, geofenceId FROM device_geofence;
+ </entry>
+
+ <entry key='database.linkDeviceGeofence'>
+ INSERT INTO device_geofence (deviceId, geofenceId) VALUES (:deviceId, :geofenceId);
+ </entry>
+
+ <entry key='database.unlinkDeviceGeofence'>
+ DELETE FROM device_geofence WHERE deviceId = :deviceId AND geofenceId = :geofenceId;
+ </entry>
+
<!-- PROTOCOL CONFIG -->
<entry key='gps103.port'>5001</entry>
diff --git a/setup/windows/traccar.xml b/setup/windows/traccar.xml
index 71f56f4c7..17f2ab4f3 100644
--- a/setup/windows/traccar.xml
+++ b/setup/windows/traccar.xml
@@ -24,6 +24,8 @@
<entry key='event.motionHandler'>true</entry>
+ <entry key='event.geofenceHandler'>true</entry>
+
<!-- DATABASE CONFIG -->
<entry key='database.driver'>org.h2.Driver</entry>
@@ -177,14 +179,77 @@
</entry>
<entry key='database.insertEvent'>
- INSERT INTO events (type, serverTime, deviceId, positionId, attributes)
- VALUES (:type, :serverTime, :deviceId, :positionId, :attributes);
+ INSERT INTO events (type, serverTime, deviceId, positionId, geofenceId, attributes)
+ VALUES (:type, :serverTime, :deviceId, :positionId, :geofenceId, :attributes);
</entry>
<entry key='database.selectEvents'>
SELECT * FROM events WHERE deviceId = :deviceId AND type LIKE :type AND serverTime BETWEEN :from AND :to ORDER BY serverTime DESC;
</entry>
+ <entry key='database.selectGeofence'>
+ SELECT * FROM geofences
+ WHERE id = :id;
+ </entry>
+
+ <entry key='database.selectGeofencesAll'>
+ SELECT * FROM geofences;
+ </entry>
+
+ <entry key='database.insertGeofence'>
+ INSERT INTO geofences (name, description, area, attributes)
+ VALUES (:name, :description, :area, :attributes);
+ </entry>
+
+ <entry key='database.updateGeofence'>
+ UPDATE geofences SET
+ name = :name,
+ description = :description,
+ area = :area,
+ attributes = :attributes
+ WHERE id = :id;
+ </entry>
+
+ <entry key='database.deleteGeofence'>
+ DELETE FROM geofences WHERE id = :id;
+ </entry>
+
+ <entry key='database.selectGeofencePermissions'>
+ SELECT userId, geofenceId FROM user_geofence;
+ </entry>
+
+ <entry key='database.linkGeofence'>
+ INSERT INTO user_geofence (userId, geofenceId) VALUES (:userId, :geofenceId);
+ </entry>
+
+ <entry key='database.unlinkGeofence'>
+ DELETE FROM user_geofence WHERE userId = :userId AND geofenceId = :geofenceId;
+ </entry>
+
+ <entry key='database.selectGroupGeofences'>
+ SELECT groupId, geofenceId FROM group_geofence;
+ </entry>
+
+ <entry key='database.linkGroupGeofence'>
+ INSERT INTO group_geofence (groupId, geofenceId) VALUES (:groupId, :geofenceId);
+ </entry>
+
+ <entry key='database.unlinkGroupGeofence'>
+ DELETE FROM group_geofence WHERE groupId = :groupId AND geofenceId = :geofenceId;
+ </entry>
+
+ <entry key='database.selectDeviceGeofences'>
+ SELECT deviceId, geofenceId FROM device_geofence;
+ </entry>
+
+ <entry key='database.linkDeviceGeofence'>
+ INSERT INTO device_geofence (deviceId, geofenceId) VALUES (:deviceId, :geofenceId);
+ </entry>
+
+ <entry key='database.unlinkDeviceGeofence'>
+ DELETE FROM device_geofence WHERE deviceId = :deviceId AND geofenceId = :geofenceId;
+ </entry>
+
<!-- PROTOCOL CONFIG -->
<entry key='gps103.port'>5001</entry>