dotstack API Reference
1.10.37
|
The Host Controller Interface (HCI) provides a uniform interface method of accessing a Bluetooth Controller's capabilities. More...
Macros | |
#define | bt_hci_add_param_uint(cmd, value) bt_hci_add_param_int(cmd, (bt_int)(value)) |
Add unsigned int parameter to an HCI command. | |
#define | bt_hci_add_param_ulong(cmd, value) bt_hci_add_param_long(cmd, (bt_long)(value)) |
Add unsigned long parameter to an HCI command. | |
#define | bt_hci_add_param_hconn(pcmd, value) bt_hci_add_param_int(pcmd, value) |
Add connection handle parameter to an HCI command. | |
#define | bt_hci_get_param_hconn(pcmd, pvalue, poffset) bt_hci_get_param_int(pcmd, pvalue, poffset) |
Get connection handle parameter from HCI command. | |
#define | bt_hci_get_evt_param_hconn(pevt, pvalue, poffset) bt_hci_get_evt_param_int(pevt, pvalue, poffset) |
Get connection handle parameter from HCI event. | |
#define | bt_hci_request_remote_name(pbdaddr, pg_scan_rpt_mode, clock_offset, cb) bt_hci_request_remote_name_ex(pbdaddr, pg_scan_rpt_mode, clock_offset, cb, NULL) |
Request remote device's name. More... | |
Typedefs | |
typedef void(* | bt_hci_start_callback_fp) (bt_bool success, void *param) |
HCI initialization callback. More... | |
typedef void(* | bt_hci_stop_callback_fp) (void *param) |
HCI stop callback. More... | |
typedef void(* | bt_hci_connect_callback_fp) (bt_byte status, bt_hci_conn_state_t *pconn, void *param) |
HCI connect callback. More... | |
typedef void(* | bt_hci_disconnect_callback_fp) (bt_byte status, bt_byte reason, bt_hci_conn_state_t *pconn, void *param) |
HCI disconnect callback. More... | |
Functions | |
bt_hci_command_t * | bt_hci_alloc_command (bt_int opcode, bt_hci_cmd_callback_fp callback) |
Allocate and initialize an HCI command structure. | |
void | bt_hci_free_command (bt_hci_command_t *cmd) |
Free HCI command. | |
bt_hci_command_t * | bt_hci_alloc_canned_command (const bt_byte *canned_command, bt_hci_cmd_callback_fp callback) |
Allocate and initialize an HCI command structure for a canned (pre-formatted) command. | |
bt_bool | bt_hci_add_param_byte (bt_hci_command_t *pcmd, bt_byte value) |
Add byte parameter to an HCI command. | |
bt_bool | bt_hci_add_param_int (bt_hci_command_t *pcmd, bt_int value) |
Add int parameter to an HCI command. | |
bt_bool | bt_hci_add_param_long (bt_hci_command_t *pcmd, bt_long value) |
Add long parameter to an HCI command. | |
bt_bool | bt_hci_add_param_bdaddr (bt_hci_command_t *pcmd, const bt_bdaddr_t *pbdaddr) |
Add BD address parameter to an HCI command. | |
bt_bool | bt_hci_add_param_string (bt_hci_command_t *pcmd, const char *ps, bt_int len) |
Add string parameter to an HCI command. | |
bt_bool | bt_hci_add_param_cod (bt_hci_command_t *pcmd, bt_long value) |
Add class of device parameter to an HCI command. | |
bt_bool | bt_hci_add_param_linkkey (bt_hci_command_t *pcmd, const bt_linkkey_t *linkkey) |
Add link key parameter to an HCI command. | |
bt_bool | bt_hci_get_param_byte (bt_hci_command_t *pcmd, bt_byte *pvalue, bt_int *offset) |
Get byte parameter from HCI command. | |
bt_bool | bt_hci_get_param_int (bt_hci_command_t *pcmd, bt_int *pvalue, bt_int *poffset) |
Get int parameter from HCI command. | |
bt_bool | bt_hci_get_param_long (bt_hci_command_t *pcmd, bt_long *pvalue, bt_int *poffset) |
Get long parameter from HCI command. | |
bt_bool | bt_hci_get_param_bdaddr (bt_hci_command_t *pcm, bt_bdaddr_t *pvalue, bt_int *poffset) |
Get BD address parameter from HCI command. | |
bt_bool | bt_hci_get_param_linkkey (bt_hci_command_t *pcmd, bt_byte *pvalue, bt_int *poffset) |
Get link key parameter from HCI command. | |
bt_bool | bt_hci_get_evt_param_byte (bt_hci_event_t *pevt, bt_byte *pvalue, bt_int *poffset) |
Get byte parameter from HCI event. | |
bt_bool | bt_hci_get_evt_param_int (bt_hci_event_t *pevt, bt_int *pvalue, bt_int *poffset) |
Get int parameter from HCI event. | |
bt_bool | bt_hci_get_evt_param_long (bt_hci_event_t *pevt, bt_long *pvalue, bt_int *poffset) |
Get long parameter from HCI event. | |
bt_bool | bt_hci_get_evt_param_bdaddr (bt_hci_event_t *pevt, bt_bdaddr_t *pvalue, bt_int *poffset) |
Get bd address parameter from HCI event. | |
bt_bool | bt_hci_get_evt_param_devclass (bt_hci_event_t *pevt, bt_long *pvalue, bt_int *poffset) |
Get class of device parameter from HCI event. | |
bt_bool | bt_hci_get_evt_param_linkkey (bt_hci_event_t *pevt, bt_linkkey_t *pvalue, bt_int *poffset) |
Get link key parameter from HCI event. | |
void | bt_hci_init (void) |
Initialize the HCI layer. More... | |
void | bt_hci_init_ex (bt_byte default_link_policy) |
Initialize the HCI layer. More... | |
bt_bool | bt_hci_start (bt_hci_start_callback_fp callback, void *callback_param, bt_byte enable_scan) |
Start HCI layer. More... | |
void | bt_hci_start_no_init (void) |
Start HCI layer without controller configuration. More... | |
void | bt_hci_stop (bt_hci_stop_callback_fp callback, void *callback_param) |
Stop HCI layer. More... | |
bt_bool | bt_hci_reset (bt_hci_cmd_callback_fp callback, void *callback_param) |
Reset controller. More... | |
bt_bool | bt_hci_connect (bt_bdaddr_t *dest, bt_uint packet_type, bt_byte pg_scan_rpt_mode, bt_byte role_switch, bt_uint acl_config, bt_hci_connect_callback_fp callback, void *param) |
Connect to a remote device. More... | |
bt_bool | bt_hci_connect_ex (bt_bdaddr_t *dest, bt_uint packet_type, bt_byte pg_scan_rpt_mode, bt_byte role_switch, bt_uint acl_config, bt_uint clock_offset, bt_hci_connect_callback_fp cb, void *param) |
Connect to a remote device. More... | |
bt_bool | bt_hci_listen (bt_hci_connect_callback_fp cb, void *param) |
Listen for incoming connections. More... | |
bt_bool | bt_hci_disconnect (bt_hci_conn_state_t *pconn) |
Abort connection. | |
bt_bool | bt_hci_request_remote_name_ex (bt_bdaddr_t *pbdaddr, bt_byte pg_scan_rpt_mode, bt_int clock_offset, bt_hci_request_remote_name_callback_fp cb, void *cb_param) |
Request remote device's name. More... | |
bt_bool | bt_hci_write_local_name (const char *device_name, bt_hci_cmd_callback_fp cb) |
Write local device name. More... | |
bt_bool | bt_hci_write_local_name_ex (const char *device_name, bt_hci_cmd_callback_fp cb, void *callback_param) |
Write local device name. More... | |
The Host Controller Interface (HCI) provides a uniform interface method of accessing a Bluetooth Controller's capabilities.
This module describes function and data structures used to send HCI commands and receive responses.
#define bt_hci_request_remote_name | ( | pbdaddr, | |
pg_scan_rpt_mode, | |||
clock_offset, | |||
cb | |||
) | bt_hci_request_remote_name_ex(pbdaddr, pg_scan_rpt_mode, clock_offset, cb, NULL) |
Request remote device's name.
The function is used to obtain the user-friendly name of another BR/EDR Controller.
pbaddr | Bluetooth address of the remote device. |
pg_scan_rpt_mode | The Page Scan Repetition mode supported by the remote device. |
clock_offset | The difference between local controller's clock and the clock of the remote device. |
cb | Pointer to a callback function that is called when the name has been received. |
TRUE
when an HCI command buffer has been allocated and added to the send queue. FALSE
otherwise. The callback function is not called in this case. typedef void(* bt_hci_connect_callback_fp) (bt_byte status, bt_hci_conn_state_t *pconn, void *param) |
HCI connect callback.
This typedef defines a type for the callback function that is called when HCI connect operation initiated by a call to bt_hci_connect() is complete.
status | Operation status. It is 0 if connection was successfully established. |
pconn | pointer to a structure representing the established connection. |
param | pointer to arbitrary data passed to the bt_hci_connect() function through its param parameter. |
typedef void(* bt_hci_disconnect_callback_fp) (bt_byte status, bt_byte reason, bt_hci_conn_state_t *pconn, void *param) |
HCI disconnect callback.
This typedef defines a type for the callback function that is called when an HCI connection has been terminated.
status | Operation status. It is 0 if connection has been successfully terminated. |
reason | Reason for disconnection. |
pconn | pointer to a structure representing the connection. |
param | pointer to arbitrary data associated with an event listener. |
typedef void(* bt_hci_start_callback_fp) (bt_bool success, void *param) |
HCI initialization callback.
This typedef defines a function pointer type for the HCI initialization callback functions. Such a function must be passed to the bt_hci_start() function.
success | Specifies whether HCI initialization succeeded or not. |
typedef void(* bt_hci_stop_callback_fp) (void *param) |
HCI stop callback.
This typedef defines a function pointer type for the HCI stop callback functions. Such a function must be passed to the bt_hci_stop() function.
bt_bool bt_hci_connect | ( | bt_bdaddr_t * | dest, |
bt_uint | packet_type, | ||
bt_byte | pg_scan_rpt_mode, | ||
bt_byte | role_switch, | ||
bt_uint | acl_config, | ||
bt_hci_connect_callback_fp | callback, | ||
void * | param | ||
) |
Connect to a remote device.
This function tries to establish an HCI connection with a remote device specified by the Bluetooth address dest
. Upon completion, the callback function specified by the callback
parameter is called.
dest | Bluetooth address of the remote device. |
packet_type | |
role_switch | |
acl_config | |
callback | Pointer to a callback function that is called when the connect operation completes. |
param | Pointer to arbitrary data that is to be passed to the callback function. |
TRUE
when the function succeeds. FALSE
otherwise. The callback function is not called in this case. bt_bool bt_hci_connect_ex | ( | bt_bdaddr_t * | dest, |
bt_uint | packet_type, | ||
bt_byte | pg_scan_rpt_mode, | ||
bt_byte | role_switch, | ||
bt_uint | acl_config, | ||
bt_uint | clock_offset, | ||
bt_hci_connect_callback_fp | cb, | ||
void * | param | ||
) |
Connect to a remote device.
This function tries to establish an HCI connection with a remote device specified by the Bluetooth address dest
. Upon completion, the callback function specified by the callback
parameter is called.
dest | Bluetooth address of the remote device. |
packet_type | |
role_switch | |
acl_config | |
clock_offset | |
callback | Pointer to a callback function that is called when the connect operation completes. |
param | Pointer to arbitrary data that is to be passed to the callback function. |
TRUE
when the function succeeds. FALSE
otherwise. The callback function is not called in this case. void bt_hci_init | ( | void | ) |
Initialize the HCI layer.
This function initializes all internal variables of the HCI layer. The application, unless it's going to use only HCI layer, does not need to call this function as it is implicitly called by bt_sys_init.
This function essentially calls bt_hci_init_ex(HCI_LINK_POLICY_ENABLE_ALL) so all link policy setting are enabled.
void bt_hci_init_ex | ( | bt_byte | default_link_policy | ) |
Initialize the HCI layer.
This function initializes all internal variables of the HCI layer. The application, unless it's going to use only HCI layer, does not need to call this function as it is implicitly called by bt_sys_init_ex.
default_link_policy | default link policy settings. This is a bitmask that defines the initial value of the link policy settings for all new BR/EDR connections. This value can be a combination of the following values:
|
bt_bool bt_hci_listen | ( | bt_hci_connect_callback_fp | cb, |
void * | param | ||
) |
Listen for incoming connections.
callback | Pointer to a callback function that is called when a new incoming connection has been established. |
param | Pointer to arbitrary data that is to be passed to the callback function. |
TRUE
when the function succeeds. FALSE
otherwise. The callback function is not called in this case. bt_bool bt_hci_request_remote_name_ex | ( | bt_bdaddr_t * | pbdaddr, |
bt_byte | pg_scan_rpt_mode, | ||
bt_int | clock_offset, | ||
bt_hci_request_remote_name_callback_fp | cb, | ||
void * | cb_param | ||
) |
Request remote device's name.
The function is used to obtain the user-friendly name of another BR/EDR Controller.
pbaddr | Bluetooth address of the remote device. |
pg_scan_rpt_mode | The Page Scan Repetition mode supported by the remote device. |
clock_offset | The difference between local controller's clock and the clock of the remote device. |
cb | Pointer to a callback function that is called when the name has been received. |
param | Pointer to arbitrary data that is to be passed to the callback function. |
TRUE
when an HCI command buffer has been allocated and added to the send queue. FALSE
otherwise. The callback function is not called in this case. bt_bool bt_hci_reset | ( | bt_hci_cmd_callback_fp | callback, |
void * | callback_param | ||
) |
Reset controller.
This function resets the BT controller.
callback | Completion callback. Called when the controller has been reset. |
callback_param | A pointer to arbitrary data to be passed to the callback callback. |
bt_bool bt_hci_start | ( | bt_hci_start_callback_fp | callback, |
void * | callback_param, | ||
bt_byte | enable_scan | ||
) |
Start HCI layer.
This function starts the HCI layer of the stack. Starting the HCI layer consists essentially of two steps:
Upon completion of controller initialization the callback function passed in the callback
parameter is called.
callback | Completion callback. Called when controller initialization is complete. |
callback_param | A pointer to arbitrary data to be passed to the callback callback. |
enable_scan | This is a bitmask that defines which scans are enabled during the controller configuration. This value can be a combination of the following values:
|
TRUE
when the function succeeds. FALSE
otherwise. The callback function is not called in this case. void bt_hci_start_no_init | ( | void | ) |
Start HCI layer without controller configuration.
This function is similar to bt_hci_start but unlike the former it does not perform the controller configuration. I.e., bt_hci_start_no_init simply calls the HCI transport and makes it receive packets from the controller. The main purpose of this function is make the HCI transport ready to exchange packets if controller needs some vendor specific configuration before it can be used with the stack. E.g., controllers based on CRS8811 chip need loading various values that configure its operating mode using CSR's proprietary protocol. So the application after configuring the HCI transport would call bt_hci_init(), bt_hci_start_no_init() and then load configuration values. Once the vendor specific configuration is done, the application will re-initialize the HCI transport and perform full start of the stack with bt_sys_init() and bt_sys_start().
void bt_hci_stop | ( | bt_hci_stop_callback_fp | callback, |
void * | callback_param | ||
) |
Stop HCI layer.
This function makes the HCI layer inoperable. After this call the application must perform the full reset of the HCI transport and stack.
callback | Completion callback. Called when the HCI layer has been stopped. |
callback_param | A pointer to arbitrary data to be passed to the callback callback. |
bt_bool bt_hci_write_local_name | ( | const char * | device_name, |
bt_hci_cmd_callback_fp | cb | ||
) |
Write local device name.
The Write_Local_Name command provides the ability to modify the user friendly name for the BR/EDR Controller.
device_name | The user friendly name for the BR/EDR Controller |
cb | Pointer to a callback function that is called when the name has been set. |
TRUE
when an HCI command buffer has been allocated and added to the send queue. FALSE
otherwise. The callback function is not called in this case. bt_bool bt_hci_write_local_name_ex | ( | const char * | device_name, |
bt_hci_cmd_callback_fp | cb, | ||
void * | callback_param | ||
) |
Write local device name.
The Write_Local_Name command provides the ability to modify the user friendly name for the BR/EDR Controller.
device_name | The user friendly name for the BR/EDR Controller |
cb | Pointer to a callback function that is called when the name has been set. |
param | Pointer to arbitrary data that is to be passed to the callback function. |
TRUE
when an HCI command buffer has been allocated and added to the send queue. FALSE
otherwise. The callback function is not called in this case.