diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2016-09-14 07:53:15 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2016-09-14 07:53:15 +1200 |
commit | 5a3cad30d5b2fa5a4be6cba0eed6df135f496165 (patch) | |
tree | bcc8191c0029266b33b5502b04097c11b658ef48 /src/org/traccar/protocol | |
parent | 38bbab77b848989b1065a41666518bef64d147e5 (diff) | |
download | traccar-server-5a3cad30d5b2fa5a4be6cba0eed6df135f496165.tar.gz traccar-server-5a3cad30d5b2fa5a4be6cba0eed6df135f496165.tar.bz2 traccar-server-5a3cad30d5b2fa5a4be6cba0eed6df135f496165.zip |
Implement more Castel message types
Diffstat (limited to 'src/org/traccar/protocol')
-rw-r--r-- | src/org/traccar/protocol/CastelProtocolDecoder.java | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/src/org/traccar/protocol/CastelProtocolDecoder.java b/src/org/traccar/protocol/CastelProtocolDecoder.java index 38fb11164..b8faed077 100644 --- a/src/org/traccar/protocol/CastelProtocolDecoder.java +++ b/src/org/traccar/protocol/CastelProtocolDecoder.java @@ -22,6 +22,7 @@ import org.traccar.BaseProtocolDecoder; import org.traccar.DeviceSession; import org.traccar.helper.Checksum; import org.traccar.helper.DateBuilder; +import org.traccar.helper.ObdDecoder; import org.traccar.helper.UnitsConverter; import org.traccar.model.Position; @@ -43,7 +44,13 @@ public class CastelProtocolDecoder extends BaseProtocolDecoder { private static final short MSG_SC_HEARTBEAT = 0x1003; private static final short MSG_SC_HEARTBEAT_RESPONSE = (short) 0x9003; private static final short MSG_SC_GPS = 0x4001; + private static final short MSG_SC_PID_DATA = 0x4002; + private static final short MSG_SC_SUPPORTED_PID = 0x4004; + private static final short MSG_SC_OBD_DATA = 0x4005; + private static final short MSG_SC_DTCS_PASSENGER = 0x4006; + private static final short MSG_SC_DTCS_COMMERCIAL = 0x400B; private static final short MSG_SC_ALARM = 0x4007; + private static final short MSG_SC_CELL = 0x4008; private static final short MSG_SC_GPS_SLEEP = 0x4009; private static final short MSG_SC_AGPS_REQUEST = 0x5101; private static final short MSG_SC_CURRENT_LOCATION = (short) 0xB001; @@ -193,6 +200,50 @@ public class CastelProtocolDecoder extends BaseProtocolDecoder { return readPosition(deviceSession, buf); + } else if (type == MSG_SC_DTCS_PASSENGER) { + + Position position = new Position(); + position.setProtocol(getProtocolName()); + position.setDeviceId(deviceSession.getDeviceId()); + + getLastLocation(position, null); + + buf.skipBytes(6 * 4 + 2 + 8); + + buf.readUnsignedByte(); // flag + position.add(ObdDecoder.decodeCodes(ChannelBuffers.hexDump(buf.readBytes(buf.readUnsignedByte())))); + + return position; + + } else if (type == MSG_SC_OBD_DATA) { + + Position position = new Position(); + position.setProtocol(getProtocolName()); + position.setDeviceId(deviceSession.getDeviceId()); + + getLastLocation(position, null); + + buf.skipBytes(6 * 4 + 2 + 8); + + // decode data + + return position; + + } else if (type == MSG_SC_CELL) { + + Position position = new Position(); + position.setProtocol(getProtocolName()); + position.setDeviceId(deviceSession.getDeviceId()); + + getLastLocation(position, null); + + buf.skipBytes(6 * 4 + 2 + 8); + + position.set(Position.KEY_LAC, buf.readUnsignedShort()); + position.set(Position.KEY_CID, buf.readUnsignedShort()); + + return position; + } return null; |