diff options
author | jon-stumpf <jon.stumpf@gmail.com> | 2017-03-16 23:35:43 -0400 |
---|---|---|
committer | jon-stumpf <jon.stumpf@gmail.com> | 2017-03-17 13:48:21 -0400 |
commit | 001ee6acf3052fd99970e75a7f55b11332b9442f (patch) | |
tree | 50d6d6d374601b9c0f03224ea7d297707a98d9a5 /src/org | |
parent | b0fed2ff54b79a47c61e9c6d0ac39963fd4a3a67 (diff) | |
download | traccar-server-001ee6acf3052fd99970e75a7f55b11332b9442f.tar.gz traccar-server-001ee6acf3052fd99970e75a7f55b11332b9442f.tar.bz2 traccar-server-001ee6acf3052fd99970e75a7f55b11332b9442f.zip |
Merged Y4 and Y2 DateTimeFormats, simplifying switch;
Diffstat (limited to 'src/org')
49 files changed, 75 insertions, 110 deletions
diff --git a/src/org/traccar/helper/Parser.java b/src/org/traccar/helper/Parser.java index b345bfab2..aa2f457d3 100644 --- a/src/org/traccar/helper/Parser.java +++ b/src/org/traccar/helper/Parser.java @@ -171,32 +171,20 @@ public class Parser { HMS, // HHMMSS SMH, // SSMMHH - HMS_Y4MD, // HHMMSSYYYYMMDD - HMS_Y2MD, // HHMMSSYYMMDD + HMS_YMD, // HHMMSSYYYYMMDD or HHMMSSYYMMDD + HMS_DMY, // HHMMSSDDMMYYYY or HHMMSSDDMMYY + SMH_YMD, // SSMMHHYYYYMMDD or SSMMHHYYMMDD + SMH_DMY, // SSMMHHDDMMYYYY or SSMMHHDDMMYY - HMS_DMY4, // HHMMSSDDMMYYYY - HMS_DMY2, // HHMMSSDDMMYY - - SMH_Y4MD, // SSMMHHYYYYMMD - SMH_Y2MD, // SSMMHHYYMMDD - - SMH_DMY4, // SSMMHHDDMMYYYY - SMH_DMY2, // SSMMHHDDMMYY - - DMY4_HMS, // DDMMYYYYHHMMSS - DMY4_HMSms, // DDMMYYYYHHMMSS.m+ - DMY2_HMS, // DDMMYYHHMMSS - DMY2_HMSms, // DDMMYYHHMMSS.m+ - - Y4MD_HMS, // YYYYMMDDHHMMSS - Y4MD_HMSms, // YYYYMMDDHHMMSS.m+ - Y2MD_HMS, // YYMMDDHHMMSS - Y2MD_HMSms, // YYMMDDHHMMSS.m+ + DMY_HMS, // DDMMYYYYHHMMSS or DDMMYYHHMMSS + DMY_HMSms, // DDMMYYYYHHMMSS.sss or DDMMYYHHMMSS.sss + YMD_HMS, // YYYYMMDDHHMMSS or YYMMDDHHMMSS + YMD_HMSms, // YYYYMMDDHHMMSS.sss or YYMMDDHHMMSS.sss ISO8601 // YYYY-MM-DDTHH:MM:SS+HH:MM } - private static final DateTimeFormat DEFAULT_FORMAT = DateTimeFormat.Y4MD_HMS; + private static final DateTimeFormat DEFAULT_FORMAT = DateTimeFormat.YMD_HMS; private static final String DEFAULT_TZ = "UTC"; private static final int DEFAULT_RADIX = 10; @@ -212,37 +200,29 @@ public class Parser { case SMH: second = nextInt(radix); minute = nextInt(radix); hour = nextInt(radix); // (d{2})(d{2})(d{2}) break; - case HMS_Y4MD: - case HMS_Y2MD: + case HMS_YMD: hour = nextInt(radix); minute = nextInt(radix); second = nextInt(radix); // (d{2})(d{2})(d{2}) year = nextInt(radix); month = nextInt(radix); day = nextInt(radix); // (d{2}|d{4})(d{2})(d{2}) break; - case HMS_DMY4: - case HMS_DMY2: + case HMS_DMY: hour = nextInt(radix); minute = nextInt(radix); second = nextInt(radix); // (d{2})(d{2})(d{2}) day = nextInt(radix); month = nextInt(radix); year = nextInt(radix); // (d{2})(d{2})(d{2}|d{4}) break; - case SMH_Y4MD: - case SMH_Y2MD: + case SMH_YMD: second = nextInt(radix); minute = nextInt(radix); hour = nextInt(radix); // (d{2})(d{2})(d{2}) year = nextInt(radix); month = nextInt(radix); day = nextInt(radix); // (d{2}|d{4})(d{2})(d{2}) break; - case SMH_DMY4: - case SMH_DMY2: + case SMH_DMY: second = nextInt(radix); minute = nextInt(radix); hour = nextInt(radix); // (d{2})(d{2})(d{2}) day = nextInt(radix); month = nextInt(radix); year = nextInt(radix); // (d{2})(d{2})(d{2}|d{4}) break; - case DMY4_HMS: - case DMY4_HMSms: - case DMY2_HMS: - case DMY2_HMSms: + case DMY_HMS: + case DMY_HMSms: day = nextInt(radix); month = nextInt(radix); year = nextInt(radix); // (d{2})(d{2})(d{2}|d{4}) hour = nextInt(radix); minute = nextInt(radix); second = nextInt(radix); // (d{2})(d{2})(d{2}) break; - case Y4MD_HMS: - case Y4MD_HMSms: - case Y2MD_HMS: - case Y2MD_HMSms: + case YMD_HMS: + case YMD_HMSms: case ISO8601: default: year = nextInt(radix); month = nextInt(radix); day = nextInt(radix); // (d{2}|d{4})(d{2})(d{2}) @@ -251,17 +231,9 @@ public class Parser { } switch (format) { - case HMS_Y2MD: - case HMS_DMY2: - case SMH_Y2MD: - case SMH_DMY2: - case DMY2_HMS: - case DMY2_HMSms: - case Y2MD_HMS: - case Y2MD_HMSms: - if (year >= 0 && year < 100) { - year += 2000; // Future Y3K issue :) - } + case YMD_HMSms: + case DMY_HMSms: + millisecond = nextInt(radix); // (ddd) break; case ISO8601: timeZone = TimeZone.getTimeZone("GMT" + next()); // ([+-]d{2}:d{2}) @@ -270,15 +242,8 @@ public class Parser { break; } - switch (format) { - case Y4MD_HMSms: - case Y2MD_HMSms: - case DMY4_HMSms: - case DMY2_HMSms: - millisecond = nextInt(radix); // (d+) - break; - default: - break; + if (year >= 0 && year < 100) { + year += 2000; // Future Y3K issue :) } DateBuilder dateBuilder = new DateBuilder(timeZone); diff --git a/src/org/traccar/protocol/AquilaProtocolDecoder.java b/src/org/traccar/protocol/AquilaProtocolDecoder.java index 182fb5080..56723e0ef 100644 --- a/src/org/traccar/protocol/AquilaProtocolDecoder.java +++ b/src/org/traccar/protocol/AquilaProtocolDecoder.java @@ -120,7 +120,7 @@ public class AquilaProtocolDecoder extends BaseProtocolDecoder { position.setLatitude(parser.nextDouble()); position.setLongitude(parser.nextDouble()); - position.setTime(parser.nextDateTime(Parser.DateTimeFormat.Y2MD_HMS)); + position.setTime(parser.nextDateTime()); position.setValid(parser.next().equals("A")); diff --git a/src/org/traccar/protocol/ArknavProtocolDecoder.java b/src/org/traccar/protocol/ArknavProtocolDecoder.java index ce47f0419..2b343e7c3 100644 --- a/src/org/traccar/protocol/ArknavProtocolDecoder.java +++ b/src/org/traccar/protocol/ArknavProtocolDecoder.java @@ -75,7 +75,7 @@ public class ArknavProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_HDOP, parser.nextDouble()); - position.setTime(parser.nextDateTime(Parser.DateTimeFormat.HMS_DMY2)); + position.setTime(parser.nextDateTime(Parser.DateTimeFormat.HMS_DMY)); return position; } diff --git a/src/org/traccar/protocol/ArknavX8ProtocolDecoder.java b/src/org/traccar/protocol/ArknavX8ProtocolDecoder.java index 08420677b..5f15323e6 100644 --- a/src/org/traccar/protocol/ArknavX8ProtocolDecoder.java +++ b/src/org/traccar/protocol/ArknavX8ProtocolDecoder.java @@ -71,7 +71,7 @@ public class ArknavX8ProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_TYPE, parser.next()); - position.setTime(parser.nextDateTime(Parser.DateTimeFormat.Y2MD_HMS)); + position.setTime(parser.nextDateTime()); position.setValid(parser.next().equals("A")); position.setLatitude(parser.nextCoordinate()); diff --git a/src/org/traccar/protocol/AuroProtocolDecoder.java b/src/org/traccar/protocol/AuroProtocolDecoder.java index c5c9c1dcb..72dea3b61 100644 --- a/src/org/traccar/protocol/AuroProtocolDecoder.java +++ b/src/org/traccar/protocol/AuroProtocolDecoder.java @@ -77,7 +77,7 @@ public class AuroProtocolDecoder extends BaseProtocolDecoder { position.setLongitude(parser.nextCoordinate(Parser.CoordinateFormat.HEM_DEG_MIN_MIN)); position.setLatitude(parser.nextCoordinate(Parser.CoordinateFormat.HEM_DEG_MIN_MIN)); - position.setTime(parser.nextDateTime(Parser.DateTimeFormat.DMY4_HMS)); + position.setTime(parser.nextDateTime(Parser.DateTimeFormat.DMY_HMS)); position.setCourse(parser.nextDouble()); position.setSpeed(UnitsConverter.knotsFromKph(parser.nextDouble())); diff --git a/src/org/traccar/protocol/BoxProtocolDecoder.java b/src/org/traccar/protocol/BoxProtocolDecoder.java index bbb0d284e..82c1c9c24 100644 --- a/src/org/traccar/protocol/BoxProtocolDecoder.java +++ b/src/org/traccar/protocol/BoxProtocolDecoder.java @@ -81,7 +81,7 @@ public class BoxProtocolDecoder extends BaseProtocolDecoder { position.setDeviceId(deviceSession.getDeviceId()); position.setProtocol(getProtocolName()); - position.setTime(parser.nextDateTime(Parser.DateTimeFormat.Y2MD_HMS)); + position.setTime(parser.nextDateTime()); position.setLatitude(parser.nextDouble()); position.setLongitude(parser.nextDouble()); diff --git a/src/org/traccar/protocol/CarcellProtocolDecoder.java b/src/org/traccar/protocol/CarcellProtocolDecoder.java index e0c4fc930..40e40a40f 100644 --- a/src/org/traccar/protocol/CarcellProtocolDecoder.java +++ b/src/org/traccar/protocol/CarcellProtocolDecoder.java @@ -128,7 +128,7 @@ public class CarcellProtocolDecoder extends BaseProtocolDecoder { position.set("clockType", parser.next()); - position.setTime(parser.nextDateTime(Parser.DateTimeFormat.DMY2_HMS)); + position.setTime(parser.nextDateTime(Parser.DateTimeFormat.DMY_HMS)); position.set("blocked", parser.next().equals("1")); position.set(Position.KEY_IGNITION, parser.next().equals("1")); diff --git a/src/org/traccar/protocol/CguardProtocolDecoder.java b/src/org/traccar/protocol/CguardProtocolDecoder.java index 59a10d804..19144017a 100644 --- a/src/org/traccar/protocol/CguardProtocolDecoder.java +++ b/src/org/traccar/protocol/CguardProtocolDecoder.java @@ -62,7 +62,7 @@ public class CguardProtocolDecoder extends BaseProtocolDecoder { position.setProtocol(getProtocolName()); position.setDeviceId(deviceSession.getDeviceId()); - position.setTime(parser.nextDateTime(Parser.DateTimeFormat.Y2MD_HMS)); + position.setTime(parser.nextDateTime()); position.setValid(true); position.setLatitude(parser.nextDouble()); @@ -88,7 +88,7 @@ public class CguardProtocolDecoder extends BaseProtocolDecoder { position.setProtocol(getProtocolName()); position.setDeviceId(deviceSession.getDeviceId()); - getLastLocation(position, parser.nextDateTime(Parser.DateTimeFormat.Y2MD_HMS)); + getLastLocation(position, parser.nextDateTime()); String[] data = parser.next().split(":"); for (int i = 0; i < data.length / 2; i++) { diff --git a/src/org/traccar/protocol/DishaProtocolDecoder.java b/src/org/traccar/protocol/DishaProtocolDecoder.java index 43019f05d..26ca1a856 100644 --- a/src/org/traccar/protocol/DishaProtocolDecoder.java +++ b/src/org/traccar/protocol/DishaProtocolDecoder.java @@ -76,7 +76,7 @@ public class DishaProtocolDecoder extends BaseProtocolDecoder { position.setValid(parser.next().equals("A")); - position.setTime(parser.nextDateTime(Parser.DateTimeFormat.HMS_DMY2)); + position.setTime(parser.nextDateTime(Parser.DateTimeFormat.HMS_DMY)); position.setLatitude(parser.nextCoordinate()); position.setLongitude(parser.nextCoordinate()); diff --git a/src/org/traccar/protocol/EasyTrackProtocolDecoder.java b/src/org/traccar/protocol/EasyTrackProtocolDecoder.java index d40c9a670..7c91b843c 100644 --- a/src/org/traccar/protocol/EasyTrackProtocolDecoder.java +++ b/src/org/traccar/protocol/EasyTrackProtocolDecoder.java @@ -74,7 +74,7 @@ public class EasyTrackProtocolDecoder extends BaseProtocolDecoder { position.setValid(parser.next().equals("A")); - position.setTime(parser.nextDateTime(Parser.DateTimeFormat.Y2MD_HMS, 16)); + position.setTime(parser.nextDateTime(16)); if (BitUtil.check(parser.nextInt(16), 3)) { position.setLatitude(-parser.nextInt(16) / 600000.0); diff --git a/src/org/traccar/protocol/FifotrackProtocolDecoder.java b/src/org/traccar/protocol/FifotrackProtocolDecoder.java index 321468a6b..bec212f30 100644 --- a/src/org/traccar/protocol/FifotrackProtocolDecoder.java +++ b/src/org/traccar/protocol/FifotrackProtocolDecoder.java @@ -84,7 +84,7 @@ public class FifotrackProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_ALARM, parser.next()); - position.setTime(parser.nextDateTime(Parser.DateTimeFormat.Y2MD_HMS)); + position.setTime(parser.nextDateTime()); position.setValid(parser.next().equals("A")); position.setLatitude(parser.nextDouble()); diff --git a/src/org/traccar/protocol/FoxProtocolDecoder.java b/src/org/traccar/protocol/FoxProtocolDecoder.java index 2b300a373..83bebd7c0 100644 --- a/src/org/traccar/protocol/FoxProtocolDecoder.java +++ b/src/org/traccar/protocol/FoxProtocolDecoder.java @@ -96,7 +96,7 @@ public class FoxProtocolDecoder extends BaseProtocolDecoder { position.setValid(parser.next().equals("A")); - position.setTime(parser.nextDateTime(Parser.DateTimeFormat.DMY2_HMS)); + position.setTime(parser.nextDateTime(Parser.DateTimeFormat.DMY_HMS)); position.setLatitude(parser.nextCoordinate()); position.setLongitude(parser.nextCoordinate()); position.setSpeed(UnitsConverter.knotsFromKph(parser.nextDouble())); diff --git a/src/org/traccar/protocol/GlobalSatProtocolDecoder.java b/src/org/traccar/protocol/GlobalSatProtocolDecoder.java index a35cfa761..50d621271 100644 --- a/src/org/traccar/protocol/GlobalSatProtocolDecoder.java +++ b/src/org/traccar/protocol/GlobalSatProtocolDecoder.java @@ -212,7 +212,7 @@ public class GlobalSatProtocolDecoder extends BaseProtocolDecoder { position.setDeviceId(deviceSession.getDeviceId()); position.setValid(!parser.next().equals("1")); - position.setTime(parser.nextDateTime(Parser.DateTimeFormat.DMY2_HMS)); + position.setTime(parser.nextDateTime(Parser.DateTimeFormat.DMY_HMS)); position.setLongitude(parser.nextCoordinate(Parser.CoordinateFormat.HEM_DEG_MIN)); position.setLatitude(parser.nextCoordinate(Parser.CoordinateFormat.HEM_DEG_MIN)); position.setAltitude(parser.nextDouble()); diff --git a/src/org/traccar/protocol/GnxProtocolDecoder.java b/src/org/traccar/protocol/GnxProtocolDecoder.java index 230a2df9a..cb29f5d23 100644 --- a/src/org/traccar/protocol/GnxProtocolDecoder.java +++ b/src/org/traccar/protocol/GnxProtocolDecoder.java @@ -93,8 +93,8 @@ public class GnxProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_ARCHIVE, true); } - position.setDeviceTime(parser.nextDateTime(Parser.DateTimeFormat.HMS_DMY2, "GMT+5:30")); - position.setFixTime(parser.nextDateTime(Parser.DateTimeFormat.HMS_DMY2, "GMT+5:30")); + position.setDeviceTime(parser.nextDateTime(Parser.DateTimeFormat.HMS_DMY, "GMT+5:30")); + position.setFixTime(parser.nextDateTime(Parser.DateTimeFormat.HMS_DMY, "GMT+5:30")); position.setValid(parser.nextInt() != 0); diff --git a/src/org/traccar/protocol/GoSafeProtocolDecoder.java b/src/org/traccar/protocol/GoSafeProtocolDecoder.java index e91ad72ed..51479ad52 100644 --- a/src/org/traccar/protocol/GoSafeProtocolDecoder.java +++ b/src/org/traccar/protocol/GoSafeProtocolDecoder.java @@ -242,7 +242,7 @@ public class GoSafeProtocolDecoder extends BaseProtocolDecoder { Date time = null; if (parser.hasNext(6)) { - time = parser.nextDateTime(Parser.DateTimeFormat.HMS_DMY2); + time = parser.nextDateTime(Parser.DateTimeFormat.HMS_DMY); } List<Position> positions = new LinkedList<>(); diff --git a/src/org/traccar/protocol/GotopProtocolDecoder.java b/src/org/traccar/protocol/GotopProtocolDecoder.java index 4a2f15ddc..aa1ab57fb 100644 --- a/src/org/traccar/protocol/GotopProtocolDecoder.java +++ b/src/org/traccar/protocol/GotopProtocolDecoder.java @@ -66,7 +66,7 @@ public class GotopProtocolDecoder extends BaseProtocolDecoder { position.setValid(parser.next().equals("A")); - position.setTime(parser.nextDateTime(Parser.DateTimeFormat.Y2MD_HMS)); + position.setTime(parser.nextDateTime()); position.setLatitude(parser.nextCoordinate(Parser.CoordinateFormat.DEG_HEM)); position.setLongitude(parser.nextCoordinate(Parser.CoordinateFormat.DEG_HEM)); diff --git a/src/org/traccar/protocol/Gps103ProtocolDecoder.java b/src/org/traccar/protocol/Gps103ProtocolDecoder.java index bdc6f5b71..5d402c09d 100644 --- a/src/org/traccar/protocol/Gps103ProtocolDecoder.java +++ b/src/org/traccar/protocol/Gps103ProtocolDecoder.java @@ -204,7 +204,7 @@ public class Gps103ProtocolDecoder extends BaseProtocolDecoder { } position.setDeviceId(deviceSession.getDeviceId()); - getLastLocation(position, parser.nextDateTime(Parser.DateTimeFormat.Y2MD_HMS)); + getLastLocation(position, parser.nextDateTime()); position.set(Position.KEY_ODOMETER, parser.nextInt()); parser.next(); // instant fuel consumption diff --git a/src/org/traccar/protocol/GpsGateProtocolDecoder.java b/src/org/traccar/protocol/GpsGateProtocolDecoder.java index 089d8186e..701b1874b 100644 --- a/src/org/traccar/protocol/GpsGateProtocolDecoder.java +++ b/src/org/traccar/protocol/GpsGateProtocolDecoder.java @@ -158,7 +158,7 @@ public class GpsGateProtocolDecoder extends BaseProtocolDecoder { position.setSpeed(parser.nextDouble()); position.setCourse(parser.nextDouble()); - position.setTime(parser.nextDateTime(Parser.DateTimeFormat.DMY2_HMS)); + position.setTime(parser.nextDateTime(Parser.DateTimeFormat.DMY_HMS)); position.setValid(parser.next().equals("1")); diff --git a/src/org/traccar/protocol/GpsMarkerProtocolDecoder.java b/src/org/traccar/protocol/GpsMarkerProtocolDecoder.java index a83e2e91e..36f4a19c6 100644 --- a/src/org/traccar/protocol/GpsMarkerProtocolDecoder.java +++ b/src/org/traccar/protocol/GpsMarkerProtocolDecoder.java @@ -70,7 +70,7 @@ public class GpsMarkerProtocolDecoder extends BaseProtocolDecoder { } position.setDeviceId(deviceSession.getDeviceId()); - position.setTime(parser.nextDateTime(Parser.DateTimeFormat.DMY2_HMS)); + position.setTime(parser.nextDateTime(Parser.DateTimeFormat.DMY_HMS)); position.setValid(true); position.setLatitude(parser.nextCoordinate(Parser.CoordinateFormat.HEM_DEG_MIN_MIN)); diff --git a/src/org/traccar/protocol/HaicomProtocolDecoder.java b/src/org/traccar/protocol/HaicomProtocolDecoder.java index dc8121ed3..45a56cc10 100644 --- a/src/org/traccar/protocol/HaicomProtocolDecoder.java +++ b/src/org/traccar/protocol/HaicomProtocolDecoder.java @@ -73,7 +73,7 @@ public class HaicomProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_VERSION_FW, parser.next()); - position.setTime(parser.nextDateTime(Parser.DateTimeFormat.Y2MD_HMS)); + position.setTime(parser.nextDateTime()); int flags = parser.nextInt(); diff --git a/src/org/traccar/protocol/HomtecsProtocolDecoder.java b/src/org/traccar/protocol/HomtecsProtocolDecoder.java index 9b6356aa3..c0dbf0b1b 100644 --- a/src/org/traccar/protocol/HomtecsProtocolDecoder.java +++ b/src/org/traccar/protocol/HomtecsProtocolDecoder.java @@ -63,7 +63,7 @@ public class HomtecsProtocolDecoder extends BaseProtocolDecoder { } position.setDeviceId(deviceSession.getDeviceId()); - position.setTime(parser.nextDateTime(Parser.DateTimeFormat.Y2MD_HMSms)); + position.setTime(parser.nextDateTime(Parser.DateTimeFormat.YMD_HMSms)); position.setValid(true); position.set(Position.KEY_SATELLITES, parser.nextInt()); diff --git a/src/org/traccar/protocol/IdplProtocolDecoder.java b/src/org/traccar/protocol/IdplProtocolDecoder.java index 0f6aea9a8..b5a23e1f2 100644 --- a/src/org/traccar/protocol/IdplProtocolDecoder.java +++ b/src/org/traccar/protocol/IdplProtocolDecoder.java @@ -80,7 +80,7 @@ public class IdplProtocolDecoder extends BaseProtocolDecoder { } position.setDeviceId(deviceSession.getDeviceId()); - position.setTime(parser.nextDateTime(Parser.DateTimeFormat.DMY2_HMS)); + position.setTime(parser.nextDateTime(Parser.DateTimeFormat.DMY_HMS)); position.setValid(parser.next().equals("A")); position.setLatitude(parser.nextCoordinate(CoordinateFormat.DEG_MIN_MIN_HEM)); diff --git a/src/org/traccar/protocol/JpKorjarProtocolDecoder.java b/src/org/traccar/protocol/JpKorjarProtocolDecoder.java index d4b8c678b..9a23a95fe 100644 --- a/src/org/traccar/protocol/JpKorjarProtocolDecoder.java +++ b/src/org/traccar/protocol/JpKorjarProtocolDecoder.java @@ -69,7 +69,7 @@ public class JpKorjarProtocolDecoder extends BaseProtocolDecoder { }
position.setDeviceId(deviceSession.getDeviceId());
- position.setTime(parser.nextDateTime(Parser.DateTimeFormat.Y2MD_HMS));
+ position.setTime(parser.nextDateTime());
position.setLatitude(parser.nextCoordinate(Parser.CoordinateFormat.DEG_HEM));
position.setLongitude(parser.nextCoordinate(Parser.CoordinateFormat.DEG_HEM));
diff --git a/src/org/traccar/protocol/Jt600ProtocolDecoder.java b/src/org/traccar/protocol/Jt600ProtocolDecoder.java index 992baa6f6..05b4abbb0 100644 --- a/src/org/traccar/protocol/Jt600ProtocolDecoder.java +++ b/src/org/traccar/protocol/Jt600ProtocolDecoder.java @@ -192,7 +192,7 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder { position.setLatitude(parser.nextCoordinate()); position.setValid(parser.next().equals("A")); - position.setTime(parser.nextDateTime(Parser.DateTimeFormat.DMY2_HMS)); + position.setTime(parser.nextDateTime(Parser.DateTimeFormat.DMY_HMS)); position.setSpeed(UnitsConverter.knotsFromKph(parser.nextDouble())); position.setCourse(parser.nextDouble()); @@ -247,7 +247,7 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder { position.setProtocol(getProtocolName()); position.setDeviceId(deviceSession.getDeviceId()); - position.setTime(parser.nextDateTime(Parser.DateTimeFormat.DMY2_HMS)); + position.setTime(parser.nextDateTime(Parser.DateTimeFormat.DMY_HMS)); position.setValid(parser.next().equals("T")); position.setLatitude(parser.nextCoordinate(Parser.CoordinateFormat.DEG_HEM)); diff --git a/src/org/traccar/protocol/MaestroProtocolDecoder.java b/src/org/traccar/protocol/MaestroProtocolDecoder.java index 654c9cadb..dfda3d693 100644 --- a/src/org/traccar/protocol/MaestroProtocolDecoder.java +++ b/src/org/traccar/protocol/MaestroProtocolDecoder.java @@ -81,7 +81,7 @@ public class MaestroProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_CHARGE, parser.nextInt() == 1); position.set(Position.KEY_IGNITION, parser.nextInt() == 1); - position.setTime(parser.nextDateTime(Parser.DateTimeFormat.Y2MD_HMS)); + position.setTime(parser.nextDateTime()); position.setLatitude(parser.nextDouble()); position.setLongitude(parser.nextDouble()); diff --git a/src/org/traccar/protocol/ManPowerProtocolDecoder.java b/src/org/traccar/protocol/ManPowerProtocolDecoder.java index da82a66af..08cb8b818 100644 --- a/src/org/traccar/protocol/ManPowerProtocolDecoder.java +++ b/src/org/traccar/protocol/ManPowerProtocolDecoder.java @@ -68,7 +68,7 @@ public class ManPowerProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_STATUS, parser.next()); - position.setTime(parser.nextDateTime(Parser.DateTimeFormat.Y2MD_HMS)); + position.setTime(parser.nextDateTime()); position.setValid(parser.next().equals("A")); position.setLatitude(parser.nextCoordinate()); diff --git a/src/org/traccar/protocol/MegastekProtocolDecoder.java b/src/org/traccar/protocol/MegastekProtocolDecoder.java index b6927b9cd..6be4845a7 100644 --- a/src/org/traccar/protocol/MegastekProtocolDecoder.java +++ b/src/org/traccar/protocol/MegastekProtocolDecoder.java @@ -287,7 +287,7 @@ public class MegastekProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_ARCHIVE, true); } - position.setTime(parser.nextDateTime(Parser.DateTimeFormat.DMY2_HMS)); + position.setTime(parser.nextDateTime(Parser.DateTimeFormat.DMY_HMS)); position.setValid(parser.next().equals("A")); position.setLatitude(parser.nextCoordinate()); diff --git a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java index d49d337ca..c7aa01793 100644 --- a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java +++ b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java @@ -265,7 +265,7 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder { return null; } - position.setTime(parser.nextDateTime(Parser.DateTimeFormat.HMS_DMY2)); + position.setTime(parser.nextDateTime(Parser.DateTimeFormat.HMS_DMY)); position.setValid(true); position.setLatitude(parser.nextCoordinate()); diff --git a/src/org/traccar/protocol/MeitrackProtocolDecoder.java b/src/org/traccar/protocol/MeitrackProtocolDecoder.java index ea08c0545..bd6f3e8be 100644 --- a/src/org/traccar/protocol/MeitrackProtocolDecoder.java +++ b/src/org/traccar/protocol/MeitrackProtocolDecoder.java @@ -106,7 +106,7 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder { position.setLatitude(parser.nextDouble()); position.setLongitude(parser.nextDouble()); - position.setTime(parser.nextDateTime(Parser.DateTimeFormat.Y2MD_HMS)); + position.setTime(parser.nextDateTime()); position.setValid(parser.next().equals("A")); diff --git a/src/org/traccar/protocol/MiniFinderProtocolDecoder.java b/src/org/traccar/protocol/MiniFinderProtocolDecoder.java index 46a11cd8f..db01eaa9f 100644 --- a/src/org/traccar/protocol/MiniFinderProtocolDecoder.java +++ b/src/org/traccar/protocol/MiniFinderProtocolDecoder.java @@ -77,7 +77,7 @@ public class MiniFinderProtocolDecoder extends BaseProtocolDecoder { private void decodeFix(Position position, Parser parser) { - position.setTime(parser.nextDateTime(Parser.DateTimeFormat.DMY2_HMS)); + position.setTime(parser.nextDateTime(Parser.DateTimeFormat.DMY_HMS)); position.setLatitude(parser.nextDouble()); position.setLongitude(parser.nextDouble()); } diff --git a/src/org/traccar/protocol/PathAwayProtocolDecoder.java b/src/org/traccar/protocol/PathAwayProtocolDecoder.java index 142d3724b..0a2204222 100644 --- a/src/org/traccar/protocol/PathAwayProtocolDecoder.java +++ b/src/org/traccar/protocol/PathAwayProtocolDecoder.java @@ -76,7 +76,7 @@ public class PathAwayProtocolDecoder extends BaseProtocolDecoder { position.setProtocol(getProtocolName()); position.setDeviceId(deviceSession.getDeviceId()); - position.setTime(parser.nextDateTime(Parser.DateTimeFormat.DMY2_HMS)); + position.setTime(parser.nextDateTime(Parser.DateTimeFormat.DMY_HMS)); position.setValid(true); position.setLatitude(parser.nextDouble()); diff --git a/src/org/traccar/protocol/PretraceProtocolDecoder.java b/src/org/traccar/protocol/PretraceProtocolDecoder.java index d3000df40..dc83b7ed2 100644 --- a/src/org/traccar/protocol/PretraceProtocolDecoder.java +++ b/src/org/traccar/protocol/PretraceProtocolDecoder.java @@ -77,7 +77,7 @@ public class PretraceProtocolDecoder extends BaseProtocolDecoder { position.setValid(parser.next().equals("A")); - position.setTime(parser.nextDateTime(Parser.DateTimeFormat.Y2MD_HMS)); + position.setTime(parser.nextDateTime()); position.setLatitude(parser.nextCoordinate()); position.setLongitude(parser.nextCoordinate()); diff --git a/src/org/traccar/protocol/SiwiProtocolDecoder.java b/src/org/traccar/protocol/SiwiProtocolDecoder.java index 7bf0e9e17..76b1e4322 100644 --- a/src/org/traccar/protocol/SiwiProtocolDecoder.java +++ b/src/org/traccar/protocol/SiwiProtocolDecoder.java @@ -88,7 +88,7 @@ public class SiwiProtocolDecoder extends BaseProtocolDecoder { position.setAltitude(parser.nextDouble()); position.setCourse(parser.nextInt()); - position.setTime(parser.nextDateTime(Parser.DateTimeFormat.HMS_DMY2, "IST")); + position.setTime(parser.nextDateTime(Parser.DateTimeFormat.HMS_DMY, "IST")); return position; } diff --git a/src/org/traccar/protocol/Stl060ProtocolDecoder.java b/src/org/traccar/protocol/Stl060ProtocolDecoder.java index 3406d1c73..599c16a3c 100644 --- a/src/org/traccar/protocol/Stl060ProtocolDecoder.java +++ b/src/org/traccar/protocol/Stl060ProtocolDecoder.java @@ -84,7 +84,7 @@ public class Stl060ProtocolDecoder extends BaseProtocolDecoder { } position.setDeviceId(deviceSession.getDeviceId()); - position.setTime(parser.nextDateTime(Parser.DateTimeFormat.DMY2_HMS)); + position.setTime(parser.nextDateTime(Parser.DateTimeFormat.DMY_HMS)); position.setLatitude(parser.nextCoordinate(Parser.CoordinateFormat.DEG_MIN_MIN_HEM)); position.setLongitude(parser.nextCoordinate(Parser.CoordinateFormat.DEG_MIN_MIN_HEM)); diff --git a/src/org/traccar/protocol/SupermateProtocolDecoder.java b/src/org/traccar/protocol/SupermateProtocolDecoder.java index e5a04c5c4..17e870950 100644 --- a/src/org/traccar/protocol/SupermateProtocolDecoder.java +++ b/src/org/traccar/protocol/SupermateProtocolDecoder.java @@ -79,7 +79,7 @@ public class SupermateProtocolDecoder extends BaseProtocolDecoder { position.setValid(parser.next().equals("A")); - position.setTime(parser.nextDateTime(Parser.DateTimeFormat.Y2MD_HMS, 16)); + position.setTime(parser.nextDateTime(16)); if (parser.nextInt(16) == 8) { position.setLatitude(-parser.nextInt(16) / 600000.0); diff --git a/src/org/traccar/protocol/TaipProtocolDecoder.java b/src/org/traccar/protocol/TaipProtocolDecoder.java index 1f7df9565..099ae005d 100644 --- a/src/org/traccar/protocol/TaipProtocolDecoder.java +++ b/src/org/traccar/protocol/TaipProtocolDecoder.java @@ -108,7 +108,7 @@ public class TaipProtocolDecoder extends BaseProtocolDecoder { } if (parser.hasNext(6)) { - position.setTime(parser.nextDateTime(Parser.DateTimeFormat.DMY2_HMS)); + position.setTime(parser.nextDateTime(Parser.DateTimeFormat.DMY_HMS)); } position.setLatitude(parser.nextCoordinate(Parser.CoordinateFormat.DEG_DEG)); diff --git a/src/org/traccar/protocol/TelicProtocolDecoder.java b/src/org/traccar/protocol/TelicProtocolDecoder.java index d380c4227..0ed1ce2d9 100644 --- a/src/org/traccar/protocol/TelicProtocolDecoder.java +++ b/src/org/traccar/protocol/TelicProtocolDecoder.java @@ -81,7 +81,7 @@ public class TelicProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_ALARM, decodeAlarm(event)); - position.setTime(parser.nextDateTime(Parser.DateTimeFormat.DMY2_HMS)); + position.setTime(parser.nextDateTime(Parser.DateTimeFormat.DMY_HMS)); if (parser.hasNext(6)) { position.setLongitude(parser.nextCoordinate(Parser.CoordinateFormat.DEG_MIN_MIN)); diff --git a/src/org/traccar/protocol/Tk103ProtocolDecoder.java b/src/org/traccar/protocol/Tk103ProtocolDecoder.java index 97b9d8770..404e9b2cf 100644 --- a/src/org/traccar/protocol/Tk103ProtocolDecoder.java +++ b/src/org/traccar/protocol/Tk103ProtocolDecoder.java @@ -138,7 +138,7 @@ public class Tk103ProtocolDecoder extends BaseProtocolDecoder { } position.setDeviceId(deviceSession.getDeviceId()); - getLastLocation(position, parser.nextDateTime(Parser.DateTimeFormat.DMY2_HMS)); + getLastLocation(position, parser.nextDateTime(Parser.DateTimeFormat.DMY_HMS)); int battery = parser.nextInt(); if (battery != 65535) { diff --git a/src/org/traccar/protocol/TmgProtocolDecoder.java b/src/org/traccar/protocol/TmgProtocolDecoder.java index 41c456e01..223f1e419 100644 --- a/src/org/traccar/protocol/TmgProtocolDecoder.java +++ b/src/org/traccar/protocol/TmgProtocolDecoder.java @@ -113,7 +113,7 @@ public class TmgProtocolDecoder extends BaseProtocolDecoder { break; } - position.setTime(parser.nextDateTime(Parser.DateTimeFormat.DMY4_HMS)); + position.setTime(parser.nextDateTime(Parser.DateTimeFormat.DMY_HMS)); position.setValid(parser.nextInt() > 0); position.setLatitude(parser.nextCoordinate()); diff --git a/src/org/traccar/protocol/TopflytechProtocolDecoder.java b/src/org/traccar/protocol/TopflytechProtocolDecoder.java index fb9fb66fb..2f853982f 100644 --- a/src/org/traccar/protocol/TopflytechProtocolDecoder.java +++ b/src/org/traccar/protocol/TopflytechProtocolDecoder.java @@ -62,7 +62,7 @@ public class TopflytechProtocolDecoder extends BaseProtocolDecoder { } position.setDeviceId(deviceSession.getDeviceId()); - position.setTime(parser.nextDateTime(Parser.DateTimeFormat.Y2MD_HMS)); + position.setTime(parser.nextDateTime()); position.setValid(parser.next().equals("A")); position.setLatitude(parser.nextCoordinate()); diff --git a/src/org/traccar/protocol/TotemProtocolDecoder.java b/src/org/traccar/protocol/TotemProtocolDecoder.java index a0b77ba26..6cac80269 100644 --- a/src/org/traccar/protocol/TotemProtocolDecoder.java +++ b/src/org/traccar/protocol/TotemProtocolDecoder.java @@ -270,7 +270,7 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_ALARM, decodeAlarm(Short.parseShort(parser.next(), 16))); } - position.setTime(parser.nextDateTime(Parser.DateTimeFormat.DMY2_HMS)); + position.setTime(parser.nextDateTime(Parser.DateTimeFormat.DMY_HMS)); position.set(Position.PREFIX_IO + 1, parser.next()); position.set(Position.KEY_BATTERY, parser.nextDouble() * 0.1); diff --git a/src/org/traccar/protocol/Tr20ProtocolDecoder.java b/src/org/traccar/protocol/Tr20ProtocolDecoder.java index 02994f16b..605a1e0b5 100644 --- a/src/org/traccar/protocol/Tr20ProtocolDecoder.java +++ b/src/org/traccar/protocol/Tr20ProtocolDecoder.java @@ -81,7 +81,7 @@ public class Tr20ProtocolDecoder extends BaseProtocolDecoder { position.setValid(parser.next().equals("A")); - position.setTime(parser.nextDateTime(Parser.DateTimeFormat.Y2MD_HMS)); + position.setTime(parser.nextDateTime()); position.setLatitude(parser.nextCoordinate(Parser.CoordinateFormat.HEM_DEG_MIN)); position.setLongitude(parser.nextCoordinate(Parser.CoordinateFormat.HEM_DEG_MIN)); diff --git a/src/org/traccar/protocol/Tr900ProtocolDecoder.java b/src/org/traccar/protocol/Tr900ProtocolDecoder.java index 70d9a51da..a566c637c 100644 --- a/src/org/traccar/protocol/Tr900ProtocolDecoder.java +++ b/src/org/traccar/protocol/Tr900ProtocolDecoder.java @@ -74,7 +74,7 @@ public class Tr900ProtocolDecoder extends BaseProtocolDecoder { position.setValid(parser.nextInt() == 1); - position.setTime(parser.nextDateTime(Parser.DateTimeFormat.Y2MD_HMS)); + position.setTime(parser.nextDateTime()); position.setLongitude(parser.nextCoordinate(Parser.CoordinateFormat.HEM_DEG_MIN)); position.setLatitude(parser.nextCoordinate(Parser.CoordinateFormat.HEM_DEG_MIN)); diff --git a/src/org/traccar/protocol/TrakMateProtocolDecoder.java b/src/org/traccar/protocol/TrakMateProtocolDecoder.java index 5cf0d07e7..03ec6cc67 100644 --- a/src/org/traccar/protocol/TrakMateProtocolDecoder.java +++ b/src/org/traccar/protocol/TrakMateProtocolDecoder.java @@ -119,7 +119,7 @@ public class TrakMateProtocolDecoder extends BaseProtocolDecoder { position.setLatitude(parser.nextDouble()); position.setLongitude(parser.nextDouble()); - position.setTime(parser.nextDateTime(Parser.DateTimeFormat.HMS_DMY2)); + position.setTime(parser.nextDateTime(Parser.DateTimeFormat.HMS_DMY)); position.set(Position.KEY_VERSION_FW, parser.next()); position.set(Position.KEY_VERSION_HW, parser.next()); @@ -150,7 +150,7 @@ public class TrakMateProtocolDecoder extends BaseProtocolDecoder { position.setLatitude(parser.nextDouble()); position.setLongitude(parser.nextDouble()); - position.setTime(parser.nextDateTime(Parser.DateTimeFormat.HMS_DMY2)); + position.setTime(parser.nextDateTime(Parser.DateTimeFormat.HMS_DMY)); position.setSpeed(parser.nextDouble()); position.setCourse(parser.nextDouble()); @@ -179,7 +179,7 @@ public class TrakMateProtocolDecoder extends BaseProtocolDecoder { position.setLatitude(parser.nextDouble()); position.setLongitude(parser.nextDouble()); - position.setTime(parser.nextDateTime(Parser.DateTimeFormat.HMS_DMY2)); + position.setTime(parser.nextDateTime(Parser.DateTimeFormat.HMS_DMY)); position.setSpeed(parser.nextDouble()); position.setCourse(parser.nextDouble()); diff --git a/src/org/traccar/protocol/VisiontekProtocolDecoder.java b/src/org/traccar/protocol/VisiontekProtocolDecoder.java index b75b117d9..7abef7386 100644 --- a/src/org/traccar/protocol/VisiontekProtocolDecoder.java +++ b/src/org/traccar/protocol/VisiontekProtocolDecoder.java @@ -90,7 +90,7 @@ public class VisiontekProtocolDecoder extends BaseProtocolDecoder { } position.setDeviceId(deviceSession.getDeviceId()); - position.setTime(parser.nextDateTime(Parser.DateTimeFormat.DMY2_HMS)); + position.setTime(parser.nextDateTime(Parser.DateTimeFormat.DMY_HMS)); if (parser.hasNext(8)) { position.setLatitude(parser.nextCoordinate(Parser.CoordinateFormat.DEG_MIN_MIN_HEM)); diff --git a/src/org/traccar/protocol/WatchProtocolDecoder.java b/src/org/traccar/protocol/WatchProtocolDecoder.java index 579b7c72b..d95f8c714 100644 --- a/src/org/traccar/protocol/WatchProtocolDecoder.java +++ b/src/org/traccar/protocol/WatchProtocolDecoder.java @@ -181,7 +181,7 @@ public class WatchProtocolDecoder extends BaseProtocolDecoder { position.setProtocol(getProtocolName()); position.setDeviceId(deviceSession.getDeviceId()); - position.setTime(parser.nextDateTime(Parser.DateTimeFormat.DMY2_HMS)); + position.setTime(parser.nextDateTime(Parser.DateTimeFormat.DMY_HMS)); position.setValid(parser.next().equals("A")); position.setLatitude(parser.nextCoordinate(Parser.CoordinateFormat.DEG_HEM)); diff --git a/src/org/traccar/protocol/WialonProtocolDecoder.java b/src/org/traccar/protocol/WialonProtocolDecoder.java index 6a2eb0228..c5b8890f3 100644 --- a/src/org/traccar/protocol/WialonProtocolDecoder.java +++ b/src/org/traccar/protocol/WialonProtocolDecoder.java @@ -84,7 +84,7 @@ public class WialonProtocolDecoder extends BaseProtocolDecoder { position.setProtocol(getProtocolName()); position.setDeviceId(deviceSession.getDeviceId()); - position.setTime(parser.nextDateTime(Parser.DateTimeFormat.DMY2_HMS)); + position.setTime(parser.nextDateTime(Parser.DateTimeFormat.DMY_HMS)); position.setLatitude(parser.nextCoordinate()); position.setLongitude(parser.nextCoordinate()); diff --git a/src/org/traccar/protocol/Xt013ProtocolDecoder.java b/src/org/traccar/protocol/Xt013ProtocolDecoder.java index 73295f9c2..93e26e986 100644 --- a/src/org/traccar/protocol/Xt013ProtocolDecoder.java +++ b/src/org/traccar/protocol/Xt013ProtocolDecoder.java @@ -74,7 +74,7 @@ public class Xt013ProtocolDecoder extends BaseProtocolDecoder { } position.setDeviceId(deviceSession.getDeviceId()); - position.setTime(parser.nextDateTime(Parser.DateTimeFormat.Y2MD_HMS)); + position.setTime(parser.nextDateTime()); position.setLatitude(parser.nextDouble()); position.setLongitude(parser.nextDouble()); diff --git a/src/org/traccar/protocol/YwtProtocolDecoder.java b/src/org/traccar/protocol/YwtProtocolDecoder.java index 17cbd376c..d79ae4439 100644 --- a/src/org/traccar/protocol/YwtProtocolDecoder.java +++ b/src/org/traccar/protocol/YwtProtocolDecoder.java @@ -87,7 +87,7 @@ public class YwtProtocolDecoder extends BaseProtocolDecoder { } position.setDeviceId(deviceSession.getDeviceId()); - position.setTime(parser.nextDateTime(Parser.DateTimeFormat.Y2MD_HMS)); + position.setTime(parser.nextDateTime()); position.setLongitude(parser.nextCoordinate(Parser.CoordinateFormat.HEM_DEG)); position.setLatitude(parser.nextCoordinate(Parser.CoordinateFormat.HEM_DEG)); |