public class BluetoothPacketEncoder extends PacketEncoder
PacketEncoder.PacketReceiver
Constructor and Description |
---|
BluetoothPacketEncoder(PacketEncoder.PacketReceiver packetReceiver,
int maxPacketSize) |
Modifier and Type | Method and Description |
---|---|
void |
onSend(byte[] msg,
int offset,
int count,
long timestamp)
Called whenever the receiver is passed new MIDI data.
|
void |
writeComplete()
Called to inform PacketEncoder when the previous write is complete.
|
flush, getMaxMessageSize, onFlush, send, send
public BluetoothPacketEncoder(PacketEncoder.PacketReceiver packetReceiver, int maxPacketSize)
public void onSend(byte[] msg, int offset, int count, long timestamp) throws IOException
MidiReceiver
MidiReceiver.getMaxMessageSize()
.
NOTE: the msg array parameter is only valid within the context of this call.
The msg bytes should be copied by the receiver rather than retaining a reference
to this parameter.
Also, modifying the contents of the msg array parameter may result in other receivers
in the same application receiving incorrect values in their {link #onSend} method.onSend
in class MidiReceiver
msg
- a byte array containing the MIDI dataoffset
- the offset of the first byte of the data in the array to be processedcount
- the number of bytes of MIDI data in the array to be processedtimestamp
- the timestamp of the message (based on System.nanoTime()
IOException
public void writeComplete()
PacketEncoder
writeComplete
in class PacketEncoder