diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2017-03-27 05:23:18 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2017-03-27 05:23:18 +1300 |
commit | ae6630ed4a88eabc71abd7252edbf6c6c127996a (patch) | |
tree | 57b620b860afedcc69963137904f3b0c5a96a007 /src/org/traccar | |
parent | c88ee305e5f023477381e81b1729479ddb593706 (diff) | |
download | trackermap-server-ae6630ed4a88eabc71abd7252edbf6c6c127996a.tar.gz trackermap-server-ae6630ed4a88eabc71abd7252edbf6c6c127996a.tar.bz2 trackermap-server-ae6630ed4a88eabc71abd7252edbf6c6c127996a.zip |
Add support for WLINK router
Diffstat (limited to 'src/org/traccar')
-rw-r--r-- | src/org/traccar/protocol/HomtecsProtocolDecoder.java | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/src/org/traccar/protocol/HomtecsProtocolDecoder.java b/src/org/traccar/protocol/HomtecsProtocolDecoder.java index 2557e1ac7..375fa27b8 100644 --- a/src/org/traccar/protocol/HomtecsProtocolDecoder.java +++ b/src/org/traccar/protocol/HomtecsProtocolDecoder.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 Anton Tananaev (anton@traccar.org) + * Copyright 2016 - 2017 Anton Tananaev (anton@traccar.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,7 +32,9 @@ public class HomtecsProtocolDecoder extends BaseProtocolDecoder { } private static final Pattern PATTERN = new PatternBuilder() - .expression("([^,]+),") // id + .expression("([^_]+)") // id + .text("_R") + .number("(x{8}),") // mac ending .number("(dd)(dd)(dd),") // date (yymmdd) .number("(dd)(dd)(dd).d+,") // time (hhmmss) .number("(d+),") // satellites @@ -42,7 +44,9 @@ public class HomtecsProtocolDecoder extends BaseProtocolDecoder { .expression("([EW]),") .number("(d+.?d*)?,") // speed .number("(d+.?d*)?,") // course - .any() + .number("(d),") // fix status + .number("(d+.?d*)?,") // hdop + .number("(d+.?d*)?") // altitude .compile(); @Override @@ -54,18 +58,20 @@ public class HomtecsProtocolDecoder extends BaseProtocolDecoder { return null; } - Position position = new Position(); - position.setProtocol(getProtocolName()); + String id = parser.next(); + String mac = parser.next(); - DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, parser.next()); + DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, id, id + "_R" + mac); if (deviceSession == null) { return null; } + + Position position = new Position(); + position.setProtocol(getProtocolName()); position.setDeviceId(deviceSession.getDeviceId()); position.setTime(parser.nextDateTime(Parser.DateTimeFormat.YMD_HMS)); - position.setValid(true); position.set(Position.KEY_SATELLITES, parser.nextInt()); position.setLatitude(parser.nextCoordinate()); @@ -73,6 +79,12 @@ public class HomtecsProtocolDecoder extends BaseProtocolDecoder { position.setSpeed(parser.nextDouble()); position.setCourse(parser.nextDouble()); + position.setValid(parser.nextInt() > 0); + + position.set(Position.KEY_HDOP, parser.nextDouble()); + + position.setAltitude(parser.nextDouble()); + return position; } |