aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2019-02-25 18:54:00 -0800
committerAnton Tananaev <anton.tananaev@gmail.com>2019-02-25 18:54:00 -0800
commit01e0702d64330d6862dfb94816d2bfaf2d9f4eeb (patch)
tree20b7c02c8ad5838930222cfce47765099cbdb82a /src/org/traccar
parent041c2b897c28dc316e8613c9ea38dee48dd64482 (diff)
downloadtraccar-server-01e0702d64330d6862dfb94816d2bfaf2d9f4eeb.tar.gz
traccar-server-01e0702d64330d6862dfb94816d2bfaf2d9f4eeb.tar.bz2
traccar-server-01e0702d64330d6862dfb94816d2bfaf2d9f4eeb.zip
Support Cguard battery voltage
Diffstat (limited to 'src/org/traccar')
-rw-r--r--src/org/traccar/protocol/CguardProtocolDecoder.java6
1 files changed, 5 insertions, 1 deletions
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));