diff options
Diffstat (limited to 'src/org/traccar/protocol')
-rw-r--r-- | src/org/traccar/protocol/MeitrackProtocolDecoder.java | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/org/traccar/protocol/MeitrackProtocolDecoder.java b/src/org/traccar/protocol/MeitrackProtocolDecoder.java index a03a3aeec..a7fca89fc 100644 --- a/src/org/traccar/protocol/MeitrackProtocolDecoder.java +++ b/src/org/traccar/protocol/MeitrackProtocolDecoder.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. @@ -73,8 +73,10 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder { .expression("[^,]*,") // reserved .number("d*,") // protocol .number("(x{4})?") // fuel - .groupEnd("?") + .number("(?:,(x{6}(?:|x{6})*))?") // temperature + .or() .any() + .groupEnd() .text("*") .number("xx") .text("\r\n").optional() @@ -153,6 +155,14 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder { Integer.parseInt(fuel.substring(0, 2), 16) + Integer.parseInt(fuel.substring(2), 16) * 0.01); } + if (parser.hasNext()) { + for (String temp : parser.next().split("\\|")) { + int index = Integer.valueOf(temp.substring(0, 2), 16); + int value = Integer.valueOf(temp.substring(2), 16); + position.set(Position.PREFIX_TEMP + index, value); + } + } + return position; } |