Problem between data packets

João Tomás15 days ago

A while ago I created a topic while trying to find a way to associate an EYE Beacon with different drivers of a device. I was successful in that, but now I have the following problem: When I receive the the data packet with beacon info, I parse it and associate the closest beacon to the driver id with:

position.set(Position.KEY_DRIVER_UNIQUE_ID, bestDriverId);

And it will work and make my device associate the correct driver in the driverUniqueId field , until I get another data packet with the I/O info, and then the driverUniqueId will not appear anymore.

Does anyone know what might be the cause? Thanks!

Anton Tananaev15 days ago

Does another packet include beacon info? If not, then it seems like expected behavior.

João Tomás15 days ago

The Teltonika device sends different packets for I/O stuff and Beacon info. I have also enabled copy attributes to save the driverId between the different packets, but when I get a Beacon info packet, the copy attributes configuration will overwrite the driverId from the last state, even if there are no current Beacons being detected. Thanks!

Anton Tananaev15 days ago

That still sounds like it's working as expected.

João Tomás15 days ago

But is there any way of removing the driverUniqueId value, if I detect that there aren't any Beacons around? Because I wanted that key from packet to packet until the packet doesn't detect a Beacon.

Anton Tananaev14 days ago

I don't think it's possible currently.

João Tomás13 days ago

Sorry for insisting, but would there be any other way to keep the driverId without using the copy attributes configuration, or otherwise remove the driverId even with copy attributes? Thanks!

João Tomás13 days ago

My current solution is to remove the attribute of driverUniqueId when I can't detect the Beacons, but I would need the copy attributes configuration to see that driverUniqueId is null and remove not set any driver.

This is the code I added for that:

ExtendedModel.java
public void unset(String key) {
        attributes.remove(key);
    }

Then I will do the following when I dont detect the beacon:

TeltonikaProtocolDecoder.java
position.unset(Position.KEY_DRIVER_UNIQUE_ID);