Skip to content

Commit

Permalink
Implement TK103 alarm messages support
Browse files Browse the repository at this point in the history
  • Loading branch information
tananaev committed Nov 25, 2015
1 parent 2c39988 commit 67f512f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/org/traccar/protocol/Tk103ProtocolDecoder.java
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,11 @@ protected Object decode(
}
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());
Expand Down
3 changes: 3 additions & 0 deletions test/org/traccar/protocol/Tk103ProtocolDecoderTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ public void testDecode() throws Exception {

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

Expand Down

0 comments on commit 67f512f

Please sign in to comment.