diff options
-rw-r--r-- | src/org/traccar/protocol/BceProtocolDecoder.java | 10 | ||||
-rw-r--r-- | test/org/traccar/protocol/BceProtocolDecoderTest.java | 3 |
2 files changed, 10 insertions, 3 deletions
diff --git a/src/org/traccar/protocol/BceProtocolDecoder.java b/src/org/traccar/protocol/BceProtocolDecoder.java index 1b65f85da..d07be6ef4 100644 --- a/src/org/traccar/protocol/BceProtocolDecoder.java +++ b/src/org/traccar/protocol/BceProtocolDecoder.java @@ -36,8 +36,11 @@ public class BceProtocolDecoder extends BaseProtocolDecoder { super(dataManager, protocol, properties); } - private static final int MSG_HEARTBEAT = 0x1A; - private static final int MSG_DATA = 0x10; + private static final int MSG_ASYNC_STACK = 0xA5; + private static final int MSG_STACK_COFIRM = 0x19; + private static final int MSG_TIME_TRIGGERED = 0xA0; + private static final int MSG_OUTPUT_CONTROL = 0x41; + private static final int MSG_OUTPUT_CONTROL_ACK = 0xC1; @Override protected Object decode( @@ -45,6 +48,9 @@ public class BceProtocolDecoder extends BaseProtocolDecoder { throws Exception { ChannelBuffer buf = (ChannelBuffer) msg; + + String imei = String.format("%015d", buf.readLong()); + /*buf.skipBytes(2); // header buf.readByte(); // size diff --git a/test/org/traccar/protocol/BceProtocolDecoderTest.java b/test/org/traccar/protocol/BceProtocolDecoderTest.java index 93fc080a4..ab65376d4 100644 --- a/test/org/traccar/protocol/BceProtocolDecoderTest.java +++ b/test/org/traccar/protocol/BceProtocolDecoderTest.java @@ -1,5 +1,6 @@ package org.traccar.protocol; +import java.nio.ByteOrder; import org.jboss.netty.buffer.ChannelBuffers; import static org.junit.Assert.assertNull; import org.junit.Test; @@ -14,7 +15,7 @@ public class BceProtocolDecoderTest { BceProtocolDecoder decoder = new BceProtocolDecoder(new TestDataManager(), null, null); - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( + verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString( "be76619c834601004200a0003fd769c568ffc3db0079161d420683a9414918b1150000000000d102660167040000000000009f06357f0000a401042ea415e10232000000000000000000000051")))); } |