GV200 ignition event not reported

Anton Tananaev7 years ago

Something is clearly not working. Maybe fix time issue or maybe something else. I can only guess.

Ferchoes7 years ago

I will test it again in a new machine, i will give you my result tomorrow. Thank you

Ferchoes7 years ago

Hello Anton,
here am i again, as i told you, i did the test in a new machine and for each test i did a new installation of traccar.

First Test:

  • Install Traccar 3.14 as it is, no one modification in config file.
  • Add the gv200 in traccar
  • Results:
    1.- when the message GTINF arrives and the status is 21 then in the route report the column "status" is 21 and the column "ignition" is "yes"
    2.- when the message GTINF arrives and the status is 11 then in the route report column "status" is 11 and the column "ignition" is empty.

Second Test

  • Install Traccar 3.14 as it is, one modification in config file, copy attributes enabled with ignition as parameter
  • Start the server.
  • Add the gv200 in traccar
  • Results:
    1.- when the message GTINF arrives and the status is 21 then in the route report the column "status" is 21 and the column "ignition" is "yes"
    2.- when the message GTINF arrives and the status is 11 then in the route report column "status" is 11 and the column "ignition" is ALSO "yes".

And this result confirms what you say, the copy attributes works fine and NEVER is empty.

With this two test can i confirm that for gv200, i don't need to enable the copy attributes, because i get the ignition status from GTINF messages, but how can i set "NO" if the status 11 arrives to the server?.

Could you please give some advice or in which java file should i work to get "No" when status 11 arrives?.

Thank you in advance

Anton Tananaev7 years ago

Here is documentation that I have:

State: The current motion state of the device.
21: The device attached vehicle is ignition on and motionless.
22: The device attached vehicle is ignition on and moving.
41: The device is motionless without ignition on.
42: The device is moving without ignition on. 

If your device is different, I would need documentation.

Ferchoes7 years ago

There are more states in the new protocol version. Here i have uploaded the complete pdf protocol and the print screen of the pag 153 where the states of the GTINF are described. You can find it under:

https://drive.google.com/drive/folders/0B_fX3SEMV_2WX1pVNWxoTjEwRlE

Anton Tananaev7 years ago

I have added support for all state codes.

Ferchoes7 years ago

Anton, you are awesome.....Thank you very much!

Ferchoes7 years ago

Hello Anton,

i implemented your changes in works, the ignition event is now triggered. But this solution means that the device GV200 should be configured to send INF message and FRI message which is many MBs in the month per user. Therefore my idea is to use the GTIGN/GTIGF messages and when these message arrives to set ignition on /off respectively.

I did my first intent so: from the original decodeIgn function, i made two decodeIgnn (for GTIGN message) and decode Ignf (for GTIGF message) and in each function i added respectively the following instrucction:

 position.set(Position.KEY_IGNITION, true);
 position.set(Position.KEY_IGNITION, false);

I thought that if i have this two code lines, the route report will display in the ignition column "yes" / "No" but it does not.

Could you please help me with an idea, what am i doing wrong?

Anton Tananaev7 years ago

It should. If it doesn't, you are doing something wrong.

Ferchoes7 years ago

I go back to your original version and set some debugs lines, and i found that when the GTIGF or GTIGN message arrives , the function initPosition returns null because parser.matches() in the function initPosition is false. Therefore decodeIgn return null and the position attributes can not be reached to be set.

private Object decodeIgn(Channel channel, SocketAddress remoteAddress, String sentence) {
        Parser parser = new Parser(PATTERN_IGN, sentence);
        Position position = initPosition(parser, channel, remoteAddress);
        Log.info("Here 1..." + sentence);
        if (position == null) {
            Log.info("Here 2...");
            return null;
        }

        Log.info("Here 3...");
        decodeLocation(position, parser);
     
        position.set(Position.KEY_HOURS, parser.next());
        position.set(Position.KEY_ODOMETER, parser.nextDouble(0) * 1000);

        decodeDeviceTime(position, parser);

        return position;
    }

I can not understand why the parser does not match and return null, have you an idea?

Anton Tananaev7 years ago

Obviously the reason is that regex pattern doesn't match.

Ferchoes7 years ago

Thank you, I doubted because i added the following test and was succesfull.... i will try to change the pattern according to the documentation.

verifyAttributes(decoder, buffer (
                "+RESP:GTIGN,040900,861074023747143,gv200,762,0,0.0,6,2892.1,-78.00000,-0.140000,20170929203131,0740,0001,38A6,0111,00,3.0,,20170929163208,2C36$"));
Ferchoes7 years ago

I found the error in the regex, i give you the pattern, which works:

private static final Pattern PATTERN_IGN = new PatternBuilder()
            .text("+").expression("(?:RESP|BUFF):GTIG[NF],")
            .number("(?:[0-9A-Z]{2}xxxx)?,")     // protocol version
            .number("(d{15}|x{14}),")            // Unique ID ==> imei
            .expression("[^,]*,")                // device name
            .number("d+,")                       // ignition off duration
            .expression(PATTERN_LOCATION.pattern())
            .number("(d{1,7}.d)?,")              // odometer
            .number("(d{5}:dd:dd)?,")            // hour meter
            .number("(dddd)(dd)(dd)")            // date (yyyymmdd)
            .number("(dd)(dd)(dd)").optional(2)  // time (hhmmss)
            .text(",")
            .number("(xxxx)")                    // count number
            .text("$").optional()
            .compile();

The error, in the current version hour meter is first and odometer after, but according to the documentation is vice versa. Now i can get the ignition status when the GTIGN / GTIGF arrive.

I found also that the regex of GTFRI has an error, but the decode is made by the decodebasic function, therefore there is no error in traccar. As soon as possible i will analyze the regex of GTFRI.

Thanks for all you help!

Anton Tananaev7 years ago

Please send a pull request if you want to include it in the official version.

Ferchoes7 years ago

Yes, i would like to include it in the official version...should i create a new branch to push the change? or can i push directly master-master.?

I use eclipse.

Thanks in advance