You would have to change the code.
FilterHandler.java ?
is it like position.getEvent() == "Stoped"
, can you tell how do I need to set it ?
to get event is almost like this ?
@Override
protected boolean filterPosition(Position position) {
// Get the device ID
long deviceId = position.getDeviceId();
// Check if it's a "stopped" event
if (position.getAttributes().containsKey("event")) {
String event = position.getAttributes().get("event").toString();
if ("stopped".equals(event)) {
stoppedState.put(deviceId, true); // Mark as stopped
} else if ("moving".equals(event)) {
stoppedState.put(deviceId, false); // Mark as moving
}
}
// Apply filtering only if the device is stopped
if (stoppedState.getOrDefault(deviceId, false)) {
// Check if the new position is identical to the last processed position
Position lastPosition = lastPositions.get(deviceId);
if (lastPosition != null
&& lastPosition.getLatitude() == position.getLatitude()
&& lastPosition.getLongitude() == position.getLongitude()
&& lastPosition.getSpeed() == position.getSpeed()) {
return true; // Filter (discard) the repeated position
}
// Update the last processed position
lastPositions.put(deviceId, position);
}
return false; // Do not filter (accept) the position
}
Hi, is that possible to have a new filter that filter positions after an event ? like device stoped.
Because we have trackers that have ignition attribute on all positions, so the filters that we like do not work , like duplicate and distance, so we would like to filter duplicate, distance positions only after device get event stoped.