diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2019-07-12 10:34:57 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-12 10:34:57 -0700 |
commit | 2ce793cfe7df9ec68708722489cec267ddda0b2b (patch) | |
tree | 31971fe8ac67abc607bcb315ada9667d309fda75 /src/main/java/org/traccar/database | |
parent | 0130b9093bca894268493d27173e8ecac02c0179 (diff) | |
parent | 1da58124acf0ce8c820b78519d17c2a408aced24 (diff) | |
download | trackermap-server-2ce793cfe7df9ec68708722489cec267ddda0b2b.tar.gz trackermap-server-2ce793cfe7df9ec68708722489cec267ddda0b2b.tar.bz2 trackermap-server-2ce793cfe7df9ec68708722489cec267ddda0b2b.zip |
Merge pull request #4342 from edvalley/proposed
Enhance Laipac protocol decoder and encoder
Diffstat (limited to 'src/main/java/org/traccar/database')
-rw-r--r-- | src/main/java/org/traccar/database/DeviceManager.java | 14 | ||||
-rw-r--r-- | src/main/java/org/traccar/database/IdentityManager.java | 4 |
2 files changed, 16 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/database/DeviceManager.java b/src/main/java/org/traccar/database/DeviceManager.java index de4607d1f..62e6de080 100644 --- a/src/main/java/org/traccar/database/DeviceManager.java +++ b/src/main/java/org/traccar/database/DeviceManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 - 2018 Anton Tananaev (anton@traccar.org) + * Copyright 2016 - 2019 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. @@ -29,6 +29,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.traccar.config.Config; import org.traccar.Context; +import org.traccar.model.Command; import org.traccar.model.Device; import org.traccar.model.DeviceState; import org.traccar.model.DeviceAccumulators; @@ -114,6 +115,17 @@ public class DeviceManager extends BaseObjectManager<Device> implements Identity return devicesByUniqueId.get(uniqueId); } + @Override + public String getDevicePassword(long id, String defaultPassword) { + + String password = getById(id).getString(Command.KEY_DEVICE_PASSWORD); + if (password != null) { + return password; + } + + return defaultPassword; + } + public Device getDeviceByPhone(String phone) { return devicesByPhone.get(phone); } diff --git a/src/main/java/org/traccar/database/IdentityManager.java b/src/main/java/org/traccar/database/IdentityManager.java index 6228a0f75..add3e5a79 100644 --- a/src/main/java/org/traccar/database/IdentityManager.java +++ b/src/main/java/org/traccar/database/IdentityManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 Anton Tananaev (anton@traccar.org) + * Copyright 2015 - 2019 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. @@ -26,6 +26,8 @@ public interface IdentityManager { Device getByUniqueId(String uniqueId) throws Exception; + String getDevicePassword(long id, String defaultPassword); + Position getLastPosition(long deviceId); boolean isLatestPosition(Position position); |