aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/GranitProtocolDecoder.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/protocol/GranitProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/GranitProtocolDecoder.java9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/org/traccar/protocol/GranitProtocolDecoder.java b/src/org/traccar/protocol/GranitProtocolDecoder.java
index 8e935ae9e..50d879bb4 100644
--- a/src/org/traccar/protocol/GranitProtocolDecoder.java
+++ b/src/org/traccar/protocol/GranitProtocolDecoder.java
@@ -158,8 +158,7 @@ public class GranitProtocolDecoder extends BaseProtocolDecoder {
if (deviceSession != null && indexTilde == -1) {
String bufString = buf.toString(StandardCharsets.US_ASCII);
- Position position = new Position();
- position.setProtocol(getProtocolName());
+ Position position = new Position(getProtocolName());
position.setDeviceId(deviceSession.getDeviceId());
position.setTime(new Date());
@@ -186,8 +185,7 @@ public class GranitProtocolDecoder extends BaseProtocolDecoder {
if (channel != null) {
sendResponseCurrent(channel, deviceId, unixTime);
}
- Position position = new Position();
- position.setProtocol(getProtocolName());
+ Position position = new Position(getProtocolName());
position.setDeviceId(deviceSession.getDeviceId());
position.setTime(new Date(unixTime * 1000));
@@ -219,8 +217,7 @@ public class GranitProtocolDecoder extends BaseProtocolDecoder {
int timeIncrement = buf.getUnsignedShort(buf.readerIndex() + 120);
for (int i = 0; i < 6; i++) {
if (buf.getUnsignedByte(buf.readerIndex()) != 0xFE) {
- Position position = new Position();
- position.setProtocol(getProtocolName());
+ Position position = new Position(getProtocolName());
position.setDeviceId(deviceSession.getDeviceId());
position.setTime(new Date((unixTime + i * timeIncrement) * 1000));
decodeStructure(buf, position);