aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/CellocatorProtocolEncoder.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/protocol/CellocatorProtocolEncoder.java')
-rw-r--r--src/org/traccar/protocol/CellocatorProtocolEncoder.java18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/org/traccar/protocol/CellocatorProtocolEncoder.java b/src/org/traccar/protocol/CellocatorProtocolEncoder.java
index bb143d349..4eef42128 100644
--- a/src/org/traccar/protocol/CellocatorProtocolEncoder.java
+++ b/src/org/traccar/protocol/CellocatorProtocolEncoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017 Anton Tananaev (anton@traccar.org)
+ * Copyright 2017 - 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,34 +15,32 @@
*/
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.Log;
import org.traccar.model.Command;
-import java.nio.ByteOrder;
-
public class CellocatorProtocolEncoder extends BaseProtocolEncoder {
- private ChannelBuffer encodeContent(long deviceId, int command, int data1, int data2) {
+ private ByteBuf encodeContent(long deviceId, int command, int data1, int data2) {
- ChannelBuffer buf = ChannelBuffers.dynamicBuffer(ByteOrder.LITTLE_ENDIAN, 0);
+ ByteBuf buf = Unpooled.buffer(0);
buf.writeByte('M');
buf.writeByte('C');
buf.writeByte('G');
buf.writeByte('P');
buf.writeByte(0);
- buf.writeInt(Integer.parseInt(getUniqueId(deviceId)));
+ buf.writeIntLE(Integer.parseInt(getUniqueId(deviceId)));
buf.writeByte(0); // command numerator
- buf.writeInt(0); // authentication code
+ buf.writeIntLE(0); // authentication code
buf.writeByte(command);
buf.writeByte(command);
buf.writeByte(data1);
buf.writeByte(data1);
buf.writeByte(data2);
buf.writeByte(data2);
- buf.writeInt(0); // command specific data
+ buf.writeIntLE(0); // command specific data
byte checksum = 0;
for (int i = 4; i < buf.writerIndex(); i++) {