aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/traccar/ExtendedObjectDecoder.java5
-rw-r--r--src/main/java/org/traccar/config/Keys.java6
2 files changed, 9 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/ExtendedObjectDecoder.java b/src/main/java/org/traccar/ExtendedObjectDecoder.java
index dad52d3ff..46720da52 100644
--- a/src/main/java/org/traccar/ExtendedObjectDecoder.java
+++ b/src/main/java/org/traccar/ExtendedObjectDecoder.java
@@ -21,6 +21,7 @@ import io.netty.channel.Channel;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.util.ReferenceCountUtil;
+import org.traccar.config.Keys;
import org.traccar.helper.DataConverter;
import org.traccar.model.Position;
@@ -31,14 +32,14 @@ import java.util.Collection;
public abstract class ExtendedObjectDecoder extends ChannelInboundHandlerAdapter {
private void saveOriginal(Object decodedMessage, Object originalMessage) {
- if (Context.getConfig().getBoolean("database.saveOriginal") && decodedMessage instanceof Position) {
+ if (Context.getConfig().getBoolean(Keys.DATABASE_SAVE_ORIGINAL) && decodedMessage instanceof Position) {
Position position = (Position) decodedMessage;
if (originalMessage instanceof ByteBuf) {
ByteBuf buf = (ByteBuf) originalMessage;
position.set(Position.KEY_ORIGINAL, ByteBufUtil.hexDump(buf, 0, buf.writerIndex()));
} else if (originalMessage instanceof String) {
position.set(Position.KEY_ORIGINAL, DataConverter.printHex(
- ((String) originalMessage).getBytes(StandardCharsets.US_ASCII)));
+ ((String) originalMessage).getBytes(StandardCharsets.US_ASCII)));
}
}
}
diff --git a/src/main/java/org/traccar/config/Keys.java b/src/main/java/org/traccar/config/Keys.java
index d9e03517c..77b42943b 100644
--- a/src/main/java/org/traccar/config/Keys.java
+++ b/src/main/java/org/traccar/config/Keys.java
@@ -76,6 +76,12 @@ public final class Keys {
"extra.handlers", String.class);
/**
+ * Store original HEX or string data as "raw" attribute in the corresponding position.
+ */
+ public static final ConfigKey DATABASE_SAVE_ORIGINAL = new ConfigKey(
+ "database.saveOriginal", Boolean.class);
+
+ /**
* Enable positions forwarding to other web server.
*/
public static final ConfigKey FORWARD_ENABLE = new ConfigKey(