Bitbrain SDK 2.10.6
Bitbrain SDK
Loading...
Searching...
No Matches
Configure the device

Functions to query and change the device configuration. More...

Data Structures

struct  bbt_device_signal_t
 The bbt_device_signal_t class. More...
 

Enumerations

enum  bbt_powerline_frequency_t { POWERLINE_DISABLED = 0 , POWERLINE_50 = 50 , POWERLINE_60 = 60 }
 Powerline frequency options. More...
 
enum  bbt_device_signal_type_t {
  Accelerometer = 0 , Analog_Aux , BVP , Digital_Aux ,
  Digital_Input , Digital_Output , EEG , EXG ,
  GSR , IMU , Photodiode , PPG ,
  Digital_Input_Output
}
 Types of signal a Bitbrain device can acquire. More...
 
enum  bbt_device_type_t {
  AIR = 0 , DIADEM , HERO , VERSATILE_8 ,
  VERSATILE_16 , VERSATILE_32 , VERSATILE_64 , VERSATILE_BIO ,
  RING , IKON , IKON_SLEEP , VERSATILE_PLUS_16 ,
  VERSATILE_PLUS_32
}
 Supported Bitbrain devices. More...
 
enum  bbt_device_versatile_plus_dio_mode { DISABLED = 0 , DIGITAL_INPUT , DIGITAL_OUTPUT }
 Signal modes of the Versatile Plus Digital I/O (DIO) port. More...
 

Functions

BBT_SDK_API int bbt_device_get_hardware_version (const bbt_device_t *device, unsigned short *major, unsigned short *minor)
 Gets the major and minor versions of the device hardware.
 
BBT_SDK_API int bbt_device_get_firmware_version (const bbt_device_t *device, unsigned short *major, unsigned short *minor)
 Gets the major and minor versions of the device firmware.
 
BBT_SDK_API unsigned short bbt_device_get_frequency (const bbt_device_t *device)
 Returns the frequency that the device communicates new data when acquiring.
 
BBT_SDK_API int bbt_device_set_frequency (bbt_device_t *device, enum bbt_powerline_frequency_t powerline_info)
 Sets the powerline frequency for the device.
 
BBT_SDK_API const int bbt_device_get_powerline_frequency (const bbt_device_t *device)
 Gets the powerline frequency for the device.
 
BBT_SDK_API const char * bbt_device_get_conn_type (const bbt_device_t *device)
 Gets the connection type (usb or bluetooth)
 
BBT_SDK_API const int bbt_device_get_versatile_plus_sampling_rate (const bbt_device_t *device)
 Gets the sampling rate for the versatile plus signals.
 
BBT_SDK_API enum bbt_device_type_t bbt_device_get_type (const bbt_device_t *device)
 Gets the type of the device that has been configured.
 
BBT_SDK_API int bbt_device_get_signals (const bbt_device_t *device, unsigned short *n, const struct bbt_device_signal_t **device_signals)
 Get the list of signals available in the device.
 
BBT_SDK_API int bbt_device_get_signal_mode (const bbt_device_t *device, unsigned short n)
 Gets the configuration mode of a signal in the device.
 
BBT_SDK_API int bbt_device_enable_signal (bbt_device_t *device, unsigned short n)
 Enables the acquisition of this signal.
 
BBT_SDK_API int bbt_device_disable_signal (bbt_device_t *device, unsigned short n)
 Disables the acquisition of this signal.
 
BBT_SDK_API int bbt_device_set_signal_mode (bbt_device_t *device, unsigned short n, int mode)
 Sets the mode to a specific value.
 
BBT_SDK_API int bbt_device_has_sd_card_capabilities (const bbt_device_t *device)
 Check if the device has SD Card capabilities to record the data.
 
BBT_SDK_API int bbt_device_is_sd_card_enabled (const bbt_device_t *device)
 Check if the SD Card recording is enabled in the device.
 
BBT_SDK_API int bbt_device_enable_sd_card (bbt_device_t *device, const char *recording_folder_path, const char *recording_name)
 Enable the SD Card recording in the device.
 
BBT_SDK_API int bbt_device_disable_sd_card (bbt_device_t *device)
 Disable the SD Card recording in the device.
 

