diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2018-10-30 16:37:19 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2018-10-30 16:37:19 +1300 |
commit | 735fc1483817da385dce0fb572440261b6a644a3 (patch) | |
tree | 28e3637fc3e4f38379d523045eb07f6e7194af5f /src/org/traccar/protocol/H02ProtocolEncoder.java | |
parent | e8f2247e719e44796a4d89f6973e3a3c0d21568a (diff) | |
download | trackermap-server-735fc1483817da385dce0fb572440261b6a644a3.tar.gz trackermap-server-735fc1483817da385dce0fb572440261b6a644a3.tar.bz2 trackermap-server-735fc1483817da385dce0fb572440261b6a644a3.zip |
Alternative H02 SOS and commands
Diffstat (limited to 'src/org/traccar/protocol/H02ProtocolEncoder.java')
-rw-r--r-- | src/org/traccar/protocol/H02ProtocolEncoder.java | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/org/traccar/protocol/H02ProtocolEncoder.java b/src/org/traccar/protocol/H02ProtocolEncoder.java index 6d5cfb298..614a07dd1 100644 --- a/src/org/traccar/protocol/H02ProtocolEncoder.java +++ b/src/org/traccar/protocol/H02ProtocolEncoder.java @@ -16,6 +16,7 @@ */ package org.traccar.protocol; +import org.traccar.Context; import org.traccar.StringProtocolEncoder; import org.traccar.model.Command; @@ -48,13 +49,17 @@ public class H02ProtocolEncoder extends StringProtocolEncoder { case Command.TYPE_ALARM_DISARM: return formatCommand(time, uniqueId, "SCF", "1", "1"); case Command.TYPE_ENGINE_STOP: - return formatCommand( - time, uniqueId, "S20", "1", "3", "10", "3", "5", "5", "3", "5", "3", "5", "3", "5"); + return formatCommand(time, uniqueId, "S20", "1", "1"); case Command.TYPE_ENGINE_RESUME: - return formatCommand(time, uniqueId, "S20", "0", "0"); + return formatCommand(time, uniqueId, "S20", "1", "0"); case Command.TYPE_POSITION_PERIODIC: - return formatCommand( - time, uniqueId, "S71", "22", command.getAttributes().get(Command.KEY_FREQUENCY).toString()); + String frequency = command.getAttributes().get(Command.KEY_FREQUENCY).toString(); + if (Context.getIdentityManager().lookupAttributeBoolean( + command.getDeviceId(), "h02.alternative", false, true)) { + return formatCommand(time, uniqueId, "D1", frequency); + } else { + return formatCommand(time, uniqueId, "S71", "22", frequency); + } default: return null; } |