aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2019-11-10 14:36:01 -0800
committerAnton Tananaev <anton.tananaev@gmail.com>2019-11-10 14:36:01 -0800
commit0ce8f90d8a8fd4315b439fe124ecebbd78ac4aa1 (patch)
tree96b833eb83f195bc6902c269b0059443b66d006d /src/main/java
parent81a7195b2efe148d47e3cf0cead0de415529bbab (diff)
downloadtraccar-server-0ce8f90d8a8fd4315b439fe124ecebbd78ac4aa1.tar.gz
traccar-server-0ce8f90d8a8fd4315b439fe124ecebbd78ac4aa1.tar.bz2
traccar-server-0ce8f90d8a8fd4315b439fe124ecebbd78ac4aa1.zip
Decode more Huabao attributes
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java b/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java
index fceefa73a..94a6670ec 100644
--- a/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java
@@ -98,6 +98,9 @@ public class HuabaoProtocolDecoder extends BaseProtocolDecoder {
if (BitUtil.check(value, 20)) {
return Position.ALARM_GEOFENCE;
}
+ if (BitUtil.check(value, 28)) {
+ return Position.ALARM_MOVEMENT;
+ }
if (BitUtil.check(value, 29)) {
return Position.ALARM_ACCIDENT;
}
@@ -160,22 +163,23 @@ public class HuabaoProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_ALARM, decodeAlarm(buf.readUnsignedInt()));
- int flags = buf.readInt();
+ int status = buf.readInt();
- position.set(Position.KEY_IGNITION, BitUtil.check(flags, 0));
+ position.set(Position.KEY_IGNITION, BitUtil.check(status, 0));
+ position.set(Position.KEY_BLOCKED, BitUtil.check(status, 10));
- position.setValid(BitUtil.check(flags, 1));
+ position.setValid(BitUtil.check(status, 1));
double lat = buf.readUnsignedInt() * 0.000001;
double lon = buf.readUnsignedInt() * 0.000001;
- if (BitUtil.check(flags, 2)) {
+ if (BitUtil.check(status, 2)) {
position.setLatitude(-lat);
} else {
position.setLatitude(lat);
}
- if (BitUtil.check(flags, 3)) {
+ if (BitUtil.check(status, 3)) {
position.setLongitude(-lon);
} else {
position.setLongitude(lon);
@@ -231,6 +235,15 @@ public class HuabaoProtocolDecoder extends BaseProtocolDecoder {
Position.KEY_VIN, buf.readCharSequence(length, StandardCharsets.US_ASCII).toString());
}
break;
+ case 0xD0:
+ long userStatus = buf.readUnsignedInt();
+ if (BitUtil.check(userStatus, 3)) {
+ position.set(Position.KEY_ALARM, Position.ALARM_VIBRATION);
+ }
+ break;
+ case 0xD3:
+ position.set(Position.KEY_POWER, buf.readUnsignedShort() * 0.1);
+ break;
default:
break;
}