Bitbrain SDK 2.8.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
15
42
43
44#ifdef WIN32
45#ifdef BBT_SDK_STATIC_DEFINE
46# define BBT_SDK_API
47# define BBT_SDK_NO_EXPORT
48#else
49# ifndef BBT_SDK_API
50# ifdef BBT_SDK_EXPORTS
51/* We are building this library */
52# define BBT_SDK_API __declspec(dllexport)
53# else
54/* We are using this library */
55# define BBT_SDK_API __declspec(dllimport)
56# endif
57# endif
58
59# ifndef BBT_SDK_NO_EXPORT
60# define BBT_SDK_NO_EXPORT
61# endif
62#endif
63#else
64# define BBT_SDK_API
65#endif
66
67#ifndef BBT_SDK_DEPRECATED
68# define BBT_SDK_DEPRECATED __declspec(deprecated)
69#endif
70
71#ifndef BBT_SDK_DEPRECATED_EXPORT
72# define BBT_SDK_DEPRECATED_EXPORT BBT_SDK_API BBT_SDK_DEPRECATED
73#endif
74
75#ifndef BBT_SDK_DEPRECATED_NO_EXPORT
76# define BBT_SDK_DEPRECATED_NO_EXPORT BBT_SDK_NO_EXPORT BBT_SDK_DEPRECATED
77#endif
78
79#if 0 /* DEFINE_NO_DEPRECATED */
80# ifndef BBT_SDK_NO_DEPRECATED
81# define BBT_SDK_NO_DEPRECATED
82# endif
83#endif
84
85#ifdef __cplusplus
86extern "C" {
87#endif
88
103
110typedef struct bbt_device_s bbt_device_t;
111
118BBT_SDK_API bbt_device_t* bbt_device_new_air(const char* device_name);
119
126BBT_SDK_API bbt_device_t* bbt_device_new_diadem(const char* device_name);
127
134BBT_SDK_API bbt_device_t* bbt_device_new_hero(const char* device_name);
135
142BBT_SDK_API bbt_device_t* bbt_device_new_versatile_8(const char* device_name);
143
150BBT_SDK_API bbt_device_t* bbt_device_new_versatile_16(const char* device_name);
151
158BBT_SDK_API bbt_device_t* bbt_device_new_versatile_32(const char* device_name);
159
167BBT_SDK_API bbt_device_t* bbt_device_new_versatile_64(const char* left_device_name, const char* right_device_name);
168
175BBT_SDK_API bbt_device_t* bbt_device_new_versatile_bio(const char* device_name);
176
183BBT_SDK_API bbt_device_t* bbt_device_new_ring(const char* device_name);
184
191BBT_SDK_API bbt_device_t* bbt_device_new_ikon(const char* device_name);
192
199BBT_SDK_API bbt_device_t* bbt_device_new_ikon_sleep(const char* device_name);
200
206BBT_SDK_API void bbt_device_free(bbt_device_t* device);
207
232
242BBT_SDK_API int bbt_device_run_connection_server(const char *connection_server_folder);
243
251
259BBT_SDK_API int bbt_device_connect(bbt_device_t* device);
260
270BBT_SDK_API int bbt_device_disconnect(bbt_device_t* device);
271
281BBT_SDK_API int bbt_device_reconnect(bbt_device_t* device);
282
289BBT_SDK_API int bbt_device_is_connected(const bbt_device_t* device);
290
302
312BBT_SDK_API int bbt_device_get_hardware_version(const bbt_device_t* device, unsigned short* major,unsigned short* minor);
313
322BBT_SDK_API int bbt_device_get_firmware_version(const bbt_device_t* device, unsigned short* major, unsigned short* minor);
323
334BBT_SDK_API unsigned short bbt_device_get_frequency(const bbt_device_t* device);
335
344 Accelerometer = 0,
345 Analog_Aux,
346 BVP,
347 Digital_Aux,
348 Digital_Input,
349 Digital_Output,
350 EEG,
351 EXG,
352 GSR,
353 IMU,
354 Photodiode,
355 PPG,
356};
357
366{
369
371 unsigned short channels;
372
374 unsigned short samples_in_block;
375
377 unsigned short sampling_rate;
378};
379
391BBT_SDK_API int bbt_device_get_signals(const bbt_device_t* device, unsigned short* n, const struct bbt_device_signal_t **device_signals);
392
401BBT_SDK_API int bbt_device_get_signal_mode(const bbt_device_t* device, unsigned short n);
402
411BBT_SDK_API int bbt_device_enable_signal(bbt_device_t* device, unsigned short n);
412
421BBT_SDK_API int bbt_device_disable_signal(bbt_device_t* device, unsigned short n);
422
438BBT_SDK_API int bbt_device_set_signal_mode(bbt_device_t* device, unsigned short n, int mode);
439
448
456BBT_SDK_API int bbt_device_is_sd_card_enabled(const bbt_device_t* device);
457
466BBT_SDK_API int bbt_device_enable_sd_card(bbt_device_t* device, const char* full_recording_path);
467
476
492
503BBT_SDK_API int bbt_device_start(bbt_device_t* device);
504
515BBT_SDK_API int bbt_device_stop(bbt_device_t* device);
516
524BBT_SDK_API int bbt_device_is_acquiring(const bbt_device_t* device);
525
540
541BBT_SDK_API extern const short bbt_device_battery_unknown;
542BBT_SDK_API extern const short bbt_device_battery_charging;
546
563BBT_SDK_API extern const unsigned short bbt_device_impedance_unknown;
567BBT_SDK_API extern const unsigned short bbt_device_impedance_saturated;
571BBT_SDK_API extern const unsigned short bbt_device_impedance_bad;
575BBT_SDK_API extern const unsigned short bbt_device_impedance_fair;
579BBT_SDK_API extern const unsigned short bbt_device_impedance_good;
580
582
583
601{
603 unsigned short sequence;
604
606 short battery;
607
609 unsigned short flags;
610
612 double* signal_data[10];
613
615 unsigned short* impedances;
616};
617
618
630BBT_SDK_API int bbt_device_read(bbt_device_t* device, struct bbt_device_data_block_t* block);
631
632
633#ifdef __cplusplus
634}
635#endif
636
637
638#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 versatile 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:110
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_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_8(const char *device_name)
Creates an instance of a handler to a 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_run_connection_server(const char *connection_server_folder)
Starts the servers needed to stablish the connections to the devices.
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_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 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 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_enable_sd_card(bbt_device_t *device, const char *full_recording_path)
Enable the SD Card recording in 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_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
The bbt_device_signal_type_t enum.
Definition bbt_device.h:343
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.
The bbt_device_data_block_t class.
Definition bbt_device.h:601
unsigned short * impedances
Definition bbt_device.h:615
double * signal_data[10]
Definition bbt_device.h:612
unsigned short flags
Definition bbt_device.h:609
short battery
Definition bbt_device.h:606
unsigned short sequence
Definition bbt_device.h:603
The bbt_device_signal_t class.
Definition bbt_device.h:366
unsigned short channels
Definition bbt_device.h:371
unsigned short samples_in_block
Definition bbt_device.h:374
enum bbt_device_signal_type_t type
Definition bbt_device.h:368
unsigned short sampling_rate
Definition bbt_device.h:377