aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/SkypatrolProtocolDecoder.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/SkypatrolProtocolDecoder.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/SkypatrolProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/SkypatrolProtocolDecoder.java19
1 files changed, 6 insertions, 13 deletions
diff --git a/src/org/traccar/protocol/SkypatrolProtocolDecoder.java b/src/org/traccar/protocol/SkypatrolProtocolDecoder.java
index 11f9424aa..fedb411a6 100644
--- a/src/org/traccar/protocol/SkypatrolProtocolDecoder.java
+++ b/src/org/traccar/protocol/SkypatrolProtocolDecoder.java
@@ -24,6 +24,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;
/**
@@ -84,13 +85,11 @@ public class SkypatrolProtocolDecoder extends BaseProtocolDecoder {
// Create new position
Position position = new Position();
- StringBuilder extendedInfo = new StringBuilder("<protocol>skypatrol</protocol>");
+ ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("skypatrol");
// Status code
if (checkBit(mask, 1)) {
- extendedInfo.append("<status>");
- extendedInfo.append(buf.readUnsignedInt());
- extendedInfo.append("</status>");
+ extendedInfo.set("status", buf.readUnsignedInt());
}
// Device id
@@ -183,9 +182,7 @@ public class SkypatrolProtocolDecoder extends BaseProtocolDecoder {
// Satellites
if (checkBit(mask, 16)) {
- extendedInfo.append("<satellites>");
- extendedInfo.append(buf.readUnsignedByte());
- extendedInfo.append("</satellites>");
+ extendedInfo.set("satellites", buf.readUnsignedByte());
}
// Battery percentage
@@ -195,16 +192,12 @@ public class SkypatrolProtocolDecoder extends BaseProtocolDecoder {
// Trip milage
if (checkBit(mask, 20)) {
- extendedInfo.append("<trip>");
- extendedInfo.append(buf.readUnsignedInt());
- extendedInfo.append("</trip>");
+ extendedInfo.set("trip", buf.readUnsignedInt());
}
// Milage
if (checkBit(mask, 21)) {
- extendedInfo.append("<milage>");
- extendedInfo.append(buf.readUnsignedInt());
- extendedInfo.append("</milage>");
+ extendedInfo.set("milage", buf.readUnsignedInt());
}
// Time of message generation