aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2018-08-25 10:35:10 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2018-08-25 10:35:22 +1200
commit74519eebedc75fec380005a2a1e6300ddd803ceb (patch)
tree55b0ea7551dcbbb1a9f53a96bba3d881860c3eac
parent052d5a61dbb7a94d4ac2ea4f17deff0f99baec58 (diff)
downloadtrackermap-server-74519eebedc75fec380005a2a1e6300ddd803ceb.tar.gz
trackermap-server-74519eebedc75fec380005a2a1e6300ddd803ceb.tar.bz2
trackermap-server-74519eebedc75fec380005a2a1e6300ddd803ceb.zip
Decode Aplicom event data as HEX
-rw-r--r--src/org/traccar/protocol/AplicomProtocolDecoder.java12
-rw-r--r--test/org/traccar/protocol/AplicomProtocolDecoderTest.java3
2 files changed, 5 insertions, 10 deletions
diff --git a/src/org/traccar/protocol/AplicomProtocolDecoder.java b/src/org/traccar/protocol/AplicomProtocolDecoder.java
index f530c8fa5..bfd92e0ad 100644
--- a/src/org/traccar/protocol/AplicomProtocolDecoder.java
+++ b/src/org/traccar/protocol/AplicomProtocolDecoder.java
@@ -103,16 +103,8 @@ public class AplicomProtocolDecoder extends BaseProtocolDecoder {
buf.readUnsignedByte();
break;
case 119:
- StringBuilder sb = new StringBuilder();
- while (buf.isReadable()) {
- char c = (char) buf.readByte();
- if (c >= 0x20) {
- sb.append(c);
- } else {
- break;
- }
- }
- position.set("eventData", sb.toString());
+ position.set("eventData", ByteBufUtil.hexDump(
+ buf, buf.readerIndex(), Math.min(buf.readableBytes(), 1024)));
break;
case 121:
case 142:
diff --git a/test/org/traccar/protocol/AplicomProtocolDecoderTest.java b/test/org/traccar/protocol/AplicomProtocolDecoderTest.java
index 9cff24295..da58717ab 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(
+ "44c30144f667c0e462019800b05f7700005b7d3bdd00000000000000000000000000000000805e420fd60a0d57fffffb002141100000011001000c0932200000000000000a18136fcafefffffb002141100000011001000c0932200000000000000a1812e6dbfefffffb002141100000011001000c746578746167204e000008e3980bfefffffb002141100000011001000ce2009000170400890310f290e873fefffffb002141100000011001000ce2009000170400890290f28e409afefffffb002141100000011001000c0932200000000000000a1812e6dbfefffffb002141100000011001000ce2009000170400890280f28d4e2dfefffffb002141100000011001000c0001460000000000000021427a6cfefffffb002141100000011001000c0001460000000000000021606a6efefffffb002141100000011001000c746578746167204e000008badcc4fefffffb002141100000011001000c00014600000000000000218c0843fefffffb002141100000011001000ce2009000170400890270f6d45e09fefffffb002141100000011001000ce2801160600002053cd57a16549efe"));
+
+ verifyAttributes(decoder, binary(
"44c30144f667ca8e6b003200b45f7700f05b6565e75b6565e6031f845100c6f0e70c00001483387c0fe60001000a263433233031303138373433303746230d0a"));
verifyAttributes(decoder, binary(