Bitbrain SDK 2.10.6
Bitbrain SDK
Loading...
Searching...
No Matches
bbt_device.h
Go to the documentation of this file.
1#ifndef BBT_DEVICE_H
2#define BBT_DEVICE_H
3
45#if defined(WIN32) || defined(_WIN32)
46#ifdef BBT_SDK_STATIC_DEFINE
47#define BBT_SDK_API
48#define BBT_SDK_NO_EXPORT
49#else
50#ifndef BBT_SDK_API
51#ifdef BBT_SDK_EXPORTS
52/* We are building this library */
53#define BBT_SDK_API __declspec(dllexport)
54#else
55/* We are using this library */
56#define BBT_SDK_API __declspec(dllimport)
57#endif
58#endif
59
60#ifndef BBT_SDK_NO_EXPORT
61#define BBT_SDK_NO_EXPORT
62#endif
63#endif
64#else
65#define BBT_SDK_API
66#endif
67
68#ifndef BBT_SDK_DEPRECATED
69#define BBT_SDK_DEPRECATED __declspec(deprecated)
70#endif
71
72#ifndef BBT_SDK_DEPRECATED_EXPORT
73#define BBT_SDK_DEPRECATED_EXPORT BBT_SDK_API BBT_SDK_DEPRECATED
74#endif
75
76#ifndef BBT_SDK_DEPRECATED_NO_EXPORT
77#define BBT_SDK_DEPRECATED_NO_EXPORT BBT_SDK_NO_EXPORT BBT_SDK_DEPRECATED
78#endif
79
80#if 0 /* DEFINE_NO_DEPRECATED */
81#ifndef BBT_SDK_NO_DEPRECATED
82#define BBT_SDK_NO_DEPRECATED
83#endif
84#endif
85
86#ifdef __cplusplus
87extern "C"
88{
89#endif
90
114 typedef struct bbt_device_s bbt_device_t;
115
122 BBT_SDK_API bbt_device_t* bbt_device_new_air(const char* device_name);
123
130 BBT_SDK_API bbt_device_t* bbt_device_new_diadem(const char* device_name);
131
138 BBT_SDK_API bbt_device_t* bbt_device_new_hero(const char* device_name);
139
146 BBT_SDK_API bbt_device_t* bbt_device_new_versatile_8(const char* device_name);
147
154 BBT_SDK_API bbt_device_t* bbt_device_new_versatile_16(const char* device_name);
155
162 BBT_SDK_API bbt_device_t* bbt_device_new_versatile_32(const char* device_name);
163
171 BBT_SDK_API bbt_device_t* bbt_device_new_versatile_64(const char* left_device_name, const char* right_device_name);
172
179 BBT_SDK_API bbt_device_t* bbt_device_new_versatile_bio(const char* device_name);
180
187 BBT_SDK_API bbt_device_t* bbt_device_new_ring(const char* device_name);
188
195 BBT_SDK_API bbt_device_t* bbt_device_new_ikon(const char* device_name);
196
203 BBT_SDK_API bbt_device_t* bbt_device_new_ikon_sleep(const char* device_name);
204
213 BBT_SDK_API bbt_device_t* bbt_device_new_versatile_plus_16(const char* device_name, const char* connection_type, unsigned short sampling_rate);
214
223 BBT_SDK_API bbt_device_t* bbt_device_new_versatile_plus_32(const char* device_name, const char* connection_type, unsigned short sampling_rate);
224
230 BBT_SDK_API void bbt_device_free(bbt_device_t* device);
231
269 BBT_SDK_API int bbt_device_run_connection_server(const char* connection_server_folder, int connection_timeout);
270
278
286 BBT_SDK_API int bbt_device_connect(bbt_device_t* device);
287
298 BBT_SDK_API int bbt_device_disconnect(bbt_device_t* device);
299
309 BBT_SDK_API int bbt_device_reconnect(bbt_device_t* device);
310
317 BBT_SDK_API int bbt_device_is_connected(const bbt_device_t* device);
318
340 BBT_SDK_API int
341 bbt_device_get_hardware_version(const bbt_device_t* device, unsigned short* major, unsigned short* minor);
342
351 BBT_SDK_API int
352 bbt_device_get_firmware_version(const bbt_device_t* device, unsigned short* major, unsigned short* minor);
353
364 BBT_SDK_API unsigned short bbt_device_get_frequency(const bbt_device_t* device);
365
380
390 BBT_SDK_API int bbt_device_set_frequency(bbt_device_t *device, enum bbt_powerline_frequency_t powerline_info);
391
401 BBT_SDK_API const int bbt_device_get_powerline_frequency(const bbt_device_t *device);
402
410 BBT_SDK_API const char* bbt_device_get_conn_type(const bbt_device_t* device);
411
419 BBT_SDK_API const int bbt_device_get_versatile_plus_sampling_rate(const bbt_device_t *device);
420
459
468 {
469 AIR = 0,
470 DIADEM,
471 HERO,
472 VERSATILE_8,
473 VERSATILE_16,
474 VERSATILE_32,
475 VERSATILE_64,
476 VERSATILE_BIO,
477 RING,
478 IKON,
479 IKON_SLEEP,
480 VERSATILE_PLUS_16,
481 VERSATILE_PLUS_32,
482 };
483
546
555 BBT_SDK_API enum bbt_device_type_t bbt_device_get_type(const bbt_device_t* device);
556
565 {
568
570 unsigned short channels;
571
573 unsigned short samples_in_block;
574
576 unsigned short sampling_rate;
577 };
578
592 BBT_SDK_API int bbt_device_get_signals(const bbt_device_t* device,
593 unsigned short* n,
594 const struct bbt_device_signal_t** device_signals);
595
605 BBT_SDK_API int bbt_device_get_signal_mode(const bbt_device_t* device, unsigned short n);
606
625 BBT_SDK_API int bbt_device_enable_signal(bbt_device_t* device, unsigned short n);
626
635 BBT_SDK_API int bbt_device_disable_signal(bbt_device_t* device, unsigned short n);
636
668 BBT_SDK_API int bbt_device_set_signal_mode(bbt_device_t* device, unsigned short n, int mode);
669
677 BBT_SDK_API int bbt_device_has_sd_card_capabilities(const bbt_device_t* device);
678
686 BBT_SDK_API int bbt_device_is_sd_card_enabled(const bbt_device_t* device);
687
703 BBT_SDK_API int
704 bbt_device_enable_sd_card(bbt_device_t* device, const char* recording_folder_path, const char* recording_name);
705
713 BBT_SDK_API int bbt_device_disable_sd_card(bbt_device_t* device);
714
743 BBT_SDK_API int bbt_device_start(bbt_device_t* device);
744
755 BBT_SDK_API int bbt_device_stop(bbt_device_t* device);
756
764 BBT_SDK_API int bbt_device_is_acquiring(const bbt_device_t* device);
765
781 BBT_SDK_API extern const short bbt_device_battery_unknown;
782 BBT_SDK_API extern const short bbt_device_battery_charging;
805 BBT_SDK_API extern const unsigned short bbt_device_impedance_unknown;
809 BBT_SDK_API extern const unsigned short bbt_device_impedance_saturated;
813 BBT_SDK_API extern const unsigned short bbt_device_impedance_bad;
817 BBT_SDK_API extern const unsigned short bbt_device_impedance_fair;
821 BBT_SDK_API extern const unsigned short bbt_device_impedance_good;
822
845 {
847 unsigned short sequence;
848
850 short battery;
851
853 unsigned short flags;
854
856 double* signal_data[10];
857
859 unsigned short* impedances;
860 };
861
873 BBT_SDK_API int bbt_device_read(bbt_device_t* device, struct bbt_device_data_block_t* block);
874
921
935 BBT_SDK_API int
936 bbt_device_import_sd_record(const char* input_folder, const char* recording_name, const char* output_folder, enum bbt_device_type_t dev_type, enum bbt_powerline_frequency_t powerline_info, const char *version);
937
957 BBT_SDK_API int bbt_device_import_eeg64_sd_record(const char* left_input_folder,
958 const char* right_input_folder,
959 const char* recording_name,
960 const char* output_folder,
961 enum bbt_device_type_t dev_type,
962 enum bbt_powerline_frequency_t powerline_info,
963 const char *version);
964
965
1071#ifdef __cplusplus
1072}
1073#endif
1074
1075#endif // BBT_DEVICE_H
BBT_SDK_API int bbt_device_start(bbt_device_t *device)
Sets the device into acquisition mode.
BBT_SDK_API int bbt_device_stop(bbt_device_t *device)
Stops acquisition mode and enters configuration mode.
BBT_SDK_API int bbt_device_read(bbt_device_t *device, struct bbt_device_data_block_t *block)
Read a data block from a device.
BBT_SDK_API int bbt_device_is_acquiring(const bbt_device_t *device)
Checks if the device is in acquisition mode.
BBT_SDK_API const short bbt_device_battery_charging
BBT_SDK_API bbt_device_t * bbt_device_new_diadem(const char *device_name)
Creates an instance of a handler to a diadem type device.
BBT_SDK_API bbt_device_t * bbt_device_new_versatile_64(const char *left_device_name, const char *right_device_name)
Creates an instance of a handler to a 64-channels versatile type device.
BBT_SDK_API bbt_device_t * bbt_device_new_ikon(const char *device_name)
Creates an instance of a handler to an ikon type device.
BBT_SDK_API bbt_device_t * bbt_device_new_versatile_bio(const char *device_name)
Creates an instance of a handler to a biosignal versatile type device.
BBT_SDK_API bbt_device_t * bbt_device_new_ikon_sleep(const char *device_name)
Creates an instance of a handler to a ikon-sleep type device.
struct bbt_device_s bbt_device_t
bbt_device_t is an opaque type that identifies a connection to a device
Definition bbt_device.h:114
BBT_SDK_API bbt_device_t * bbt_device_new_versatile_16(const char *device_name)
Creates an instance of a handler to a 16-channels versatile type device.
BBT_SDK_API bbt_device_t * bbt_device_new_versatile_plus_16(const char *device_name, const char *connection_type, unsigned short sampling_rate)
Creates an instance of a handler to a versatile plus type device with 16 channels.
BBT_SDK_API bbt_device_t * bbt_device_new_air(const char *device_name)
Creates an instance of a handler to an air type device.
BBT_SDK_API bbt_device_t * bbt_device_new_versatile_plus_32(const char *device_name, const char *connection_type, unsigned short sampling_rate)
Creates an instance of a handler to a versatile plus type device with 32 channels.
BBT_SDK_API bbt_device_t * bbt_device_new_versatile_8(const char *device_name)
Creates an instance of a handler to an 8-channels versatile type device.
BBT_SDK_API bbt_device_t * bbt_device_new_versatile_32(const char *device_name)
Creates an instance of a handler to a 32-channels versatile type device.
BBT_SDK_API void bbt_device_free(bbt_device_t *device)
Destroys the handler to a device.
BBT_SDK_API bbt_device_t * bbt_device_new_hero(const char *device_name)
Creates an instance of a handler to a hero type device.
BBT_SDK_API bbt_device_t * bbt_device_new_ring(const char *device_name)
Creates an instance of a handler to a ring type device.
BBT_SDK_API int bbt_device_reconnect(bbt_device_t *device)
Recovers from accidental disconnection.
BBT_SDK_API int bbt_device_connect(bbt_device_t *device)
Initiates the connection to the device.
BBT_SDK_API int bbt_device_disconnect(bbt_device_t *device)
Disconnects from the device and clears the information from the device.
BBT_SDK_API int bbt_device_run_connection_server(const char *connection_server_folder, int connection_timeout)
Starts the servers needed to establish the connections to the devices.
BBT_SDK_API int bbt_device_is_connected(const bbt_device_t *device)
Returns the state of the connection with the device.
BBT_SDK_API int bbt_device_kill_connection_server()
Kills the connection servers.
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 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_get_signal_mode(const bbt_device_t *device, unsigned short n)
Gets the configuration mode of a signal in the device.
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_powerline_frequency_t
Powerline frequency options.
Definition bbt_device.h:375
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_device_versatile_plus_dio_mode
Signal modes of the Versatile Plus Digital I/O (DIO) port.
Definition bbt_device.h:528
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 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_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_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 int bbt_device_disable_sd_card(bbt_device_t *device)
Disable the SD Card recording in the device.
bbt_device_type_t
Supported Bitbrain devices.
Definition bbt_device.h:468
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_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_device_signal_type_t
Types of signal a Bitbrain device can acquire.
Definition bbt_device.h:434
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 const int bbt_device_get_powerline_frequency(const bbt_device_t *device)
Gets the powerline frequency for the device.
@ POWERLINE_50
Definition bbt_device.h:377
@ POWERLINE_DISABLED
Definition bbt_device.h:376
@ POWERLINE_60
Definition bbt_device.h:378
@ DIGITAL_INPUT
Definition bbt_device.h:536
@ DISABLED
Definition bbt_device.h:530
@ DIGITAL_OUTPUT
Definition bbt_device.h:544
@ BVP
Definition bbt_device.h:437
@ EEG
Definition bbt_device.h:441
@ GSR
Definition bbt_device.h:443
@ Digital_Aux
Definition bbt_device.h:438
@ Analog_Aux
Definition bbt_device.h:436
@ Digital_Output
Definition bbt_device.h:440
@ Photodiode
Definition bbt_device.h:445
@ Digital_Input_Output
Definition bbt_device.h:457
@ Digital_Input
Definition bbt_device.h:439
@ EXG
Definition bbt_device.h:442
@ PPG
Definition bbt_device.h:446
@ IMU
Definition bbt_device.h:444
@ Accelerometer
Definition bbt_device.h:435
BBT_SDK_API const unsigned short bbt_device_impedance_unknown
The impedance/quality is being computed.
BBT_SDK_API const unsigned short bbt_device_impedance_saturated
The channel is saturated.
BBT_SDK_API const unsigned short bbt_device_impedance_bad
The impedance/quality of the channel is bad.
BBT_SDK_API const unsigned short bbt_device_impedance_fair
The impedance/quality of the channel is fair.
BBT_SDK_API const unsigned short bbt_device_impedance_good
The impedance/quality of the channel is good.
BBT_SDK_API int bbt_mount_versatile_plus_sd_card(bbt_device_t *device)
Mount SD volume in Versatile Plus devices to import data from them.
BBT_SDK_API int bbt_device_import_eeg64_sd_record(const char *left_input_folder, const char *right_input_folder, const char *recording_name, const char *output_folder, enum bbt_device_type_t dev_type, enum bbt_powerline_frequency_t powerline_info, const char *version)
Imports a recording from the SD Card of a 64-channels versatile device.
BBT_SDK_API int bbt_device_import_sd_record(const char *input_folder, const char *recording_name, const char *output_folder, enum bbt_device_type_t dev_type, enum bbt_powerline_frequency_t powerline_info, const char *version)
Imports a recording from the SD Card of any Bitbrain device except from a 64-channels versatile devic...
The bbt_device_data_block_t class.
Definition bbt_device.h:845
unsigned short * impedances
Definition bbt_device.h:859
double * signal_data[10]
Definition bbt_device.h:856
unsigned short flags
Definition bbt_device.h:853
short battery
Definition bbt_device.h:850
unsigned short sequence
Definition bbt_device.h:847
The bbt_device_signal_t class.
Definition bbt_device.h:565
unsigned short channels
Definition bbt_device.h:570
unsigned short samples_in_block
Definition bbt_device.h:573
enum bbt_device_signal_type_t type
Definition bbt_device.h:567
unsigned short sampling_rate
Definition bbt_device.h:576