diff options
-rw-r--r-- | debug.xml | 2 | ||||
-rw-r--r-- | setup/traccar.xml | 4 | ||||
-rw-r--r-- | src/org/traccar/protocol/AplicomProtocolDecoder.java | 98 | ||||
-rw-r--r-- | src/org/traccar/protocol/TelicProtocolDecoder.java | 2 | ||||
-rw-r--r-- | test/org/traccar/protocol/AplicomProtocolDecoderTest.java | 3 | ||||
-rw-r--r-- | test/org/traccar/protocol/MeitrackProtocolDecoderTest.java | 3 | ||||
-rw-r--r-- | test/org/traccar/protocol/TelicProtocolDecoderTest.java | 6 |
7 files changed, 65 insertions, 53 deletions
@@ -4,7 +4,7 @@ <properties> - <entry key="config.default">./setup/default.xml</entry> + <entry key='config.default'>./setup/default.xml</entry> <entry key='web.path'>./traccar-web/web</entry> <entry key='web.debug'>true</entry> diff --git a/setup/traccar.xml b/setup/traccar.xml index 61e23a066..aab9ba311 100644 --- a/setup/traccar.xml +++ b/setup/traccar.xml @@ -4,6 +4,8 @@ <properties> + <entry key='config.default'>./conf/default.xml</entry> + <!-- This is the main configuration file. All your configuration parameters should be placed in this file. @@ -16,8 +18,6 @@ --> - <entry key="config.default">./conf/default.xml</entry> - <entry key='database.driver'>org.h2.Driver</entry> <entry key='database.url'>jdbc:h2:./data/database</entry> <entry key='database.user'>sa</entry> diff --git a/src/org/traccar/protocol/AplicomProtocolDecoder.java b/src/org/traccar/protocol/AplicomProtocolDecoder.java index ef02cda7e..94d12c633 100644 --- a/src/org/traccar/protocol/AplicomProtocolDecoder.java +++ b/src/org/traccar/protocol/AplicomProtocolDecoder.java @@ -470,59 +470,59 @@ public class AplicomProtocolDecoder extends BaseProtocolDecoder { buf.readUnsignedShort(); // length while (buf.readableBytes() > 0) { - position.set("towedPosition", buf.readUnsignedByte()); + buf.readUnsignedByte(); // towed position int type = buf.readUnsignedByte(); int length = buf.readUnsignedByte(); + int end = buf.readerIndex() + length; - if (type == 0x01) { - position.set("brakeFlags", ChannelBuffers.hexDump(buf.readBytes(length))); - } else if (type == 0x02) { - position.set("wheelSpeed", buf.readUnsignedShort() / 256.0); - position.set("wheelSpeedDifference", buf.readUnsignedShort() / 256.0 - 125.0); - position.set("lateralAcceleration", buf.readUnsignedByte() / 10.0 - 12.5); - position.set("vehicleSpeed", buf.readUnsignedShort() / 256.0); - } else if (type == 0x03) { - position.set("axleLoadSum", buf.readUnsignedShort() * 2); - } else if (type == 0x04) { - position.set("tyrePressure", buf.readUnsignedByte() * 10); - position.set("pneumaticPressure", buf.readUnsignedByte() * 5); - } else if (type == 0x05) { - position.set("brakeLining", buf.readUnsignedByte() * 0.4); - position.set("brakeTemperature", buf.readUnsignedByte() * 10); - } else if (type == 0x06) { - position.set(Position.KEY_ODOMETER, buf.readUnsignedInt() * 5); - position.set(Position.KEY_ODOMETER_TRIP, buf.readUnsignedInt() * 5); - position.set(Position.KEY_ODOMETER_SERVICE, (buf.readUnsignedInt() - 2105540607) * 5); - } else if (type == 0x0A) { - ChannelBuffer brakeData = buf.readBytes(length); - position.set("absStatusCounter", brakeData.readUnsignedShort()); - position.set("atvbStatusCounter", brakeData.readUnsignedShort()); - position.set("vdcActiveCounter", brakeData.readUnsignedShort()); - } else if (type == 0x0B) { - position.set("brakeMinMaxData", ChannelBuffers.hexDump(buf.readBytes(length))); - } else if (type == 0x0C) { - position.set("missingPgn", ChannelBuffers.hexDump(buf.readBytes(length))); - } else if (type == 0x0D) { - switch (buf.readUnsignedByte()) { - case 1: - position.set("brakeManufacturer", "Wabco"); - break; - case 2: - position.set("brakeManufacturer", "Knorr"); - break; - case 3: - position.set("brakeManufacturer", "Haldex"); - break; - default: - position.set("brakeManufacturer", "Unknown"); - break; - } - buf.readUnsignedByte(); - position.set(Position.KEY_VIN, buf.readBytes(17).toString(StandardCharsets.US_ASCII)); - position.set("towedDetectionStatus", buf.readUnsignedByte()); - } else if (type == 0x0E) { - buf.skipBytes(length); + switch (type) { + case 0x01: + position.set("brakeFlags", ChannelBuffers.hexDump(buf.readBytes(length))); + break; + case 0x02: + position.set("wheelSpeed", buf.readUnsignedShort() / 256.0); + position.set("wheelSpeedDifference", buf.readUnsignedShort() / 256.0 - 125.0); + position.set("lateralAcceleration", buf.readUnsignedByte() / 10.0 - 12.5); + position.set("vehicleSpeed", buf.readUnsignedShort() / 256.0); + break; + case 0x03: + position.set("axleLoadSum", buf.readUnsignedShort() * 2); + break; + case 0x04: + position.set("tyrePressure", buf.readUnsignedByte() * 10); + position.set("pneumaticPressure", buf.readUnsignedByte() * 5); + break; + case 0x05: + position.set("brakeLining", buf.readUnsignedByte() * 0.4); + position.set("brakeTemperature", buf.readUnsignedByte() * 10); + break; + case 0x06: + position.set(Position.KEY_ODOMETER, buf.readUnsignedInt() * 5L); + position.set(Position.KEY_ODOMETER_TRIP, buf.readUnsignedInt() * 5L); + position.set(Position.KEY_ODOMETER_SERVICE, (buf.readUnsignedInt() - 2105540607) * 5L); + break; + case 0x0A: + position.set("absStatusCounter", buf.readUnsignedShort()); + position.set("atvbStatusCounter", buf.readUnsignedShort()); + position.set("vdcActiveCounter", buf.readUnsignedShort()); + break; + case 0x0B: + position.set("brakeMinMaxData", ChannelBuffers.hexDump(buf.readBytes(length))); + break; + case 0x0C: + position.set("missingPgn", ChannelBuffers.hexDump(buf.readBytes(length))); + break; + case 0x0D: + buf.readUnsignedByte(); + position.set("towedDetectionStatus", buf.readUnsignedInt()); + buf.skipBytes(17); // vin + break; + case 0x0E: + default: + break; } + + buf.readerIndex(end); } } diff --git a/src/org/traccar/protocol/TelicProtocolDecoder.java b/src/org/traccar/protocol/TelicProtocolDecoder.java index a875009a1..2c0d714c6 100644 --- a/src/org/traccar/protocol/TelicProtocolDecoder.java +++ b/src/org/traccar/protocol/TelicProtocolDecoder.java @@ -35,7 +35,7 @@ public class TelicProtocolDecoder extends BaseProtocolDecoder { private static final Pattern PATTERN = new PatternBuilder() .number("dddd") .number("(d{6}|d{15})") // device id - .number("(dd),") // type + .number("(d{1,2}),") // type .number("d{12},") // event time .number("d+,") .number("(dd)(dd)(dd)") // date (ddmmyy) diff --git a/test/org/traccar/protocol/AplicomProtocolDecoderTest.java b/test/org/traccar/protocol/AplicomProtocolDecoderTest.java index 2498d94b3..862cff055 100644 --- a/test/org/traccar/protocol/AplicomProtocolDecoderTest.java +++ b/test/org/traccar/protocol/AplicomProtocolDecoderTest.java @@ -11,6 +11,9 @@ public class AplicomProtocolDecoderTest extends ProtocolTest { AplicomProtocolDecoder decoder = new AplicomProtocolDecoder(new AplicomProtocol());
verifyAttributes(decoder, binary(
+ "44c30144f667c4316500e903ffdfbc00f059aebeb659aebeb302e3f5860065fe32120000ae0000000e47000000000000000000000000000127cd0000014c00000000000000ff010a002900000000000000014542016d0001010090070e140144f667c4316559ae620402e3f7f300660714c0010d15ff0f3332373937313100000000000000000000002a01010737341d331fffcf0103020b8601060c0001a5860001a58600000000010b1001ca01ca7d007d007c7cffffffffffff010a240000ffff0000000100010001ffff0000ffffffffffffffffffffffffffff00000002ffff010c06fec6febffeec"));
+
+ verifyAttributes(decoder, binary(
"45c20144f667c06ff9005d0161ef17000104596da2dc4b10c0c01d99020d6c04004cba7a010d44463030303235333731363238303030000000000000000000000000000000000000000000000000000001010d44463030303235333731363238303030000000000000031c"));
verifyAttributes(decoder, binary(
diff --git a/test/org/traccar/protocol/MeitrackProtocolDecoderTest.java b/test/org/traccar/protocol/MeitrackProtocolDecoderTest.java index cbbbd17f6..07411dbc8 100644 --- a/test/org/traccar/protocol/MeitrackProtocolDecoderTest.java +++ b/test/org/traccar/protocol/MeitrackProtocolDecoderTest.java @@ -12,6 +12,9 @@ public class MeitrackProtocolDecoderTest extends ProtocolTest { MeitrackProtocolDecoder decoder = new MeitrackProtocolDecoder(new MeitrackProtocol()); verifyPosition(decoder, buffer( + "$$V177,863835026871173,AAA,35,34.516428,10.470160,170915154043,A,9,12,68,74,0.9,9,1988259,525882,605|2|008C|0007B5A6,0200,0003|0000|0000|01A6|0571,00000001,,3,0000,010A92,360,511*74")); + + verifyPosition(decoder, buffer( "$$B136,011691002364761,AAA,29,47.055220,28.893193,170914144240,V,0,7,0,0,0,132,129754946,129793197,259|2|02F8|413F,0000,000D|000C||028C|,*9E")); verifyNotNull(decoder, buffer( diff --git a/test/org/traccar/protocol/TelicProtocolDecoderTest.java b/test/org/traccar/protocol/TelicProtocolDecoderTest.java index 84b6a797b..ed8245e1f 100644 --- a/test/org/traccar/protocol/TelicProtocolDecoderTest.java +++ b/test/org/traccar/protocol/TelicProtocolDecoderTest.java @@ -14,6 +14,12 @@ public class TelicProtocolDecoderTest extends ProtocolTest { "0026355565071347499|206|01|001002008")); verifyPosition(decoder, text( + "052028495198,160917073641,0,160917073642,43879,511958,3,24,223,17,,,-3,142379,,0010,00,64,205,0,0499")); + + verifyPosition(decoder, text( + "01302849516,160917073503,0,160917073504,43907,512006,3,11,160,14,,,-7,141811,,0010,00,64,206,0,0499")); + + verifyPosition(decoder, text( "002135556507134749999,010817171138,0,010817171138,004560973,50667173,3,0,0,11,1,1,100,958071,20601,000000,00,4142,0000,0000,0208,10395,0")); verifyPosition(decoder, text( |