diff options
Diffstat (limited to 'src/main/java/org')
11 files changed, 434 insertions, 66 deletions
diff --git a/src/main/java/org/traccar/protocol/DmtProtocolDecoder.java b/src/main/java/org/traccar/protocol/DmtProtocolDecoder.java index c04e90f1d..fabcae002 100644 --- a/src/main/java/org/traccar/protocol/DmtProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/DmtProtocolDecoder.java @@ -1,5 +1,5 @@ /* - * Copyright 2017 - 2018 Anton Tananaev (anton@traccar.org) + * Copyright 2017 - 2019 Anton Tananaev (anton@traccar.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -208,6 +208,7 @@ public class DmtProtocolDecoder extends BaseProtocolDecoder { position.set("solarPower", buf.readUnsignedShortLE() * 0.001); break; default: + buf.readUnsignedShortLE(); // other break; } } diff --git a/src/main/java/org/traccar/protocol/GalileoProtocolDecoder.java b/src/main/java/org/traccar/protocol/GalileoProtocolDecoder.java index 5b843324c..dfaedd695 100644 --- a/src/main/java/org/traccar/protocol/GalileoProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/GalileoProtocolDecoder.java @@ -318,7 +318,9 @@ public class GalileoProtocolDecoder extends BaseProtocolDecoder { buf.readUnsignedByte(); // part number photo.writeBytes(buf, length - 1); - } else { + sendResponse(channel, 0x07, buf.readUnsignedShortLE()); + + } else if (photo != null) { DeviceSession deviceSession = getDeviceSession(channel, remoteAddress); String uniqueId = Context.getIdentityManager().getById(deviceSession.getDeviceId()).getUniqueId(); @@ -334,8 +336,6 @@ public class GalileoProtocolDecoder extends BaseProtocolDecoder { } - sendResponse(channel, 0x07, buf.readUnsignedShortLE()); - return position; } diff --git a/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java b/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java index dc7a95955..a5a7c711e 100644 --- a/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java @@ -988,7 +988,9 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_INDEX, buf.readUnsignedInt()); break; case 0x2a: - position.set(Position.KEY_INPUT, buf.readUnsignedByte()); + int input = buf.readUnsignedByte(); + position.set(Position.KEY_DOOR, BitUtil.to(input, 4) > 0); + position.set("tamper", BitUtil.from(input, 4) > 0); break; case 0x2b: int event = buf.readUnsignedByte(); diff --git a/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java b/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java index 09ee12256..fceefa73a 100644 --- a/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java @@ -197,20 +197,44 @@ public class HuabaoProtocolDecoder extends BaseProtocolDecoder { while (buf.readableBytes() > 2) { int subtype = buf.readUnsignedByte(); int length = buf.readUnsignedByte(); + int endIndex = buf.readerIndex() + length; switch (subtype) { case 0x01: position.set(Position.KEY_ODOMETER, buf.readUnsignedInt() * 100); break; + case 0x02: + position.set(Position.KEY_FUEL_LEVEL, buf.readUnsignedShort() * 0.1); + break; case 0x30: position.set(Position.KEY_RSSI, buf.readUnsignedByte()); break; case 0x31: position.set(Position.KEY_SATELLITES, buf.readUnsignedByte()); break; + case 0x91: + position.set(Position.KEY_BATTERY, buf.readUnsignedShort() * 0.1); + position.set(Position.KEY_RPM, buf.readUnsignedShort()); + position.set(Position.KEY_OBD_SPEED, buf.readUnsignedByte()); + position.set(Position.KEY_THROTTLE, buf.readUnsignedByte() * 100 / 255); + position.set(Position.KEY_ENGINE_LOAD, buf.readUnsignedByte() * 100 / 255); + position.set(Position.KEY_COOLANT_TEMP, buf.readUnsignedByte() - 40); + buf.readUnsignedShort(); + position.set(Position.KEY_FUEL_CONSUMPTION, buf.readUnsignedShort() * 0.01); + buf.readUnsignedShort(); + buf.readUnsignedInt(); + buf.readUnsignedShort(); + position.set(Position.KEY_FUEL_USED, buf.readUnsignedShort() * 0.01); + break; + case 0x94: + if (length > 0) { + position.set( + Position.KEY_VIN, buf.readCharSequence(length, StandardCharsets.US_ASCII).toString()); + } + break; default: - buf.skipBytes(length); break; } + buf.readerIndex(endIndex); } return position; @@ -233,3 +257,4 @@ public class HuabaoProtocolDecoder extends BaseProtocolDecoder { } } + diff --git a/src/main/java/org/traccar/protocol/Pt215Protocol.java b/src/main/java/org/traccar/protocol/Pt215Protocol.java new file mode 100644 index 000000000..09bd9b121 --- /dev/null +++ b/src/main/java/org/traccar/protocol/Pt215Protocol.java @@ -0,0 +1,35 @@ +/* + * Copyright 2019 Anton Tananaev (anton@traccar.org) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.traccar.protocol; + +import io.netty.handler.codec.LengthFieldBasedFrameDecoder; +import org.traccar.BaseProtocol; +import org.traccar.PipelineBuilder; +import org.traccar.TrackerServer; + +public class Pt215Protocol extends BaseProtocol { + + public Pt215Protocol() { + addServer(new TrackerServer(false, getName()) { + @Override + protected void addProtocolHandlers(PipelineBuilder pipeline) { + pipeline.addLast(new LengthFieldBasedFrameDecoder(1024, 2, 1, -1, 0)); + pipeline.addLast(new Pt215ProtocolDecoder(Pt215Protocol.this)); + } + }); + } + +} diff --git a/src/main/java/org/traccar/protocol/Pt215ProtocolDecoder.java b/src/main/java/org/traccar/protocol/Pt215ProtocolDecoder.java new file mode 100644 index 000000000..48ce7dede --- /dev/null +++ b/src/main/java/org/traccar/protocol/Pt215ProtocolDecoder.java @@ -0,0 +1,118 @@ +/* + * Copyright 2019 Anton Tananaev (anton@traccar.org) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.traccar.protocol; + +import io.netty.buffer.ByteBuf; +import io.netty.buffer.ByteBufUtil; +import io.netty.buffer.Unpooled; +import io.netty.channel.Channel; +import org.traccar.BaseProtocolDecoder; +import org.traccar.DeviceSession; +import org.traccar.NetworkMessage; +import org.traccar.Protocol; +import org.traccar.helper.BitUtil; +import org.traccar.helper.DateBuilder; +import org.traccar.model.Position; + +import java.net.SocketAddress; + +public class Pt215ProtocolDecoder extends BaseProtocolDecoder { + + public Pt215ProtocolDecoder(Protocol protocol) { + super(protocol); + } + + public static final int MSG_LOGIN = 0x01; + public static final int MSG_HEARTBEAT = 0x08; + public static final int MSG_GPS_REALTIME = 0x10; + public static final int MSG_GPS_OFFLINE = 0x11; + public static final int MSG_STATUS = 0x13; + + private void sendResponse( + Channel channel, SocketAddress remoteAddress, int type, ByteBuf content) { + if (channel != null) { + ByteBuf response = Unpooled.buffer(); + response.writeByte('X'); + response.writeByte('X'); + response.writeByte(content != null ? 1 + content.readableBytes() : 1); + response.writeByte(type); + if (content != null) { + response.writeBytes(content); + content.release(); + } + response.writeByte('\r'); + response.writeByte('\n'); + channel.writeAndFlush(new NetworkMessage(response, remoteAddress)); + } + } + + @Override + protected Object decode( + Channel channel, SocketAddress remoteAddress, Object msg) throws Exception { + + ByteBuf buf = (ByteBuf) msg; + + buf.skipBytes(2); // header + buf.readUnsignedByte(); // length + int type = buf.readUnsignedByte(); + + if (type == MSG_LOGIN) { + + getDeviceSession(channel, remoteAddress, ByteBufUtil.hexDump(buf.readSlice(8)).substring(1)); + sendResponse(channel, remoteAddress, type, null); + + } else if (type == MSG_GPS_OFFLINE || type == MSG_GPS_REALTIME) { + + DeviceSession deviceSession = getDeviceSession(channel, remoteAddress); + if (deviceSession == null) { + return null; + } + + Position position = new Position(getProtocolName()); + position.setDeviceId(deviceSession.getDeviceId()); + + sendResponse(channel, remoteAddress, type, buf.retainedSlice(buf.readerIndex(), 6)); + + DateBuilder dateBuilder = new DateBuilder() + .setDate(buf.readUnsignedByte(), buf.readUnsignedByte(), buf.readUnsignedByte()) + .setTime(buf.readUnsignedByte(), buf.readUnsignedByte(), buf.readUnsignedByte()); + position.setTime(dateBuilder.getDate()); + + double latitude = buf.readUnsignedInt() / 60.0 / 30000.0; + double longitude = buf.readUnsignedInt() / 60.0 / 30000.0; + + int flags = buf.readUnsignedShort(); + position.setCourse(BitUtil.to(flags, 10)); + position.setValid(BitUtil.check(flags, 12)); + + if (!BitUtil.check(flags, 10)) { + latitude = -latitude; + } + if (BitUtil.check(flags, 11)) { + longitude = -longitude; + } + + position.setLatitude(latitude); + position.setLongitude(longitude); + + return position; + + } + + return null; + } + +} diff --git a/src/main/java/org/traccar/protocol/RaceDynamicsProtocol.java b/src/main/java/org/traccar/protocol/RaceDynamicsProtocol.java index 749893d4d..c9db10610 100644 --- a/src/main/java/org/traccar/protocol/RaceDynamicsProtocol.java +++ b/src/main/java/org/traccar/protocol/RaceDynamicsProtocol.java @@ -28,7 +28,7 @@ public class RaceDynamicsProtocol extends BaseProtocol { addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { - pipeline.addLast(new LineBasedFrameDecoder(1024)); + pipeline.addLast(new LineBasedFrameDecoder(1500)); pipeline.addLast(new StringEncoder()); pipeline.addLast(new StringDecoder()); pipeline.addLast(new RaceDynamicsProtocolDecoder(RaceDynamicsProtocol.this)); diff --git a/src/main/java/org/traccar/protocol/RaceDynamicsProtocolDecoder.java b/src/main/java/org/traccar/protocol/RaceDynamicsProtocolDecoder.java index 0261199a3..f441bf8ed 100644 --- a/src/main/java/org/traccar/protocol/RaceDynamicsProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/RaceDynamicsProtocolDecoder.java @@ -71,6 +71,17 @@ public class RaceDynamicsProtocolDecoder extends BaseProtocolDecoder { .number("(d+),") // power .number("[01],") // power status .number("(d+),") // battery + .number("([01]),") // panic + .number("d+,") + .number("d+,") + .number("(d),") // overspeed + .number("d+,") // speed limit + .number("d+,") // tachometer + .number("d+,d+,d+,") // aux + .number("d+,") // geofence id + .number("d+,") // road speed type + .number("d+,") // ibutton count + .number("(d),") // overdriver alert .any() .compile(); @@ -135,6 +146,13 @@ public class RaceDynamicsProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_DRIVER_UNIQUE_ID, parser.next()); position.set(Position.KEY_POWER, parser.nextInt() * 0.01); position.set(Position.KEY_BATTERY, parser.nextInt() * 0.01); + position.set(Position.KEY_ALARM, parser.nextInt() > 0 ? Position.ALARM_SOS : null); + position.set(Position.KEY_ALARM, parser.nextInt() > 0 ? Position.ALARM_OVERSPEED : null); + + int overDriver = parser.nextInt(); + if (overDriver > 0) { + position.set("overDriver", overDriver); + } positions.add(position); diff --git a/src/main/java/org/traccar/protocol/RstProtocol.java b/src/main/java/org/traccar/protocol/RstProtocol.java new file mode 100644 index 000000000..1e164866f --- /dev/null +++ b/src/main/java/org/traccar/protocol/RstProtocol.java @@ -0,0 +1,39 @@ +/* + * Copyright 2019 Anton Tananaev (anton@traccar.org) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.traccar.protocol; + +import io.netty.handler.codec.string.StringDecoder; +import io.netty.handler.codec.string.StringEncoder; +import org.traccar.BaseProtocol; +import org.traccar.CharacterDelimiterFrameDecoder; +import org.traccar.PipelineBuilder; +import org.traccar.TrackerServer; + +public class RstProtocol extends BaseProtocol { + + public RstProtocol() { + addServer(new TrackerServer(false, getName()) { + @Override + protected void addProtocolHandlers(PipelineBuilder pipeline) { + pipeline.addLast(new CharacterDelimiterFrameDecoder(1024, "FIM;")); + pipeline.addLast(new StringEncoder()); + pipeline.addLast(new StringDecoder()); + pipeline.addLast(new RstProtocolDecoder(RstProtocol.this)); + } + }); + } + +} diff --git a/src/main/java/org/traccar/protocol/RstProtocolDecoder.java b/src/main/java/org/traccar/protocol/RstProtocolDecoder.java new file mode 100644 index 000000000..db2c35c3f --- /dev/null +++ b/src/main/java/org/traccar/protocol/RstProtocolDecoder.java @@ -0,0 +1,115 @@ +/* + * Copyright 2019 Anton Tananaev (anton@traccar.org) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.traccar.protocol; + +import io.netty.channel.Channel; +import org.traccar.BaseProtocolDecoder; +import org.traccar.DeviceSession; +import org.traccar.Protocol; +import org.traccar.helper.Parser; +import org.traccar.helper.PatternBuilder; +import org.traccar.helper.UnitsConverter; +import org.traccar.model.Position; + +import java.net.SocketAddress; +import java.util.regex.Pattern; + +public class RstProtocolDecoder extends BaseProtocolDecoder { + + public RstProtocolDecoder(Protocol protocol) { + super(protocol); + } + + private static final Pattern PATTERN = new PatternBuilder() + .text("RST;") + .expression("[AL];") + .expression("[^,]+;") // model + .expression(".{5};") // firmware + .number("(d{9});") // serial number + .number("d+;") // index + .number("d+;") // type + .number("(dd)-(dd)-(dddd) ") // event date + .number("(dd):(dd):(dd);") // event time + .number("(dd)-(dd)-(dddd) ") // fix date + .number("(dd):(dd):(dd);") // fix time + .number("(-?d+.d+);") // longitude + .number("(-?d+.d+);") // latitude + .number("(d+);") // speed + .number("(d+);") // course + .number("(-?d+);") // altitude + .number("([01]);") // valid + .number("(d+);") // satellites + .number("(d+);") // hdop + .number("(xx);") // inputs 1 + .number("(xx);") // inputs 2 + .number("(xx);") // inputs 3 + .number("(xx);") // outputs 1 + .number("(xx);") // outputs 2 + .number("(d+.d+);") // power + .number("(d+.d+);") // battery + .number("(d+);") // odometer + .number("(d+);") // rssi + .number("(xx);") // temperature + .number("x{4};") // sensors + .number("(xx);") // status 1 + .number("(xx);") // status 2 + .any() + .compile(); + + @Override + protected Object decode( + Channel channel, SocketAddress remoteAddress, Object msg) throws Exception { + + Parser parser = new Parser(PATTERN, (String) msg); + if (!parser.matches()) { + return null; + } + + DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, parser.next()); + if (deviceSession == null) { + return null; + } + + Position position = new Position(getProtocolName()); + position.setDeviceId(deviceSession.getDeviceId()); + + position.setDeviceTime(parser.nextDateTime(Parser.DateTimeFormat.DMY_HMS)); + position.setFixTime(parser.nextDateTime(Parser.DateTimeFormat.DMY_HMS)); + position.setLongitude(parser.nextDouble()); + position.setLatitude(parser.nextDouble()); + position.setSpeed(UnitsConverter.knotsFromKph(parser.nextInt())); + position.setCourse(parser.nextInt()); + position.setAltitude(parser.nextInt()); + position.setValid(parser.nextInt() > 0); + + position.set(Position.KEY_SATELLITES, parser.nextInt()); + position.set(Position.KEY_HDOP, parser.nextInt()); + position.set(Position.PREFIX_IN + 1, parser.nextHexInt()); + position.set(Position.PREFIX_IN + 2, parser.nextHexInt()); + position.set(Position.PREFIX_IN + 3, parser.nextHexInt()); + position.set(Position.PREFIX_OUT + 1, parser.nextHexInt()); + position.set(Position.PREFIX_OUT + 2, parser.nextHexInt()); + position.set(Position.KEY_POWER, parser.nextDouble()); + position.set(Position.KEY_BATTERY, parser.nextDouble()); + position.set(Position.KEY_ODOMETER, parser.nextInt()); + position.set(Position.KEY_RSSI, parser.nextInt()); + position.set(Position.PREFIX_TEMP + 1, (int) parser.nextHexInt().byteValue()); + position.set(Position.KEY_STATUS, parser.nextHexInt() << 8 + parser.nextHexInt()); + + return position; + } + +} diff --git a/src/main/java/org/traccar/protocol/SigfoxProtocolDecoder.java b/src/main/java/org/traccar/protocol/SigfoxProtocolDecoder.java index ea9c9767b..f9c79fb5b 100644 --- a/src/main/java/org/traccar/protocol/SigfoxProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/SigfoxProtocolDecoder.java @@ -64,74 +64,89 @@ public class SigfoxProtocolDecoder extends BaseHttpProtocolDecoder { Position position = new Position(getProtocolName()); position.setDeviceId(deviceSession.getDeviceId()); - position.setTime(new Date(json.getInt("time") * 1000L)); + if (json.containsKey("time")) { + position.setTime(new Date(json.getInt("time") * 1000L)); + } else { + position.setTime(new Date()); + } - String data = json.getString(json.containsKey("data") ? "data" : "payload"); - ByteBuf buf = Unpooled.wrappedBuffer(DataConverter.parseHex(data)); - try { - int event = buf.readUnsignedByte(); - if (event >> 4 == 0) { + if (json.containsKey("location")) { - position.setValid(true); - position.setLatitude(buf.readIntLE() * 0.0000001); - position.setLongitude(buf.readIntLE() * 0.0000001); - position.setCourse(buf.readUnsignedByte() * 2); - position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedByte())); + JsonObject location = json.getJsonObject("location"); - position.set(Position.KEY_BATTERY, buf.readUnsignedByte() * 0.025); + position.setValid(true); + position.setLatitude(location.getJsonNumber("lat").doubleValue()); + position.setLongitude(location.getJsonNumber("lng").doubleValue()); - } else { + } else { - position.set(Position.KEY_EVENT, event); - if (event == 0x22 || event == 0x62) { - position.set(Position.KEY_ALARM, Position.ALARM_SOS); - } + String data = json.getString(json.containsKey("data") ? "data" : "payload"); + ByteBuf buf = Unpooled.wrappedBuffer(DataConverter.parseHex(data)); + try { + int event = buf.readUnsignedByte(); + if (event >> 4 == 0) { + + position.setValid(true); + position.setLatitude(buf.readIntLE() * 0.0000001); + position.setLongitude(buf.readIntLE() * 0.0000001); + position.setCourse(buf.readUnsignedByte() * 2); + position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedByte())); + + position.set(Position.KEY_BATTERY, buf.readUnsignedByte() * 0.025); + + } else { - while (buf.isReadable()) { - int type = buf.readUnsignedByte(); - switch (type) { - case 0x01: - position.setValid(true); - position.setLatitude(buf.readMedium()); - position.setLongitude(buf.readMedium()); - break; - case 0x02: - position.setValid(true); - position.setLatitude(buf.readFloat()); - position.setLongitude(buf.readFloat()); - break; - case 0x03: - position.set(Position.PREFIX_TEMP + 1, buf.readByte() * 0.5); - break; - case 0x04: - position.set(Position.KEY_BATTERY, buf.readUnsignedByte() * 0.1); - break; - case 0x05: - position.set(Position.KEY_BATTERY_LEVEL, buf.readUnsignedByte()); - break; - case 0x06: - String mac = ByteBufUtil.hexDump(buf.readSlice(6)).replaceAll("(..)", "$1:"); - position.setNetwork(new Network(WifiAccessPoint.from( - mac.substring(0, mac.length() - 1), buf.readUnsignedByte()))); - break; - case 0x07: - buf.skipBytes(10); // wifi extended - break; - case 0x08: - buf.skipBytes(6); // accelerometer - break; - case 0x09: - position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedByte())); - break; - default: - buf.readUnsignedByte(); // fence number - break; + position.set(Position.KEY_EVENT, event); + if (event == 0x22 || event == 0x62) { + position.set(Position.KEY_ALARM, Position.ALARM_SOS); + } + + while (buf.isReadable()) { + int type = buf.readUnsignedByte(); + switch (type) { + case 0x01: + position.setValid(true); + position.setLatitude(buf.readMedium()); + position.setLongitude(buf.readMedium()); + break; + case 0x02: + position.setValid(true); + position.setLatitude(buf.readFloat()); + position.setLongitude(buf.readFloat()); + break; + case 0x03: + position.set(Position.PREFIX_TEMP + 1, buf.readByte() * 0.5); + break; + case 0x04: + position.set(Position.KEY_BATTERY, buf.readUnsignedByte() * 0.1); + break; + case 0x05: + position.set(Position.KEY_BATTERY_LEVEL, buf.readUnsignedByte()); + break; + case 0x06: + String mac = ByteBufUtil.hexDump(buf.readSlice(6)).replaceAll("(..)", "$1:"); + position.setNetwork(new Network(WifiAccessPoint.from( + mac.substring(0, mac.length() - 1), buf.readUnsignedByte()))); + break; + case 0x07: + buf.skipBytes(10); // wifi extended + break; + case 0x08: + buf.skipBytes(6); // accelerometer + break; + case 0x09: + position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedByte())); + break; + default: + buf.readUnsignedByte(); // fence number + break; + } } - } + } + } finally { + buf.release(); } - } finally { - buf.release(); } if (position.getLatitude() == 0 && position.getLongitude() == 0) { |