mirror of
https://github.com/traccar/traccar.git
synced 2025-01-08 11:47:49 +08:00
Improve GV300 and GV65 CAN data support
This commit is contained in:
parent
980baa309e
commit
489eb32e7d
@ -67,7 +67,9 @@
|
||||
<module name="LineLength">
|
||||
<property name="max" value="120"/>
|
||||
</module>
|
||||
<module name="MethodLength"/>
|
||||
<module name="MethodLength">
|
||||
<property name="max" value="200"/>
|
||||
</module>
|
||||
<module name="ParameterNumber"/>
|
||||
|
||||
<!-- Checks for whitespace -->
|
||||
|
@ -581,6 +581,7 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder {
|
||||
index += 1; // report type
|
||||
index += 1; // canbus state
|
||||
long reportMask = Long.parseLong(values[index++], 16);
|
||||
long reportMaskExt = 0;
|
||||
|
||||
if (BitUtil.check(reportMask, 0)) {
|
||||
position.set(Position.KEY_VIN, values[index++]);
|
||||
@ -649,7 +650,79 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder {
|
||||
position.set("engineOverspeed", Double.parseDouble(values[index - 1]));
|
||||
}
|
||||
if (BitUtil.check(reportMask, 29)) {
|
||||
index += 1; // expansion
|
||||
reportMaskExt = Long.parseLong(values[index++], 16);
|
||||
}
|
||||
if (BitUtil.check(reportMaskExt, 0) && !values[index++].isEmpty()) {
|
||||
position.set("adBlueLevel", Integer.parseInt(values[index - 1]));
|
||||
}
|
||||
if (BitUtil.check(reportMaskExt, 1) && !values[index++].isEmpty()) {
|
||||
position.set("axleWeight1", Integer.parseInt(values[index - 1]));
|
||||
}
|
||||
if (BitUtil.check(reportMaskExt, 2) && !values[index++].isEmpty()) {
|
||||
position.set("axleWeight3", Integer.parseInt(values[index - 1]));
|
||||
}
|
||||
if (BitUtil.check(reportMaskExt, 3) && !values[index++].isEmpty()) {
|
||||
position.set("axleWeight4", Integer.parseInt(values[index - 1]));
|
||||
}
|
||||
if (BitUtil.check(reportMaskExt, 4)) {
|
||||
index += 1; // tachograph overspeed
|
||||
}
|
||||
if (BitUtil.check(reportMaskExt, 5)) {
|
||||
index += 1; // tachograph motion
|
||||
}
|
||||
if (BitUtil.check(reportMaskExt, 6)) {
|
||||
index += 1; // tachograph direction
|
||||
}
|
||||
if (BitUtil.check(reportMaskExt, 7) && !values[index++].isEmpty()) {
|
||||
position.set(Position.PREFIX_ADC + 1, Integer.parseInt(values[index - 1]) * 0.001);
|
||||
}
|
||||
if (BitUtil.check(reportMaskExt, 8)) {
|
||||
index += 1; // pedal breaking factor
|
||||
}
|
||||
if (BitUtil.check(reportMaskExt, 9)) {
|
||||
index += 1; // engine breaking factor
|
||||
}
|
||||
if (BitUtil.check(reportMaskExt, 10)) {
|
||||
index += 1; // total accelerator kick-downs
|
||||
}
|
||||
if (BitUtil.check(reportMaskExt, 11)) {
|
||||
index += 1; // total effective engine speed
|
||||
}
|
||||
if (BitUtil.check(reportMaskExt, 12)) {
|
||||
index += 1; // total cruise control time
|
||||
}
|
||||
if (BitUtil.check(reportMaskExt, 13)) {
|
||||
index += 1; // total accelerator kick-down time
|
||||
}
|
||||
if (BitUtil.check(reportMaskExt, 14)) {
|
||||
index += 1; // total brake application
|
||||
}
|
||||
if (BitUtil.check(reportMaskExt, 15) && !values[index++].isEmpty()) {
|
||||
position.set("driver1Card", values[index - 1]);
|
||||
}
|
||||
if (BitUtil.check(reportMaskExt, 16) && !values[index++].isEmpty()) {
|
||||
position.set("driver2Card", values[index - 1]);
|
||||
}
|
||||
if (BitUtil.check(reportMaskExt, 17) && !values[index++].isEmpty()) {
|
||||
position.set("driver1Name", values[index - 1]);
|
||||
}
|
||||
if (BitUtil.check(reportMaskExt, 18) && !values[index++].isEmpty()) {
|
||||
position.set("driver2Name", values[index - 1]);
|
||||
}
|
||||
if (BitUtil.check(reportMaskExt, 19) && !values[index++].isEmpty()) {
|
||||
position.set("registration", values[index - 1]);
|
||||
}
|
||||
if (BitUtil.check(reportMaskExt, 20)) {
|
||||
index += 1; // expansion information
|
||||
}
|
||||
if (BitUtil.check(reportMaskExt, 21)) {
|
||||
index += 1; // rapid brakings
|
||||
}
|
||||
if (BitUtil.check(reportMaskExt, 22)) {
|
||||
index += 1; // rapid accelerations
|
||||
}
|
||||
if (BitUtil.check(reportMaskExt, 23)) {
|
||||
index += 1; // engine torque
|
||||
}
|
||||
|
||||
DateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||
@ -674,10 +747,9 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder {
|
||||
|
||||
if (BitUtil.check(reportMask, 31)) {
|
||||
index += 4; // cell
|
||||
index += 1; // reserved
|
||||
}
|
||||
|
||||
index += 1; // reserved
|
||||
|
||||
if (ignoreFixTime) {
|
||||
position.setTime(dateFormat.parse(values[index]));
|
||||
} else {
|
||||
|
@ -10,6 +10,15 @@ public class Gl200TextProtocolDecoderTest extends ProtocolTest {
|
||||
|
||||
Gl200TextProtocolDecoder decoder = new Gl200TextProtocolDecoder(null);
|
||||
|
||||
verifyAttributes(decoder, buffer(
|
||||
"+RESP:GTCAN,310701,863286023712855,,10,0,003FFFFF,,2,H46358,12305.50,601,0,83,,P53.00,,0,2749.15,0.19,2.80,,,,40,,0,,,20181110103016,2945$"));
|
||||
|
||||
verifyAttributes(decoder, buffer(
|
||||
"+RESP:GTCAN,310701,863286023712855,,10,0,203FFFFF,,2,H46358,12305.50,601,0,83,,P53.00,,0,2749.15,0.19,2.80,,,,40,,0,,,007FFFFF,,,,,,0,,,134,37,6,0.19,,0.00,0,,,,,,0,0,0,20181110112126,299F$"));
|
||||
|
||||
verifyPosition(decoder, buffer(
|
||||
"+RESP:GTCAN,310701,863286023712855,,10,0,E03FFFFF,,2,H46358,12305.50,601,0,83,,P53.00,,0,2749.15,0.19,2.80,,,,40,,0,,,007FFFFF,,,,,,0,,,134,37,6,0.19,,0.00,0,,,,,,0,0,0,0,0.0,312,358.4,14.271460,50.110796,20181110103130,0230,0003,94D4,3B30,00,20181110105348,2969$"));
|
||||
|
||||
verifyPositions(decoder, buffer(
|
||||
"+RESP:GTFRI,1F0301,862193022001432,WF0GXXGBBGBM26503,,14900,41,1,1,11.6,74,356.0,14.120023,50.167894,20181104080703,0230,0003,9B14,5891,00,74.1,,,,83,220000,799,7.3,,20181104080703,099B$"));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user