diff options
Diffstat (limited to 'src/org/traccar/protocol/Gl200ProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/Gl200ProtocolDecoder.java | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/org/traccar/protocol/Gl200ProtocolDecoder.java b/src/org/traccar/protocol/Gl200ProtocolDecoder.java index 66a4e2f7e..769964f33 100644 --- a/src/org/traccar/protocol/Gl200ProtocolDecoder.java +++ b/src/org/traccar/protocol/Gl200ProtocolDecoder.java @@ -24,6 +24,8 @@ import org.traccar.helper.DateBuilder; import org.traccar.helper.Parser; import org.traccar.helper.PatternBuilder; import org.traccar.helper.UnitsConverter; +import org.traccar.model.CellTower; +import org.traccar.model.Network; import org.traccar.model.Position; import java.net.SocketAddress; @@ -324,7 +326,9 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_BATTERY, parser.nextDouble()); position.set(Position.KEY_CHARGE, parser.nextInt() == 1); - parser.next(); // battery percentage + if (parser.hasNext()) { + position.set(Position.KEY_BATTERY, parser.next() + "%"); + } position.set(Position.PREFIX_TEMP + 1, parser.next()); @@ -392,10 +396,8 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder { } if (parser.hasNext(4)) { - position.set(Position.KEY_MCC, parser.nextInt()); - position.set(Position.KEY_MNC, parser.nextInt()); - position.set(Position.KEY_LAC, parser.nextInt(16)); - position.set(Position.KEY_CID, parser.nextInt(16)); + position.setNetwork(new Network(CellTower.from( + parser.nextInt(), parser.nextInt(), parser.nextInt(16), parser.nextInt(16)))); } parser.skip(4); // alternative networks |