Detailed Description

Functions to query and change the device configuration.

The initial state of a device after a reset is the configuration mode with all the signals disabled and the SD Card recording disabled too. You can query and modify the configuration of the device by calling the functions in this group. During configuration, no data streaming is available. Only a request/reply communication happens between the SDK and the device.

Enumeration Type Documentation

◆ bbt_powerline_frequency_t

Powerline frequency options.

This enum identifies the state of the powerline frequency (values in Hz). Pass one of these values to bbt_device_set_frequency.

Enumerator
POWERLINE_DISABLED 

No powerline filtering is applied.

POWERLINE_50 

Filter the 50 Hz powerline component (Europe, Asia, Africa).

POWERLINE_60 

Filter the 60 Hz powerline component (North America).

◆ bbt_device_signal_type_t

Types of signal a Bitbrain device can acquire.

Use bbt_device_get_signals to find which of these a given device provides.

@important Photodiode is mutually exclusive with the Digital_Input_Output. Only one of them can be acquired at a time. Disable the one you don't need before enabling the other. The same relationship is expected between Photodiode and Digital_Input for the VERSATILE_8 VERSATILE_16 DIADEM and AIR devices.

Enumerator
Accelerometer 

Three-axis accelerometer.

Analog_Aux 

Auxiliary analog input.

BVP 

Blood volume pulse.

Digital_Aux 

Auxiliary digital channel.

Digital_Input 

Digital input port (trigger reception).

Digital_Output 

Digital output port (trigger generation).

EEG 

Electroencephalography.

EXG 

Generic biopotential channel (ECG/EOG/EMG).

GSR 

Galvanic skin response.

IMU 

Inertial measurement unit.

Photodiode 

Photodiode / light sensor.

PPG 

Photoplethysmography.

Digital_Input_Output 

Bidirectional Digital I/O port of the Versatile Plus devices.

Unlike every other signal, this one is directional: enabling it is not enough, you must also choose whether the port reads or writes. Select the direction by passing a bbt_device_versatile_plus_dio_mode value to bbt_device_set_signal_mode instead of calling bbt_device_enable_signal. See Digital I/O (DIO) port.

◆ bbt_device_type_t

Supported Bitbrain devices.

This enum identifies the types of devices that could be used with this SDK

◆ bbt_device_versatile_plus_dio_mode

Signal modes of the Versatile Plus Digital I/O (DIO) port.

The DIO port of the Versatile Plus devices can either read triggers from external equipment or write TTL pulses for other equipment to read. Because a single signal covers both directions, the DIO signal cannot be turned on with bbt_device_enable_signal alone: you must state the direction by passing one of these values as the mode argument of bbt_device_set_signal_mode.

Locate the signal by scanning bbt_device_get_signals for the entry whose type is Digital_Input_Output, then set its mode:

unsigned short count = 0;
const struct bbt_device_signal_t* signals = NULL;
bbt_device_get_signals(device, &count, &signals);
for (unsigned short i = 0; i < count; ++i)
{
if (signals[i].type == Digital_Input_Output)
{
// Read triggers coming from a button box, pedal or TTL cable:
// ...or emit TTL pulses for another device instead:
// bbt_device_set_signal_mode(device, i, DIGITAL_OUTPUT);
break;
}
}
BBT_SDK_API int bbt_device_start(bbt_device_t *device)
Sets the device into acquisition mode.
BBT_SDK_API int bbt_device_get_signals(const bbt_device_t *device, unsigned short *n, const struct bbt_device_signal_t **device_signals)
Get the list of signals available in the device.
BBT_SDK_API int bbt_device_set_signal_mode(bbt_device_t *device, unsigned short n, int mode)
Sets the mode to a specific value.
@ DIGITAL_INPUT
Definition bbt_device.h:536
@ Digital_Input_Output
Definition bbt_device.h:457
The bbt_device_signal_t class.
Definition bbt_device.h:565
enum bbt_device_signal_type_t type
Definition bbt_device.h:567
Note
Calling bbt_device_enable_signal on the DIO signal applies the default mode of 1, which is equivalent to DIGITAL_INPUT. If you need the port to emit pulses, you have to call bbt_device_set_signal_mode explicitly.
See also
bbt_device_set_signal_mode, Digital_Input_Output, Digital I/O (DIO) port
Enumerator
DISABLED 

