KindleBT
Bluetooth functionality for Kindle 11th gen and up
Loading...
Searching...
No Matches
KindleBT Data Structures

Detailed Description

KindleBT-specific data structures.

Warning
As an application, you shouldn't need to use or interact with any of these structs/variables. These are all for use within the internal KindleBT code to provide the API. However, they are documented here since it can help contributors.

Data Structures

struct  bleCallbackVars_t
 Internal struct for certain Bluetooth conditions. More...
struct  device_context_t
 Internal struct for certain Bluetooth conditions during a BLE connection. More...
struct  device_context_array_t
 Internal dynamic array struct for devices context during a BLE connection. More...

Variables

device_context_array_t devices_context
 Internal device_context_array_t.
bleCallbackVars_t callback_vars
 Internal bleCallbackVars_t.
uint32_t gNo_svc
 Internal number of GATT services, often paired with pGgatt_service.
bleGattsService_tpGgatt_service
 Internal reference to a GATT service.
bleConnHandle ble_conn_handle
 Internal BLE connection handle.

Data Structure Documentation

◆ bleCallbackVars_t

struct bleCallbackVars_t

Internal struct for certain Bluetooth conditions.

Deprecated
Mostly replaced by device_context_t and device_context_array_t.

Most of the Bluetooth operations are asynchronous, even if the API call returns immediately. This is because the API call return just indicates whether the request was made successfully or not. To know whether the Bluetooth hardware completed your request (or failed to), you'll need to sign up for different callbacks.

For some of these operations, KindleBT will set up its own callbacks and wait for the condition, this way we can provide a synchronous behaviour to a few of the API calls.

Definition at line 235 of file kindlebt_defines.h.

Data Fields
bool ble_registered
bool bt_enabled
bool gattc_connected
bool gattc_disconnected
bool gattc_discovered
bool got_gatt_db
bool mtu_set

◆ device_context_t

struct device_context_t

Internal struct for certain Bluetooth conditions during a BLE connection.

Most of the Bluetooth operations are asynchronous, even if the API call returns immediately. This is because the API call return just indicates whether the request was made successfully or not. To know whether the Bluetooth hardware completed your request (or failed to), you'll need to sign up for the different callbacks.

For some of these operations, KindleBT will set up its own callbacks and wait for the condition, this way we can provide a synchronous behaviour to a few of the API calls.

Additionally, when we need to share data between a callback and the public API, we'll use this common context to pass the data around.

Definition at line 259 of file kindlebt_defines.h.

Data Fields
uint8_t address[MAC_ADDR_LEN]

BLE connection address, used for context retrieval before a BLE connection

pthread_cond_t cond

Internal condition flag

bool gattc_connected

BLE connection has GATT Client has been established

bool gattc_disconnected

BLE connection has been disconnected

bool gattc_discovered

Services for the BLE connection have been discovered

uint32_t * gattdb_count_out

Paired with gattdb_out, the count for services will be written out

bleGattsService_t ** gattdb_out

Paired with gattdb_count_out, the services will be written out

bool gattdb_retrieved

GATT Services (DB) for the BLE connection have been retrieved. Paired with gattdb_count and gattdb_count_out.

bleConnHandle handle

BLE connection handle, used for context retrieval after a BLE connection

pthread_mutex_t lock

Internal lock

◆ device_context_array_t

struct device_context_array_t

Internal dynamic array struct for devices context during a BLE connection.

Since we may have multiple connections at once, we'll use this dynamic array to keep track of all connections, and remove them once the connection is closed.

See also
device_context_t.

Definition at line 292 of file kindlebt_defines.h.

Data Fields
size_t capacity
size_t count
device_context_t * items

Variable Documentation

◆ ble_conn_handle

bleConnHandle ble_conn_handle
extern

Internal BLE connection handle.

Deprecated
Replaced by device_context_t. After calling bleConnect, the bleConnStateChangedCallback callback will write back the BLE connection handle.

Definition at line 18 of file kindlebt_callbacks.c.

◆ callback_vars

bleCallbackVars_t callback_vars
extern

Internal bleCallbackVars_t.

Deprecated
Mostly replaced by devices_context.

Definition at line 17 of file kindlebt_callbacks.c.

◆ devices_context

device_context_array_t devices_context
extern

Internal device_context_array_t.

See also
device_context_t

Definition at line 23 of file kindlebt_callbacks.c.

◆ gNo_svc

uint32_t gNo_svc
extern

Internal number of GATT services, often paired with pGgatt_service.

Deprecated
Replaced by device_context_t. When calling bleGetDatabase, the it will set gattdb_out and gattdb_count_out for the callback to write out the data directly to the pointers provided by the caller.

Definition at line 20 of file kindlebt_callbacks.c.

◆ pGgatt_service

bleGattsService_t* pGgatt_service
extern

Internal reference to a GATT service.

Deprecated
Replaced by device_context_t. When calling bleGetDatabase, the it will set gattdb_out and gattdb_count_out for the callback to write out the data directly to the pointers provided by the caller.

Definition at line 21 of file kindlebt_callbacks.c.