Error codes#

Most functions return a ba_error (error.h); ba_core_init() and ba_core_close() return a ba_init_error (bacore.h). The reference page of each function lists the codes it returns.

ba_error#

Code

Value

Meaning

BA_ERROR_OK

0

Success.

BA_ERROR_CONNECTION

1

Not connected, or the connection failed.

BA_ERROR_UNSUPPORTED_DEVICE

2

The device does not support the request, such as a sample rate it lacks.

BA_ERROR_WRONG_VALUE

3

An invalid argument, a call at the wrong time, or settings the device refused.

BA_ERROR_BLUETOOTH_DISABLED

4

Bluetooth is turned off.

BA_ERROR_BLUETOOTH_ADAPTER_NOT_FOUND

5

No Bluetooth adapter.

BA_ERROR_ADAPTER_OUT_OF_INDEX

6

Linux: no adapter with sBACORE_Config_t::adapter_index.

BA_ERROR_UPDATE_FILE_NOT_FOUND

7

The firmware file could not be opened.

BA_ERROR_UPDATE_INITIATED_UNSUCCESSFULLY

8

The firmware update did not succeed.

BA_ERROR_UPDATE_FAILED_DEVICE_DISCONNECTED

9

The device disconnected during the firmware update.

BA_ERROR_NO_DEVICES_FOUND

11

No device with the name passed to ba_eeg_manager_connect() is nearby.

BA_ERROR_NOT_ALL_MANAGERS_CLOSED

12

Managers were not freed before closing the library.

BA_ERROR_CORE_NOT_INITIALIZED

13

ba_core_init() was not called.

BA_ERROR_BLUETOOTH_SERVICE_UNAVAILABLE

15

The system’s Bluetooth service did not respond.

BA_ERROR_UPDATE_REJECTED

16

The device refused the firmware image and keeps its current firmware.

BA_ERROR_STREAM_START_FAILED

17

The device could not start the stream; it can be retried.

BA_ERROR_UNKNOWN

255

Unexpected error; the log has details.

ba_init_error#

Code

Value

Meaning

BA_INIT_ERROR_OK

0

Success.

BA_INIT_WARNING_ALREADY_INITIALIZED

7

ba_core_init(): already initialized; nothing changed.

BA_INIT_WARNING_NOT_INITIALIZED

9

ba_core_close(): not initialized; nothing to do.

BA_INIT_ERROR_NOT_ALL_MANAGERS_CLOSED

12

ba_core_close(): free every manager first.

BA_INIT_ERROR_UNKNOWN

255

ba_core_init() failed; the call may be retried.

The log#

The log file (bacore.log by default) explains failures. When reporting a problem, set sBACORE_Config_t::log_level to BA_LOG_LEVEL_DEBUG and send the log.