diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2018-06-06 21:56:37 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2018-06-06 21:56:37 +1200 |
commit | 681b8f42633d7c6741e6fbac4308ba25c4aff9fa (patch) | |
tree | 488c6d1d43399899243adebcb565edd0cf294374 /src/org/traccar/protocol/EelinkProtocolEncoder.java | |
parent | 35bef1115f73da97b15ae3c1de03db1cd6d733c5 (diff) | |
download | trackermap-server-681b8f42633d7c6741e6fbac4308ba25c4aff9fa.tar.gz trackermap-server-681b8f42633d7c6741e6fbac4308ba25c4aff9fa.tar.bz2 trackermap-server-681b8f42633d7c6741e6fbac4308ba25c4aff9fa.zip |
Migrate D, E, F protocols
Diffstat (limited to 'src/org/traccar/protocol/EelinkProtocolEncoder.java')
-rw-r--r-- | src/org/traccar/protocol/EelinkProtocolEncoder.java | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/org/traccar/protocol/EelinkProtocolEncoder.java b/src/org/traccar/protocol/EelinkProtocolEncoder.java index 4d2d86e68..33dca54f2 100644 --- a/src/org/traccar/protocol/EelinkProtocolEncoder.java +++ b/src/org/traccar/protocol/EelinkProtocolEncoder.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 - 2017 Anton Tananaev (anton@traccar.org) + * Copyright 2016 - 2018 Anton Tananaev (anton@traccar.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,8 +15,8 @@ */ package org.traccar.protocol; -import org.jboss.netty.buffer.ChannelBuffer; -import org.jboss.netty.buffer.ChannelBuffers; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; import org.traccar.BaseProtocolEncoder; import org.traccar.helper.DataConverter; import org.traccar.helper.Log; @@ -41,13 +41,13 @@ public class EelinkProtocolEncoder extends BaseProtocolEncoder { return sum; } - public static ChannelBuffer encodeContent( - boolean connectionless, String uniqueId, int type, int index, ChannelBuffer content) { + public static ByteBuf encodeContent( + boolean connectionless, String uniqueId, int type, int index, ByteBuf content) { - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + ByteBuf buf = Unpooled.buffer(); if (connectionless) { - buf.writeBytes(ChannelBuffers.wrappedBuffer(DataConverter.parseHex('0' + uniqueId))); + buf.writeBytes(Unpooled.wrappedBuffer(DataConverter.parseHex('0' + uniqueId))); } buf.writeByte(0x67); @@ -60,13 +60,13 @@ public class EelinkProtocolEncoder extends BaseProtocolEncoder { buf.writeBytes(content); } - ChannelBuffer result = ChannelBuffers.dynamicBuffer(); + ByteBuf result = Unpooled.buffer(); if (connectionless) { result.writeByte('E'); result.writeByte('L'); result.writeShort(2 + buf.readableBytes()); // length - result.writeShort(checksum(buf.toByteBuffer())); + result.writeShort(checksum(buf.nioBuffer())); } result.writeBytes(buf); @@ -74,9 +74,9 @@ public class EelinkProtocolEncoder extends BaseProtocolEncoder { return result; } - private ChannelBuffer encodeContent(long deviceId, String content) { + private ByteBuf encodeContent(long deviceId, String content) { - ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); + ByteBuf buf = Unpooled.buffer(); buf.writeByte(0x01); // command buf.writeInt(0); // server id |