aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-02-07 07:25:32 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2017-02-07 07:25:32 +1300
commitb43aa7157c740a22aaecdefe6559fb5d6889535c (patch)
tree7db3c630364b3b8f9ff7298c30d055a678e33ca6 /src/org/traccar/protocol
parent23660ca2426b670abf6b0899fe796d4012a81589 (diff)
downloadtrackermap-server-b43aa7157c740a22aaecdefe6559fb5d6889535c.tar.gz
trackermap-server-b43aa7157c740a22aaecdefe6559fb5d6889535c.tar.bz2
trackermap-server-b43aa7157c740a22aaecdefe6559fb5d6889535c.zip
Implement GL505 cell decoding
Diffstat (limited to 'src/org/traccar/protocol')
-rw-r--r--src/org/traccar/protocol/Gl200ProtocolDecoder.java37
1 files changed, 26 insertions, 11 deletions
diff --git a/src/org/traccar/protocol/Gl200ProtocolDecoder.java b/src/org/traccar/protocol/Gl200ProtocolDecoder.java
index ab6507122..59f013313 100644
--- a/src/org/traccar/protocol/Gl200ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gl200ProtocolDecoder.java
@@ -278,11 +278,15 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder {
.number("(d{1,3}.d)?,") // speed
.number("(d{1,3})?,") // course
.number("(-?d{1,5}.d)?,") // altitude
- .number("(-?d{1,3}.d{6}),") // longitude
- .number("(-?d{1,2}.d{6}),") // latitude
+ .number("(-?d{1,3}.d{6})?,") // longitude
+ .number("(-?d{1,2}.d{6})?,") // latitude
.number("(dddd)(dd)(dd)") // date
- .number("(dd)(dd)(dd)") // time
+ .number("(dd)(dd)(dd)").optional(2) // time
.text(",")
+ .number("(0ddd),") // mcc
+ .number("(0ddd),") // mnc
+ .number("(xxxx),") // lac
+ .number("(xxxx),").optional(4) // cell
.any()
.number("(dddd)(dd)(dd)") // date
.number("(dd)(dd)(dd)").optional(2) // time
@@ -703,17 +707,28 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder {
position.setCourse(parser.nextDouble());
position.setAltitude(parser.nextDouble());
- position.setValid(true);
- position.setLongitude(parser.nextDouble());
- position.setLatitude(parser.nextDouble());
+ if (parser.hasNext(2)) {
+ position.setValid(true);
+ position.setLongitude(parser.nextDouble());
+ position.setLatitude(parser.nextDouble());
+ } else {
+ getLastLocation(position, null);
+ }
- DateBuilder dateBuilder = new DateBuilder()
- .setDate(parser.nextInt(), parser.nextInt(), parser.nextInt())
- .setTime(parser.nextInt(), parser.nextInt(), parser.nextInt());
- position.setTime(dateBuilder.getDate());
+ if (parser.hasNext(6)) {
+ DateBuilder dateBuilder = new DateBuilder()
+ .setDate(parser.nextInt(), parser.nextInt(), parser.nextInt())
+ .setTime(parser.nextInt(), parser.nextInt(), parser.nextInt());
+ position.setTime(dateBuilder.getDate());
+ }
+
+ if (parser.hasNext(4)) {
+ position.setNetwork(new Network(CellTower.from(
+ parser.nextInt(), parser.nextInt(), parser.nextInt(16), parser.nextInt(16))));
+ }
if (parser.hasNext(6)) {
- dateBuilder = new DateBuilder()
+ DateBuilder dateBuilder = new DateBuilder()
.setDate(parser.nextInt(), parser.nextInt(), parser.nextInt())
.setTime(parser.nextInt(), parser.nextInt(), parser.nextInt());
if (!position.getOutdated() && position.getFixTime().after(dateBuilder.getDate())) {