I have problems sending ACK in custom protocol

Welcomme25 days ago

I'm implementing a custom protocol for a GPS device I received from China.
The GPS sends a Sync Request to the server like this:

S168#862240656514739#0001#001d#SYNC:0-766-23-1;STATUS:84,100$

Then it waits for a response from the server....

My protocol receives it and creates the response but it never gets sent.
Could someone help me find the reason?

In the traccar log I see my "ACK Armed for sending" text but not the traccar prot > device one.

My ACK code is:

private void sendAck(Channel channel,SocketAddress remoteAddress, String imei, String serialNumber, String type) {
 if (channel != null && channel.isActive() && channel.isWritable()) {

 String utcTime = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date());
 String ackContent = String.format("ACK^%s,%s", type, utcTime);
 String lengthHex = String.format("%04x", ackContent.length());
 String response = String.format("S168#%s#%s#%s#%s$", imei, serialNumber, lengthHex, ackContent);
 //channel.writeAndFlush(response);

 channel.writeAndFlush(new NetworkMessage(response, channel.remoteAddress()));

 LOGGER.log(Level.INFO, "ACK Armed for sending: " + response + channel.isActive());
 }
 else {
 LOGGER.log(Level.INFO, "Error");
 }
 }
Anton Tananaev24 days ago

Are you sure it's a new protocol?

Welcomme24 days ago

Hi Anton!
I hope you're doing well.
You're telling me it's already implemented? I honestly couldn't find the equivalent!
Did I search wrong?

Anton Tananaev24 days ago

I think so.

Welcomme24 days ago

OMG!

I found it, it's called S168!
Now the problem I see is that the GPS is waiting for the SYNC response and until it receives it, it oscillates between connected and disconnected.
But it's a good start!