aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/AplicomFrameDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2018-06-05 23:16:21 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2018-06-05 23:16:21 +1200
commit9c99076dc2416c4e0725007af0e5f2f2f444c05c (patch)
tree55068f2ab5dbe99fcd60acc01c1bb05fc365aa43 /src/org/traccar/protocol/AplicomFrameDecoder.java
parentb8f4fc8888aaad7fe384c1dc2b80f44c1683bb03 (diff)
downloadtraccar-server-9c99076dc2416c4e0725007af0e5f2f2f444c05c.tar.gz
traccar-server-9c99076dc2416c4e0725007af0e5f2f2f444c05c.tar.bz2
traccar-server-9c99076dc2416c4e0725007af0e5f2f2f444c05c.zip
Migrate more protocols
Diffstat (limited to 'src/org/traccar/protocol/AplicomFrameDecoder.java')
-rw-r--r--src/org/traccar/protocol/AplicomFrameDecoder.java18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/org/traccar/protocol/AplicomFrameDecoder.java b/src/org/traccar/protocol/AplicomFrameDecoder.java
index 083025077..813bd49c6 100644
--- a/src/org/traccar/protocol/AplicomFrameDecoder.java
+++ b/src/org/traccar/protocol/AplicomFrameDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2013 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.
@@ -16,15 +16,15 @@
package org.traccar.protocol;
import io.netty.buffer.ByteBuf;
+import io.netty.channel.Channel;
import io.netty.channel.ChannelHandlerContext;
-import io.netty.handler.codec.ByteToMessageDecoder;
+import org.traccar.BaseFrameDecoder;
-import java.util.List;
-
-public class AplicomFrameDecoder extends ByteToMessageDecoder {
+public class AplicomFrameDecoder extends BaseFrameDecoder {
@Override
- protected void decode(ChannelHandlerContext ctx, ByteBuf buf, List<Object> out) throws Exception {
+ protected Object decode(
+ ChannelHandlerContext ctx, Channel channel, ByteBuf buf) throws Exception {
// Skip Alive message
while (buf.isReadable() && Character.isDigit(buf.getByte(buf.readerIndex()))) {
@@ -33,7 +33,7 @@ public class AplicomFrameDecoder extends ByteToMessageDecoder {
// Check minimum length
if (buf.readableBytes() < 11) {
- return;
+ return null;
}
// Read flags
@@ -53,8 +53,10 @@ public class AplicomFrameDecoder extends ByteToMessageDecoder {
// Return buffer
if (buf.readableBytes() >= length) {
- out.add(buf.readBytes(length));
+ return buf.readBytes(length);
}
+
+ return null;
}
}