diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2016-08-28 10:59:15 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2016-08-28 10:59:15 +1200 |
commit | 037e0394d41c8c0557a28059a65373edaba0d929 (patch) | |
tree | ad9798f4ceb49181190a03bf676c9c0435e1db35 /src/org/traccar/protocol/TotemProtocolEncoder.java | |
parent | 7eb57d7c23e68774197ab78986c0fbd2c02f6042 (diff) | |
download | trackermap-server-037e0394d41c8c0557a28059a65373edaba0d929.tar.gz trackermap-server-037e0394d41c8c0557a28059a65373edaba0d929.tar.bz2 trackermap-server-037e0394d41c8c0557a28059a65373edaba0d929.zip |
Allow to pass password in commands
Diffstat (limited to 'src/org/traccar/protocol/TotemProtocolEncoder.java')
-rw-r--r-- | src/org/traccar/protocol/TotemProtocolEncoder.java | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/src/org/traccar/protocol/TotemProtocolEncoder.java b/src/org/traccar/protocol/TotemProtocolEncoder.java index 1c870f63c..5e0ca407a 100644 --- a/src/org/traccar/protocol/TotemProtocolEncoder.java +++ b/src/org/traccar/protocol/TotemProtocolEncoder.java @@ -1,6 +1,6 @@ /* * Copyright 2015 Irving Gonzalez - * Copyright 2015 Anton Tananaev (anton.tananaev@gmail.com) + * Copyright 2015 - 2016 Anton Tananaev (anton.tananaev@gmail.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,26 +16,19 @@ */ package org.traccar.protocol; -import org.traccar.Context; import org.traccar.StringProtocolEncoder; import org.traccar.helper.Log; import org.traccar.model.Command; -import org.traccar.model.Device; public class TotemProtocolEncoder extends StringProtocolEncoder { @Override protected Object encodeCommand(Command command) { - command.set(Command.KEY_DEVICE_PASSWORD, "000000"); - Device device = Context.getIdentityManager().getDeviceById(command.getDeviceId()); - if (device.getAttributes().containsKey(Command.KEY_DEVICE_PASSWORD)) { - command.set(Command.KEY_DEVICE_PASSWORD, (String) device.getAttributes() - .get(Command.KEY_DEVICE_PASSWORD)); - } + initDevicePassword(command, "000000"); switch (command.getType()) { - //Assuming PIN 8 (Output C) is the power wire, like manual says but it can be PIN 5,7,8 + // Assuming PIN 8 (Output C) is the power wire, like manual says but it can be PIN 5,7,8 case Command.TYPE_ENGINE_STOP: return formatCommand(command, "*{%s},025,C,1#", Command.KEY_DEVICE_PASSWORD); case Command.TYPE_ENGINE_RESUME: @@ -47,4 +40,5 @@ public class TotemProtocolEncoder extends StringProtocolEncoder { return null; } + } |