aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/WondexProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2018-01-22 19:33:56 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2018-01-22 19:33:56 +1300
commit58ade656e2070387f95984f5851cbc41990467ba (patch)
tree7ed9c8e095ad6bd57098f214c5749475853bbac4 /src/org/traccar/protocol/WondexProtocolDecoder.java
parent68b2d3ab8897114dac8cd92618cf0777f630750a (diff)
downloadtrackermap-server-58ade656e2070387f95984f5851cbc41990467ba.tar.gz
trackermap-server-58ade656e2070387f95984f5851cbc41990467ba.tar.bz2
trackermap-server-58ade656e2070387f95984f5851cbc41990467ba.zip
Add new position constructor
Diffstat (limited to 'src/org/traccar/protocol/WondexProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/WondexProtocolDecoder.java10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/org/traccar/protocol/WondexProtocolDecoder.java b/src/org/traccar/protocol/WondexProtocolDecoder.java
index e27745f38..a0fa436e4 100644
--- a/src/org/traccar/protocol/WondexProtocolDecoder.java
+++ b/src/org/traccar/protocol/WondexProtocolDecoder.java
@@ -70,17 +70,17 @@ public class WondexProtocolDecoder extends BaseProtocolDecoder {
return null;
} else if (buf.toString(StandardCharsets.US_ASCII).startsWith("$OK:")
|| buf.toString(StandardCharsets.US_ASCII).startsWith("$ERR:")
- || buf.toString(StandardCharsets.US_ASCII).startsWith("$MSG:")) {
+ || buf.toString(StandardCharsets.US_ASCII).startsWith("$MSG:")) {
DeviceSession deviceSession = getDeviceSession(channel, remoteAddress);
- Position position = new Position();
- position.setProtocol(getProtocolName());
+ Position position = new Position(getProtocolName());
position.setDeviceId(deviceSession.getDeviceId());
getLastLocation(position, new Date());
position.set(Position.KEY_RESULT, buf.toString(StandardCharsets.US_ASCII));
return position;
+
} else {
Parser parser = new Parser(PATTERN, buf.toString(StandardCharsets.US_ASCII));
@@ -88,8 +88,7 @@ public class WondexProtocolDecoder extends BaseProtocolDecoder {
return null;
}
- Position position = new Position();
- position.setProtocol(getProtocolName());
+ Position position = new Position(getProtocolName());
DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, parser.next());
if (deviceSession == null) {
@@ -120,6 +119,7 @@ public class WondexProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_OUTPUT, parser.next());
return position;
+
}
}