From 9c99076dc2416c4e0725007af0e5f2f2f444c05c Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Tue, 5 Jun 2018 23:16:21 +1200 Subject: Migrate more protocols --- src/org/traccar/protocol/AplicomFrameDecoder.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'src/org/traccar/protocol/AplicomFrameDecoder.java') 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 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; } } -- cgit v1.2.3