aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2013-12-21 20:17:57 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2013-12-21 20:17:57 +1300
commit4237194639161293e97d79443bb152819320c862 (patch)
tree74696c1c17c0157b9bf742be8a4c276d32fab3f0
parent32d72e4dfbafbec1e16b8925956d5543744fcb21 (diff)
downloadtrackermap-server-4237194639161293e97d79443bb152819320c862.tar.gz
trackermap-server-4237194639161293e97d79443bb152819320c862.tar.bz2
trackermap-server-4237194639161293e97d79443bb152819320c862.zip
Improve GL200 decoder
-rw-r--r--src/org/traccar/protocol/Gl200ProtocolDecoder.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/org/traccar/protocol/Gl200ProtocolDecoder.java b/src/org/traccar/protocol/Gl200ProtocolDecoder.java
index f1101bde4..4c55a97a1 100644
--- a/src/org/traccar/protocol/Gl200ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gl200ProtocolDecoder.java
@@ -45,6 +45,11 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder {
"(-?\\d+\\.\\d+)," + // Latitude
"(\\d{4})(\\d{2})(\\d{2})" + // Date (YYYYMMDD)
"(\\d{2})(\\d{2})(\\d{2})," + // Time (HHMMSS)
+ "(\\d{4})," + // MCC
+ "(\\d{4})," + // MNC
+ "(\\p{XDigit}{4})," + // LAC
+ "(\\p{XDigit}{4})," + // Cell
+ "(?:.*,(\\d{1,3}),\\d{14},)?" + // Battery
".*");
@Override
@@ -98,6 +103,18 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder {
time.set(Calendar.SECOND, Integer.valueOf(parser.group(index++)));
position.setTime(time.getTime());
+ // Cell information
+ extendedInfo.set("mcc", parser.group(index++));
+ extendedInfo.set("mnc", parser.group(index++));
+ extendedInfo.set("lac", parser.group(index++));
+ extendedInfo.set("cell", parser.group(index++));
+
+ // Battery
+ String battery = parser.group(index++);
+ if (battery != null) {
+ extendedInfo.set("battery", Integer.valueOf(battery));
+ }
+
position.setExtendedInfo(extendedInfo.toString());
return position;
}