diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2018-11-15 11:11:39 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2018-11-15 11:11:39 +1300 |
commit | 3f44240490ccb0cfc0da59cb5ecf101bf622ae1d (patch) | |
tree | 4d785f1a5dba4a9901beecedf9c6ecb6944ec79e | |
parent | e36c69db0c5e610d30977de7b2fa71e715d9a1ae (diff) | |
download | traccar-server-3f44240490ccb0cfc0da59cb5ecf101bf622ae1d.tar.gz traccar-server-3f44240490ccb0cfc0da59cb5ecf101bf622ae1d.tar.bz2 traccar-server-3f44240490ccb0cfc0da59cb5ecf101bf622ae1d.zip |
Support TR30 Track-pro from Iridium
-rw-r--r-- | src/org/traccar/protocol/Tr20ProtocolDecoder.java | 11 | ||||
-rw-r--r-- | test/org/traccar/protocol/Tr20ProtocolDecoderTest.java | 3 |
2 files changed, 12 insertions, 2 deletions
diff --git a/src/org/traccar/protocol/Tr20ProtocolDecoder.java b/src/org/traccar/protocol/Tr20ProtocolDecoder.java index e7ae0185f..6c7b689a6 100644 --- a/src/org/traccar/protocol/Tr20ProtocolDecoder.java +++ b/src/org/traccar/protocol/Tr20ProtocolDecoder.java @@ -52,6 +52,9 @@ public class Tr20ProtocolDecoder extends BaseProtocolDecoder { .number("(ddd)(dd.d+),") // longitude .number("(d+),") // speed .number("(d+),") // course + .number("(?:NA|[FC](-?d+)),") // temperature + .number("(x{8}),") // status + .number("(d+)") // event .any() .compile(); @@ -87,8 +90,12 @@ public class Tr20ProtocolDecoder extends BaseProtocolDecoder { position.setLatitude(parser.nextCoordinate(Parser.CoordinateFormat.HEM_DEG_MIN)); position.setLongitude(parser.nextCoordinate(Parser.CoordinateFormat.HEM_DEG_MIN)); - position.setSpeed(UnitsConverter.knotsFromKph(parser.nextDouble(0))); - position.setCourse(parser.nextDouble(0)); + position.setSpeed(UnitsConverter.knotsFromKph(parser.nextDouble())); + position.setCourse(parser.nextDouble()); + + position.set(Position.PREFIX_TEMP + 1, parser.nextInt()); + position.set(Position.KEY_STATUS, parser.nextHexLong()); + position.set(Position.KEY_EVENT, parser.nextInt()); return position; } diff --git a/test/org/traccar/protocol/Tr20ProtocolDecoderTest.java b/test/org/traccar/protocol/Tr20ProtocolDecoderTest.java index c00c5f069..d43031e06 100644 --- a/test/org/traccar/protocol/Tr20ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/Tr20ProtocolDecoderTest.java @@ -14,6 +14,9 @@ public class Tr20ProtocolDecoderTest extends ProtocolTest { "%%TRACKPRO01,1")); verifyPosition(decoder, text( + "%%868873457748532,A,181109121248,N2237.4181E11403.2857,000,282,NA,47010000,108")); + + verifyPosition(decoder, text( "%%TR-10,A,050916070549,N2240.8887E11359.2994,0,000,NA,D3800000,150,CFG:resend|"), position("2005-09-16 07:05:49.000", true, 22.68148, 113.98832)); |