diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2018-05-22 01:19:12 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2018-05-22 01:19:12 +1200 |
commit | 7e6b73ab434e12584dbdf65725ae36b8326f41c8 (patch) | |
tree | a85d7f806d46cd93be2bc6df443a7ecdb2908124 /src | |
parent | 4b42dab928b652d95ffa65b251ded885f0904e52 (diff) | |
download | traccar-server-7e6b73ab434e12584dbdf65725ae36b8326f41c8.tar.gz traccar-server-7e6b73ab434e12584dbdf65725ae36b8326f41c8.tar.bz2 traccar-server-7e6b73ab434e12584dbdf65725ae36b8326f41c8.zip |
Decode Meiligao digital inputs and outputs
Diffstat (limited to 'src')
-rw-r--r-- | src/org/traccar/protocol/MeiligaoProtocolDecoder.java | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java index d766e32c3..5ff0dedc7 100644 --- a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java +++ b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java @@ -21,6 +21,7 @@ import org.jboss.netty.channel.Channel; import org.traccar.BaseProtocolDecoder; import org.traccar.Context; import org.traccar.DeviceSession; +import org.traccar.helper.BitUtil; import org.traccar.helper.Checksum; import org.traccar.helper.DateBuilder; import org.traccar.helper.Parser; @@ -269,7 +270,15 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder { position.setAltitude(parser.nextDouble(0)); } - position.set(Position.KEY_STATUS, parser.next()); + if (parser.hasNext()) { + int status = parser.nextHexInt(); + for (int i = 1; i <= 5; i++) { + position.set(Position.PREFIX_OUT + i, BitUtil.check(status, i - 1)); + } + for (int i = 1; i <= 5; i++) { + position.set(Position.PREFIX_IN + i, BitUtil.check(status, i - 1 + 8)); + } + } for (int i = 1; i <= 8; i++) { position.set(Position.PREFIX_ADC + i, parser.nextHexInt()); |