diff options
author | Anton Tananaev <anton@traccar.org> | 2023-07-14 06:49:08 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2023-07-14 06:49:08 -0700 |
commit | 104e8a4a7829b4b4a4723a715cc2b15899fa8b9f (patch) | |
tree | 97f20ef8462f3293fb86d4e837c775e53b2d1868 /src/main/java | |
parent | 105873ab5256a774ef07ca7ee459da0917829591 (diff) | |
download | trackermap-server-104e8a4a7829b4b4a4723a715cc2b15899fa8b9f.tar.gz trackermap-server-104e8a4a7829b4b4a4723a715cc2b15899fa8b9f.tar.bz2 trackermap-server-104e8a4a7829b4b4a4723a715cc2b15899fa8b9f.zip |
Option to disable Topic commands
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/org/traccar/config/Keys.java | 7 | ||||
-rw-r--r-- | src/main/java/org/traccar/protocol/TopinProtocol.java | 9 |
2 files changed, 13 insertions, 3 deletions
diff --git a/src/main/java/org/traccar/config/Keys.java b/src/main/java/org/traccar/config/Keys.java index 6f5360c22..7ad981799 100644 --- a/src/main/java/org/traccar/config/Keys.java +++ b/src/main/java/org/traccar/config/Keys.java @@ -234,6 +234,13 @@ public final class Keys { List.of(KeyType.CONFIG, KeyType.DEVICE)); /** + * Disable commands for the protocol. Not all protocols support this option. + */ + public static final ConfigSuffix<Boolean> PROTOCOL_DISABLE_COMMANDS = new BooleanConfigSuffix( + ".disableCommands", + List.of(KeyType.CONFIG)); + + /** * Protocol format. Used by protocols that have configurable message format. */ public static final ConfigSuffix<String> PROTOCOL_FORMAT = new StringConfigSuffix( diff --git a/src/main/java/org/traccar/protocol/TopinProtocol.java b/src/main/java/org/traccar/protocol/TopinProtocol.java index b15373d71..37afac582 100644 --- a/src/main/java/org/traccar/protocol/TopinProtocol.java +++ b/src/main/java/org/traccar/protocol/TopinProtocol.java @@ -1,5 +1,5 @@ /* - * Copyright 2019 - 2021 Anton Tananaev (anton@traccar.org) + * Copyright 2019 - 2023 Anton Tananaev (anton@traccar.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,6 +19,7 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; import org.traccar.config.Config; +import org.traccar.config.Keys; import org.traccar.model.Command; import javax.inject.Inject; @@ -27,8 +28,10 @@ public class TopinProtocol extends BaseProtocol { @Inject public TopinProtocol(Config config) { - setSupportedDataCommands( - Command.TYPE_SOS_NUMBER); + if (!config.getBoolean(Keys.PROTOCOL_DISABLE_COMMANDS.withPrefix(getName()))) { + setSupportedDataCommands( + Command.TYPE_SOS_NUMBER); + } addServer(new TrackerServer(config, getName(), false) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline, Config config) { |