Package org.altbeacon.bluetooth
Class Pdu
- java.lang.Object
-
- org.altbeacon.bluetooth.Pdu
-
public class Pdu extends Object
Converts a byte string from a Bluetooth LE scan into a Payload Data Unit (PDU) Created by dyoung on 4/14/15.
-
-
Field Summary
Fields Modifier and Type Field Description static byteGATT_SERVICE_UUID_PDU_TYPEstatic byteMANUFACTURER_DATA_PDU_TYPE
-
Constructor Summary
Constructors Constructor Description Pdu()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetActualLength()Actual PDU length (may be less than declared length if fewer bytes are actually available.)intgetDeclaredLength()PDU length from headerintgetEndIndex()End index within byte buffer of PDUintgetStartIndex()Start index within byte buffer of PDU This is the start of the payload data that starts after the length and the type, so the PDU actually starts two bytes earlierbytegetType()PDU type fieldstatic Pduparse(byte[] bytes, int startIndex)Parse a PDU from a byte array looking offset by startIndex
-
-
-
Field Detail
-
MANUFACTURER_DATA_PDU_TYPE
public static final byte MANUFACTURER_DATA_PDU_TYPE
- See Also:
- Constant Field Values
-
GATT_SERVICE_UUID_PDU_TYPE
public static final byte GATT_SERVICE_UUID_PDU_TYPE
- See Also:
- Constant Field Values
-
-
Method Detail
-
parse
public static Pdu parse(byte[] bytes, int startIndex)
Parse a PDU from a byte array looking offset by startIndex- Parameters:
bytes-startIndex-- Returns:
-
getType
public byte getType()
PDU type field- Returns:
-
getDeclaredLength
public int getDeclaredLength()
PDU length from header- Returns:
-
getActualLength
public int getActualLength()
Actual PDU length (may be less than declared length if fewer bytes are actually available.)- Returns:
-
getStartIndex
public int getStartIndex()
Start index within byte buffer of PDU This is the start of the payload data that starts after the length and the type, so the PDU actually starts two bytes earlier- Returns:
-
getEndIndex
public int getEndIndex()
End index within byte buffer of PDU- Returns:
-
-