Driver SDK
1.6
|
Modules | |
Battery level constants | |
Possible values for the output parameter battery of function bbt_driver_read(). | |
Record flags constants | |
Functions | |
BBT_SDK_API int | bbt_driver_start (bbt_driver_t *driver) |
Stars a new recording. More... | |
BBT_SDK_API int | bbt_driver_stop (bbt_driver_t *driver) |
Stops the current recording. More... | |
BBT_SDK_API int | bbt_driver_is_running (const bbt_driver_t *driver) |
Checks if the recording is active. More... | |
BBT_SDK_API unsigned long | bbt_driver_read_data_size (const bbt_driver_t *driver) |
Gets the size of the data vector read on each block depending on the configuration of the driver. More... | |
BBT_SDK_API double * | bbt_driver_read (bbt_driver_t *driver, unsigned short *sequence, short *battery, unsigned short *flags) |
Reads one data message from the device. More... | |
BBT_SDK_API unsigned short | bbt_driver_get_eeg_impedance (const bbt_driver_t *driver, unsigned short index) |
Reads the impedance value for the index channel of the EEG signal (if any) More... | |
Variables | |
BBT_SDK_API const unsigned short | bbt_driver_impedance_unknown |
bbt_driver_impedance_unknown | |
BBT_SDK_API const unsigned short | bbt_driver_impedance_saturated |
bbt_driver_impedance_saturated | |
BBT_SDK_API const unsigned short | bbt_driver_impedance_bad |
bbt_driver_impedance_bad | |
BBT_SDK_API const unsigned short | bbt_driver_impedance_fair |
bbt_driver_impedance_fair | |
BBT_SDK_API const unsigned short | bbt_driver_impedance_good |
bbt_driver_impedance_good | |
Functions manage the recording of data
BBT_SDK_API int bbt_driver_start | ( | bbt_driver_t * | driver | ) |
Stars a new recording.
The device is commanded to start registering the signals configured and sending them to the driver. If the sd card is enabled, the data will also be recorded internally in the device. Take care that any file in the sd card with the same path will be overwriten at this point. You can change the path with bbt_driver_set_folder and bbt_driver_set_file
[in] | driver |
driver
must be not NULLBBT_SDK_API int bbt_driver_stop | ( | bbt_driver_t * | driver | ) |
Stops the current recording.
The device is commanded to stop registering.
[in] | driver |
driver
must be not NULLBBT_SDK_API int bbt_driver_is_running | ( | const bbt_driver_t * | driver | ) |
Checks if the recording is active.
[in] | driver | The driver object |
driver
must be not NULLBBT_SDK_API unsigned long bbt_driver_read_data_size | ( | const bbt_driver_t * | driver | ) |
Gets the size of the data vector read on each block depending on the configuration of the driver.
driver |
BBT_SDK_API double* bbt_driver_read | ( | bbt_driver_t * | driver, |
unsigned short * | sequence, | ||
short * | battery, | ||
unsigned short * | flags | ||
) |
Reads one data message from the device.
[in] | driver | The driver object |
[out] | sequence | The number of the sequence of the message. The memory is managed by the user. |
[out] | battery | The level of the battery of the device. See Battery level constants for more info. The memory is managed by the user. |
[out] | flags | Error flags that alerts about internal problems of the device. See Record flags constants for more info. The memory is managed by the user. |
This function tries to read a data message from the device. The device must be connected and running. The fields data, sequence, battery and flags are filled up with the last data received. No internal buffering is performed. Every time the read function is called, the data stored is overwritten. Extra buffering must be done externally by the user.
The data vector is a list of data_size
doubles with all the data from the signals recorded in the device. It is composed by the concatenation of the signal data blocks as specified by the configuration (see Device Configuration). Only signals enabled (mode > 0) will provide data. The order of the indexes in bbt_driver_get_signal is kept for the data read from different signals. Inside each signal data block, the values are arranged in a channels x samples matrix, as returned by bbt_signal_get_channels and bbt_signal_get_samples, respectively.
As returned in a 1d vector, the matrix is rearranged in channels, i.e. all the samples of one channel are provided before moving to the next channel.
Let's supose we have a 16 channel EEG device. Using the functions from Device Configuration, we can configure the device as follows:
signal | channels | samples | mode |
---|---|---|---|
EEG | 16 | 8 | 1 |
IMU | 9 | 1 | 0 |
Photodiode | 1 | 8 | 0 |
D in | 1 | 8 | 1 |
This means that the bbt_driver_read function will set the parameter data_size
value to 16 * 8 + 1 * 8 = 136.
Also, the data
parameter will contain 136 doubles with the following organization:
BBT_SDK_API unsigned short bbt_driver_get_eeg_impedance | ( | const bbt_driver_t * | driver, |
unsigned short | index | ||
) |
Reads the impedance value for the index
channel of the EEG signal (if any)
driver | The driver object |
index | The number of EEG channel |