Skip to content

Commit

Permalink
Decode remaining GV65 CAN data
Browse files Browse the repository at this point in the history
  • Loading branch information
tananaev committed Dec 16, 2017
1 parent b0151a4 commit 3ad24b1
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 28 deletions.
1 change: 1 addition & 0 deletions src/org/traccar/model/Position.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ public class Position extends Message {
public static final String KEY_COMMAND = "command";
public static final String KEY_BLOCKED = "blocked";
public static final String KEY_DOOR = "door";
public static final String KEY_AXLE_WEIGHT = "axleWeight";

public static final String KEY_DTCS = "dtcs";
public static final String KEY_OBD_SPEED = "obdSpeed"; // knots
Expand Down
2 changes: 1 addition & 1 deletion src/org/traccar/protocol/AplicomProtocolDecoder.java
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ private void decodeEB(Position position, ChannelBuffer buf) {
position.set("vehicleSpeed", buf.readUnsignedShort() / 256.0);
break;
case 0x03:
position.set("axleLoadSum", buf.readUnsignedShort() * 2);
position.set(Position.KEY_AXLE_WEIGHT, buf.readUnsignedShort() * 2);
break;
case 0x04:
position.set("tyrePressure", buf.readUnsignedByte() * 10);
Expand Down
50 changes: 25 additions & 25 deletions src/org/traccar/protocol/Gl200TextProtocolDecoder.java
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ private Object decodeCan(Channel channel, SocketAddress remoteAddress, String se
position.set(Position.KEY_IGNITION, Integer.parseInt(values[index++]) > 0);
}
if (BitUtil.check(reportMask, 2)) {
index += 1; // total distance
position.set("totalVehicleDistance", values[index++]);
}
if (BitUtil.check(reportMask, 3)) {
position.set("totalFuelConsumption", Double.parseDouble(values[index++]));
Expand All @@ -566,14 +566,14 @@ private Object decodeCan(Channel channel, SocketAddress remoteAddress, String se
if (BitUtil.check(reportMask, 6)) {
position.set(Position.KEY_COOLANT_TEMP, Integer.parseInt(values[index++]));
}
if (BitUtil.check(reportMask, 7)) {
index += 1; // fuel consumption
if (BitUtil.check(reportMask, 7) && !values[index++].isEmpty()) {
position.set(Position.KEY_FUEL_CONSUMPTION, Double.parseDouble(values[index - 1].substring(1)));
}
if (BitUtil.check(reportMask, 8)) {
index += 1; // fuel level
if (BitUtil.check(reportMask, 8) && !values[index++].isEmpty()) {
position.set(Position.KEY_FUEL_LEVEL, Double.parseDouble(values[index - 1].substring(1)));
}
if (BitUtil.check(reportMask, 9)) {
index += 1; // range
if (BitUtil.check(reportMask, 9) && !values[index++].isEmpty()) {
position.set("range", Long.parseLong(values[index - 1]) * 100);
}
if (BitUtil.check(reportMask, 10) && !values[index++].isEmpty()) {
position.set(Position.KEY_THROTTLE, Integer.parseInt(values[index - 1]));
Expand All @@ -582,34 +582,34 @@ private Object decodeCan(Channel channel, SocketAddress remoteAddress, String se
position.set(Position.KEY_HOURS, Double.parseDouble(values[index++]));
}
if (BitUtil.check(reportMask, 12)) {
index += 1; // driving time
position.set("drivingHours", Double.parseDouble(values[index++]));
}
if (BitUtil.check(reportMask, 13)) {
index += 1; // idle time
position.set("idleHours", Double.parseDouble(values[index++]));
}
if (BitUtil.check(reportMask, 14)) {
index += 1; // idle fuel
if (BitUtil.check(reportMask, 14) && !values[index++].isEmpty()) {
position.set("idleFuelConsumption", Double.parseDouble(values[index - 1]));
}
if (BitUtil.check(reportMask, 15)) {
index += 1; // axle weight
if (BitUtil.check(reportMask, 15) && !values[index++].isEmpty()) {
position.set(Position.KEY_AXLE_WEIGHT, Integer.parseInt(values[index - 1]));
}
if (BitUtil.check(reportMask, 16)) {
index += 1; // tachograph info
if (BitUtil.check(reportMask, 16) && !values[index++].isEmpty()) {
position.set("tachographInfo", Integer.parseInt(values[index - 1]));
}
if (BitUtil.check(reportMask, 17)) {
index += 1; // indicators
if (BitUtil.check(reportMask, 17) && !values[index++].isEmpty()) {
position.set("indicators", Integer.parseInt(values[index - 1]));
}
if (BitUtil.check(reportMask, 18)) {
index += 1; // lights
if (BitUtil.check(reportMask, 18) && !values[index++].isEmpty()) {
position.set("lights", Integer.parseInt(values[index - 1]));
}
if (BitUtil.check(reportMask, 19)) {
index += 1; // doors
if (BitUtil.check(reportMask, 19) && !values[index++].isEmpty()) {
position.set("doors", Integer.parseInt(values[index - 1]));
}
if (BitUtil.check(reportMask, 20)) {
index += 1; // total vehicle overspeed time
if (BitUtil.check(reportMask, 20) && !values[index++].isEmpty()) {
position.set("vehicleOverspeed", Double.parseDouble(values[index - 1]));
}
if (BitUtil.check(reportMask, 21)) {
index += 1; // total engine overspeed time
if (BitUtil.check(reportMask, 21) && !values[index++].isEmpty()) {
position.set("engineOverspeed", Double.parseDouble(values[index - 1]));
}
if (BitUtil.check(reportMask, 29)) {
index += 1; // expansion
Expand Down
2 changes: 1 addition & 1 deletion src/org/traccar/protocol/IntellitracProtocolDecoder.java
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ protected Object decode(
position.set(Position.PREFIX_TEMP + 1, parser.nextInt(0));
position.set("chargerPressure", parser.nextInt(0));
position.set("tpl", parser.nextInt(0));
position.set("axle", parser.nextInt(0));
position.set(Position.KEY_AXLE_WEIGHT, parser.nextInt(0));
position.set(Position.KEY_OBD_ODOMETER, parser.nextInt(0));

return position;
Expand Down
2 changes: 1 addition & 1 deletion src/org/traccar/protocol/TytanProtocolDecoder.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ private void decodeExtraData(Position position, ChannelBuffer buf, int end) {
}
break;
case 28:
position.set("weight", buf.readUnsignedShort());
position.set(Position.KEY_AXLE_WEIGHT, buf.readUnsignedShort());
buf.readUnsignedByte();
break;
case 90:
Expand Down

0 comments on commit 3ad24b1

Please sign in to comment.