aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-06-12 15:00:08 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2016-06-12 15:00:08 +1200
commit19d7c0dd692145fa11dee3fa07099c80052e1be4 (patch)
treee29289a9364284a650d4ef6650c69fd98c1384f4 /src/org/traccar
parentc995dde98c23b5ae1fe49261d48c7d7ce2618d7f (diff)
downloadtrackermap-server-19d7c0dd692145fa11dee3fa07099c80052e1be4.tar.gz
trackermap-server-19d7c0dd692145fa11dee3fa07099c80052e1be4.tar.bz2
trackermap-server-19d7c0dd692145fa11dee3fa07099c80052e1be4.zip
Support J1708 decoding for Ulbotech
Diffstat (limited to 'src/org/traccar')
-rw-r--r--src/org/traccar/protocol/UlbotechProtocolDecoder.java21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/org/traccar/protocol/UlbotechProtocolDecoder.java b/src/org/traccar/protocol/UlbotechProtocolDecoder.java
index 9cbaadfb4..2fd7d8f74 100644
--- a/src/org/traccar/protocol/UlbotechProtocolDecoder.java
+++ b/src/org/traccar/protocol/UlbotechProtocolDecoder.java
@@ -65,6 +65,25 @@ public class UlbotechProtocolDecoder extends BaseProtocolDecoder {
}
}
+ private void decodeJ1708(Position position, ChannelBuffer buf, short length) {
+
+ int end = buf.readerIndex() + length;
+
+ while (buf.readerIndex() < end) {
+ int mark = buf.readUnsignedByte();
+ int len = BitUtil.between(mark, 0, 6);
+ int type = BitUtil.between(mark, 6, 8);
+ int id = buf.readUnsignedByte();
+ if (type == 3) {
+ id += 256;
+ }
+ String value = ChannelBuffers.hexDump(buf.readBytes(len - 1));
+ if (type == 2 || type == 3) {
+ position.set("pid" + id, value);
+ }
+ }
+ }
+
private void decodeDriverBehavior(Position position, ChannelBuffer buf) {
int value = buf.readUnsignedByte();
@@ -200,7 +219,7 @@ public class UlbotechProtocolDecoder extends BaseProtocolDecoder {
break;
case DATA_J1708:
- position.set("j1708", ChannelBuffers.hexDump(buf.readBytes(length)));
+ decodeJ1708(position, buf, length);
break;
case DATA_VIN: