aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-12-10 08:58:27 +1300
committerGitHub <noreply@github.com>2016-12-10 08:58:27 +1300
commit25bd13ef6fa31b3fc5992ce70d8845ea0b56dfad (patch)
tree7bbf0d19470e480f68d6a6fce7dea12f1eb24334
parent47357e8b056d316c143df6d6cb8754f10cf2b5a6 (diff)
parentd139c55f06342fefb80082a0f6ffa6adea77f8dc (diff)
downloadtraccar-server-25bd13ef6fa31b3fc5992ce70d8845ea0b56dfad.tar.gz
traccar-server-25bd13ef6fa31b3fc5992ce70d8845ea0b56dfad.tar.bz2
traccar-server-25bd13ef6fa31b3fc5992ce70d8845ea0b56dfad.zip
Merge pull request #2650 from duke2906/master
Add configurable default values for group & category on on-the-fly created devices
-rw-r--r--src/org/traccar/BaseProtocolDecoder.java6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/org/traccar/BaseProtocolDecoder.java b/src/org/traccar/BaseProtocolDecoder.java
index d8130c79e..ea0905bf2 100644
--- a/src/org/traccar/BaseProtocolDecoder.java
+++ b/src/org/traccar/BaseProtocolDecoder.java
@@ -36,6 +36,12 @@ public abstract class BaseProtocolDecoder extends ExtendedObjectDecoder {
Device device = new Device();
device.setName(uniqueId);
device.setUniqueId(uniqueId);
+ device.setCategory(Context.getConfig().getString("database.registerUnknown.defaultCategory"));
+
+ long defaultGroupId = Context.getConfig().getLong("database.registerUnknown.defaultGroupId");
+ if (defaultGroupId != 0) {
+ device.setGroupId(defaultGroupId);
+ }
try {
Context.getDeviceManager().addDevice(device);