aboutsummaryrefslogtreecommitdiff
path: root/setup
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2016-06-10 16:02:06 +0500
committerAbyss777 <abyss@fox5.ru>2016-06-10 16:02:06 +0500
commit41fe4ca770875842f4d17531506c4bc74dc90501 (patch)
treed8cdfbf19873d8dd4ae100887b0cec5134f5eb74 /setup
parente966778c43ee4a2fa12705cded8648b96ef78f61 (diff)
downloadtraccar-server-41fe4ca770875842f4d17531506c4bc74dc90501.tar.gz
traccar-server-41fe4ca770875842f4d17531506c4bc74dc90501.tar.bz2
traccar-server-41fe4ca770875842f4d17531506c4bc74dc90501.zip
Geofences
Diffstat (limited to 'setup')
-rw-r--r--setup/unix/traccar.xml71
-rw-r--r--setup/windows/traccar.xml71
2 files changed, 136 insertions, 6 deletions
diff --git a/setup/unix/traccar.xml b/setup/unix/traccar.xml
index d8d4a1084..37ff31bbe 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>
@@ -116,7 +118,7 @@
</entry>
<entry key='database.updateDeviceStatus'>
- UPDATE devices SET status = :status, lastUpdate = :lastUpdate, motion = :motion WHERE id = :id;
+ UPDATE devices SET status = :status, lastUpdate = :lastUpdate, motion = :motion, geofenceId = :geofenceId WHERE id = :id;
</entry>
<entry key='database.deleteDevice'>
@@ -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.selectUserDeviceGeofences'>
+ SELECT userId, deviceId, geofenceId FROM user_device_geofence;
+ </entry>
+
+ <entry key='database.linkUserDeviceGeofence'>
+ INSERT INTO user_device_geofence (userId, deviceId, geofenceId) VALUES (:userId, :deviceId, :geofenceId);
+ </entry>
+
+ <entry key='database.unlinkUserDeviceGeofence'>
+ DELETE FROM user_device_geofence WHERE userId = :userId AND 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..5f86e53b0 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>
@@ -116,7 +118,7 @@
</entry>
<entry key='database.updateDeviceStatus'>
- UPDATE devices SET status = :status, lastUpdate = :lastUpdate, motion = :motion WHERE id = :id;
+ UPDATE devices SET status = :status, lastUpdate = :lastUpdate, motion = :motion, geofenceId = :geofenceId WHERE id = :id;
</entry>
<entry key='database.deleteDevice'>
@@ -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.selectUserDeviceGeofences'>
+ SELECT userId, deviceId, geofenceId FROM user_device_geofence;
+ </entry>
+
+ <entry key='database.linkUserDeviceGeofence'>
+ INSERT INTO user_device_geofence (userId, deviceId, geofenceId) VALUES (:userId, :deviceId, :geofenceId);
+ </entry>
+
+ <entry key='database.unlinkUserDeviceGeofence'>
+ DELETE FROM user_device_geofence WHERE userId = :userId AND deviceId = :deviceId AND geofenceId = :geofenceId;
+ </entry>
+
<!-- PROTOCOL CONFIG -->
<entry key='gps103.port'>5001</entry>