CharacteristicBuffer – BLE Service incoming values buffer.

Accumulates a Characteristic’s incoming values in a FIFO buffer.

class bleio.CharacteristicBuffer(characteristic, *, timeout=1, buffer_size=64)

Create a new Characteristic object identified by the specified UUID.

Parameters:
  • characteristic (bleio.Characteristic) – The characteristic to monitor
  • timeout (int) – the timeout in seconds to wait for the first character and between subsequent characters.//|
  • buffer_size (int) – Size of ring buffer that stores incoming data coming from client. Must be >= 1.
read(nbytes=None)

Read characters. If nbytes is specified then read at most that many bytes. Otherwise, read everything that arrives until the connection times out. Providing the number of bytes expected is highly recommended because it will be faster.

Returns:Data read
Return type:bytes or None
readinto(buf)

Read bytes into the buf. Read at most len(buf) bytes.

Returns:number of bytes read and stored into buf
Return type:int or None (on a non-blocking error)
readline()

Read a line, ending in a newline character.

Returns:the line read
Return type:int or None
in_waiting

The number of bytes in the input buffer, available to be read

reset_input_buffer()

Discard any unread characters in the input buffer.

deinit()

Disable permanently.