aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2018-11-11 10:52:44 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2018-11-11 10:52:44 +1300
commitcad845deb903fa84549845246f12927b46709e16 (patch)
treeec111b69e3a8ed66e8e89a32a8f1c8db35a9f887
parent25b6d4fe524f41ae9a37d7b57a2c4f0e8e1dfa25 (diff)
downloadtraccar-server-cad845deb903fa84549845246f12927b46709e16.tar.gz
traccar-server-cad845deb903fa84549845246f12927b46709e16.tar.bz2
traccar-server-cad845deb903fa84549845246f12927b46709e16.zip
Improve GV300 and GV65 CAN data support
-rw-r--r--checkstyle.xml4
-rw-r--r--src/org/traccar/protocol/Gl200TextProtocolDecoder.java78
-rw-r--r--test/org/traccar/protocol/Gl200TextProtocolDecoderTest.java9
3 files changed, 87 insertions, 4 deletions
diff --git a/checkstyle.xml b/checkstyle.xml
index 9d0314b06..d85100471 100644
--- a/checkstyle.xml
+++ b/checkstyle.xml
@@ -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 -->
diff --git a/src/org/traccar/protocol/Gl200TextProtocolDecoder.java b/src/org/traccar/protocol/Gl200TextProtocolDecoder.java
index 0d600e240..e004ce994 100644
--- a/src/org/traccar/protocol/Gl200TextProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gl200TextProtocolDecoder.java
@@ -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 {
diff --git a/test/org/traccar/protocol/Gl200TextProtocolDecoderTest.java b/test/org/traccar/protocol/Gl200TextProtocolDecoderTest.java
index cc5ef63d4..619721b8b 100644
--- a/test/org/traccar/protocol/Gl200TextProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Gl200TextProtocolDecoderTest.java
@@ -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$"));