aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/notification/NotificationFormatter.java
diff options
context:
space:
mode:
authorPhilipp Prangenberg <philipp.prangenberg@derkurier.de>2016-12-05 12:03:08 +0100
committerPhilipp Prangenberg <philipp.prangenberg@derkurier.de>2016-12-05 12:03:08 +0100
commita21f436a58133f7da0cae06366d729665f3b8f9c (patch)
tree72ff1743d96f79e4a9d85b0d48715e5f9aa67cf9 /src/org/traccar/notification/NotificationFormatter.java
parent960bf899414d89221e92138fdb98777c3f4f73ec (diff)
parent40607036c5aa6385a7ae3f3a283bf107238a5944 (diff)
downloadtrackermap-server-a21f436a58133f7da0cae06366d729665f3b8f9c.tar.gz
trackermap-server-a21f436a58133f7da0cae06366d729665f3b8f9c.tar.bz2
trackermap-server-a21f436a58133f7da0cae06366d729665f3b8f9c.zip
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'src/org/traccar/notification/NotificationFormatter.java')
-rw-r--r--src/org/traccar/notification/NotificationFormatter.java40
1 files changed, 31 insertions, 9 deletions
diff --git a/src/org/traccar/notification/NotificationFormatter.java b/src/org/traccar/notification/NotificationFormatter.java
index ae1a58d3a..6753873ed 100644
--- a/src/org/traccar/notification/NotificationFormatter.java
+++ b/src/org/traccar/notification/NotificationFormatter.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 Anton Tananaev (anton.tananaev@gmail.com)
+ * Copyright 2016 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -39,6 +39,10 @@ public final class NotificationFormatter {
public static final String MESSAGE_TEMPLATE_TYPE_DEVICE_ONLINE = "Device: %1$s%n"
+ "Online%n"
+ "Time: %2$tc%n";
+ public static final String TITLE_TEMPLATE_TYPE_DEVICE_UNKNOWN = "%1$s: status is unknown";
+ public static final String MESSAGE_TEMPLATE_TYPE_DEVICE_UNKNOWN = "Device: %1$s%n"
+ + "Status is unknown%n"
+ + "Time: %2$tc%n";
public static final String TITLE_TEMPLATE_TYPE_DEVICE_OFFLINE = "%1$s: offline";
public static final String MESSAGE_TEMPLATE_TYPE_DEVICE_OFFLINE = "Device: %1$s%n"
+ "Offline%n"
@@ -47,46 +51,51 @@ public final class NotificationFormatter {
public static final String TITLE_TEMPLATE_TYPE_DEVICE_MOVING = "%1$s: moving";
public static final String MESSAGE_TEMPLATE_TYPE_DEVICE_MOVING = "Device: %1$s%n"
+ "Moving%n"
- + "Point: http://www.openstreetmap.org/?mlat=%3$f&mlon=%4$f#map=16/%3$f/%4$f%n"
+ + "Point: https://www.openstreetmap.org/?mlat=%3$f&mlon=%4$f#map=16/%3$f/%4$f%n"
+ "Time: %2$tc%n";
public static final String TITLE_TEMPLATE_TYPE_DEVICE_STOPPED = "%1$s: stopped";
public static final String MESSAGE_TEMPLATE_TYPE_DEVICE_STOPPED = "Device: %1$s%n"
+ "Stopped%n"
- + "Point: http://www.openstreetmap.org/?mlat=%3$f&mlon=%4$f#map=16/%3$f/%4$f%n"
+ + "Point: https://www.openstreetmap.org/?mlat=%3$f&mlon=%4$f#map=16/%3$f/%4$f%n"
+ "Time: %2$tc%n";
public static final String TITLE_TEMPLATE_TYPE_DEVICE_OVERSPEED = "%1$s: exceeds the speed";
public static final String MESSAGE_TEMPLATE_TYPE_DEVICE_OVERSPEED = "Device: %1$s%n"
+ "Exceeds the speed: %5$s%n"
- + "Point: http://www.openstreetmap.org/?mlat=%3$f&mlon=%4$f#map=16/%3$f/%4$f%n"
+ + "Point: https://www.openstreetmap.org/?mlat=%3$f&mlon=%4$f#map=16/%3$f/%4$f%n"
+ "Time: %2$tc%n";
public static final String TITLE_TEMPLATE_TYPE_GEOFENCE_ENTER = "%1$s: has entered geofence";
public static final String MESSAGE_TEMPLATE_TYPE_GEOFENCE_ENTER = "Device: %1$s%n"
+ "Has entered geofence: %5$s%n"
- + "Point: http://www.openstreetmap.org/?mlat=%3$f&mlon=%4$f#map=16/%3$f/%4$f%n"
+ + "Point: https://www.openstreetmap.org/?mlat=%3$f&mlon=%4$f#map=16/%3$f/%4$f%n"
+ "Time: %2$tc%n";
public static final String TITLE_TEMPLATE_TYPE_GEOFENCE_EXIT = "%1$s: has exited geofence";
public static final String MESSAGE_TEMPLATE_TYPE_GEOFENCE_EXIT = "Device: %1$s%n"
+ "Has exited geofence: %5$s%n"
- + "Point: http://www.openstreetmap.org/?mlat=%3$f&mlon=%4$f#map=16/%3$f/%4$f%n"
+ + "Point: https://www.openstreetmap.org/?mlat=%3$f&mlon=%4$f#map=16/%3$f/%4$f%n"
+ "Time: %2$tc%n";
public static final String TITLE_TEMPLATE_TYPE_ALARM = "%1$s: alarm!";
public static final String MESSAGE_TEMPLATE_TYPE_ALARM = "Device: %1$s%n"
+ "Alarm: %5$s%n"
- + "Point: http://www.openstreetmap.org/?mlat=%3$f&mlon=%4$f#map=16/%3$f/%4$f%n"
+ + "Point: https://www.openstreetmap.org/?mlat=%3$f&mlon=%4$f#map=16/%3$f/%4$f%n"
+ "Time: %2$tc%n";
public static final String TITLE_TEMPLATE_TYPE_IGNITION_ON = "%1$s: ignition ON";
public static final String MESSAGE_TEMPLATE_TYPE_IGNITION_ON = "Device: %1$s%n"
+ "Ignition ON%n"
- + "Point: http://www.openstreetmap.org/?mlat=%3$f&mlon=%4$f#map=16/%3$f/%4$f%n"
+ + "Point: https://www.openstreetmap.org/?mlat=%3$f&mlon=%4$f#map=16/%3$f/%4$f%n"
+ "Time: %2$tc%n";
public static final String TITLE_TEMPLATE_TYPE_IGNITION_OFF = "%1$s: ignition OFF";
public static final String MESSAGE_TEMPLATE_TYPE_IGNITION_OFF = "Device: %1$s%n"
+ "Ignition OFF%n"
- + "Point: http://www.openstreetmap.org/?mlat=%3$f&mlon=%4$f#map=16/%3$f/%4$f%n"
+ + "Point: https://www.openstreetmap.org/?mlat=%3$f&mlon=%4$f#map=16/%3$f/%4$f%n"
+ + "Time: %2$tc%n";
+ public static final String TITLE_TEMPLATE_TYPE_MAINTENANCE = "%1$s: maintenance is required";
+ public static final String MESSAGE_TEMPLATE_TYPE_MAINTENANCE = "Device: %1$s%n"
+ + "Maintenance is required%n"
+ + "Point: https://www.openstreetmap.org/?mlat=%3$f&mlon=%4$f#map=16/%3$f/%4$f%n"
+ "Time: %2$tc%n";
public static String formatTitle(long userId, Event event, Position position) {
@@ -101,6 +110,9 @@ public final class NotificationFormatter {
case Event.TYPE_DEVICE_ONLINE:
formatter.format(TITLE_TEMPLATE_TYPE_DEVICE_ONLINE, device.getName());
break;
+ case Event.TYPE_DEVICE_UNKNOWN:
+ formatter.format(TITLE_TEMPLATE_TYPE_DEVICE_UNKNOWN, device.getName());
+ break;
case Event.TYPE_DEVICE_OFFLINE:
formatter.format(TITLE_TEMPLATE_TYPE_DEVICE_OFFLINE, device.getName());
break;
@@ -128,6 +140,9 @@ public final class NotificationFormatter {
case Event.TYPE_IGNITION_OFF:
formatter.format(TITLE_TEMPLATE_TYPE_IGNITION_OFF, device.getName());
break;
+ case Event.TYPE_MAINTENANCE:
+ formatter.format(TITLE_TEMPLATE_TYPE_MAINTENANCE, device.getName());
+ break;
default:
formatter.format("Unknown type");
break;
@@ -150,6 +165,9 @@ public final class NotificationFormatter {
case Event.TYPE_DEVICE_ONLINE:
formatter.format(MESSAGE_TEMPLATE_TYPE_DEVICE_ONLINE, device.getName(), event.getServerTime());
break;
+ case Event.TYPE_DEVICE_UNKNOWN:
+ formatter.format(MESSAGE_TEMPLATE_TYPE_DEVICE_UNKNOWN, device.getName(), event.getServerTime());
+ break;
case Event.TYPE_DEVICE_OFFLINE:
formatter.format(MESSAGE_TEMPLATE_TYPE_DEVICE_OFFLINE, device.getName(), event.getServerTime());
break;
@@ -188,6 +206,10 @@ public final class NotificationFormatter {
formatter.format(MESSAGE_TEMPLATE_TYPE_IGNITION_OFF, device.getName(), position.getFixTime(),
position.getLatitude(), position.getLongitude());
break;
+ case Event.TYPE_MAINTENANCE:
+ formatter.format(MESSAGE_TEMPLATE_TYPE_MAINTENANCE, device.getName(), position.getFixTime(),
+ position.getLatitude(), position.getLongitude());
+ break;
default:
formatter.format("Unknown type");
break;