Implement TK103 alarm messages support

This commit is contained in:
Anton Tananaev
2015-11-25 22:05:43 +13:00
parent 2c399889e9
commit 67f512fb2b
2 changed files with 8 additions and 0 deletions

View File

@@ -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());

View File

@@ -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"));