public class BLEPacketBuilder
extends java.lang.Object
Glue packet chunk to build the original ble packet Formats: Packets: OFFSET (1byte) | data (MAX 19 bytes) First packet: OFFSET (1byte) | data (Max 18 bytes) | CHECKSUM (1 byte)
Modifier and Type | Field and Description |
---|---|
byte[] |
data |
Constructor and Description |
---|
BLEPacketBuilder(int bufferLength) |
Modifier and Type | Method and Description |
---|---|
void |
append(byte[] dataChunk)
Append new chunk of data into the builder
|
byte |
computeChecksum() |
byte[] |
getBuffer() |
byte[] |
getData() |
boolean |
hasAllChunks() |
boolean |
isChecksumValid() |
byte |
readChecksumInData() |
void |
reset() |
java.lang.String |
toString() |
public void append(@NonNull byte[] dataChunk)
dataChunk
- the data chunk. The first byte must be the position offset of this chunk in the buffer (in bytes)public void reset()
public boolean hasAllChunks()
public boolean isChecksumValid()
public byte readChecksumInData()
public byte computeChecksum()
public byte[] getData()
public byte[] getBuffer()
public java.lang.String toString()
toString
in class java.lang.Object