Enfora in UDP

Global Trans8 years ago

Hello Anton
I was trying to run the Enfora GSM2338 on port 5008, it works perfectly but only with TCP, it sends many connection checks, which means a lot consumption of data.

I read in this link: https://github.com/tananaev/traccar/issues/6 that we could implement UDP for Enfora.

I tried to replace "ServerBootstrap" with "ConnectionlessBootstrap" in the file "EnforaProtocol.java" and I was not successful.

I ask if you can help me with this topic.
Thank you very much.

Anton Tananaev8 years ago

It should work. Try removing frame decoder.

Global Trans8 years ago

Hi thanks for the prompt response, i try what you tell me but it does not work.
I show you the file's code "EnforaProtocol.java":

package org.traccar.protocol;
import org.jboss.netty.bootstrap.ConnectionlessBootstrap;
//import org.jboss.netty.bootstrap.ServerBootstrap;
import org.jboss.netty.channel.ChannelPipeline;
//import org.jboss.netty.handler.codec.frame.LengthFieldBasedFrameDecoder;
import org.traccar.BaseProtocol;
import org.traccar.TrackerServer;
import java.util.List;

public class EnforaProtocol extends BaseProtocol {
    public EnforaProtocol() {
        super("enfora");
    }
    @Override
    public void initTrackerServers(List<TrackerServer> serverList) {
        //serverList.add(new TrackerServer(new ServerBootstrap(), getName()) {
        serverList.add(new TrackerServer(new ConnectionlessBootstrap(), getName()) {
            @Override
            protected void addSpecificHandlers(ChannelPipeline pipeline) {
                //pipeline.addLast("frameDecoder", new LengthFieldBasedFrameDecoder(1024, 0, 2, -2, 2));
                pipeline.addLast("objectDecoder", new EnforaProtocolDecoder(EnforaProtocol.this));
            }
        });
    }
}
Anton Tananaev8 years ago

Check raw data from your device. If it don't contain IMEI and GPRMC sentences, it won't work.

Global Trans8 years ago

Hello, I was able to fix the problem!! =)
The code I placed above was correct
thanks for your help.