diff options
Diffstat (limited to 'src/org/traccar/protocol/NavisProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/NavisProtocolDecoder.java | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/org/traccar/protocol/NavisProtocolDecoder.java b/src/org/traccar/protocol/NavisProtocolDecoder.java index a4b900f96..39912e420 100644 --- a/src/org/traccar/protocol/NavisProtocolDecoder.java +++ b/src/org/traccar/protocol/NavisProtocolDecoder.java @@ -34,7 +34,7 @@ public class NavisProtocolDecoder extends BaseProtocolDecoder { private String prefix; private long deviceUniqueId, serverId; - private static final Charset charset = Charset.defaultCharset(); + private static final Charset CHARSET = Charset.defaultCharset(); public NavisProtocolDecoder(NavisProtocol protocol) { super(protocol); @@ -212,7 +212,7 @@ public class NavisProtocolDecoder extends BaseProtocolDecoder { ParseResult result = parsePosition(buf); ChannelBuffer response = ChannelBuffers.dynamicBuffer(ByteOrder.LITTLE_ENDIAN, 8); - response.writeBytes(ChannelBuffers.copiedBuffer(ByteOrder.LITTLE_ENDIAN, "*<T", charset)); + response.writeBytes(ChannelBuffers.copiedBuffer(ByteOrder.LITTLE_ENDIAN, "*<T", CHARSET)); response.writeInt((int) result.getId()); sendReply(channel, response); @@ -236,7 +236,7 @@ public class NavisProtocolDecoder extends BaseProtocolDecoder { } ChannelBuffer response = ChannelBuffers.dynamicBuffer(ByteOrder.LITTLE_ENDIAN, 8); - response.writeBytes(ChannelBuffers.copiedBuffer(ByteOrder.LITTLE_ENDIAN, "*<A", charset)); + response.writeBytes(ChannelBuffers.copiedBuffer(ByteOrder.LITTLE_ENDIAN, "*<A", CHARSET)); response.writeByte(count); sendReply(channel, response); @@ -251,7 +251,7 @@ public class NavisProtocolDecoder extends BaseProtocolDecoder { private Object processHandshake(Channel channel, ChannelBuffer buf) { buf.readByte(); // semicolon symbol if (identify(buf.toString(Charset.defaultCharset()), channel)) { - sendReply(channel, ChannelBuffers.copiedBuffer(ByteOrder.LITTLE_ENDIAN, "*<S", charset)); + sendReply(channel, ChannelBuffers.copiedBuffer(ByteOrder.LITTLE_ENDIAN, "*<S", CHARSET)); } return null; } @@ -266,7 +266,7 @@ public class NavisProtocolDecoder extends BaseProtocolDecoder { private void sendReply(Channel channel, ChannelBuffer data) { ChannelBuffer header = ChannelBuffers.directBuffer(ByteOrder.LITTLE_ENDIAN, 16); - header.writeBytes(ChannelBuffers.copiedBuffer(ByteOrder.LITTLE_ENDIAN, prefix, charset)); + header.writeBytes(ChannelBuffers.copiedBuffer(ByteOrder.LITTLE_ENDIAN, prefix, CHARSET)); header.writeInt((int) deviceUniqueId); header.writeInt((int) serverId); header.writeShort(data.readableBytes()); @@ -286,7 +286,7 @@ public class NavisProtocolDecoder extends BaseProtocolDecoder { ChannelBuffer buf = (ChannelBuffer) msg; // Read header - prefix = buf.toString(buf.readerIndex(), 4, charset); + prefix = buf.toString(buf.readerIndex(), 4, CHARSET); buf.skipBytes(prefix.length()); // prefix @NTC by default serverId = buf.readUnsignedInt(); deviceUniqueId = buf.readUnsignedInt(); @@ -298,7 +298,7 @@ public class NavisProtocolDecoder extends BaseProtocolDecoder { } // Read message type - String type = buf.toString(buf.readerIndex(), 3, charset); + String type = buf.toString(buf.readerIndex(), 3, CHARSET); buf.skipBytes(type.length()); switch (type) { |