diff options
author | Anton Tananaev <anton@traccar.org> | 2024-06-29 06:29:29 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2024-06-29 06:29:29 -0700 |
commit | 64794efca6f23aa2e89085d4fc822e27cfedcbe2 (patch) | |
tree | 740639d89112ea56cc581fc0b765dc4b09befd7b /src | |
parent | 90e5c5a7ede05d5d06abda6474d593b5a7843c9e (diff) | |
download | trackermap-server-64794efca6f23aa2e89085d4fc822e27cfedcbe2.tar.gz trackermap-server-64794efca6f23aa2e89085d4fc822e27cfedcbe2.tar.bz2 trackermap-server-64794efca6f23aa2e89085d4fc822e27cfedcbe2.zip |
Support Farnear protocol
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/org/traccar/protocol/GotopProtocolDecoder.java | 14 | ||||
-rw-r--r-- | src/test/java/org/traccar/protocol/GotopProtocolDecoderTest.java | 6 |
2 files changed, 15 insertions, 5 deletions
diff --git a/src/main/java/org/traccar/protocol/GotopProtocolDecoder.java b/src/main/java/org/traccar/protocol/GotopProtocolDecoder.java index 5c8d0bac2..933e6fe4f 100644 --- a/src/main/java/org/traccar/protocol/GotopProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/GotopProtocolDecoder.java @@ -1,5 +1,5 @@ /* - * Copyright 2013 - 2022 Anton Tananaev (anton@traccar.org) + * Copyright 2013 - 2024 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. @@ -37,10 +37,14 @@ public class GotopProtocolDecoder extends BaseProtocolDecoder { .number("(d+),") // imei .expression("([^,]+),") // type .expression("([AV]),") // validity - .number("DATE:(dd)(dd)(dd),") // date (yyddmm) - .number("TIME:(dd)(dd)(dd),") // time (hhmmss) - .number("LAT:(d+.d+)([NS]),") // latitude - .number("LO[NT]:(d+.d+)([EW]),") // longitude + .text("DATE:").optional() + .number("(dd)(dd)(dd),") // date (yyddmm) + .text("TIME:").optional() + .number("(dd)(dd)(dd),") // time (hhmmss) + .text("LAT:").optional() + .number("(d+.d+)([NS]),") // latitude + .expression("LO[NT]:").optional() + .number("(d+.d+)([EW]),") // longitude .text("Speed:").number("(d+.d+),") // speed .expression("([^,]+),") // status .number("(d+)?") // course diff --git a/src/test/java/org/traccar/protocol/GotopProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/GotopProtocolDecoderTest.java index aea6e7592..8601618bd 100644 --- a/src/test/java/org/traccar/protocol/GotopProtocolDecoderTest.java +++ b/src/test/java/org/traccar/protocol/GotopProtocolDecoderTest.java @@ -11,6 +11,12 @@ public class GotopProtocolDecoderTest extends ProtocolTest { var decoder = inject(new GotopProtocolDecoder(null)); + verifyPosition(decoder, text( + "012896001901633,CMD-T,A,130104,175950,24.0234233S,029.4691133E,Speed:001.8,90-24,1.3,10,10,65501-0371-170D,12,1-1,00.00")); + + verifyPosition(decoder, text( + "012896001901633,CMD-T,A,130104,175950,24.0234233S,029.4691133E,Speed:001.8,90-24,1.3,00.00")); + verifyNull(decoder, text( "")); |