aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-05-19 23:37:03 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2016-05-19 23:37:03 -0700
commit8249d9f7dc2cd4b7bb32e8d528d387f5ce88a60d (patch)
treedc2962ede741a42f43a025ee1b2d93213e7d2d3b
parente816b0e9f3023f31b3ed0d984ded755d07dcb9b3 (diff)
parent252530b36e2b7e09bfe16d301d1106f86ebf178d (diff)
downloadtraccar-server-8249d9f7dc2cd4b7bb32e8d528d387f5ce88a60d.tar.gz
traccar-server-8249d9f7dc2cd4b7bb32e8d528d387f5ce88a60d.tar.bz2
traccar-server-8249d9f7dc2cd4b7bb32e8d528d387f5ce88a60d.zip
Merge pull request #1953 from Abyss777/master
Custom command support for web interface
-rw-r--r--src/org/traccar/BaseProtocol.java1
-rw-r--r--web/app/view/CommandDialog.js7
-rw-r--r--web/app/view/CommandDialogController.js9
-rw-r--r--web/l10n/en.json14
4 files changed, 30 insertions, 1 deletions
diff --git a/src/org/traccar/BaseProtocol.java b/src/org/traccar/BaseProtocol.java
index 446f57d65..d1791d673 100644
--- a/src/org/traccar/BaseProtocol.java
+++ b/src/org/traccar/BaseProtocol.java
@@ -42,6 +42,7 @@ public abstract class BaseProtocol implements Protocol {
public void setSupportedCommands(String... commands) {
supportedCommands.addAll(Arrays.asList(commands));
+ supportedCommands.add(Command.TYPE_CUSTOM);
}
@Override
diff --git a/web/app/view/CommandDialog.js b/web/app/view/CommandDialog.js
index d23b50d4c..031815273 100644
--- a/web/app/view/CommandDialog.js
+++ b/web/app/view/CommandDialog.js
@@ -54,6 +54,13 @@ Ext.define('Traccar.view.CommandDialog', {
displayField: 'name',
valueField: 'factor'
}]
+ }, {
+ xtype: 'textfield',
+ reference: 'paramCustom',
+ fieldLabel: Strings.commandCustom,
+ name: 'customCommand',
+ hidden: true,
+ allowBlank: false
}]
},
diff --git a/web/app/view/CommandDialogController.js b/web/app/view/CommandDialogController.js
index 93109a2d6..1b5ca0ce0 100644
--- a/web/app/view/CommandDialogController.js
+++ b/web/app/view/CommandDialogController.js
@@ -21,6 +21,8 @@ Ext.define('Traccar.view.CommandDialogController', {
onSelect: function (selected) {
this.lookupReference('paramPositionPeriodic').setHidden(
selected.getValue() !== 'positionPeriodic');
+ this.lookupReference('paramCustom').setHidden(
+ selected.getValue() !== 'custom');
},
onSendClick: function (button) {
@@ -40,6 +42,13 @@ Ext.define('Traccar.view.CommandDialogController', {
});
}
+ if (record.get('type') === 'custom') {
+ value = this.lookupReference('paramCustom').getValue();
+ record.set('attributes', {
+ data: value
+ });
+ }
+
Ext.Ajax.request({
scope: this,
url: '/api/commands',
diff --git a/web/l10n/en.json b/web/l10n/en.json
index 1c8cc2bd0..932cbfa78 100644
--- a/web/l10n/en.json
+++ b/web/l10n/en.json
@@ -85,5 +85,17 @@
"commandEngineStop": "Engine Stop",
"commandEngineResume": "Engine Resume",
"commandFrequency": "Frequency",
- "commandUnit": "Unit"
+ "commandUnit": "Unit",
+ "commandCustom": "Custom command",
+ "commandPositionSingle": "Single Reporting",
+ "commandAlarmArm": "Arm Alarm",
+ "commandAlarmDisarm": "Disarm Alarm",
+ "commandSetTimezone": "Set Timezone",
+ "commandRequestPhoto": "Request Photo",
+ "commandRebootDevice": "Reboot Device",
+ "commandSendSms": "Send SMS",
+ "commandSosNumber": "Set SOS Number",
+ "commandSilenceTime": "Set Silence Time",
+ "commandSetPhonebook": "Set Phonebook",
+ "commandVoiceMessage": "Voice Message"
} \ No newline at end of file