mirror of
https://github.com/traccar/traccar.git
synced 2025-01-07 03:07:01 +08:00
Implement Sinocastel alarm response
This commit is contained in:
parent
4c0156e9db
commit
016c6a52d7
@ -91,6 +91,7 @@ public class CastelProtocolDecoder extends BaseProtocolDecoder {
|
||||
public static final short MSG_SC_DTCS_PASSENGER = 0x4006;
|
||||
public static final short MSG_SC_DTCS_COMMERCIAL = 0x400B;
|
||||
public static final short MSG_SC_ALARM = 0x4007;
|
||||
public static final short MSG_SC_ALARM_RESPONSE = (short) 0xC007;
|
||||
public static final short MSG_SC_CELL = 0x4008;
|
||||
public static final short MSG_SC_GPS_SLEEP = 0x4009;
|
||||
public static final short MSG_SC_FUEL = 0x400E;
|
||||
@ -291,15 +292,15 @@ public class CastelProtocolDecoder extends BaseProtocolDecoder {
|
||||
response.writeShortLE(0);
|
||||
response.writeIntLE((int) (System.currentTimeMillis() / 1000));
|
||||
sendResponse(channel, remoteAddress, version, id, MSG_SC_LOGIN_RESPONSE, response);
|
||||
}
|
||||
|
||||
if (type == MSG_SC_GPS || type == MSG_SC_COMPREHENSIVE) {
|
||||
} else if (type == MSG_SC_GPS || type == MSG_SC_COMPREHENSIVE) {
|
||||
buf.readUnsignedByte(); // historical
|
||||
if (type == MSG_SC_COMPREHENSIVE) {
|
||||
buf.readUnsignedIntLE(); // index
|
||||
}
|
||||
} else if (type == MSG_SC_ALARM) {
|
||||
buf.readUnsignedIntLE(); // alarm
|
||||
ByteBuf response = Unpooled.buffer(10);
|
||||
response.writeIntLE(buf.readIntLE()); // alarm index
|
||||
sendResponse(channel, remoteAddress, version, id, MSG_SC_ALARM_RESPONSE, response);
|
||||
} else if (type == MSG_SC_CURRENT_LOCATION) {
|
||||
buf.readUnsignedShortLE();
|
||||
}
|
||||
|
@ -11,6 +11,9 @@ public class CastelProtocolDecoderTest extends ProtocolTest {
|
||||
|
||||
var decoder = inject(new CastelProtocolDecoder(null));
|
||||
|
||||
verifyPositions(decoder, binary(
|
||||
"40406600043231334744533230323130303030353200000000400701000000CEE93667D0E93667000000000000000000000000000000020400003E00400000001C010F0B18061B134C96D604106E7218000000000302010900000000011602000000F39A0D0A"));
|
||||
|
||||
verifyPositions(decoder, binary(
|
||||
"4040660004542D3233344C2D54455354313233343536000000401F000E000000255C03674F5C0367EB7D0000000000000000000000000002040000002EC71E000036011E0918080C282497D604A86C7218000000000310000200FF0021000200820109BF0D0A"));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user