Package org.openmuc.j60870.ie
Class IeBinaryStateInformation
- java.lang.Object
-
- org.openmuc.j60870.ie.InformationElement
-
- org.openmuc.j60870.ie.IeBinaryStateInformation
-
public class IeBinaryStateInformation extends InformationElement
Represents a binary state information (BSI) information element.
-
-
Constructor Summary
Constructors Constructor Description IeBinaryStateInformation(byte[] value)Creates a BSI (binary state information) information element from a byte array.IeBinaryStateInformation(int value)Creates a BSI (binary state information) information element from an integer value.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleangetBinaryState(int position)Returns true if the bit at the given position is 1 and false otherwise.intgetValue()Returns the 32 binary states of this element as an integer.byte[]getValueAsByteArray()Returns the 32 binary states of this element as a byte array.java.lang.StringtoString()
-
-
-
Constructor Detail
-
IeBinaryStateInformation
public IeBinaryStateInformation(int value)
Creates a BSI (binary state information) information element from an integer value.- Parameters:
value- the bits of value represent the 32 binary states of this element. When encoded in a message, the MSB ofvalueis transmitted first and the LSB ofvalueis transmitted last.
-
IeBinaryStateInformation
public IeBinaryStateInformation(byte[] value)
Creates a BSI (binary state information) information element from a byte array.- Parameters:
value- the bits of value represent the 32 binary states of this element. When encoded in a message, the MSB of the first byte is transmitted first and the LSB of fourth byte is transmitted last.
-
-
Method Detail
-
getValue
public int getValue()
Returns the 32 binary states of this element as an integer. When encoded in a message, the MSB of the return value is transmitted first and the LSB of the return value is transmitted last.- Returns:
- the 32 binary states of this element.
-
getValueAsByteArray
public byte[] getValueAsByteArray()
Returns the 32 binary states of this element as a byte array. When encoded in a message, the MSB of the first byte is transmitted first and the LSB of the fourth byte is transmitted last.- Returns:
- the 32 binary states of this element.
-
getBinaryState
public boolean getBinaryState(int position)
Returns true if the bit at the given position is 1 and false otherwise.- Parameters:
position- the position in the bit string. Range: 1-32. Position 1 represents the last bit in the encoded message and is the least significant bit (LSB) of the value returned bygetValue(). Position 32 represents the first bit in the encoded message and is the most significant bit (MSB) of the value returned bygetValue().- Returns:
- true if the bit at the given position is 1 and false otherwise.
-
toString
public java.lang.String toString()
- Specified by:
toStringin classInformationElement
-
-