Skip to content

Commit

Permalink
Add support for multi-fence type
Browse files Browse the repository at this point in the history
  • Loading branch information
tananaev committed Dec 14, 2017
1 parent c2e96b3 commit c60b591
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/org/traccar/protocol/Gt06ProtocolDecoder.java
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ private static boolean hasGps(int type) {
case MSG_GPS_LBS_EXTEND:
case MSG_GPS_2:
case MSG_FENCE_SINGLE:
case MSG_FENCE_MULTI:
return true;
default:
return false;
Expand All @@ -135,6 +136,7 @@ private static boolean hasLbs(int type) {
case MSG_GPS_LBS_STATUS_3:
case MSG_GPS_2:
case MSG_FENCE_SINGLE:
case MSG_FENCE_MULTI:
case MSG_LBS_ALARM:
case MSG_LBS_ADDRESS:
return true;
Expand Down Expand Up @@ -630,7 +632,7 @@ private Object decodeBasicOther(Channel channel, ChannelBuffer buf,
buf.readUnsignedShort();
}

if (type == MSG_GPS_LBS_STATUS_3) {
if (type == MSG_GPS_LBS_STATUS_3 || type == MSG_FENCE_MULTI) {
position.set(Position.KEY_GEOFENCE, buf.readUnsignedByte());
}

Expand Down
2 changes: 1 addition & 1 deletion test/org/traccar/protocol/Gt06ProtocolDecoderTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public void testDecode() throws Exception {
verifyAttributes(decoder, binary(
"78780B23C00122040001000818720D0A"));

verifyNull(decoder, binary(
verifyNotNull(decoder, binary(
"78782EA4110C0C02281BF6026C18720C38D22800149C1181CC00010000260E000000000615F8012C05041102FF001058FD0D0A"));

verifyNotNull(decoder, binary(
Expand Down

0 comments on commit c60b591

Please sign in to comment.