From b8b330317dbac78c2d0a007a195efd8d42b3e791 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sat, 6 Aug 2016 10:34:41 +0300 Subject: Support temperature for TK103 protocol --- src/org/traccar/protocol/Tk103ProtocolDecoder.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/org/traccar/protocol/Tk103ProtocolDecoder.java b/src/org/traccar/protocol/Tk103ProtocolDecoder.java index 55a41f5a2..ac99a1440 100644 --- a/src/org/traccar/protocol/Tk103ProtocolDecoder.java +++ b/src/org/traccar/protocol/Tk103ProtocolDecoder.java @@ -1,5 +1,5 @@ /* - * Copyright 2012 - 2015 Anton Tananaev (anton.tananaev@gmail.com) + * Copyright 2012 - 2016 Anton Tananaev (anton.tananaev@gmail.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -51,6 +51,7 @@ public class Tk103ProtocolDecoder extends BaseProtocolDecoder { .number("(?:([01]{8})|(x{8}))?,?") // state .number("(?:L(x+))?") // odometer .any() + .number("([+-]ddd.d)?") // temperature .text(")").optional() .compile(); @@ -225,6 +226,10 @@ public class Tk103ProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_ODOMETER, parser.nextLong(16)); } + if (parser.hasNext()) { + position.set(Position.PREFIX_TEMP + 1, parser.nextDouble()); + } + return position; } -- cgit v1.2.3