diff options
Diffstat (limited to 'src/org/traccar/protocol/Jt600ProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/Jt600ProtocolDecoder.java | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/org/traccar/protocol/Jt600ProtocolDecoder.java b/src/org/traccar/protocol/Jt600ProtocolDecoder.java index 5c3dcef46..eaf9ff9c6 100644 --- a/src/org/traccar/protocol/Jt600ProtocolDecoder.java +++ b/src/org/traccar/protocol/Jt600ProtocolDecoder.java @@ -32,20 +32,20 @@ import org.traccar.model.Position; public class Jt600ProtocolDecoder extends BaseProtocolDecoder { - public Jt600ProtocolDecoder(String protocol) { + public Jt600ProtocolDecoder(Jt600Protocol protocol) { super(protocol); } - private Position decodeNormalMessage(ChannelBuffer buf) throws Exception { + private Position decodeNormalMessage(ChannelBuffer buf, Channel channel) throws Exception { Position position = new Position(); - position.setProtocol(getProtocol()); + position.setProtocol(getProtocolName()); buf.readByte(); // header // Get device by identifier String id = Long.valueOf(ChannelBufferTools.readHexString(buf, 10)).toString(); - if (!identify(id)) { + if (!identify(id, channel)) { return null; } position.setDeviceId(getDeviceId()); @@ -140,7 +140,7 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder { "(\\d+)," + // Alert Type ".*\\)"); - private Position decodeAlertMessage(ChannelBuffer buf) throws Exception { + private Position decodeAlertMessage(ChannelBuffer buf, Channel channel) throws Exception { String message = buf.toString(Charset.defaultCharset()); @@ -152,12 +152,12 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder { // Create new position Position position = new Position(); - position.setProtocol(getProtocol()); + position.setProtocol(getProtocolName()); position.set(Event.KEY_ALARM, true); Integer index = 1; // Get device by identifier - if (!identify(parser.group(index++))) { + if (!identify(parser.group(index++), channel)) { return null; } position.setDeviceId(getDeviceId()); @@ -209,9 +209,9 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder { // Check message type if (first == '$') { - return decodeNormalMessage(buf); + return decodeNormalMessage(buf, channel); } else if (first == '(') { - return decodeAlertMessage(buf); + return decodeAlertMessage(buf, channel); } return null; |