How to access latest position in ConnectionManager.java

Victor Butler 2 years ago

Hello,

Is there an easy way to access the latest position in ConnectionManager.java?

My understanding is that the below would work only when a new position is sent by the device, however I need to get the latest position eve when the device does not send data:

@Override
public void handlePosition(Position position, Callback callback) {
   Position last = cacheManager.getPosition(position.getDeviceId());
   callback.processed(false);
}
Anton Tananaev 2 years ago

Your understanding is incorrect.

Victor Butler 2 years ago

Thanks for that, you are correct indeed. Using cacheManager I was able to access the last recorded message and for new incoming messages I had to use the PostProcessHandler. Your help and a bit of digging did the trick.

I do have a question about the BaseBroadcastService, in particular the code below. What is the code below actually updating:

@Override
public void updateDevice(boolean local, Device device) {
        BroadcastMessage message = new BroadcastMessage();
        message.setDevice(device);
        sendMessage(message);
}
Victor Butler 2 years ago

Some feedback will be appreciated. I couldn't understand what the BroadcastService actually does.