GL520-GL530

Maximilien7 years ago

Hi,

I'm using GL520 device and will implement the missing message types in Gl200 protocol.

Do you suggest to do it in Gl200TextProtocolDecoder or create a new Gl500TextProtocolDecode.
I wonder this because the "Position Related Report" doesn't have the same format in Gl200 and Gl520 doc but both have RESP:GTGEO for example.

I also have several questions about Gl200TextProtocolDecoder :

In Gl200TextProtocolDecoder the last part of PATTERN_LOCATION is stated as odometer but in documentation it is just a reserved place, morevover each time the decodeLocation is called it is followed by a position.set(Position.KEY_ODOMETER, parser.nextDouble(0) * 1000); so i think we should remove the odometer part on decodeLocation.

The decodeOther seems strange too, the ODOMETER is set 3 times :

    decodeLocation(position, parser);

    position.set(Position.KEY_ODOMETER, parser.nextDouble(0) * 1000);
    position.set(Position.KEY_BATTERY_LEVEL, parser.nextInt(0));

    position.set(Position.KEY_ODOMETER, parser.nextDouble(0) * 1000);

Best regards,
Maximilien

Anton Tananaev7 years ago

It should definitely be in the same decoder. Check this for example on how we develop decoder:

https://github.com/tananaev/traccar/issues/2402

We shouldn't remove odometer from decodeLocation. I believe it should only be there and not after. What we might need to do is to check if the field is present like this:

if (parser.hasNext()) {
    position.set(Position.KEY_ODOMETER, parser.nextDouble() * 1000);
}
Maximilien7 years ago

Ok, i understand a little better how you built Gl200TextProtocolDecoder.

However it's already difficult to make a common pattern with one message type, if we want all the messages types it seems to me really hard to do so.

I think it will be easier and less error prone to first identify the protocol type and then apply the pattern related to it.
It can be done inside the Gl200TextProtocolDecoder.

As we need messages for GL520 , i'll do it like that for now and later see if i can find a way to extract common patterns like you seems to prefer.

Best regards,
Maximilien

Anton Tananaev7 years ago

If you look at the comparison table you'll notice that there is not as much difference between protocols, so it should be fairly easy to come up with common pattern.

Maximilien7 years ago

For example the GL50X have 3 fields between "Report Type" and "Location fields". Among this 3 fields there is the battery percentage that is after the location fields in gl200/gl300.

So let's see