AVEMA AT35 4G/LTE MiFi

JM6 years ago

Hi!
I have two AT35 4G/LTE MiFi devices and can not make api to recognize them.
When I make them to communicate on port 10101, on the same server where api is, I have response from device in format:

8,20180927150956,19.154864,49.124862,7,56,0,12,3,0.0,0,0.02,14.01,0,0,26,0,219-2,65534,10255884,0.01

every 25 sec.
But when I set device to port 5171 (port for AVEMA gps devices), and add new device entering the device name and setting the identifier to 8, the API does not recognize my device.
Version of API is traccar-linux-64-4.3 and AVEMA is supportet from version 4.0.

Do you have any idea why it is not working?

Anton Tananaev6 years ago

Looks like format is different from what's implemented. Please provide protocol documentation.

JM6 years ago

Hi Anton, I have sent documentation on mail Support: support@traccar.org

Anton Tananaev6 years ago

Documentation you provided doesn't seem to match. Here is an example from there:

1130048939,20120224000129,121.447487,25.168025,0,0,0,0,3,0.0,1,0.02V,14.88V,0,1,24,4,46608,F8BC,F9AD,CID0000028
JM6 years ago

Hi Anton,

It is match!
Delimiter is ","[comma], and there is 21 comma delimited information that device send in my example and in documentation example.
By the specification my example and the one from documentation have the same number of delimited information and every information is in the same place.

my case documentation description
8 1130048939 Unit ID -> in your API it is "identifier "
20180927150956 20120224000129 date-time -> The latest valid GPS date and time
19.154864 121.447487 Longitude in decimal degrees
49.124862 25.168025 Latitude in decimal degrees
7 0 Speed in decimal kilometer per hour
56 0 Direction in decimal degrees
0 0 Altitude in meters
12 0 Number of Satellites
3 3 Event ID
0.0 0.0 Mileage value in kilometer
0 1 Decimal value of Input Status
0.02 0.02 Analog input 1 voltage level
14.01 14.88 Analog input 2 voltage level
0 0 Decimal value of Output Status
0 1 Show Roaming status
26 24 GSM Network Signal Strength, CSQ data
0 4 Communication system
219-2 46608 mobile country code/ mobile network code
65534 F8BC Location area code
10255884 F9AD Cell ID
0.01 CID0000028 RFID Data See $AVM,RFID command

As you can see, FORMAT of my device AVEMA AT35 4G/LTE MiFi is te same like in documentation, only value are different.

Anton Tananaev6 years ago

At least last 4 is not a match. Format is completely different.

JM6 years ago

I'll contact factory and ask them if they have change there format?
Because maybe I can program the device to have format as yours.

Can you post me the format that is implemented in traccar?

Anton Tananaev6 years ago

Implemented format from documentation.

JM6 years ago

This response is on all AVEMA AT35 devices:

21212,20181023192708,16.428229,43.480302,0,189,0,12,3,0.0,0,0.04,15.00,0,0,27,4,219-2,65534,10379275,0.01

I talk to them and find out that documentation is very lousy. So probably non of the avema devices is not working on your software.

If I adopt this protocol document to match device, is it going to work, or must adopt database to?

private static final Pattern PATTERN = new PatternBuilder()
            .number("(d+),")                     // device id
            .number("(dddd)(dd)(dd)")            // date (yyyymmdd)
            .number("(dd)(dd)(dd),")             // time (hhmmss)
            .number("(-?d+.d+),")                // longitude  //********* Why is '-' in this pattern (-?d+.d+)*********
            .number("(-?d+.d+),")                // latitude     //********* Why is '-' in this pattern (-?d+.d+)*********
            .number("(d+),")                     // speed
            .number("(d+),")                     // course
            .number("(-?d+),")                   // altitude  //********* Why is '-' in this pattern (-?d+.d+)*********
            .number("(d+),")                     // satellites
            .number("(d+),")                     // event
            .number("(d+.d+),")                  // odometer
            .number("(d+),")                     // input
            .number("(d+.d+)V,")                 // adc 1
            .number("(d+.d+)V,")                 // adc 2
            .number("(d+),")                     // output
            .number("(d),")                      // roaming
            .number("(d+),")                     // rssi
            .number("d,")                        // communication system
            .number("(ddd)")                     // mcc
            .number("(dd),")                     // mnc
            .number("(x+),")                     // lac
            .number("(x+),")                     // cid
            .number("([^,]+)?")                  // rfid
JM6 years ago

Hi Anton,
I just try to simulate communication with exactly same output with program PacketSenter by sending this on the server (multiple string with time changed)

8888888888,20190325120129,121.447487,25.168025,0,0,0,0,3,0.0,1,0.02V,14.88V,0,1,24,4,46608,F8BC,F9AD,CID0000028

And device was not recognized on the map.

Any more suggestions?

JM6 years ago

I sow that you ad in test for AVEMA new protocol.

package org.traccar.protocol;

import org.junit.Test;
import org.traccar.ProtocolTest;

public class AvemaProtocolDecoderTest extends ProtocolTest {

    @Test
    public void testDecode() throws Exception {

        AvemaProtocolDecoder decoder = new AvemaProtocolDecoder(null);

        verifyNull(decoder, text(
                "8,20180927150956,19.154864,49.124862,7,56,0,12,3,0.0,0,0.02,14.01,0,0,26,0,219-2,65534,10255884,0.01"));

        verifyPosition(decoder, text(
                "1130048939,20120224000129,121.447487,25.168025,0,0,0,0,3,0.0,1,0.02V,14.88V,0,1,24,4,46608,F8BC,F9AD,CID0000028"));

    }

}

Does it means that it should work now wit this "new" protocol?

Anton Tananaev6 years ago

Why is '-' in this pattern (-?d+.d+)

I think the answer is pretty obvious here - those values can be negative.

Does it means that it should work now wit this "new" protocol?

No, it does not.

Jaime Duardo5 months ago

Hello, I believe there is an error in the parser for this protocol. As soon as it wakes up, the unit establishes a TCP connection and opens a socket to your server. Your server must accept this socket. Once opened, the unit triggers a keep-alive string (8 bytes with 2 bytes for the header 0xC1D4, 2 bytes for increment, and 4 bytes for unitID). The server must return the same keep-alive string for acknowledgment. At this step, the unit begins data transmission, sending the position message (ASCII string). The socket stays open until the unit enters sleep mode, loses the network, or reboots.

Anton Tananaev5 months ago

Log and documentation please.

Jaime Duardo5 months ago

The device keeps sending the same type of message until it receives a response from the server:
2024-06-14 14:06:58 INFO: [T2022d707: avema < remote_IP] d4c195013797ce77
In this document, you can see more details on pages 8-9 (SyncPos on page 9) about how it should be. I was doing some tests on Flespi, and it follows the pattern described above.