Skip to content

Commit

Permalink
Minor formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
bmalinowsky committed Feb 24, 2024
1 parent 2709e86 commit bcb51d1
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 27 deletions.
14 changes: 3 additions & 11 deletions src/io/calimero/knxnetip/util/DIB.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
Calimero 2 - A library for KNX network access
Copyright (c) 2006, 2022 B. Malinowsky
Copyright (c) 2006, 2024 B. Malinowsky
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -95,7 +95,6 @@ public abstract class DIB

/**
* Creates a new DIB out of a byte array.
* <p>
*
* @param data byte array containing DIB structure
* @param offset start offset of DIB in {@code data}
Expand All @@ -113,7 +112,6 @@ protected DIB(final byte[] data, final int offset) throws KNXFormatException

/**
* Creates a new DIB and initializes basic fields.
* <p>
*
* @param dibSize total size of DIB in bytes, {@code dibSize > 0}
* @param descriptionType one of the description type code constants of this class
Expand All @@ -138,21 +136,15 @@ public final int getDescTypeCode()
}

/**
* Returns the structure length of this DIB in bytes.
* <p>
*
* @return structure length as unsigned byte
* {@return the structure length of this DIB in bytes as unsigned byte}
*/
public final int getStructLength()
{
return size;
}

/**
* Returns the byte representation of the whole DIB structure.
* <p>
*
* @return byte array containing structure
* {@return the byte representation of the whole DIB structure as byte array}
*/
public byte[] toByteArray()
{
Expand Down
19 changes: 8 additions & 11 deletions src/io/calimero/link/medium/TP1Ack.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
Calimero 2 - A library for KNX network access
Copyright (c) 2006, 2022 B. Malinowsky
Copyright (c) 2006, 2024 B. Malinowsky
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -75,16 +75,13 @@ public TP1Ack(final byte[] data, final int offset) throws KNXFormatException
final int ctrl = data[offset] & 0xff;
if ((ctrl & 0x33) != 0x00)
throw new KNXFormatException("no TP1 ACK frame, invalid control field", ctrl);
if (ctrl == ACK)
ack = ACK;
else if (ctrl == NAK)
ack = NAK;
else if (ctrl == BUSY)
ack = BUSY;
else if (ctrl == NAK_BUSY)
ack = NAK_BUSY;
else
throw new KNXFormatException("no valid acknowledge type", ctrl);
ack = switch (ctrl) {
case ACK -> ACK;
case NAK -> NAK;
case BUSY -> BUSY;
case NAK_BUSY -> NAK_BUSY;
default -> throw new KNXFormatException("invalid acknowledge type", ctrl);
};
}

@Override
Expand Down
10 changes: 5 additions & 5 deletions test/io/calimero/knxnetip/KNXnetIPRouterTest.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
Calimero 2 - A library for KNX network access
Copyright (c) 2006, 2023 B. Malinowsky
Copyright (c) 2006, 2024 B. Malinowsky
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -36,14 +36,14 @@

package io.calimero.knxnetip;

import static io.calimero.knxnetip.KNXnetIPConnection.BlockingMode.NonBlocking;
import static java.nio.ByteBuffer.allocate;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
import static io.calimero.knxnetip.KNXnetIPConnection.BlockingMode.NonBlocking;

import java.io.IOException;
import java.net.DatagramPacket;
Expand All @@ -65,9 +65,6 @@
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import tag.KnxnetIP;
import tag.KnxnetIPSequential;
import tag.Slow;
import io.calimero.CloseEvent;
import io.calimero.DataUnitBuilder;
import io.calimero.FrameEvent;
Expand All @@ -87,6 +84,9 @@
import io.calimero.knxnetip.servicetype.RoutingBusy;
import io.calimero.knxnetip.servicetype.RoutingSystemBroadcast;
import io.calimero.mgmt.PropertyAccess.PID;
import tag.KnxnetIP;
import tag.KnxnetIPSequential;
import tag.Slow;


@KnxnetIP
Expand Down

0 comments on commit bcb51d1

Please sign in to comment.