aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/traccar')
-rw-r--r--src/main/java/org/traccar/config/Keys.java7
-rw-r--r--src/main/java/org/traccar/protocol/TopinProtocol.java9
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) {