Migrating from 3.6#

Every function declared in the 3.6 headers is still there, so existing code compiles and links unchanged. Update the points below to benefit from 4.0.

Replace these functions#

The old getters cannot report a failure. Their replacements return a ba_error and fill an out-parameter:

3.6

4.0

info = ba_eeg_manager_get_battery_info(m)

ba_eeg_manager_read_battery_info(m, &info)

s = ba_eeg_manager_get_charging_settings(m)

ba_eeg_manager_read_charging_settings(m, &s)

rate = ba_eeg_manager_get_sample_frequency(m)

ba_eeg_manager_read_sample_frequency(m, &rate)

ba_eeg_manager_set_channel_bias(m, ch)

ba_eeg_manager_set_channel_bias_feedback(m, ch) (same behavior)

New functions#

  • ba_eeg_manager_set_output_mode() / ba_eeg_manager_read_output_mode() – built-in test signal.

  • ba_eeg_manager_read_full_battery_info() – battery voltage, current and health.

  • ba_eeg_manager_get_stream_channel_data_types() – the type of each chunk row.

New constants#

  • Channels: BA_EEG_CHANNEL_ID_DIGITAL_INPUT is one uint8_t per sample.

  • Errors: BA_ERROR_BLUETOOTH_SERVICE_UNAVAILABLE (15), BA_ERROR_UPDATE_REJECTED (16), BA_ERROR_STREAM_START_FAILED (17), BA_INIT_ERROR_NOT_ALL_MANAGERS_CLOSED (12) and BA_INIT_WARNING_NOT_INITIALIZED (9). See Error codes.

Behavior changes#

Closing the library

ba_core_close() returns BA_INIT_ERROR_NOT_ALL_MANAGERS_CLOSED while a manager has not been freed. Free every manager first.

The last chunk

Stopping a stream delivers the remaining samples in one last, shorter chunk. Use the callback’s size argument rather than assuming chunk_size.

Refused settings

ba_eeg_manager_start_stream() and ba_eeg_manager_load_config() report settings the device refuses, and ba_eeg_manager_set_data_stream_rate() refuses rates the device lacks.

Callbacks

The callback setters may be called from any thread, also while streaming.

macOS scan results

ba_ble_device::mac_address holds the device’s CoreBluetooth UUID.

Default log level

BA_LOG_LEVEL_INFO.