Protocol Daycom

Roberto Sousa2 months ago

Hello, how are you? Can you add the attached protocol? We are trying to implement more without success! thank you very much

https://ssdtecnologia.online/daycom.pdf

Best Regards,

Anton Tananaev2 months ago

Do you have some samples from logs?

Roberto Sousa2 months ago

I'm using port 5023 but I don't know if I would have to configure another port, I believe that as the protocol does not exist in traccar I would have to configure, (imei device daycom test 869139054254699) the equipment expects something like this

CONFIG,00,00:05:00,00:00:00,10,3.00,0,123456\r\n
CONFIG,OK\r\n
2025-02-25 20:05:34  INFO: [T122e2637: osmand < 127.0.0.1] POST /?id=563209×tamp=1740513933&lat=-23.497749&lon=-46.848607&speed=0&bearing=0&altitude=776.7665249279202&accuracy=163.0770535555072&batt=30.00000190734863 HTTP/1.1\r\nAccept: */*\r\nUser-Agent: TraccarClient/59 CFNetwork/3826.400.120 Darwin/24.3.0\r\nAccept-Language: pt-BR,pt;q=0.9\r\nAccept-Encoding: gzip, deflate\r\nVia: 1.1 ssdtecnologia\r\nX-Forwarded-For: 177.26.249.135\r\nX-Forwarded-Proto: http\r\nX-Forwarded-Host: plataforma.iotsegsing.com.br:8082\r\nX-Forwarded-Server: 172.20.1.15\r\nHost: localhost:5055\r\nContent-Length: 0\r\n\r\n
2025-02-25 20:05:34  WARN: Geocoding failed - HTTP 500 Internal Server Error - InternalServerErrorException (...)
2025-02-25 20:05:35  INFO: [T122e2637] id: 563209, time: 2025-02-25 20:05:33, lat: -23.49775, lon: -46.84861, course: 0.0, accuracy: 163.1
2025-02-25 20:05:35  INFO: [T122e2637: osmand > 127.0.0.1] HTTP/1.1 200 OK\r\ncontent-length: 0\r\n\r\n
2025-02-25 20:05:54  INFO: [Tc37ab448] connected
2025-02-25 20:06:05  INFO: [T122e2637] disconnected
2025-02-25 20:06:07  INFO: [Tc37ab448: gt06 < 88.205.108.11] VRL,2.608,000000,P,L,010104,000031,869139054254699,8955170000208273533f|724|10|01|2397|2aa0|44,0,4.082|85,n,20,001,10000002|0|0,30,999,0,00000000000000,724,10,1,2397,2aa0,044,0000,ffff,033,0000,ffff,030,0000,ffff,030,8\r\n
2025-02-25 20:07:10  INFO: [T730f53d5] connected
2025-02-25 20:07:22  INFO: [T730f53d5: gt06 < 88.205.108.11] VRL,2.608,000000,P,L,010104,000147,869139054254699,8955170000208273533f|724|10|01|2397|2aa0|43,0,4.093|86,n,21,001,10000002|0|0,30,999,0,00000000000000,724,10,1,2397,2aa0,043,0000,ffff,032,0000,ffff,030,0000,ffff,030,8\r\n
2025-02-25 20:08:10  INFO: [Tdd9e2f6c] connected
2025-02-25 20:08:10  INFO: [Tdd9e2f6c: startek < 147.45.112.186] 0300002f2ae00000000000436f6f6b69653a206d737473686173683d41646d696e697374720d0a0100080003000000
2025-02-25 20:08:17  WARN: [Tdd9e2f6c] error - Connection reset - SocketException (...)
2025-02-25 20:08:17  INFO: [Tdd9e2f6c] disconnected
2025-02-25 20:10:02  INFO: [T0287215a] connected
2025-02-25 20:10:02  INFO: [T0287215a: pt502 < 185.243.96.117] 0300002f2ae00000000000436f6f6b69653a206d737473686173683d41646d696e697374720d0a0100080003000000
2025-02-25 20:10:02  WARN: [T0287215a] error - index: 0, length: -1 (expected: range(0, 37)) - IndexOutOfBoundsException (... < Pt502ProtocolDecoder:149 < ExtendedObjectDecoder:73 < ... < WrapperContext:102 < ... < WrapperInboundHandler:56 < ...)
2025-02-25 20:10:02  INFO: [T0287215a] disconnected
2025-02-25 20:10:24  INFO: [Te2f81604] connected
2025-02-25 20:10:39  INFO: [Te2f81604: gt06 < 88.205.108.11] VRL,2.608,000000,P,L,010104,000102,869139054254699,8955170000208273533f|724|10|01|2397|2aa1|37,0,4.110|88,n,13,001,90000002|0|0,30,999,0,00000000000000,724,10,1,2397,2aa1,037,2397,2aa0,037,2397,2a9f,025,2397,34e5,022,8\r\n
2025-02-25 20:10:52  INFO: [Ta7849bb5] connected
2025-02-25 20:10:52  INFO: [Ta7849bb5: osmand < 127.0.0.1] POST /?id=563209×tamp=1740514251&lat=-23.497743&lon=-46.848619&speed=0&bearing=0&altitude=774.4965249279202&accuracy=152.5389767836889&batt=30.00000190734863 HTTP/1.1\r\nAccept: */*\r\nUser-Agent: TraccarClient/59 CFNetwork/3826.400.120 Darwin/24.3.0\r\nAccept-Language: pt-BR,pt;q=0.9\r\nAccept-Encoding: gzip, deflate\r\nVia: 1.1 ssdtecnologia\r\nX-Forwarded-For: 177.26.250.137\r\nX-Forwarded-Proto: http\r\nX-Forwarded-Host: plataforma.iotsegsing.com.br:8082\r\nX-Forwarded-Server: 172.20.1.15\r\nHost: localhost:5055\r\nContent-Length: 0\r\n\r\n
2025-02-25 20:10:53  INFO: [Ta7849bb5] id: 563209, time: 2025-02-25 20:10:51, lat: -23.49774, lon: -46.84862, course: 0.0, accuracy: 152.5
2025-02-25 20:10:53  INFO: [Ta7849bb5: osmand > 127.0.0.1] HTTP/1.1 200 OK\r\ncontent-length: 0\r\n\r\n
2025-02-25 20:10:55  INFO: [Ta7d1be78] connected
2025-02-25 20:10:55  INFO: [Ta7d1be78: gl100 < 45.227.254.155] 0300002f2ae00000000000436f6f6b69653a206d737473686173683d41646d696e697374720d0a0100080003000000
2025-02-25 20:11:04  WARN: [Ta7d1be78] error - Connection reset - SocketException (...)
2025-02-25 20:11:04  INFO: [Ta7d1be78] disconnected
2025-02-25 20:11:23  INFO: [Ta7849bb5] disconnected
2025-02-25 20:11:48  INFO: [Td3cc367b] connected
2025-02-25 20:12:01  INFO: [Td3cc367b: gt06 < 88.205.108.11] VRL,2.608,000000,P,L,010104,000229,869139054254699,8955170000208273533f|724|10|01|2397|2aa0|43,0,4.116|89,n,22,001,10000002|0|0,30,999,0,00000000000000,724,10,1,2397,2aa0,043,0000,ffff,032,0000,ffff,029,0000,ffff,028,8\r\n
2025-02-25 20:12:32  INFO: [T208c26ce] connected
2025-02-25 20:12:32  INFO: [T208c26ce: intellitrac < 185.243.96.117] 0300002f2ae00000000000436f6f6b69653a206d737473686173683d41646d696e697374720d0a0100080003000000
2025-02-25 20:14:01  INFO: [Tc19c2ec6] connected
2025-02-25 20:14:13  INFO: [Tc19c2ec6: gt06 < 88.205.108.11] VRL,2.608,000000,P,L,010104,000031,869139054254699,8955170000208273533f|724|10|01|2397|2aa0|38,0,4.116|89,n,19,001,90000002|0|0,30,999,0,00000000000000,724,10,1,2397,2aa0,038,0000,ffff,032,0000,ffff,028,0000,ffff,028,8\r\n
2025-02-25 20:14:45  INFO: [T108ff8e3] connected
2025-02-25 20:14:45  INFO: [T108ff8e3: racedynamics < 185.243.96.117] 0300002f2ae00000000000436f6f6b69653a206d737473686173683d41646d696e697374720d0a0100080003000000
2025-02-25 20:14:45  WARN: [T108ff8e3] error - For input string: "
Anton Tananaev2 months ago

