From 525db3566a9e17f626d34e498c85e02d382d6655 Mon Sep 17 00:00:00 2001 From: jon-stumpf Date: Sat, 4 Mar 2017 17:15:40 -0500 Subject: Added Position.KEY_COMMAND; --- src/org/traccar/model/Position.java | 1 + src/org/traccar/protocol/CarTrackProtocolDecoder.java | 2 +- src/org/traccar/protocol/EasyTrackProtocolDecoder.java | 2 +- src/org/traccar/protocol/Gt06ProtocolDecoder.java | 3 ++- src/org/traccar/protocol/RitiProtocolDecoder.java | 2 +- src/org/traccar/protocol/SupermateProtocolDecoder.java | 2 +- src/org/traccar/protocol/TeltonikaProtocolDecoder.java | 2 +- 7 files changed, 8 insertions(+), 6 deletions(-) (limited to 'src/org/traccar') diff --git a/src/org/traccar/model/Position.java b/src/org/traccar/model/Position.java index 409b49ccb..218b8a4e8 100644 --- a/src/org/traccar/model/Position.java +++ b/src/org/traccar/model/Position.java @@ -62,6 +62,7 @@ public class Position extends Message { public static final String KEY_ACCELERATION = "acceleration"; public static final String KEY_DEVICE_TEMP = "deviceTemp"; public static final String KEY_OPERATOR = "operator"; + public static final String KEY_COMMAND = "command"; public static final String KEY_DTCS = "dtcs"; public static final String KEY_OBD_SPEED = "obdSpeed"; diff --git a/src/org/traccar/protocol/CarTrackProtocolDecoder.java b/src/org/traccar/protocol/CarTrackProtocolDecoder.java index 94f5d208b..0952a0978 100644 --- a/src/org/traccar/protocol/CarTrackProtocolDecoder.java +++ b/src/org/traccar/protocol/CarTrackProtocolDecoder.java @@ -74,7 +74,7 @@ public class CarTrackProtocolDecoder extends BaseProtocolDecoder { } position.setDeviceId(deviceSession.getDeviceId()); - position.set("command", parser.next()); + position.set(Position.KEY_COMMAND, parser.next()); DateBuilder dateBuilder = new DateBuilder() .setTime(parser.nextInt(), parser.nextInt(), parser.nextInt(), parser.nextInt()); diff --git a/src/org/traccar/protocol/EasyTrackProtocolDecoder.java b/src/org/traccar/protocol/EasyTrackProtocolDecoder.java index 688629063..c4baad5ab 100644 --- a/src/org/traccar/protocol/EasyTrackProtocolDecoder.java +++ b/src/org/traccar/protocol/EasyTrackProtocolDecoder.java @@ -77,7 +77,7 @@ public class EasyTrackProtocolDecoder extends BaseProtocolDecoder { } position.setDeviceId(deviceSession.getDeviceId()); - position.set("command", parser.next()); + position.set(Position.KEY_COMMAND, parser.next()); position.setValid(parser.next().equals("A")); diff --git a/src/org/traccar/protocol/Gt06ProtocolDecoder.java b/src/org/traccar/protocol/Gt06ProtocolDecoder.java index 356097fb2..bbba639c1 100644 --- a/src/org/traccar/protocol/Gt06ProtocolDecoder.java +++ b/src/org/traccar/protocol/Gt06ProtocolDecoder.java @@ -264,7 +264,8 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { if (commandLength > 0) { buf.readUnsignedByte(); // server flag (reserved) - position.set("command", buf.readBytes(commandLength - 1).toString(StandardCharsets.US_ASCII)); + position.set(Position.KEY_COMMAND, + buf.readBytes(commandLength - 1).toString(StandardCharsets.US_ASCII)); } } else if (isSupported(type)) { diff --git a/src/org/traccar/protocol/RitiProtocolDecoder.java b/src/org/traccar/protocol/RitiProtocolDecoder.java index 26aeb40f3..7f81ef09c 100644 --- a/src/org/traccar/protocol/RitiProtocolDecoder.java +++ b/src/org/traccar/protocol/RitiProtocolDecoder.java @@ -66,7 +66,7 @@ public class RitiProtocolDecoder extends BaseProtocolDecoder { position.setDeviceId(deviceSession.getDeviceId()); position.set("mode", buf.readUnsignedByte()); - position.set("command", buf.readUnsignedByte()); + position.set(Position.KEY_COMMAND, buf.readUnsignedByte()); position.set(Position.KEY_POWER, buf.readUnsignedShort()); // mV buf.skipBytes(5); // status diff --git a/src/org/traccar/protocol/SupermateProtocolDecoder.java b/src/org/traccar/protocol/SupermateProtocolDecoder.java index 7f12121bb..5e6615e9f 100755 --- a/src/org/traccar/protocol/SupermateProtocolDecoder.java +++ b/src/org/traccar/protocol/SupermateProtocolDecoder.java @@ -82,7 +82,7 @@ public class SupermateProtocolDecoder extends BaseProtocolDecoder { position.setDeviceId(deviceSession.getDeviceId()); position.set("commandId", parser.next()); - position.set("command", parser.next()); + position.set(Position.KEY_COMMAND, parser.next()); position.setValid(parser.next().equals("A")); diff --git a/src/org/traccar/protocol/TeltonikaProtocolDecoder.java b/src/org/traccar/protocol/TeltonikaProtocolDecoder.java index 77211b7ab..e55d354cf 100644 --- a/src/org/traccar/protocol/TeltonikaProtocolDecoder.java +++ b/src/org/traccar/protocol/TeltonikaProtocolDecoder.java @@ -67,7 +67,7 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_TYPE, buf.readUnsignedByte()); - position.set("command", buf.readBytes(buf.readInt()).toString(StandardCharsets.US_ASCII)); + position.set(Position.KEY_COMMAND, buf.readBytes(buf.readInt()).toString(StandardCharsets.US_ASCII)); } -- cgit v1.2.3