Extract data from watch protocol

mahmoud3 years ago

Dear Anton
I hope this finds you well

I have a personal GPS tracker and it used "watch" protocol, and I connected it to the my Traccar server and I get the data from the device.
But when I receive the data I found the Traccar can't explain the alarm type from the message as follow:

[3G*2104026574*00C6*AL,060721,053245,A,22.653628,N,114.0146350,E,0.00,260.9,0.0,9,100,93,0,0,00010000,7,255,460,0,9724,5241,144,9724,4642,134,9724,4543,133,9724,4641,132,9724,5242,130,9724,3802,130,9724,5071,127,0,41.1]

[3G*2104026574*00C5*AL,060721,053245,A,22.653628,N,114.0146350,E,0.00,260.9,0.0,9,94,68,0,0,00400000,7,255,460,0,9724,5242,148,9724,5241,140,9724,4641,138,9724,4062,137,9724,5071,136,9724,3913,134,9724,4654,132,0,41.1]

00010000 and 00400000 are the different types of alarm from the device but it assume the as same.
How can I edit it?

Best regards
Mahmoud alqannas

Anton Tananaev3 years ago

You have to modify the decoder class for this protocol.

mahmoud3 years ago

Do you mean I should edit the conditions of the following cod?

private String decodeAlarm(int status) {
        if (BitUtil.check(status, 0)) {
            return Position.ALARM_LOW_BATTERY;
        } else if (BitUtil.check(status, 1)) {
            return Position.ALARM_GEOFENCE_EXIT;
        } else if (BitUtil.check(status, 2)) {
            return Position.ALARM_GEOFENCE_ENTER;
        } else if (BitUtil.check(status, 3)) {
            return Position.ALARM_OVERSPEED;
        } else if (BitUtil.check(status, 16)) {
            return Position.ALARM_SOS;
        } else if (BitUtil.check(status, 17)) {
            return Position.ALARM_LOW_BATTERY;
        } else if (BitUtil.check(status, 18)) {
            return Position.ALARM_GEOFENCE_EXIT;
        } else if (BitUtil.check(status, 19)) {
            return Position.ALARM_GEOFENCE_ENTER;
        } else if (BitUtil.check(status, 20)) {
            return Position.ALARM_REMOVING;
        } else if (BitUtil.check(status, 22)) {
            return Position.ALARM_FALL_DOWN;
        }
        return null;