Great. I see some matching samples. From here there are two main options:

  1. Submit a feature request on GitHub and wait for us to prioritize this
  2. If you're interested in sponsoring the work, email us to discuss it
Roberto Sousa2 months ago

Very good! Send e-mail! Thank you Anton

Roberto Sousaa month ago

Good afternoon everyone! I'm trying to create a new protocol in my traccar 3.6, I've already registered port 6822 in my traccar.xml. I'm building the protocol with the help of research but it's still giving me an unknown device. Could someone validate where I'm going wrong? I'll send my daycomProtocol and my DaycomProtocolDevice.

//DaycomProtocol.java

package org.traccar.protocol;

import org.traccar.BaseProtocol;
import org.traccar.PipelineBuilder;
import org.traccar.TrackerServer;
import org.traccar.config.Config;
import jakarta.inject.Inject;

public class DaycomProtocol extends BaseProtocol {

    @Inject
    public DaycomProtocol(Config config) {
        addServer(new TrackerServer(config, getName(), false) {
            @Override
            protected void addProtocolHandlers(PipelineBuilder pipeline, Config config) {
                pipeline.addLast(new DaycomFrameDecoder());
                pipeline.addLast(new DaycomProtocolDecoder(DaycomProtocol.this));
            }
        });
    }
}

