Bitbrain SDK 2.8.6
Bitbrain SDK
|
Functions to manage the status of the connection to the device. More...
Functions | |
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_kill_connection_server () |
Kills the connection servers. | |
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_reconnect (bbt_device_t *device) |
Recovers from accidental disconnection. | |
BBT_SDK_API int | bbt_device_is_connected (const bbt_device_t *device) |
Returns the state of the connection with the device. |
Functions to manage the status of the connection to the device.
Connnections to Bitbrain devices are managed by processes that run in the background. The rationale behind this decission is to be able to manage multiple connections coordinately. The functions in this SDK interact with the servers to communicate with the devices through them. So, in order to communicate with the devices, the servers must be running as long as any connection is active. Thus, make sure that you start them before any call to bbt_device_connect is performed. After all the devices are disconnected, servers can be safely killed.
Wireless connections can fail if the conditions are not optimal. A failure in the connection will provoke a failure in most of the other functions, as a connection is required to communicate to the device. After a failure in one of the calls, it is important to check the connection status and reconnect if needed (check bbt_device_reconnect). The status of the connection to a Bitbrain device does not change the state of the device acquisition, it just breaks the data stream comming and going. So, if a device was configured, the configuration keeps the same after a reconnection. During acquisition, a disconnection may cause data loss in the live stream of data. But if the SD card is enabled, all the data keeps being recorded in the device even during disconnections.
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.
This servers are mandatory to have a successful connection. Run this function before any call to bbt_device_connect.
connection_server_folder | The folder where the execuables (bthserver and bbt-connection-server) are in the hard drive |
BBT_SDK_API int bbt_device_kill_connection_server | ( | ) |
Kills the connection servers.
BBT_SDK_API int bbt_device_connect | ( | bbt_device_t * | device | ) |
Initiates the connection to the device.
device | The handler 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.
Use this function to make a full disconnection to the device. To solve accidental disconnections, use bbt_device_reconnect.
device | The handler to the device |
BBT_SDK_API int bbt_device_reconnect | ( | bbt_device_t * | device | ) |
Recovers from accidental disconnection.
This function will reconnect the device, keeping all the configurations.
device | The handler to the device |
BBT_SDK_API int bbt_device_is_connected | ( | const bbt_device_t * | device | ) |
Returns the state of the connection with the device.
device | The handle to the device |