aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-05-07 10:05:29 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2015-05-07 10:05:29 +1200
commit34a476ef05da4316cd1e268891e27a0f2a698d6a (patch)
tree2aafbca4fbaa47c60b9078d411bee1cddde081e4 /src
parentc4c127d7c116241865ef7e710585ef04ddd60ce8 (diff)
downloadtrackermap-server-34a476ef05da4316cd1e268891e27a0f2a698d6a.tar.gz
trackermap-server-34a476ef05da4316cd1e268891e27a0f2a698d6a.tar.bz2
trackermap-server-34a476ef05da4316cd1e268891e27a0f2a698d6a.zip
Decode Tytan inputs correctly
Diffstat (limited to 'src')
-rw-r--r--src/org/traccar/protocol/TytanProtocolDecoder.java30
1 files changed, 19 insertions, 11 deletions
diff --git a/src/org/traccar/protocol/TytanProtocolDecoder.java b/src/org/traccar/protocol/TytanProtocolDecoder.java
index 49757d7b0..f03a9916c 100644
--- a/src/org/traccar/protocol/TytanProtocolDecoder.java
+++ b/src/org/traccar/protocol/TytanProtocolDecoder.java
@@ -106,8 +106,14 @@ public class TytanProtocolDecoder extends BaseProtocolDecoder {
position.set(Event.KEY_INPUT, buf.readUnsignedByte());
break;
case 6:
- buf.readUnsignedByte();
- position.set(Event.PREFIX_ADC + 1, buf.readFloat());
+ {
+ int n = buf.readUnsignedByte() >> 4;
+ if (n < 2) {
+ position.set(Event.PREFIX_ADC + n, buf.readFloat());
+ } else {
+ position.set("DI" + (n - 2), buf.readFloat());
+ }
+ }
break;
case 7:
position.set(Event.KEY_ALARM, buf.readUnsignedShort());
@@ -125,16 +131,18 @@ public class TytanProtocolDecoder extends BaseProtocolDecoder {
buf.skipBytes(9);
break;
case 24:
- Set<Integer> temps = new LinkedHashSet<Integer>();
- int temp = buf.readUnsignedByte();
- for (int i = 3; i >= 0; i--) {
- int n = (temp >> (2 * i)) & 0x03;
- if (!temps.contains(n)) {
- temps.add(n);
+ {
+ Set<Integer> temps = new LinkedHashSet<Integer>();
+ int temp = buf.readUnsignedByte();
+ for (int i = 3; i >= 0; i--) {
+ int n = (temp >> (2 * i)) & 0x03;
+ if (!temps.contains(n)) {
+ temps.add(n);
+ }
+ }
+ for (int n : temps) {
+ position.set(Event.PREFIX_TEMP + n, buf.readUnsignedByte());
}
- }
- for (int n : temps) {
- position.set(Event.PREFIX_TEMP + n, buf.readUnsignedByte());
}
break;
case 25: