diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-06-26 13:44:13 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-06-26 13:44:13 +1200 |
commit | 8bee4f349397ce03cbc9c88b2b173dd8fa599c44 (patch) | |
tree | df0f9dd1bdc18472ea82e8cec9e9f16ab14ef75a | |
parent | f47ab14095137689e1c9040ab5add2f6e3174023 (diff) | |
download | trackermap-server-8bee4f349397ce03cbc9c88b2b173dd8fa599c44.tar.gz trackermap-server-8bee4f349397ce03cbc9c88b2b173dd8fa599c44.tar.bz2 trackermap-server-8bee4f349397ce03cbc9c88b2b173dd8fa599c44.zip |
Remove CAN Aplicom extension
-rw-r--r-- | src/org/traccar/protocol/AplicomProtocolDecoder.java | 53 | ||||
-rw-r--r-- | test/org/traccar/protocol/AplicomProtocolDecoderTest.java | 15 |
2 files changed, 9 insertions, 59 deletions
diff --git a/src/org/traccar/protocol/AplicomProtocolDecoder.java b/src/org/traccar/protocol/AplicomProtocolDecoder.java index 102c7e90d..81f760654 100644 --- a/src/org/traccar/protocol/AplicomProtocolDecoder.java +++ b/src/org/traccar/protocol/AplicomProtocolDecoder.java @@ -272,59 +272,6 @@ public class AplicomProtocolDecoder extends BaseProtocolDecoder { } } - // CAN data - if (buf.readable() && (selector & 0x1000) != 0 && event == EVENT_DATA && - Boolean.parseBoolean(Context.getProps().getProperty(getProtocol() + ".can"))) { - - buf.readUnsignedMedium(); // packet identifier - buf.readUnsignedByte(); // version - int count = buf.readUnsignedByte(); - buf.readUnsignedByte(); // batch count - buf.readUnsignedShort(); // selector bit - buf.readUnsignedInt(); // timestamp - - buf.skipBytes(8); - - ArrayList<ChannelBuffer> values = new ArrayList<ChannelBuffer>(count); - - for (int i = 0; i < count; i++) { - values.add(buf.readBytes(8)); - } - - for (int i = 0; i < count; i++) { - ChannelBuffer value = values.get(i); - switch (buf.readInt()) { - case 0x40C: - position.set("suction-temperature1", ChannelBuffers.swapShort(value.readShort()) * 0.1); - position.set("suction-temperature2", ChannelBuffers.swapShort(value.readShort()) * 0.1); - position.set("suction-temperature3", ChannelBuffers.swapShort(value.readShort()) * 0.1); - position.set("evaporator-fan", ChannelBuffers.swapShort(value.readShort())); - break; - case 0x50C: - position.set("evaporator-temperature1", ChannelBuffers.swapShort(value.readShort()) * 0.1); - position.set("evaporator-temperature2", ChannelBuffers.swapShort(value.readShort()) * 0.1); - position.set("evaporator-temperature3", ChannelBuffers.swapShort(value.readShort()) * 0.1); - break; - case 0x20D: - position.set("diesel-rpm", ChannelBuffers.swapShort(value.readShort())); - position.set("diesel-temperature", ChannelBuffers.swapShort(value.readShort()) * 0.1); - position.set(Event.KEY_BATTERY, ChannelBuffers.swapShort(value.readShort()) * 0.01); - position.set("air-temperature", ChannelBuffers.swapShort(value.readShort()) * 0.1); - break; - case 0x30D: - position.set(Event.KEY_ALARM, ChannelBufferTools.readHexString(value, 16)); - break; - case 0x40D: - position.set("cold-unit-status", ChannelBufferTools.readHexString(value, 16)); - break; - case 0x50D: - position.set("coolant-pressure", ChannelBuffers.swapShort(value.readShort()) * 0.1); - position.set("suction-pressure", ChannelBuffers.swapShort(value.readShort()) * 0.1); - break; - } - } - } - return position; } diff --git a/test/org/traccar/protocol/AplicomProtocolDecoderTest.java b/test/org/traccar/protocol/AplicomProtocolDecoderTest.java index 69c3d3b78..e163b8e35 100644 --- a/test/org/traccar/protocol/AplicomProtocolDecoderTest.java +++ b/test/org/traccar/protocol/AplicomProtocolDecoderTest.java @@ -11,12 +11,6 @@ public class AplicomProtocolDecoderTest extends ProtocolDecoderTest { public void testDecode() throws Exception {
AplicomProtocolDecoder decoder = new AplicomProtocolDecoder(null);
-
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "44c20144563508385a009500b09f7700c0555ea99e555ea9b103bb569f01883ff50b00002a30f000000000000013074349460108010007555ea99e000000000000003f0000ae017605b3ff00000000010000006700d900d500000003000000000000006700d900d500000087002500c4ff0000435020150000000040512001000000000000020d0000030d0000040c0000040d0000050c0000050d0000058c0000060c"))));
-
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "44C20146B710C158DA009500B09F7700C054CA0EA454CA0EA403BE0BF6015D706B070000142A600000000000000002434946010801000754CA0EA4000000000000008400000000000000000000000000000000300000FE00FE0000000000000000000000000000000000000000000000000000000000000000000040502035000000000000020D0000030D0000040C0000040D0000050C0000050D0000058C0000060C"))));
verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
"44C20146B710C158DA002100B09F0700C054CA0EA254CA0E9C03BE0BF6015D7069070000142A600000000000000001"))));
@@ -27,6 +21,15 @@ public class AplicomProtocolDecoderTest extends ProtocolDecoderTest { verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
"440129D684002b0700C0450ef906450ef90603b20b8003b20b80066465b3870ce30f010ce30ce300003b130300000bcb170a"))));
+ verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
+ "44c3014645e8e9152e008900b09f7700f4558c07e8558c07e703be0bd8015d6faf0e0000003240000000000000000f4349460107010007558c07e70000000000000002d209df028f05fffe00000000000000002eff13fe11fe1a00011000000000000010ff11ff3cff11008c00080060f41b0043502015000000000000020d0000030d0000040c0000040d0000050c0000050d0000058c"))));
+
+ verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
+ "44c20144563508385a009500b09f7700c0555ea99e555ea9b103bb569f01883ff50b00002a30f000000000000013074349460108010007555ea99e000000000000003f0000ae017605b3ff00000000010000006700d900d500000003000000000000006700d900d500000087002500c4ff0000435020150000000040512001000000000000020d0000030d0000040c0000040d0000050c0000050d0000058c0000060c"))));
+
+ verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
+ "44C20146B710C158DA009500B09F7700C054CA0EA454CA0EA403BE0BF6015D706B070000142A600000000000000002434946010801000754CA0EA4000000000000008400000000000000000000000000000000300000FE00FE0000000000000000000000000000000000000000000000000000000000000000000040502035000000000000020D0000030D0000040C0000040D0000050C0000050D0000058C0000060C"))));
+
}
}
|