diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-06-29 10:49:13 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-06-29 10:49:13 +1200 |
commit | 55448d82b2971bc16c67bfa2b2e996d81c4c702e (patch) | |
tree | 565ee245ea0e98b88674b775147fbc6d3e1933cb /src/org/traccar/protocol/Jt600ProtocolDecoder.java | |
parent | 88b3f00f3855aa408c7859051efdcb5b37fe559f (diff) | |
parent | d1c4cd526845aad56c5b0a3e20454638bbc7fecc (diff) | |
download | trackermap-server-55448d82b2971bc16c67bfa2b2e996d81c4c702e.tar.gz trackermap-server-55448d82b2971bc16c67bfa2b2e996d81c4c702e.tar.bz2 trackermap-server-55448d82b2971bc16c67bfa2b2e996d81c4c702e.zip |
Merge branch implement commands (fix #1271)
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; |