diff options
author | Ankit Tater <ankit@isuraksha.in> | 2015-10-26 13:48:58 +0530 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-11-01 18:21:32 +1300 |
commit | 2243487bd8ce4abaaafd40357b00a35c28242d85 (patch) | |
tree | 108a2522cc47e1fc0d7cf951bece86ed5069bd68 /src/org | |
parent | fe1ed7c8087d24cf5e853dc5ef942cce16149248 (diff) | |
download | traccar-server-2243487bd8ce4abaaafd40357b00a35c28242d85.tar.gz traccar-server-2243487bd8ce4abaaafd40357b00a35c28242d85.tar.bz2 traccar-server-2243487bd8ce4abaaafd40357b00a35c28242d85.zip |
T880X Acc calculation Fix
Mix Data Handling
Diffstat (limited to 'src/org')
-rw-r--r-- | src/org/traccar/protocol/T800XProtocolDecoder.java | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/org/traccar/protocol/T800XProtocolDecoder.java b/src/org/traccar/protocol/T800XProtocolDecoder.java index ecd021547..fc62e2ef9 100644 --- a/src/org/traccar/protocol/T800XProtocolDecoder.java +++ b/src/org/traccar/protocol/T800XProtocolDecoder.java @@ -9,6 +9,7 @@ import org.traccar.database.DataManager; import org.traccar.helper.ChannelBufferTools; import org.traccar.helper.Log; import org.traccar.model.ExtendedInfoFormatter; +import org.traccar.model.MixPacket; import org.traccar.model.Position; import org.traccar.model.Status; @@ -81,6 +82,7 @@ public class T800XProtocolDecoder extends BaseProtocolDecoder { ChannelBuffer buf = (ChannelBuffer) msg; List<Position> positions=new ArrayList<Position>(); + List<Status> statusList=new ArrayList<Status>(); int i=0; while (buf.readable()){ i++; @@ -138,9 +140,10 @@ public class T800XProtocolDecoder extends BaseProtocolDecoder { buf.skipBytes(2); // Digital I/O Status - String binaryDigitalIO = getBits(buf.readUnsignedShort()); + String binaryDigitalIO = getBits(buf.readUnsignedByte()); extendedInfo.set("acc", binaryDigitalIO.charAt(1)); extendedInfo.set("ac", binaryDigitalIO.charAt(2)); + buf.skipBytes(1); // 2 Analog Input buf.skipBytes(4); @@ -211,8 +214,7 @@ public class T800XProtocolDecoder extends BaseProtocolDecoder { status.setDeviceid(deviceId); status.setVoltage(getBatteryPerc(batteryVoltage)); status.setStatusType(statusType); - - return status; + statusList.add(status); } buf.skipBytes(16); } @@ -222,12 +224,15 @@ public class T800XProtocolDecoder extends BaseProtocolDecoder { Status status = new Status(); status.setDate(dateFormatLocal.parse(dateFormatGmt.format(new Date()))); status.setDeviceid(deviceId); + statusList.add(status); sendLoginResponse(channel, type, index, imei); - return status; } } - return positions; + MixPacket mixPacket=new MixPacket(); + mixPacket.setPositions(positions); + mixPacket.setStatus(statusList); + return mixPacket; } |