diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2016-11-23 23:22:43 +1300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-23 23:22:43 +1300 |
commit | dbbe99269140f057d3f72acca557730a6b10e902 (patch) | |
tree | 0a66b3ce6ce21964c539c4627e04640738f04c2b /src/org/traccar/notification/NotificationFormatter.java | |
parent | 5f867c6077f79a2a1d3b8ec18f78c3a2657ba698 (diff) | |
parent | 685fd3826b64b14106aeace0a647e71a4cc4fe81 (diff) | |
download | trackermap-server-dbbe99269140f057d3f72acca557730a6b10e902.tar.gz trackermap-server-dbbe99269140f057d3f72acca557730a6b10e902.tar.bz2 trackermap-server-dbbe99269140f057d3f72acca557730a6b10e902.zip |
Merge pull request #2583 from Abyss777/maintenanceevents
Implement maintenance events
Diffstat (limited to 'src/org/traccar/notification/NotificationFormatter.java')
-rw-r--r-- | src/org/traccar/notification/NotificationFormatter.java | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/org/traccar/notification/NotificationFormatter.java b/src/org/traccar/notification/NotificationFormatter.java index 2355d1793..38a228beb 100644 --- a/src/org/traccar/notification/NotificationFormatter.java +++ b/src/org/traccar/notification/NotificationFormatter.java @@ -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" @@ -88,6 +92,11 @@ public final class NotificationFormatter { + "Ignition OFF%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_NEEDED = "%1$s: maintenance is needed"; + public static final String MESSAGE_TEMPLATE_TYPE_MAINTENANCE_NEEDED = "Device: %1$s%n" + + "Maintenance is needed%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) { Device device = Context.getIdentityManager().getDeviceById(event.getDeviceId()); @@ -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_NEEDED: + formatter.format(TITLE_TEMPLATE_TYPE_MAINTENANCE_NEEDED, 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_NEEDED: + formatter.format(MESSAGE_TEMPLATE_TYPE_MAINTENANCE_NEEDED, device.getName(), position.getFixTime(), + position.getLatitude(), position.getLongitude()); + break; default: formatter.format("Unknown type"); break; |