Tramigo T23

Anton Tananaev6 years ago

Send to support email address.

hackerunet6 years ago

Sent, thanks a lot.

Anton Tananaev6 years ago

I have fixed the issue:

https://github.com/traccar/traccar/commit/38e77023844a5c76112ed79ddf8308cedfc3e099

The problem happened in frame decoder during migration to Netty 4.

hackerunet6 years ago

understood, thank you very much, what was the error? I have 3.17 class and need to understand what do I have to fix to be able to apply it to the old class

package org.traccar.protocol;

import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.handler.codec.frame.LengthFieldBasedFrameDecoder;

import java.nio.ByteOrder;

public class TramigoFrameDecoder extends LengthFieldBasedFrameDecoder {

    public TramigoFrameDecoder() {
        super(1024, 6, 2, -8, 0);
    }

    @Override
    protected Object decode(
            ChannelHandlerContext ctx,
            Channel channel,
            ChannelBuffer buf) throws Exception {

        if (buf.readableBytes() < 20) {
            return null;
        }

        // Swap byte order for legacy protocol
        if (buf.getUnsignedByte(buf.readerIndex()) == 0x80) {
            int length = buf.readableBytes();
            byte[] bytes = new byte[length];
            buf.getBytes(buf.readerIndex(), bytes);

            ChannelBuffer result = (ChannelBuffer) super.decode(
                    ctx, channel, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, bytes));
            if (result != null) {
                buf.skipBytes(result.readableBytes());
            }
            return result;
        }

        return super.decode(ctx, channel, buf);
    }

}
Anton Tananaev6 years ago

You don't need to do anything. The issue was introduced in 4.0.

hackerunet6 years ago

Weird, the error I had was for 3.17 but I just made an upgrade and the issue persist, actually I didn't have to do anything different, just recompiled the new 4.0 version and place the jar and that was all, but, Im really concern that the device is still having issues, I'm going to test with a different device, thanks a lot anton.

Anton Tananaev6 years ago

No, the log that you provided earlier was from Traccar 4.0.

gutitoni4 years ago

hello anton I get the following debug in the logs and the position version 3.16 doesn't update

2020-08-08 09:58:07 DEBUG: [F0F8EB91: 5073 < 192.168.1.254] HEX: 8000c711c0001c00010100000381812278bd2e5f70696e6720454f46
2020-08-08 09:58:07 DEBUG: [F0F8EB91: 5073 > 192.168.1.254] HEX: 677072732c61636b2c34353531
2020-08-08 09:58:27 DEBUG: [F0F8EB91: 5073 < 192.168.1.254] HEX: 8000c811c0001c0001010000038181228fbd2e5f70696e6720454f46
2020-08-08 09:58:27 DEBUG: [F0F8EB91: 5073 > 192.168.1.254] HEX: 677072732c61636b2c34353532
2020-08-08 09:58:50 DEBUG: [F0F8EB91: 5073 < 192.168.1.254] HEX: 8000c911c0001c000101000003818122a6bd2e5f70696e6720454f46
2020-08-08 09:58:50 DEBUG: [F0F8EB91: 5073 > 192.168.1.254] HEX: 677072732c61636b2c34353533
Anton Tananaev4 years ago

Upgrade to the latest version of Traccar.

gutitoni4 years ago

Look Anton that I update the latest version and in that I do not see anything in the logs only once load this version if it reports to me but sometimes it sends those errors so I installed this version 3.16

gutitoni4 years ago

I read that a friend of the forum passed the same thing are the test with version 4.0 because the latest version does not register anything