//DaycomProtocol.java

//DaycomProtocolDecoder.java

package org.traccar.protocol;

import io.netty.buffer.ByteBuf;
import io.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.model.Position;
import org.traccar.session.DeviceSession;
import java.net.SocketAddress;
import java.nio.charset.StandardCharsets;
import java.util.Date;

public class DaycomProtocolDecoder extends BaseProtocolDecoder {

    public DaycomProtocolDecoder(DaycomProtocol protocol) {
        super(protocol);
    }

    @Override
    protected Object decode(Channel channel, SocketAddress remoteAddress, Object msg) {
        ByteBuf buf = (ByteBuf) msg;

        System.out.println("[Daycom] Pacote recebido. Tamanho: " + buf.readableBytes());

        if (buf.readableBytes() < 24) {
            System.out.println("[Daycom] Pacote muito pequeno. Ignorado.");
            return null;
        }

        // Tentando extrair IMEI
        String imei;
        try {
            byte[] imeiBytes = new byte[15];
            buf.readBytes(imeiBytes);
            imei = new String(imeiBytes, StandardCharsets.US_ASCII).trim();
            System.out.println("[Daycom] IMEI Extraído: " + imei);
        } catch (Exception e) {
            System.out.println("[Daycom] Erro ao extrair IMEI: " + e.getMessage());
            return null;
        }

        // Verificando se o dispositivo está cadastrado
        DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, imei);
        if (deviceSession == null) {
            System.out.println("[Daycom] Dispositivo desconhecido: " + imei);
            return null;
        }

        Position position = new Position(getProtocolName());
        position.setDeviceId(deviceSession.getDeviceId());