Port inactive. The DIO signal is not acquired. Equivalent to bbt_device_disable_signal.

DIGITAL_INPUT 

Input: the port receives trigger signals from compatible accessories and external equipment (a button box, a pedal, a TTL cable, etc.). Equivalent to bbt_device_enable_signal

DIGITAL_OUTPUT 

Output: the port generates TTL pulses that the digital input of another device can receive over a TTL cable, synchronizing with other Bitbrain devices or external acquisition systems at sample level. The port sends a pulse every 30 s, each one randomly either short (125 ms) or long (250 ms).

Function Documentation

◆ bbt_device_get_hardware_version()

BBT_SDK_API int bbt_device_get_hardware_version ( const bbt_device_t *  device,
unsigned short *  major,
unsigned short *  minor 
)

Gets the major and minor versions of the device hardware.

Parameters
deviceThe handle to the device
majorThe number of major version
minorThe number of minor version
Returns
True on success, false otherwise.

◆ bbt_device_get_firmware_version()

BBT_SDK_API int bbt_device_get_firmware_version ( const bbt_device_t *  device,
unsigned short *  major,
unsigned short *  minor 
)

Gets the major and minor versions of the device firmware.

Parameters
deviceThe handle to the device
majorThe number of major version
minorThe number of minor version
Returns
True on success, false otherwise.

◆ bbt_device_get_frequency()

BBT_SDK_API unsigned short bbt_device_get_frequency ( const bbt_device_t *  device)

Returns the frequency that the device communicates new data when acquiring.

On acquisition, you should call bbt_device_read at this frequency to avoid data loss

Parameters
deviceThe handle to the device
Returns
The frequency value in Hz. 0 If something went wrong.

◆ bbt_device_set_frequency()

BBT_SDK_API int bbt_device_set_frequency ( bbt_device_t *  device,
enum bbt_powerline_frequency_t  powerline_info 
)

Sets the powerline frequency for the device.

Parameters
deviceThe handle to the device
powerline_infoThe powerline frequency to apply, see bbt_powerline_frequency_t

◆ bbt_device_get_powerline_frequency()

BBT_SDK_API const int bbt_device_get_powerline_frequency ( const bbt_device_t *  device)

Gets the powerline frequency for the device.

Parameters
deviceThe handle to the device
Returns
The frequency value in Hz.

◆ bbt_device_get_conn_type()

BBT_SDK_API const char * bbt_device_get_conn_type ( const bbt_device_t *  device)

Gets the connection type (usb or bluetooth)

Returns
string with the connection type

◆ bbt_device_get_versatile_plus_sampling_rate()

BBT_SDK_API const int bbt_device_get_versatile_plus_sampling_rate ( const bbt_device_t *  device)

Gets the sampling rate for the versatile plus signals.

Returns
Sampling rate for the versatile plus signals (except IMU)

◆ bbt_device_get_type()

BBT_SDK_API enum bbt_device_type_t bbt_device_get_type ( const bbt_device_t *  device)

Gets the type of the device that has been configured.

Parameters
deviceThe handle to the device
Returns
the bbt_device_type_t value for the device that is being used

◆ bbt_device_get_signals()

BBT_SDK_API int bbt_device_get_signals ( const bbt_device_t *  device,
unsigned short *  n,
const struct bbt_device_signal_t **  device_signals 
)

Get the list of signals available in the device.

The order of the list is crucial to be able to index the data received during acquisition with bbt_device_read.

Parameters
deviceThe handle to the device
nOutput parameter to receive the number of signals 0 <= n <= 10.
device_signalsOutput parameter to receive the array of pointers to bbt_device_signal_t. The index in this array will be used to identify the signal in the device in other functions.
Returns
True on success. False otherwise

◆ bbt_device_get_signal_mode()

BBT_SDK_API int bbt_device_get_signal_mode ( const bbt_device_t *  device,
unsigned short  n 
)

Gets the configuration mode of a signal in the device.

