aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/org/traccar/protocol/CalAmpProtocolDecoder.java8
-rw-r--r--test/org/traccar/protocol/CalAmpProtocolDecoderTest.java6
2 files changed, 11 insertions, 3 deletions
diff --git a/src/org/traccar/protocol/CalAmpProtocolDecoder.java b/src/org/traccar/protocol/CalAmpProtocolDecoder.java
index 7850de1ca..c89983c23 100644
--- a/src/org/traccar/protocol/CalAmpProtocolDecoder.java
+++ b/src/org/traccar/protocol/CalAmpProtocolDecoder.java
@@ -212,13 +212,15 @@ public class CalAmpProtocolDecoder extends BaseProtocolDecoder {
// Event code and status
if (type == MSG_EVENT_REPORT || type == MSG_MINI_EVENT_REPORT) {
- extendedInfo.set("event", buf.readUnsignedByte());
+ extendedInfo.set("event", buf.readUnsignedByte() + " - " + buf.readUnsignedByte());
}
// Accumulators
- /*int accCount = buf.readUnsignedByte();
+ int accCount = buf.readUnsignedByte();
int accType = accCount >> 6;
accCount &= 0x3f;
+
+ buf.readUnsignedByte(); // reserved
if (accType == 1) {
buf.readUnsignedInt(); // threshold
@@ -227,7 +229,7 @@ public class CalAmpProtocolDecoder extends BaseProtocolDecoder {
for (int i = 0; i < accCount; i++) {
extendedInfo.set("acc" + i, buf.readUnsignedInt());
- }*/
+ }
position.setExtendedInfo(extendedInfo.toString());
return position;
diff --git a/test/org/traccar/protocol/CalAmpProtocolDecoderTest.java b/test/org/traccar/protocol/CalAmpProtocolDecoderTest.java
index 31336a66c..02ceed36a 100644
--- a/test/org/traccar/protocol/CalAmpProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/CalAmpProtocolDecoderTest.java
@@ -16,6 +16,12 @@ public class CalAmpProtocolDecoderTest {
CalAmpProtocolDecoder decoder = new CalAmpProtocolDecoder(new TestDataManager(), null, null);
verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
+ "8308353301059723580f01020102088952d994c352d994c4134fa767c4c482e20000c12700000d29006e1002019affc90f061d00060c0000")), null));
+
+ verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
+ "8308355233050116134f01020102445652d993e152d993e1124c728cc68f0647000023c00000000000000e02019affc90f071c0015020000")), null));
+
+ verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
"830545420185450101010200075517fb335516c5c40fb1aea4cf4cbf250000000000000000008900260015ffb10f001108110a0000")), null));
verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(