aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/ProgressProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-05-04 10:53:27 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2015-05-04 10:53:27 +1200
commit88e777a2ceb50e34dbe9577237483d8d3cebf346 (patch)
tree6b2058f1cf43e56a4be20d981acd8b03452bdc8e /src/org/traccar/protocol/ProgressProtocolDecoder.java
parentbbfd08e59ba23c6aee85bc1083588529a7b90ebb (diff)
downloadtrackermap-server-88e777a2ceb50e34dbe9577237483d8d3cebf346.tar.gz
trackermap-server-88e777a2ceb50e34dbe9577237483d8d3cebf346.tar.bz2
trackermap-server-88e777a2ceb50e34dbe9577237483d8d3cebf346.zip
Create other data keys
Diffstat (limited to 'src/org/traccar/protocol/ProgressProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/ProgressProtocolDecoder.java15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/org/traccar/protocol/ProgressProtocolDecoder.java b/src/org/traccar/protocol/ProgressProtocolDecoder.java
index f07498d1e..a4231448f 100644
--- a/src/org/traccar/protocol/ProgressProtocolDecoder.java
+++ b/src/org/traccar/protocol/ProgressProtocolDecoder.java
@@ -28,6 +28,7 @@ import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
+import org.traccar.model.Event;
import org.traccar.model.Position;
public class ProgressProtocolDecoder extends BaseProtocolDecoder {
@@ -122,14 +123,14 @@ public class ProgressProtocolDecoder extends BaseProtocolDecoder {
position.set("archive", true);
int subtype = buf.readUnsignedShort();
if (subtype == MSG_ALARM) {
- position.set("alarm", true);
+ position.set(Event.KEY_ALARM, true);
}
if (buf.readUnsignedShort() > buf.readableBytes()) {
lastIndex += 1;
break; // workaround for device bug
}
lastIndex = buf.readUnsignedInt();
- position.set("index", lastIndex);
+ position.set(Event.KEY_INDEX, lastIndex);
} else {
newIndex = buf.readUnsignedInt();
}
@@ -157,16 +158,16 @@ public class ProgressProtocolDecoder extends BaseProtocolDecoder {
// Satellites
int satellitesNumber = buf.readUnsignedByte();
- position.set("satellites", satellitesNumber);
+ position.set(Event.KEY_SATELLITES, satellitesNumber);
// Validity
position.setValid(satellitesNumber >= 3); // TODO: probably wrong
// Cell signal
- position.set("gsm", buf.readUnsignedByte());
+ position.set(Event.KEY_GSM, buf.readUnsignedByte());
- // Milage
- position.set("milage", buf.readUnsignedInt());
+ // Odometer
+ position.set(Event.KEY_ODOMETER, buf.readUnsignedInt());
long extraFlags = buf.readLong();
@@ -208,7 +209,7 @@ public class ProgressProtocolDecoder extends BaseProtocolDecoder {
byte[] response = {(byte)0xC9,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
channel.write(ChannelBuffers.wrappedBuffer(response));
- position.set("alarm", true);
+ position.set(Event.KEY_ALARM, true);
}
// Skip CRC