aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/Tlt2hProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2013-05-02 22:16:14 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2013-05-02 22:16:14 +1200
commit81beb5afb946d8c9ccfa2bbdfcfe884771a5bd3b (patch)
treece4d0b24f1c82381da30472844052f8cfdc1a164 /src/org/traccar/protocol/Tlt2hProtocolDecoder.java
parentf367b71b9c081416f6d64f6efd9844cd05f047ea (diff)
downloadtrackermap-server-81beb5afb946d8c9ccfa2bbdfcfe884771a5bd3b.tar.gz
trackermap-server-81beb5afb946d8c9ccfa2bbdfcfe884771a5bd3b.tar.bz2
trackermap-server-81beb5afb946d8c9ccfa2bbdfcfe884771a5bd3b.zip
Fix extended info XML format
Diffstat (limited to 'src/org/traccar/protocol/Tlt2hProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/Tlt2hProtocolDecoder.java11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/org/traccar/protocol/Tlt2hProtocolDecoder.java b/src/org/traccar/protocol/Tlt2hProtocolDecoder.java
index 66146b6fb..e38b3ab7b 100644
--- a/src/org/traccar/protocol/Tlt2hProtocolDecoder.java
+++ b/src/org/traccar/protocol/Tlt2hProtocolDecoder.java
@@ -26,6 +26,7 @@ import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
import org.traccar.ServerManager;
import org.traccar.helper.Log;
+import org.traccar.model.ExtendedInfoFormatter;
import org.traccar.model.Position;
public class Tlt2hProtocolDecoder extends BaseProtocolDecoder {
@@ -34,9 +35,6 @@ public class Tlt2hProtocolDecoder extends BaseProtocolDecoder {
super(serverManager);
}
- /**
- * Regular expressions pattern
- */
static private Pattern pattern = Pattern.compile(
"#([0-9a-f]+)?" + // Cell info
"\\$GPRMC," +
@@ -75,16 +73,13 @@ public class Tlt2hProtocolDecoder extends BaseProtocolDecoder {
Matcher parser = pattern.matcher(message);
if (parser.matches()) {
Position position = new Position();
- StringBuilder extendedInfo = new StringBuilder("<protocol>tlt2h</protocol>");
+ ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("tlt2h");
position.setDeviceId(deviceId);
Integer index = 1;
// Cell
- String cell = parser.group(index++);
- if (cell != null) {
- extendedInfo.append("<cell>").append(cell).append("</cell>");
- }
+ extendedInfo.set("cell", parser.group(index++));
// Time
Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC"));