diff options
-rw-r--r-- | src/main/java/org/traccar/protocol/TaipProtocolDecoder.java | 8 | ||||
-rw-r--r-- | src/test/java/org/traccar/protocol/TaipProtocolDecoderTest.java | 4 |
2 files changed, 8 insertions, 4 deletions
diff --git a/src/main/java/org/traccar/protocol/TaipProtocolDecoder.java b/src/main/java/org/traccar/protocol/TaipProtocolDecoder.java index ed6d2b899..7d31b332d 100644 --- a/src/main/java/org/traccar/protocol/TaipProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/TaipProtocolDecoder.java @@ -73,8 +73,8 @@ public class TaipProtocolDecoder extends BaseProtocolDecoder { .number(",(d{4})(d{4})") // power / battery .number(",(d+)") // rpm .groupBegin() - .number(",(-?d+)") // temperature 1 - .number(",(-?d+)") // temperature 2 + .number(",([-+]?d+.?d*)") // temperature 1 + .number(",([-+]?d+.?d*)") // temperature 2 .groupEnd("?") .number(",(xx)") // alarm .or() @@ -191,8 +191,8 @@ public class TaipProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_POWER, parser.nextInt() * 0.01); position.set(Position.KEY_BATTERY, parser.nextInt() * 0.01); position.set(Position.KEY_RPM, parser.nextInt()); - position.set(Position.PREFIX_TEMP + 1, parser.nextInt()); - position.set(Position.PREFIX_TEMP + 2, parser.nextInt()); + position.set(Position.PREFIX_TEMP + 1, parser.nextDouble()); + position.set(Position.PREFIX_TEMP + 2, parser.nextDouble()); position.set(Position.KEY_ALARM, decodeAlarm(parser.nextHexInt())); } diff --git a/src/test/java/org/traccar/protocol/TaipProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/TaipProtocolDecoderTest.java index b4594bb0e..6682a4d99 100644 --- a/src/test/java/org/traccar/protocol/TaipProtocolDecoderTest.java +++ b/src/test/java/org/traccar/protocol/TaipProtocolDecoderTest.java @@ -12,6 +12,10 @@ public class TaipProtocolDecoderTest extends ProtocolTest { TaipProtocolDecoder decoder = new TaipProtocolDecoder(null); verifyAttribute(decoder, text( + ">RUS00,111220124402-3138067-06417623000012200FF,000000000000000000000000000,0000000111,15640422,00000,+25.5,00000,51;ID=CST3G0443;#IP1:089F;*34<"), + Position.PREFIX_TEMP + 1, 25.5); + + verifyAttribute(decoder, text( ">RUS00,031120185945-3138060-06417622000209200FF,000000000000000000000000000,0000000000,11440419,00000,00000,00000,00;ID=CST3G0495;#IP0:1EF7;*4B<"), Position.KEY_BATTERY, 4.19); |