aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2013-09-28 13:40:00 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2013-09-28 13:40:00 +1200
commit53494de4e41e1c4d4440c9afc0c4a9dfa6480558 (patch)
tree9dc441029fbcb5ea71b83c49ef89599012bcccc8 /src
parentc1b6fb0e25020b845b059aef0adebeac7d90ed7c (diff)
downloadtraccar-server-53494de4e41e1c4d4440c9afc0c4a9dfa6480558.tar.gz
traccar-server-53494de4e41e1c4d4440c9afc0c4a9dfa6480558.tar.bz2
traccar-server-53494de4e41e1c4d4440c9afc0c4a9dfa6480558.zip
Remove optional fields
Diffstat (limited to 'src')
-rw-r--r--src/org/traccar/model/DatabaseDataManager.java30
-rw-r--r--src/org/traccar/model/Position.java13
-rw-r--r--src/org/traccar/protocol/ApelProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/AplicomProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/Avl08ProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/EasyTrackProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/GalileoProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/GatorProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/Gt02ProtocolDecoder.java5
-rw-r--r--src/org/traccar/protocol/Gt06ProtocolDecoder.java4
-rw-r--r--src/org/traccar/protocol/IntellitracProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/Jt600ProtocolDecoder.java4
-rw-r--r--src/org/traccar/protocol/MegastekProtocolDecoder.java4
-rw-r--r--src/org/traccar/protocol/Mta6ProtocolDecoder.java4
-rw-r--r--src/org/traccar/protocol/NavigilProtocolDecoder.java22
-rw-r--r--src/org/traccar/protocol/NavisProtocolDecoder.java37
-rw-r--r--src/org/traccar/protocol/ProgressProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/SkypatrolProtocolDecoder.java4
-rw-r--r--src/org/traccar/protocol/TotemProtocolDecoder.java4
-rw-r--r--src/org/traccar/protocol/Xexun2ProtocolDecoder.java3
-rw-r--r--src/org/traccar/protocol/Xt7ProtocolDecoder.java2
21 files changed, 93 insertions, 59 deletions
diff --git a/src/org/traccar/model/DatabaseDataManager.java b/src/org/traccar/model/DatabaseDataManager.java
index ce781da1a..f56782b44 100644
--- a/src/org/traccar/model/DatabaseDataManager.java
+++ b/src/org/traccar/model/DatabaseDataManager.java
@@ -16,13 +16,21 @@
package org.traccar.model;
import java.io.File;
+import java.io.StringReader;
import java.net.URL;
import java.net.URLClassLoader;
import java.sql.*;
import java.util.*;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathExpressionException;
+import javax.xml.xpath.XPathFactory;
import org.traccar.helper.AdvancedConnection;
import org.traccar.helper.DriverDelegate;
+import org.traccar.helper.Log;
import org.traccar.helper.NamedParameterStatement;
+import org.xml.sax.InputSource;
/**
* Database abstraction class
@@ -140,7 +148,6 @@ public class DatabaseDataManager implements DataManager {
if (queryAddPosition != null) {
queryAddPosition.prepare(Statement.RETURN_GENERATED_KEYS);
- queryAddPosition.setLong("id", position.getId());
queryAddPosition.setLong("device_id", position.getDeviceId());
queryAddPosition.setTimestamp("time", position.getTime());
queryAddPosition.setBoolean("valid", position.getValid());
@@ -149,9 +156,28 @@ public class DatabaseDataManager implements DataManager {
queryAddPosition.setDouble("longitude", position.getLongitude());
queryAddPosition.setDouble("speed", position.getSpeed());
queryAddPosition.setDouble("course", position.getCourse());
- queryAddPosition.setDouble("power", position.getPower());
queryAddPosition.setString("address", position.getAddress());
queryAddPosition.setString("extended_info", position.getExtendedInfo());
+
+ // DELME: Temporary compatibility support
+ XPath xpath = XPathFactory.newInstance().newXPath();
+ InputSource source = new InputSource(new StringReader(position.getExtendedInfo()));
+ try {
+ String index = xpath.evaluate("/info/index", source);
+ if (!index.isEmpty()) {
+ queryAddPosition.setLong("id", Long.valueOf(index));
+ } else {
+ queryAddPosition.setLong("id", null);
+ }
+ String power = xpath.evaluate("/info/power", source);
+ if (!power.isEmpty()) {
+ queryAddPosition.setDouble("power", Double.valueOf(power));
+ } else {
+ queryAddPosition.setLong("power", null);
+ }
+ } catch (XPathExpressionException ex) {
+ Log.warning(ex);
+ }
queryAddPosition.executeUpdate();
diff --git a/src/org/traccar/model/Position.java b/src/org/traccar/model/Position.java
index b408dbbf2..744019bc0 100644
--- a/src/org/traccar/model/Position.java
+++ b/src/org/traccar/model/Position.java
@@ -140,19 +140,6 @@ public class Position {
}
/**
- * Power
- */
- private Double power;
-
- public Double getPower() {
- return power;
- }
-
- public void setPower(Double power) {
- this.power = power;
- }
-
- /**
* Address
*/
private String address;
diff --git a/src/org/traccar/protocol/ApelProtocolDecoder.java b/src/org/traccar/protocol/ApelProtocolDecoder.java
index 5f626a496..9ffc473c7 100644
--- a/src/org/traccar/protocol/ApelProtocolDecoder.java
+++ b/src/org/traccar/protocol/ApelProtocolDecoder.java
@@ -177,7 +177,7 @@ public class ApelProtocolDecoder extends BaseProtocolDecoder {
if (type == MSG_TYPE_LOG_RECORDS) {
extendedInfo.set("archive", true);
lastIndex = buf.readUnsignedInt() + 1;
- position.setId(lastIndex);
+ extendedInfo.set("index", lastIndex);
subtype = buf.readUnsignedShort();
if (subtype != MSG_TYPE_CURRENT_GPS_DATA && subtype != MSG_TYPE_STATE_FULL_INFO_T104) {
diff --git a/src/org/traccar/protocol/AplicomProtocolDecoder.java b/src/org/traccar/protocol/AplicomProtocolDecoder.java
index 978b84b6d..21a3127d1 100644
--- a/src/org/traccar/protocol/AplicomProtocolDecoder.java
+++ b/src/org/traccar/protocol/AplicomProtocolDecoder.java
@@ -181,7 +181,7 @@ public class AplicomProtocolDecoder extends BaseProtocolDecoder {
// Power
if ((selector & 0x8000) != 0) {
- position.setPower(buf.readUnsignedShort() / 1000.0);
+ extendedInfo.set("power", buf.readUnsignedShort() / 1000.0);
extendedInfo.set("battery", buf.readUnsignedShort());
}
diff --git a/src/org/traccar/protocol/Avl08ProtocolDecoder.java b/src/org/traccar/protocol/Avl08ProtocolDecoder.java
index 6ccb333d9..825e84cf6 100644
--- a/src/org/traccar/protocol/Avl08ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Avl08ProtocolDecoder.java
@@ -157,7 +157,7 @@ public class Avl08ProtocolDecoder extends BaseProtocolDecoder {
// Voltage
String voltage = parser.group(index++);
- position.setPower(Double.valueOf(voltage.substring(1, 4)) / 100);
+ extendedInfo.set("power", Double.valueOf(voltage.substring(1, 4)) / 100);
extendedInfo.set("voltage", voltage);
// ADC
diff --git a/src/org/traccar/protocol/EasyTrackProtocolDecoder.java b/src/org/traccar/protocol/EasyTrackProtocolDecoder.java
index d6a14fd08..7152955f5 100644
--- a/src/org/traccar/protocol/EasyTrackProtocolDecoder.java
+++ b/src/org/traccar/protocol/EasyTrackProtocolDecoder.java
@@ -123,7 +123,7 @@ public class EasyTrackProtocolDecoder extends BaseProtocolDecoder {
extendedInfo.set("signal", parser.group(index++));
// Power
- position.setPower(Double.valueOf(parser.group(index++)));
+ extendedInfo.set("power", Double.valueOf(parser.group(index++)));
// Oil
extendedInfo.set("oil", Integer.parseInt(parser.group(index++), 16));
diff --git a/src/org/traccar/protocol/GalileoProtocolDecoder.java b/src/org/traccar/protocol/GalileoProtocolDecoder.java
index 94ffa60af..3f652dcb0 100644
--- a/src/org/traccar/protocol/GalileoProtocolDecoder.java
+++ b/src/org/traccar/protocol/GalileoProtocolDecoder.java
@@ -137,7 +137,7 @@ public class GalileoProtocolDecoder extends BaseProtocolDecoder {
break;
case TAG_POWER:
- position.setPower((double) buf.readUnsignedShort());
+ extendedInfo.set("power", buf.readUnsignedShort());
break;
case TAG_BATTERY:
diff --git a/src/org/traccar/protocol/GatorProtocolDecoder.java b/src/org/traccar/protocol/GatorProtocolDecoder.java
index 9fa50cc88..041e44588 100644
--- a/src/org/traccar/protocol/GatorProtocolDecoder.java
+++ b/src/org/traccar/protocol/GatorProtocolDecoder.java
@@ -126,7 +126,7 @@ public class GatorProtocolDecoder extends BaseProtocolDecoder {
extendedInfo.set("oil", buf.readUnsignedShort() / 10.0);
// Power
- position.setPower(buf.readUnsignedByte() + buf.readUnsignedByte() / 100.0);
+ extendedInfo.set("power", buf.readUnsignedByte() + buf.readUnsignedByte() / 100.0);
// Milage
extendedInfo.set("milage", buf.readUnsignedInt());
diff --git a/src/org/traccar/protocol/Gt02ProtocolDecoder.java b/src/org/traccar/protocol/Gt02ProtocolDecoder.java
index 22402ce45..65c3260e7 100644
--- a/src/org/traccar/protocol/Gt02ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gt02ProtocolDecoder.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 Gt02ProtocolDecoder extends BaseProtocolDecoder {
@@ -76,7 +77,8 @@ public class Gt02ProtocolDecoder extends BaseProtocolDecoder {
// Create new position
Position position = new Position();
- position.setId(index);
+ ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("gt02");
+ extendedInfo.set("index", index);
// Get device id
try {
@@ -120,6 +122,7 @@ public class Gt02ProtocolDecoder extends BaseProtocolDecoder {
position.setLongitude(longitude);
position.setAltitude(0.0);
+ position.setExtendedInfo(extendedInfo.toString());
return position;
}
diff --git a/src/org/traccar/protocol/Gt06ProtocolDecoder.java b/src/org/traccar/protocol/Gt06ProtocolDecoder.java
index 9b5bcc441..d67e6843e 100644
--- a/src/org/traccar/protocol/Gt06ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gt06ProtocolDecoder.java
@@ -169,7 +169,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
extendedInfo.set("alarm", true);
// Voltage
- position.setPower((double) buf.readUnsignedByte());
+ extendedInfo.set("power", buf.readUnsignedByte());
// GSM signal
extendedInfo.set("gsm", buf.readUnsignedByte());
@@ -181,7 +181,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
buf.skipBytes(buf.readableBytes() - 6);
}
int index = buf.readUnsignedShort();
- position.setId((long) index);
+ extendedInfo.set("index", index);
sendResponse(channel, type, index);
position.setExtendedInfo(extendedInfo.toString());
diff --git a/src/org/traccar/protocol/IntellitracProtocolDecoder.java b/src/org/traccar/protocol/IntellitracProtocolDecoder.java
index de1ce35de..b71237e7f 100644
--- a/src/org/traccar/protocol/IntellitracProtocolDecoder.java
+++ b/src/org/traccar/protocol/IntellitracProtocolDecoder.java
@@ -100,7 +100,7 @@ public class IntellitracProtocolDecoder extends BaseProtocolDecoder {
extendedInfo.set("satellites", satellites);
// Report identifier
- position.setId(Long.valueOf(parser.group(index++)));
+ extendedInfo.set("index", Long.valueOf(parser.group(index++)));
// Input
extendedInfo.set("input", parser.group(index++));
diff --git a/src/org/traccar/protocol/Jt600ProtocolDecoder.java b/src/org/traccar/protocol/Jt600ProtocolDecoder.java
index df6d94e47..d12b09740 100644
--- a/src/org/traccar/protocol/Jt600ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Jt600ProtocolDecoder.java
@@ -98,7 +98,7 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder {
extendedInfo.set("satellites", buf.readUnsignedByte());
// Power
- position.setPower((double) buf.readUnsignedByte());
+ extendedInfo.set("power", buf.readUnsignedByte());
buf.readByte(); // other flags and sensors
@@ -204,7 +204,7 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder {
position.setCourse(Double.valueOf(parser.group(index++)));
// Power
- position.setPower(Double.valueOf(parser.group(index++)));
+ extendedInfo.set("power", Double.valueOf(parser.group(index++)));
position.setExtendedInfo(extendedInfo.toString());
return position;
diff --git a/src/org/traccar/protocol/MegastekProtocolDecoder.java b/src/org/traccar/protocol/MegastekProtocolDecoder.java
index ee7c5df2c..f73d04be4 100644
--- a/src/org/traccar/protocol/MegastekProtocolDecoder.java
+++ b/src/org/traccar/protocol/MegastekProtocolDecoder.java
@@ -218,7 +218,7 @@ public class MegastekProtocolDecoder extends BaseProtocolDecoder {
position.setAltitude(Double.valueOf(parser.group(index++)));
// Battery
- position.setPower(Double.valueOf(parser.group(index++)));
+ extendedInfo.set("power", Double.valueOf(parser.group(index++)));
// Charger
String charger = parser.group(index++);
@@ -253,7 +253,7 @@ public class MegastekProtocolDecoder extends BaseProtocolDecoder {
extendedInfo.set("gsm", parser.group(index++));
// Battery
- position.setPower(Double.valueOf(parser.group(index++)));
+ extendedInfo.set("battery", Double.valueOf(parser.group(index++)));
extendedInfo.set("flags", parser.group(index++));
extendedInfo.set("input", parser.group(index++));
diff --git a/src/org/traccar/protocol/Mta6ProtocolDecoder.java b/src/org/traccar/protocol/Mta6ProtocolDecoder.java
index 108e74963..62fa87e68 100644
--- a/src/org/traccar/protocol/Mta6ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Mta6ProtocolDecoder.java
@@ -189,7 +189,7 @@ public class Mta6ProtocolDecoder extends BaseProtocolDecoder {
if (checkBit(flags, 7)) {
extendedInfo.set("battery", buf.getUnsignedByte(buf.readerIndex()) >> 2);
- position.setPower((double) (buf.readUnsignedShort() & 0x03ff));
+ extendedInfo.set("power", buf.readUnsignedShort() & 0x03ff);
buf.readByte(); // microcontroller temperature
extendedInfo.set("gsm", (buf.getUnsignedByte(buf.readerIndex()) >> 4) & 0x07);
@@ -269,7 +269,7 @@ public class Mta6ProtocolDecoder extends BaseProtocolDecoder {
if (checkBit(flags, 5)) {
extendedInfo.set("battery", buf.getUnsignedByte(buf.readerIndex()) >> 2);
- position.setPower((double) (buf.readUnsignedShort() & 0x03ff));
+ extendedInfo.set("power", buf.readUnsignedShort() & 0x03ff);
buf.readByte(); // microcontroller temperature
extendedInfo.set("gsm", buf.getUnsignedByte(buf.readerIndex()) >> 5);
diff --git a/src/org/traccar/protocol/NavigilProtocolDecoder.java b/src/org/traccar/protocol/NavigilProtocolDecoder.java
index 34642496a..29be1e5ad 100644
--- a/src/org/traccar/protocol/NavigilProtocolDecoder.java
+++ b/src/org/traccar/protocol/NavigilProtocolDecoder.java
@@ -83,7 +83,7 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder {
ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("navigil");
position.setValid(true);
- position.setId((long) sequenceNumber);
+ extendedInfo.set("index", sequenceNumber);
position.setDeviceId(deviceId);
buf.readUnsignedShort(); // report trigger
@@ -102,8 +102,8 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder {
buf.readUnsignedInt(); // distance
buf.readUnsignedInt(); // delta distance
-
- position.setPower(buf.readUnsignedShort() * 0.001);
+
+ extendedInfo.set("battery", buf.readUnsignedShort() * 0.001);
buf.readUnsignedShort(); // battery charger status
@@ -120,7 +120,7 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder {
ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("navigil");
position.setValid(true);
- position.setId((long) sequenceNumber);
+ extendedInfo.set("index", sequenceNumber);
position.setDeviceId(deviceId);
buf.readUnsignedShort(); // report trigger
@@ -146,7 +146,7 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder {
buf.readUnsignedShort(); // VSAUT1 voltage
buf.readUnsignedShort(); // VSAUT2 voltage
buf.readUnsignedShort(); // solar voltage
- position.setPower(buf.readUnsignedShort() * 0.001); // battery voltage
+ extendedInfo.set("battery", buf.readUnsignedShort() * 0.001);
// TODO: a lot of other stuff
@@ -158,7 +158,7 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder {
Position position = new Position();
ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("navigil");
- position.setId((long) sequenceNumber);
+ extendedInfo.set("index", sequenceNumber);
position.setDeviceId(deviceId);
position.setTime(convertTimestamp(timestamp));
@@ -182,7 +182,7 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder {
Position position = new Position();
ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("navigil");
- position.setId((long) sequenceNumber);
+ extendedInfo.set("index", sequenceNumber);
position.setDeviceId(deviceId);
position.setTime(convertTimestamp(timestamp));
@@ -209,7 +209,7 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder {
Position position = new Position();
ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("navigil");
- position.setId((long) sequenceNumber);
+ extendedInfo.set("index", sequenceNumber);
position.setDeviceId(deviceId);
buf.readUnsignedByte(); // report trigger
@@ -238,7 +238,7 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder {
buf.readUnsignedByte(); // supply voltage 1
buf.readUnsignedByte(); // supply voltage 2
- position.setPower(buf.readUnsignedByte() * 0.01 + 2.5); // battery voltage
+ extendedInfo.set("battery", buf.readUnsignedShort() * 0.001);
// TODO: a lot of other stuff
@@ -250,7 +250,7 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder {
Position position = new Position();
ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("navigil");
- position.setId((long) sequenceNumber);
+ extendedInfo.set("index", sequenceNumber);
position.setDeviceId(deviceId);
position.setTime(convertTimestamp(timestamp));
@@ -270,7 +270,7 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder {
buf.readUnsignedByte(); // satellites in fix
- position.setPower(buf.readUnsignedByte() * 0.005 + 3.0); // battery voltage
+ extendedInfo.set("battery", buf.readUnsignedShort() * 0.001);
buf.readUnsignedInt(); // distance
diff --git a/src/org/traccar/protocol/NavisProtocolDecoder.java b/src/org/traccar/protocol/NavisProtocolDecoder.java
index 9de70595a..70a76a2f5 100644
--- a/src/org/traccar/protocol/NavisProtocolDecoder.java
+++ b/src/org/traccar/protocol/NavisProtocolDecoder.java
@@ -62,8 +62,26 @@ public class NavisProtocolDecoder extends BaseProtocolDecoder {
}
return false;
}
+
+ private class ParseResult {
+ private long id;
+ private Position position;
+
+ public ParseResult(long id, Position position) {
+ this.id = id;
+ this.position = position;
+ }
+
+ public long getId() {
+ return id;
+ }
+
+ public Position getPosition() {
+ return position;
+ }
+ }
- private Position parsePosition(ChannelBuffer buf) {
+ private ParseResult parsePosition(ChannelBuffer buf) {
Position position = new Position();
ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("navis");
@@ -79,7 +97,8 @@ public class NavisProtocolDecoder extends BaseProtocolDecoder {
}
extendedInfo.set("format", format);
- position.setId(buf.readUnsignedInt()); // sequence number
+ long index = buf.readUnsignedInt();
+ extendedInfo.set("index", index);
// Event type
extendedInfo.set("event", buf.readUnsignedShort());
@@ -118,7 +137,7 @@ public class NavisProtocolDecoder extends BaseProtocolDecoder {
extendedInfo.set("input", buf.readUnsignedByte());
}
- position.setPower(buf.readUnsignedShort() / 1000.0); // power
+ extendedInfo.set("power", buf.readUnsignedShort() / 1000.0);
// Battery power
extendedInfo.set("battery", buf.readUnsignedShort());
@@ -195,23 +214,23 @@ public class NavisProtocolDecoder extends BaseProtocolDecoder {
// Extended info
position.setExtendedInfo(extendedInfo.toString());
- return position;
+ return new ParseResult(index, position);
}
private Object processSingle(Channel channel, ChannelBuffer buf) {
- Position position = parsePosition(buf);
+ ParseResult result = parsePosition(buf);
ChannelBuffer response = ChannelBuffers.dynamicBuffer(ByteOrder.LITTLE_ENDIAN, 8);
response.writeBytes(ChannelBuffers.copiedBuffer(ByteOrder.LITTLE_ENDIAN, "*<T", charset));
- response.writeInt(position.getId().intValue());
+ response.writeInt((int) result.getId());
sendReply(channel, response);
// No location data
- if (position.getValid() == null) {
+ if (result.getPosition().getValid() == null) {
return null;
}
- return position;
+ return result.getPosition();
}
private Object processArray(Channel channel, ChannelBuffer buf) {
@@ -219,7 +238,7 @@ public class NavisProtocolDecoder extends BaseProtocolDecoder {
int count = buf.readUnsignedByte();
for (int i = 0; i < count; i++) {
- Position position = parsePosition(buf);
+ Position position = parsePosition(buf).getPosition();
if (position.getValid() != null) {
positions.add(position);
}
diff --git a/src/org/traccar/protocol/ProgressProtocolDecoder.java b/src/org/traccar/protocol/ProgressProtocolDecoder.java
index 87fc0ae44..c4a4d5e6f 100644
--- a/src/org/traccar/protocol/ProgressProtocolDecoder.java
+++ b/src/org/traccar/protocol/ProgressProtocolDecoder.java
@@ -155,7 +155,7 @@ public class ProgressProtocolDecoder extends BaseProtocolDecoder {
break; // workaround for device bug
}
lastIndex = buf.readUnsignedInt();
- position.setId(lastIndex);
+ extendedInfo.set("index", lastIndex);
} else {
newIndex = buf.readUnsignedInt();
}
diff --git a/src/org/traccar/protocol/SkypatrolProtocolDecoder.java b/src/org/traccar/protocol/SkypatrolProtocolDecoder.java
index fedb411a6..72fa45ac7 100644
--- a/src/org/traccar/protocol/SkypatrolProtocolDecoder.java
+++ b/src/org/traccar/protocol/SkypatrolProtocolDecoder.java
@@ -207,7 +207,7 @@ public class SkypatrolProtocolDecoder extends BaseProtocolDecoder {
// Battery level
if (checkBit(mask, 24)) {
- position.setPower(buf.readUnsignedShort() / 1000.0);
+ extendedInfo.set("power", buf.readUnsignedShort() / 1000.0);
}
// GPS overspeed
@@ -222,7 +222,7 @@ public class SkypatrolProtocolDecoder extends BaseProtocolDecoder {
// Sequence number
if (checkBit(mask, 28)) {
- position.setId((long) buf.readUnsignedShort());
+ extendedInfo.set("index", buf.readUnsignedShort());
}
// Extended info
diff --git a/src/org/traccar/protocol/TotemProtocolDecoder.java b/src/org/traccar/protocol/TotemProtocolDecoder.java
index 58e975730..5b9aeff84 100644
--- a/src/org/traccar/protocol/TotemProtocolDecoder.java
+++ b/src/org/traccar/protocol/TotemProtocolDecoder.java
@@ -241,7 +241,7 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder {
// Power
extendedInfo.set("battery", parser.group(index++));
- position.setPower(Double.valueOf(parser.group(index++)));
+ extendedInfo.set("power", Double.valueOf(parser.group(index++)));
// ADC
extendedInfo.set("adc", parser.group(index++));
@@ -273,7 +273,7 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder {
// Power
extendedInfo.set("battery", Double.valueOf(parser.group(index++)) / 10);
- position.setPower(Double.valueOf(parser.group(index++)));
+ extendedInfo.set("power", Double.valueOf(parser.group(index++)));
// ADC
extendedInfo.set("adc1", parser.group(index++));
diff --git a/src/org/traccar/protocol/Xexun2ProtocolDecoder.java b/src/org/traccar/protocol/Xexun2ProtocolDecoder.java
index a33743afe..bd75d5379 100644
--- a/src/org/traccar/protocol/Xexun2ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Xexun2ProtocolDecoder.java
@@ -33,7 +33,6 @@ public class Xexun2ProtocolDecoder extends BaseProtocolDecoder {
super(serverManager);
}
- //130725134142,,GPRMC,134142.591,A,3845.6283,N,00909.8876,W,2.08,287.33,250713,,,A*71,F,, imei:013227000526784,03,-50.7,L:3.69V,0,128,65337,268,03,177A,119F
static private Pattern pattern = Pattern.compile(
"[\r\n]*" +
"(\\d+)," + // Serial
@@ -150,7 +149,7 @@ public class Xexun2ProtocolDecoder extends BaseProtocolDecoder {
}
// Power
- position.setPower(Double.valueOf(parser.group(index++)));
+ extendedInfo.set("power", Double.valueOf(parser.group(index++)));
// Extended info
position.setExtendedInfo(extendedInfo.toString());
diff --git a/src/org/traccar/protocol/Xt7ProtocolDecoder.java b/src/org/traccar/protocol/Xt7ProtocolDecoder.java
index e5f81902a..cee9d18a7 100644
--- a/src/org/traccar/protocol/Xt7ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Xt7ProtocolDecoder.java
@@ -140,7 +140,7 @@ public class Xt7ProtocolDecoder extends BaseProtocolDecoder {
extendedInfo.set("gsm", parser.group(index++));
// Battery
- position.setPower(Double.valueOf(parser.group(index++)));
+ extendedInfo.set("power", Double.valueOf(parser.group(index++)));
// Flags
extendedInfo.set("flags", parser.group(index++));