aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/events/AlertEventHandler.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-07-25 16:20:15 +1200
committerGitHub <noreply@github.com>2016-07-25 16:20:15 +1200
commit4a31e34ca62d4b1941d3bc329afc127ef7263f34 (patch)
tree09b9ad0420a4819a350bcdcffeeee2342c5d2483 /src/org/traccar/events/AlertEventHandler.java
parent866c3073ef48a24d86834a391a4d3d91209a6eed (diff)
parentb4841fa0a6293c0b895cf6bb65c6c2d871c78397 (diff)
downloadtrackermap-server-4a31e34ca62d4b1941d3bc329afc127ef7263f34.tar.gz
trackermap-server-4a31e34ca62d4b1941d3bc329afc127ef7263f34.tar.bz2
trackermap-server-4a31e34ca62d4b1941d3bc329afc127ef7263f34.zip
Merge pull request #2104 from ninioe/master
Added support for Alarm notifications & positions history cleaner & show alarms in report & Mute button & unlock UI files (for windows)
Diffstat (limited to 'src/org/traccar/events/AlertEventHandler.java')
-rw-r--r--src/org/traccar/events/AlertEventHandler.java38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/org/traccar/events/AlertEventHandler.java b/src/org/traccar/events/AlertEventHandler.java
new file mode 100644
index 000000000..61c2d7b16
--- /dev/null
+++ b/src/org/traccar/events/AlertEventHandler.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2016 Anton Tananaev (anton.tananaev@gmail.com)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.traccar.events;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.traccar.BaseEventHandler;
+import org.traccar.model.Event;
+import org.traccar.model.Position;
+
+public class AlertEventHandler extends BaseEventHandler {
+
+ @Override
+ protected Collection<Event> analyzePosition(Position position) {
+ Object alarm = position.getAttributes().get(Position.KEY_ALARM);
+ if (alarm != null) {
+ Collection<Event> events = new ArrayList<>();
+ events.add(new Event(Event.TYPE_ALARM, position.getDeviceId(), position.getId()));
+ return events;
+ }
+ return null;
+ }
+
+}