processData

fun processData(data: ByteArray, deviceConfig: BADeviceConfig, lastSample: Int, batteryLevel: Float, isWriteToFile: Boolean = false, callback: (chunk: FloatArray, isDummy: Boolean, lastSample: Int) -> Unit, fileCallback: (arrayToWrite: DoubleArray) -> Unit = {}): Boolean

Processes raw ByteArray data from a BrainAccess device using the provided BADeviceConfig, and invokes a callback with parsed signal chunks.

Return

True if data was processed successfully, false on failure.

Parameters

data

The raw byte data received from the device.

deviceConfig

The configuration of the device.

lastSample

The index of the last processed sample.

batteryLevel

Current battery level.

isWriteToFile

Whether to output values for file writing using fileCallback.

callback

Callback for each parsed data chunk with parameters: - chunk: Parsed EEG (and accelerometer) data with metadata. - isDummy: Whether the chunk is a dummy due to missing samples. - lastSample: Sample index.

fileCallback

Optional callback for writing parsed data to a file (used when isWriteToFile is true).