Binary stream

This module must be run in the same machine that OpenBCI hardware was attached.

class openbci_stream.acquisition.binary_stream.BinaryStream(streaming_package_size: int, board_id: str = '')[source]

Kafka producer for equal size packages streaming.

The dictionary streamed contain two objects: data and context.

data: Bytes with binary raw data.

context: A dictionary with the following keys:

  • created: The timestamp for the exact moment when binary data was read.

  • daisy: True if Daisy board is attached, otherwise False.

  • boardmode: Can be default, digital, ‘’analog’, ‘debug’ or marker.

  • montage: A list means consecutive channels e.g. [‘Fp1’, ‘Fp2’, ‘F3’, ‘Fz’, ‘F4’] and a dictionary means specific channels {1: ‘Fp1’, 2: ‘Fp2’, 3: ‘F3’, 4: ‘Fz’, 5: ‘F4’}.

  • connection: Can be serial or wifi.

  • gain: Array with gains.

e.g

>>> context = {'created': 1604196938.727064,
               'daisy': False,
               'boardmode': 'default',
               'montage': ['Fp1', 'Fp2', 'F3', 'Fz', 'F4'],
               'connection': 'wifi',
               'gain': [24, 24, 24, 24, 24, 24, 24, 24]
               }
__init__(streaming_package_size: int, board_id: str = '') None[source]
Parameters

streaming_package_size – The package size for streaming packages.

close() None[source]

Terminate the produser.

stream(data: Dict[str, Any]) None[source]

This stream attempts to create packages of the same size.

Over WiFi and Daisy, the sampling frequency is doubled in favor to get all 16 channels, so the size of the packages is also doubled.

Parameters

data – Dictionary with context and raw binary data.