aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/broadcast
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/traccar/broadcast')
-rw-r--r--src/main/java/org/traccar/broadcast/BroadcastInterface.java6
-rw-r--r--src/main/java/org/traccar/broadcast/MulticastBroadcastService.java12
2 files changed, 9 insertions, 9 deletions
diff --git a/src/main/java/org/traccar/broadcast/BroadcastInterface.java b/src/main/java/org/traccar/broadcast/BroadcastInterface.java
index d5b49f213..69e610dc6 100644
--- a/src/main/java/org/traccar/broadcast/BroadcastInterface.java
+++ b/src/main/java/org/traccar/broadcast/BroadcastInterface.java
@@ -22,13 +22,13 @@ import org.traccar.model.Position;
public interface BroadcastInterface {
- default void updateDevice(Device device) {
+ default void updateDevice(boolean local, Device device) {
}
- default void updatePosition(Position position) {
+ default void updatePosition(boolean local, Position position) {
}
- default void updateEvent(long userId, Event event) {
+ default void updateEvent(boolean local, long userId, Event event) {
}
default void invalidateObject(Class<? extends BaseModel> clazz, long id) {
diff --git a/src/main/java/org/traccar/broadcast/MulticastBroadcastService.java b/src/main/java/org/traccar/broadcast/MulticastBroadcastService.java
index 0525fa742..ac0fcbd86 100644
--- a/src/main/java/org/traccar/broadcast/MulticastBroadcastService.java
+++ b/src/main/java/org/traccar/broadcast/MulticastBroadcastService.java
@@ -66,21 +66,21 @@ public class MulticastBroadcastService implements BroadcastService {
}
@Override
- public void updateDevice(Device device) {
+ public void updateDevice(boolean local, Device device) {
BroadcastMessage message = new BroadcastMessage();
message.setDevice(device);
sendMessage(message);
}
@Override
- public void updatePosition(Position position) {
+ public void updatePosition(boolean local, Position position) {
BroadcastMessage message = new BroadcastMessage();
message.setPosition(position);
sendMessage(message);
}
@Override
- public void updateEvent(long userId, Event event) {
+ public void updateEvent(boolean local, long userId, Event event) {
BroadcastMessage message = new BroadcastMessage();
message.setUserId(userId);
message.setEvent(event);
@@ -115,11 +115,11 @@ public class MulticastBroadcastService implements BroadcastService {
private void handleMessage(BroadcastMessage message) {
if (message.getDevice() != null) {
- listeners.forEach(listener -> listener.updateDevice(message.getDevice()));
+ listeners.forEach(listener -> listener.updateDevice(false, message.getDevice()));
} else if (message.getPosition() != null) {
- listeners.forEach(listener -> listener.updatePosition(message.getPosition()));
+ listeners.forEach(listener -> listener.updatePosition(false, message.getPosition()));
} else if (message.getUserId() != null && message.getEvent() != null) {
- listeners.forEach(listener -> listener.updateEvent(message.getUserId(), message.getEvent()));
+ listeners.forEach(listener -> listener.updateEvent(false, message.getUserId(), message.getEvent()));
} else if (message.getChanges() != null) {
var iterator = message.getChanges().entrySet().iterator();
if (iterator.hasNext()) {