From 01e0702d64330d6862dfb94816d2bfaf2d9f4eeb Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Mon, 25 Feb 2019 18:54:00 -0800 Subject: Support Cguard battery voltage --- src/org/traccar/protocol/CguardProtocolDecoder.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/org/traccar/protocol/CguardProtocolDecoder.java b/src/org/traccar/protocol/CguardProtocolDecoder.java index 9786afd6a..d934921f1 100644 --- a/src/org/traccar/protocol/CguardProtocolDecoder.java +++ b/src/org/traccar/protocol/CguardProtocolDecoder.java @@ -101,7 +101,11 @@ public class CguardProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_SATELLITES, Integer.parseInt(value)); break; case "BAT1": - position.set(Position.KEY_BATTERY_LEVEL, Integer.parseInt(value)); + if (value.contains(".")) { + position.set(Position.KEY_BATTERY, Double.parseDouble(value)); + } else { + position.set(Position.KEY_BATTERY_LEVEL, Integer.parseInt(value)); + } break; case "PWR1": position.set(Position.KEY_POWER, Double.parseDouble(value)); -- cgit v1.2.3