From 7e6b73ab434e12584dbdf65725ae36b8326f41c8 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Tue, 22 May 2018 01:19:12 +1200 Subject: Decode Meiligao digital inputs and outputs --- src/org/traccar/protocol/MeiligaoProtocolDecoder.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/org/traccar') 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()); -- cgit v1.2.3