Parameters
deviceThe handle of the device
nThe index of the signal as returned in the bbt_device_get_signals function.
Returns
The mode of the signal. 0 if it is disabled (not acquired). Values different from 0 indicate that the signal is being acquired.

◆ bbt_device_enable_signal()

BBT_SDK_API int bbt_device_enable_signal ( bbt_device_t *  device,
unsigned short  n 
)

Enables the acquisition of this signal.

The signal is enabled with its default mode.

Note
This is not sufficient for the Versatile Plus DIO signal (Digital_Input_Output), which is directional. The default mode applied here is equivalent to DIGITAL_INPUT, so the port will only read triggers. To make it emit pulses, choose the direction explicitly with bbt_device_set_signal_mode and a bbt_device_versatile_plus_dio_mode value. See Digital I/O (DIO) port for more information regarding the Versatile Plus DIO signal.
Parameters
deviceThe handle to the device
nThe index of the signal to enable, as returned in the array from function bbt_device_get_signals
Returns
True on success, false otherwise

◆ bbt_device_disable_signal()

BBT_SDK_API int bbt_device_disable_signal ( bbt_device_t *  device,
unsigned short  n 
)

Disables the acquisition of this signal.

Parameters
deviceThe handle to the device
nThe index of the signal to disable, as returned in the array from function bbt_device_get_signals
Returns
True on success, false otherwise

◆ bbt_device_set_signal_mode()

BBT_SDK_API int bbt_device_set_signal_mode ( bbt_device_t *  device,
unsigned short  n,
int  mode 
)

Sets the mode to a specific value.

‍[!NOTE] For most signals this function is not needed, as they can be enabled and

disabled with bbt_device_enable_signal and bbt_device_disable_signal. Only specific signals require it.

The Versatile Plus Digital I/O signal (Digital_Input_Output) is one such signal: this function is the only way to select whether the port reads triggers or emits the signal. Pass a bbt_device_versatile_plus_dio_mode value as mode:

bbt_device_set_signal_mode(device, dio_index, DISABLED); // signal disabled
bbt_device_set_signal_mode(device, dio_index, DIGITAL_INPUT); // read triggers
bbt_device_set_signal_mode(device, dio_index, DIGITAL_OUTPUT); // emit TTL pulses
@ DISABLED
Definition bbt_device.h:530
@ DIGITAL_OUTPUT
Definition bbt_device.h:544

See Digital I/O (DIO) port for the full description of the port.

Parameters
deviceThe handle to the device
nThe index of the signal to set the mode, as returned in the array from function bbt_device_get_signals
modeThe mode to set. Acceptable values are from 0 to 255. A value of 0 disables the signal. For the DIO signal, use bbt_device_versatile_plus_dio_mode rather than a raw number.
Returns
True on success, false otherwise

◆ bbt_device_has_sd_card_capabilities()

BBT_SDK_API int bbt_device_has_sd_card_capabilities ( const bbt_device_t *  device)

Check if the device has SD Card capabilities to record the data.

Parameters
deviceThe handle to the device
Returns
True if the device can record data in the SD Card. False otherwise.

◆ bbt_device_is_sd_card_enabled()

BBT_SDK_API int bbt_device_is_sd_card_enabled ( const bbt_device_t *  device)

Check if the SD Card recording is enabled in the device.

Parameters
deviceThe handle to the device
Returns
True if the recording to the SD card is enabled. False otherwise

◆ bbt_device_enable_sd_card()

BBT_SDK_API int bbt_device_enable_sd_card ( bbt_device_t *  device,
const char *  recording_folder_path,
const char *  recording_name 
)

Enable the SD Card recording in the device.

Data is recorded in the device while acquired and can be recorded after the acquisition has stopped with the import functions.

Parameters
deviceThe handle to the device
recording_folder_pathThe full path of a folder in the SD Card where the recording will take place
recording_nameA name to identify the recording. It will be used for the file names created in the SD Card and to identify them upon import.
Returns
True on success. False otherwise

◆ bbt_device_disable_sd_card()

BBT_SDK_API int bbt_device_disable_sd_card ( bbt_device_t *  device)

Disable the SD Card recording in the device.

Parameters
deviceThe handle to the device
Returns
True on success. False otherwise