From 345262a970292541c07aee9982c6a26a29c11f9c Mon Sep 17 00:00:00 2001 From: Alexandre Truppel Date: Wed, 22 Feb 2023 15:36:45 +0100 Subject: Boolean special case for Wialon done, added tests --- src/main/java/org/traccar/protocol/WialonProtocolDecoder.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/main/java/org/traccar/protocol/WialonProtocolDecoder.java') diff --git a/src/main/java/org/traccar/protocol/WialonProtocolDecoder.java b/src/main/java/org/traccar/protocol/WialonProtocolDecoder.java index 1fc434ed8..4c4ff7a63 100644 --- a/src/main/java/org/traccar/protocol/WialonProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/WialonProtocolDecoder.java @@ -140,9 +140,13 @@ public class WialonProtocolDecoder extends BaseProtocolDecoder { String value = paramParser.group(2); // Key is already in correct type (string) - // If we can parse the value as a double, then we use that as the value's type - // If not, value type is a string unless it is equal to some specific cases (true, yes, etc), in which case we convert into a boolean - + + // If we can parse the value as a double, then we use that as the value's type. + // This covers both integer (x:1:y) and double (x:2:y) types in the Wialon protocol + + // If not, value type is a string unless it is equal to some specific cases + // (true, yes, etc), in which case we convert into a boolean + try { position.set(key, Double.parseDouble(value)); } catch (NumberFormatException e) { -- cgit v1.2.3