aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/BaseProtocolEncoder.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/traccar/BaseProtocolEncoder.java')
-rw-r--r--src/main/java/org/traccar/BaseProtocolEncoder.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/main/java/org/traccar/BaseProtocolEncoder.java b/src/main/java/org/traccar/BaseProtocolEncoder.java
index b9ca16838..e357c27dc 100644
--- a/src/main/java/org/traccar/BaseProtocolEncoder.java
+++ b/src/main/java/org/traccar/BaseProtocolEncoder.java
@@ -39,6 +39,8 @@ public abstract class BaseProtocolEncoder extends ChannelOutboundHandlerAdapter
private CacheManager cacheManager;
+ private String modelOverride;
+
public BaseProtocolEncoder(Protocol protocol) {
this.protocol = protocol;
}
@@ -68,6 +70,15 @@ public abstract class BaseProtocolEncoder extends ChannelOutboundHandlerAdapter
}
}
+ public void setModelOverride(String modelOverride) {
+ this.modelOverride = modelOverride;
+ }
+
+ public String getDeviceModel(long deviceId) {
+ String model = getCacheManager().getObject(Device.class, deviceId).getModel();
+ return modelOverride != null ? modelOverride : model;
+ }
+
@Override
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception {