Decoding Event Only Packet (Without Position Information)

Abish2 years ago

I have a tracker (M588FS) which is built on top of Gator Protocol.
The tracker supports a Relay, which can be controlled by sending commands.
I built a Protocol Encoder to do the same, and it's successfully being executed. These sent commands will be acknowledged by the tracker with a packet for confirmation (success or failure), but it doesn't have any position information.

I have made a draft for decoding the acknowledgment, but since it's using the position class, it does have zero latitude and longitude.
So when reports are generated for events, it shows the position icon leading to zero coordinates.
I may have to filter zero coordinates / invalid position, this will actually neglect the packet.

How to counter this? Is there any other way of just invoking Alarm / Event class without using Position.

Attaching screenshot of Events created with the following snippet.
https://i.imgur.com/WuHOVYR.png

            position.set(Position.KEY_EVENT, Event.TYPE_COMMAND_RESULT);
            position.setValid(false);

            // If Main Order -> 0x38 = Start Engine, 0x39 = Stop Engine
            if (_success == 0x01){
                if (_main_order == 0x38){
                    position.set(Position.KEY_COMMAND, Command.TYPE_ENGINE_RESUME);
                    position.set(Position.KEY_RESULT, "Engine Started");
                }
                else if (_main_order == 0x39){
                    position.set(Position.KEY_COMMAND, Command.TYPE_ENGINE_STOP);
                    position.set(Position.KEY_RESULT, "Engine Stopped");
                }
            }
            else {
                position.set(Position.KEY_RESULT, "Command Failed");
            }

            return position;
Anton Tananaev2 years ago

Do you want to send a pull request?

Abish2 years ago

I wanted to do a proper test on a vehicle before making it public / creating a pull request.

Coming back to my question, Is there any other way of just invoking Alarm / Event class without using the Position Class.?

I'm currently taking getLastLocation() from the Base Decoder Class, and adding that location to the acknowledgment from the tracker. If there aren't any other ways to tackle this, then this would be at least the best way currently possible. Could you confirm this?

Anton Tananaev2 years ago

Using getLastLocation is the right way of handling messages without location info.

Abish2 years ago

I implemented with getLastLocation, I'll initiate a pull request.

Do note that, It's the first time I'm using Java. There may be a need for code optimization.

Anton Tananaev2 years ago

Sounds good, thanks.

Abish2 years ago

Also, is there any support for a notification which effectively executes a command.

I wanted to execute a command when an Alarm is triggered.

For example,
when the device exits a Geofence, a corresponding Geofence Exit Event / Alarm is generated, then the tracker gets notified to change the Relay state.

Anton Tananaev2 years ago

Yes, it's something we implemented recently.

Abish2 years ago

That's cool, I'll try and get back to you.

Meanwhile check out the pull request.

Abish2 years ago

Yes, it's something we implemented recently.

is there any documentation related to this specific feature. I'm not sure what's the process of getting started?

Abish2 years ago

I understood that NotificatorCommand is the feature you're referring. But is it supported from the frontend (modern web)?

Note: On Latest Master Branch, Added "command" to notificator.types in Configuration file
.
Attaching screenshots, if it's a bug I'll make this a new topic.

https://i.imgur.com/qI04NgT.png
https://i.imgur.com/xYDhtSQ.png

Anton Tananaev2 years ago

Have you tried the preview?

Abish2 years ago

I didn't understand, is preview another branch?

Anton Tananaev2 years ago
Abish2 years ago

Okay, I actually was using react app within the traccar/traccar repo. Both preview and traccar-web repo works fine in terms of UI.

Don't want to take up your time, though an error pop up.
But both showed the same error on saving the notification. Attaching it below.
https://i.imgur.com/oKa6nv1.png

I'll try to explore and figure out. If you have anything to specify after seeing this, do share.