        try {
            // Extraindo latitude e longitude
            float latitude = buf.readFloat();
            float longitude = buf.readFloat();
            position.setLatitude(latitude);
            position.setLongitude(longitude);
            System.out.println("[Daycom] Latitude = " + latitude + ", Longitude = " + longitude);

            // Extraindo velocidade
            float speed = buf.readFloat();
            position.setSpeed(speed);
            System.out.println("[Daycom] Velocidade = " + speed + " km/h");

            // Configurar data/hora do servidor
            position.setFixTime(new Date());
            position.setValid(true);

            System.out.println("[Daycom] Posição processada com sucesso.");
            return position;

        } catch (Exception e) {
            System.out.println("[Daycom] Erro ao processar pacote: " + e.getMessage());
            return null;
        }
    }
}

//DaycomProtocolDecoder.java
Roberto Sousaa month ago

Help me please!

Roberto Sousaa month ago

Good afternoon everyone! I'm trying to create a new protocol in my traccar 3.6, I've already registered port 6822 in my traccar.xml. I'm building the protocol with the help of research but it's still giving me an unknown device. Could someone validate where I'm going wrong? I'll send my daycomProtocol and my DaycomProtocolDevice.

//DaycomProtocol.java

package org.traccar.protocol;

import org.traccar.BaseProtocol;
import org.traccar.PipelineBuilder;
import org.traccar.TrackerServer;
import org.traccar.config.Config;
import jakarta.inject.Inject;

public class DaycomProtocol extends BaseProtocol {

    @Inject
    public DaycomProtocol(Config config) {
        addServer(new TrackerServer(config, getName(), false) {
            @Override
            protected void addProtocolHandlers(PipelineBuilder pipeline, Config config) {
                pipeline.addLast(new DaycomFrameDecoder());
                pipeline.addLast(new DaycomProtocolDecoder(DaycomProtocol.this));
            }
        });
    }
}

//DaycomProtocol.java

//DaycomProtocolDecoder.java

package org.traccar.protocol;

import io.netty.buffer.ByteBuf;
import io.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.model.Position;
import org.traccar.session.DeviceSession;
import java.net.SocketAddress;
import java.nio.charset.StandardCharsets;
import java.util.Date;

public class DaycomProtocolDecoder extends BaseProtocolDecoder {

    public DaycomProtocolDecoder(DaycomProtocol protocol) {
        super(protocol);
    }

    @Override
    protected Object decode(Channel channel, SocketAddress remoteAddress, Object msg) {
        ByteBuf buf = (ByteBuf) msg;

        System.out.println("[Daycom] Pacote recebido. Tamanho: " + buf.readableBytes());

        if (buf.readableBytes() < 24) {
            System.out.println("[Daycom] Pacote muito pequeno. Ignorado.");
            return null;
        }

        // Tentando extrair IMEI
        String imei;
        try {
            byte[] imeiBytes = new byte[15];
            buf.readBytes(imeiBytes);
            imei = new String(imeiBytes, StandardCharsets.US_ASCII).trim();
            System.out.println("[Daycom] IMEI Extraído: " + imei);
        } catch (Exception e) {
            System.out.println("[Daycom] Erro ao extrair IMEI: " + e.getMessage());
            return null;
        }

        // Verificando se o dispositivo está cadastrado
        DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, imei);
        if (deviceSession == null) {
            System.out.println("[Daycom] Dispositivo desconhecido: " + imei);
            return null;
        }

        Position position = new Position(getProtocolName());
        position.setDeviceId(deviceSession.getDeviceId());

        try {
            // Extraindo latitude e longitude
            float latitude = buf.readFloat();
            float longitude = buf.readFloat();
            position.setLatitude(latitude);
            position.setLongitude(longitude);
            System.out.println("[Daycom] Latitude = " + latitude + ", Longitude = " + longitude);

            // Extraindo velocidade
            float speed = buf.readFloat();
            position.setSpeed(speed);
            System.out.println("[Daycom] Velocidade = " + speed + " km/h");

            // Configurar data/hora do servidor
            position.setFixTime(new Date());
            position.setValid(true);

            System.out.println("[Daycom] Posição processada com sucesso.");
            return position;

        } catch (Exception e) {
            System.out.println("[Daycom] Erro ao processar pacote: " + e.getMessage());
            return null;
        }
    }
}

//DaycomProtocolDecoder.java