aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/CellocatorProtocolEncoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2018-06-06 16:51:47 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2018-06-06 16:51:47 +1200
commit562535fd538e7b05b6fe96c0f56eb2ec0ae1fd0e (patch)
tree44fa438ebc6be56ede7307b18a2116fff14d8cc8 /src/org/traccar/protocol/CellocatorProtocolEncoder.java
parent9c99076dc2416c4e0725007af0e5f2f2f444c05c (diff)
downloadtrackermap-server-562535fd538e7b05b6fe96c0f56eb2ec0ae1fd0e.tar.gz
trackermap-server-562535fd538e7b05b6fe96c0f56eb2ec0ae1fd0e.tar.bz2
trackermap-server-562535fd538e7b05b6fe96c0f56eb2ec0ae1fd0e.zip
Migrate more protocols
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++) {