mirror of
https://github.com/traccar/traccar.git
synced 2026-02-05 13:13:55 -05:00
Implement TK103 alarm messages support
This commit is contained in:
@@ -154,6 +154,11 @@ public class Tk103ProtocolDecoder extends BaseProtocolDecoder {
|
||||
}
|
||||
position.setDeviceId(getDeviceId());
|
||||
|
||||
int alarm = sentence.indexOf("BO01");
|
||||
if (alarm != -1) {
|
||||
position.set(Event.KEY_ALARM, Integer.parseInt(sentence.substring(alarm + 4, alarm + 5)));
|
||||
}
|
||||
|
||||
DateBuilder dateBuilder = new DateBuilder();
|
||||
if (parser.next() == null) {
|
||||
dateBuilder.setDate(parser.nextInt(), parser.nextInt(), parser.nextInt());
|
||||
|
||||
@@ -10,6 +10,9 @@ public class Tk103ProtocolDecoderTest extends ProtocolDecoderTest {
|
||||
|
||||
Tk103ProtocolDecoder decoder = new Tk103ProtocolDecoder(new Tk103Protocol());
|
||||
|
||||
verifyPosition(decoder, text(
|
||||
"(013612345678BO012061830A2934.0133N10627.2544E040.0080331309.6200000000L000770AD"));
|
||||
|
||||
verifyAttributes(decoder, text(
|
||||
"(088047194605BZ00,510,010,36e6,932c,43,36e6,766b,36,36e6,7668,32"));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user