aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/IntellitracProtocolDecoder.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/IntellitracProtocolDecoder.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/IntellitracProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/IntellitracProtocolDecoder.java23
1 files changed, 9 insertions, 14 deletions
diff --git a/src/org/traccar/protocol/IntellitracProtocolDecoder.java b/src/org/traccar/protocol/IntellitracProtocolDecoder.java
index 7b1cb3880..de1ce35de 100644
--- a/src/org/traccar/protocol/IntellitracProtocolDecoder.java
+++ b/src/org/traccar/protocol/IntellitracProtocolDecoder.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;
public class IntellitracProtocolDecoder extends BaseProtocolDecoder {
@@ -36,8 +37,8 @@ public class IntellitracProtocolDecoder extends BaseProtocolDecoder {
"(?:.+,)?(\\d+)," + // Device Identifier
"(\\d{4})(\\d{2})(\\d{2})" + // Date (YYYYMMDD)
"(\\d{2})(\\d{2})(\\d{2})," + // Time (HHMMSS)
- "(\\d+\\.\\d+)," + // Longitude
- "(\\d+\\.\\d+)," + // Latitude
+ "(-?\\d+\\.\\d+)," + // Longitude
+ "(-?\\d+\\.\\d+)," + // Latitude
"(\\d+\\.?\\d*)," + // Speed
"(\\d+\\.?\\d*)," + // Course
"(\\d+\\.?\\d*)," + // Altitude
@@ -63,7 +64,7 @@ public class IntellitracProtocolDecoder extends BaseProtocolDecoder {
// Create new position
Position position = new Position();
- StringBuilder extendedInfo = new StringBuilder("<protocol>intellitrac</protocol>");
+ ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("intellitrac");
Integer index = 1;
// Detect device
@@ -96,33 +97,27 @@ public class IntellitracProtocolDecoder extends BaseProtocolDecoder {
// Satellites
int satellites = Integer.valueOf(parser.group(index++));
position.setValid(satellites >= 3);
- extendedInfo.append("<satellites>");
- extendedInfo.append(satellites);
- extendedInfo.append("</satellites>");
+ extendedInfo.set("satellites", satellites);
// Report identifier
position.setId(Long.valueOf(parser.group(index++)));
// Input
- extendedInfo.append("<input>");
- extendedInfo.append(parser.group(index++));
- extendedInfo.append("</input>");
+ extendedInfo.set("input", parser.group(index++));
// Output
- extendedInfo.append("<output>");
- extendedInfo.append(parser.group(index++));
- extendedInfo.append("</output>");
+ extendedInfo.set("output", parser.group(index++));
// ADC1
String adc1 = parser.group(index++);
if (adc1 != null) {
- extendedInfo.append("<adc1>").append(adc1).append("</adc1>");
+ extendedInfo.set("adc1", adc1);
}
// ADC2
String adc2 = parser.group(index++);
if (adc2 != null) {
- extendedInfo.append("<adc2>").append(adc2).append("</adc2>");
+ extendedInfo.set("adc2", adc2);
}
position.setExtendedInfo(extendedInfo.toString());