aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/AutoFonProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-11-05 14:59:40 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-11-05 14:59:40 +1300
commit1a86616ca2032fa0c3fee7446a6dc545f4f77451 (patch)
tree5670ed0aa2e7ef84cd5da86112e21aed773b2932 /src/org/traccar/protocol/AutoFonProtocolDecoder.java
parent111ea9bbec5516c36939df8eec4f7ba3edb268bf (diff)
downloadtrackermap-server-1a86616ca2032fa0c3fee7446a6dc545f4f77451.tar.gz
trackermap-server-1a86616ca2032fa0c3fee7446a6dc545f4f77451.tar.bz2
trackermap-server-1a86616ca2032fa0c3fee7446a6dc545f4f77451.zip
Partially refactor AutoFon 45 decoder
Diffstat (limited to 'src/org/traccar/protocol/AutoFonProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/AutoFonProtocolDecoder.java8
1 files changed, 1 insertions, 7 deletions
diff --git a/src/org/traccar/protocol/AutoFonProtocolDecoder.java b/src/org/traccar/protocol/AutoFonProtocolDecoder.java
index 1da024e0b..c0c3aaf08 100644
--- a/src/org/traccar/protocol/AutoFonProtocolDecoder.java
+++ b/src/org/traccar/protocol/AutoFonProtocolDecoder.java
@@ -45,7 +45,6 @@ public class AutoFonProtocolDecoder extends BaseProtocolDecoder {
private Position decodePosition(ChannelBuffer buf, boolean history) {
- // Create new position
Position position = new Position();
position.setProtocol(getProtocolName());
position.setDeviceId(getDeviceId());
@@ -61,7 +60,6 @@ public class AutoFonProtocolDecoder extends BaseProtocolDecoder {
position.set(Event.KEY_BATTERY, buf.readUnsignedByte());
buf.skipBytes(6); // time
- // Timers
if (!history) {
for (int i = 0; i < 2; i++) {
buf.skipBytes(5); // time
@@ -77,12 +75,10 @@ public class AutoFonProtocolDecoder extends BaseProtocolDecoder {
buf.readUnsignedShort(); // lac
buf.readUnsignedShort(); // cid
- // GPS status
int valid = buf.readUnsignedByte();
position.setValid((valid & 0xc0) != 0);
position.set(Event.KEY_SATELLITES, valid & 0x3f);
- // Date and time
Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
time.clear();
time.set(Calendar.DAY_OF_MONTH, buf.readUnsignedByte());
@@ -93,7 +89,6 @@ public class AutoFonProtocolDecoder extends BaseProtocolDecoder {
time.set(Calendar.SECOND, buf.readUnsignedByte());
position.setTime(time.getTime());
- // Location
position.setLatitude(convertCoordinate(buf.readInt()));
position.setLongitude(convertCoordinate(buf.readInt()));
position.setAltitude(buf.readShort());
@@ -109,8 +104,7 @@ public class AutoFonProtocolDecoder extends BaseProtocolDecoder {
@Override
protected Object decode(
- Channel channel, SocketAddress remoteAddress, Object msg)
- throws Exception {
+ Channel channel, SocketAddress remoteAddress, Object msg) throws Exception {
ChannelBuffer buf = (ChannelBuffer) msg;