dotstack API Reference  1.10.37
Macros | Functions
GAP

The GAP profile defines the generic procedures related to discovery of Bluetooth devices and link management aspects of connecting to Bluetooth devices. More...

Macros

#define bt_gap_request_remote_name(addr, name_buffer, name_buffer_len, callback, callback_param)   bt_gap_request_remote_name_ex(addr, HCI_PAGE_SCAN_REPETITION_MODE_R2, 0, name_buffer, name_buffer_len, callback, callback_param)
 Request remote BR/EDR controller's name. More...
 
#define bt_gap_connect(addr, acl_config, callback, callback_param)
 Make a connection between two BR/EDR devices. More...
 

Functions

bt_bool bt_gap_find_devices (bt_find_devices_t *find, bt_gap_callback_fp callback, void *callback_param)
 Discover nearby Bluetooth (BR/EDR) devices. More...
 
bt_bool bt_gap_cancel_find_devices (void)
 Terminate inquiry started with bt_gap_find_devices(). More...
 
bt_bool bt_gap_set_local_name (const char *device_name, bt_int name_len, bt_gap_callback_fp callback, void *callback_param)
 Set the name of the local BR/EDR controller. More...
 
bt_bool bt_gap_set_class_of_device (bt_ulong cod, bt_gap_callback_fp callback, void *callback_param)
 Set the class of device of the local BR/EDR controller. More...
 
void bt_gap_get_local_address (bt_bdaddr_t *addr)
 Get the local BR/EDR controller's address. More...
 
bt_bool bt_gap_set_scan_params (bt_bool discoverable, bt_ulong discoverable_period, bt_byte discoverable_mode, bt_bool connectable, bt_ulong connectable_period, bt_gap_callback_fp callback, void *callback_param)
 Set discoverability and connectability of the local BR/EDR controller. More...
 
bt_bool bt_gap_request_remote_name_ex (bt_bdaddr_t *addr, bt_byte pg_scan_rpt_mode, bt_int clock_offset, char *name_buffer, bt_uint name_buffer_len, bt_gap_callback_fp callback, void *callback_param)
 Request remote BR/EDR controller's name. More...
 
bt_bool bt_gap_set_link_role (bt_bdaddr_t *addr, bt_byte role, bt_gap_callback_fp callback, void *callback_param)
 Set link role. More...
 
bt_bool bt_gap_set_link_policy (bt_bdaddr_t *addr, bt_uint policy, bt_gap_callback_fp callback, void *callback_param)
 Set link policy. More...
 
bt_bool bt_gap_connect_ex (bt_bdaddr_t *addr, bt_uint packet_type, bt_byte pg_scan_rpt_mode, bt_byte role_switch, bt_uint acl_config, bt_uint clock_offset, bt_gap_callback_fp callback, void *callback_param)
 Make a connection between two BR/EDR devices. More...
 
bt_bool bt_gap_disconnect (bt_bdaddr_t *addr, bt_gap_callback_fp callback, void *callback_param)
 Terminate a connection between two BR/EDR devices. More...
 
bt_bool bt_gap_sniff_mode (bt_bdaddr_t *addr, bt_int min_interval, bt_int max_interval, bt_int attempt_slots, bt_int timeout, bt_gap_callback_fp callback, void *callback_param)
 Put a connection into Sniff mode. More...
 
bt_bool bt_gap_exit_sniff_mode (bt_bdaddr_t *addr, bt_gap_callback_fp callback, void *callback_param)
 Exit SNIFF mode. More...
 
bt_bool bt_gap_eir_add_local_name (const char *local_name)
 Add local name EIR data. More...
 
bt_bool bt_gap_eir_add (bt_byte data_type, const bt_byte *data, bt_byte length)
 Add arbitrary EIR data. More...
 
bt_bool bt_gap_eir_add_uuid16 (bt_byte data_type, const bt_uint *uuid_list, bt_byte uuid_list_size)
 Add a list of 16-bit UUIDs EIR data. More...
 
bt_bool bt_gap_eir_add_uuid32 (bt_byte data_type, const bt_uuid32 *uuid_list, bt_byte uuid_list_size)
 Add a list of 32-bit UUIDs EIR data. More...
 
bt_bool bt_gap_eir_add_uuid128 (bt_byte data_type, const bt_uuid_t *uuid_list, bt_byte uuid_list_size)
 Add a list of 128-bit UUIDs EIR data. More...
 
bt_bool bt_gap_eir_add_vendor (bt_uint vendor_id, bt_byte *data, bt_byte data_len)
 Add vendor specific EIR data. More...
 
bt_bool bt_gap_eir_add_tx_power_level (bt_byte tx_power_level)
 Add transmission power level EIR data. More...
 
bt_bool bt_gap_eir_add_device_id (bt_uint vendor_id_source, bt_uint vendor_id, bt_uint product_id, bt_uint version)
 Add device Id EIR data. More...
 
bt_bool bt_gap_eir_write (bt_gap_callback_fp callback, void *callback_param)
 Write EIR data to controller. More...
 
void bt_gap_eir_clear (void)
 Clear EIR data list. More...
 
bt_bool bt_gap_le_ad_add_local_name (const char *local_name)
 Add local name LE Advertising data. More...
 
bt_bool bt_gap_le_ad_add (bt_byte data_type, const bt_byte *data, bt_byte length)
 Add arbitrary LE Advertising data. More...
 
bt_bool bt_gap_le_ad_add_uuid16 (bt_byte data_type, const bt_uint *uuid_list, bt_byte uuid_list_size)
 Add a list of 16-bit UUIDs LE Advertising data. More...
 
bt_bool bt_gap_le_ad_add_uuid32 (bt_byte data_type, const bt_uuid32 *uuid_list, bt_byte uuid_list_size)
 Add a list of 32-bit UUIDs LE Advertising data. More...
 
bt_bool bt_gap_le_ad_add_uuid128 (bt_byte data_type, const bt_uuid_t *uuid_list, bt_byte uuid_list_size)
 Add a list of 128-bit UUIDs LE Advertising data. More...
 
bt_bool bt_gap_le_ad_add_vendor (bt_uint vendor_id, bt_byte *data, bt_byte data_len)
 Add vendor specific LE Advertising data. More...
 
bt_bool bt_gap_le_ad_add_tx_power_level (bt_byte tx_power_level)
 Add transmission power level LE Advertising data. More...
 
bt_bool bt_gap_le_ad_add_flags (bt_byte flags)
 Add flags LE Advertising data. More...
 
bt_bool bt_gap_le_ad_add_device_id (bt_uint vendor_id_source, bt_uint vendor_id, bt_uint product_id, bt_uint version)
 Add device Id LE Advertising data. More...
 
bt_bool bt_gap_le_ad_add_ibeacon (const bt_uuid_t *uuid, bt_uint major, bt_uint minor, bt_byte tx_power_level)
 Add Apple beacon Advertising data. More...
 
bt_bool bt_gap_le_ad_set (bt_gap_callback_fp callback, void *callback_param)
 Write LE Advertising data to controller. More...
 
void bt_gap_le_ad_clear (void)
 Clear LE Advertising data list. More...
 
bt_bool bt_gap_le_scan_add_local_name (const char *local_name)
 Add local name LE Scan data. More...
 
bt_bool bt_gap_le_scan_add (bt_byte data_type, const bt_byte *data, bt_byte length)
 Add arbitrary LE Scan data. More...
 
bt_bool bt_gap_le_scan_add_uuid16 (bt_byte data_type, const bt_uint *uuid_list, bt_byte uuid_list_size)
 Add a list of 16-bit UUIDs LE Scan data. More...
 
bt_bool bt_gap_le_scan_add_uuid32 (bt_byte data_type, const bt_uuid32 *uuid_list, bt_byte uuid_list_size)
 Add a list of 32-bit UUIDs LE Scan data. More...
 
bt_bool bt_gap_le_scan_add_uuid128 (bt_byte data_type, const bt_uuid_t *uuid_list, bt_byte uuid_list_size)
 Add a list of 128-bit UUIDs LE Scan data. More...
 
bt_bool bt_gap_le_scan_add_vendor (bt_uint vendor_id, bt_byte *data, bt_byte data_len)
 Add vendor specific LE Scan data. More...
 
bt_bool bt_gap_le_scan_add_tx_power_level (bt_byte tx_power_level)
 Add transmission power level LE Scan data. More...
 
bt_bool bt_gap_le_scan_add_flags (bt_byte flags)
 Add flags LE Scan data. More...
 
bt_bool bt_gap_le_scan_add_device_id (bt_uint vendor_id_source, bt_uint vendor_id, bt_uint product_id, bt_uint version)
 Add device Id LE Scan data. More...
 
bt_bool bt_gap_le_scan_add_ibeacon (const bt_uuid_t *uuid, bt_uint major, bt_uint minor, bt_byte tx_power_level)
 Add Apple beacon Scan data. More...
 
bt_bool bt_gap_le_scan_set (bt_gap_callback_fp callback, void *callback_param)
 Write LE Scan data to controller. More...
 
void bt_gap_le_scan_clear (void)
 Clear LE Scan data list. More...
 
bt_bool bt_gap_le_set_advertising_parameters (bt_uint adv_interval_min, bt_uint adv_interval_max, bt_byte adv_type, bt_byte own_address_type, bt_byte direct_address_type, bt_bdaddr_t *direct_address, bt_byte adv_channel_map, bt_byte adv_filter_policy, bt_gap_callback_fp callback, void *callback_param)
 Set Advertising parameters. More...
 
bt_bool bt_gap_le_advertise (bt_bool enable, bt_gap_callback_fp callback, void *callback_param)
 Enable or disable advertising. More...
 
bt_bool bt_gap_le_update_conn_parameters (bt_bdaddr_t *addr, bt_uint min_interval, bt_uint max_interval, bt_uint slave_latency, bt_uint supervision_timeout, bt_gap_callback_fp callback, void *callback_param)
 Update connection parameters. More...
 
bt_bool bt_gap_le_read_phy (bt_bdaddr_t *addr, bt_gap_callback_fp callback, void *callback_param)
 Read current PHYs. More...
 
bt_bool bt_gap_le_set_default_phy (bt_byte all_phys, bt_byte tx_phys, bt_byte rx_phys, bt_gap_callback_fp callback, void *callback_param)
 Set default PHYs. More...
 
bt_bool bt_gap_le_set_phy (bt_bdaddr_t *addr, bt_byte all_phys, bt_byte tx_phys, bt_byte rx_phys, bt_uint phy_options, bt_gap_callback_fp callback, void *callback_param)
 Set current PHYs. More...
 
bt_bool bt_gap_get_rssi (bt_bdaddr_t *addr, bt_char *rssi, bt_gap_callback_fp callback, void *callback_param)
 Get RSSI. More...
 

Detailed Description

The GAP profile defines the generic procedures related to discovery of Bluetooth devices and link management aspects of connecting to Bluetooth devices.

All functions in this module that have a callback are executed through a queue. I.e., when a function is called a request is put into the queue and the function returns. The request is executed later. By default the depth of the queue is 1. Only one function at a time can be called. The second function can only be executed in the callback of the first one. The length of the queue can be changed by adding GAP_MAX_CMD_BUFFERS option to the stack configuration file. This allows to enqueue several requests sequentially.

Macro Definition Documentation

#define bt_gap_connect (   addr,
  acl_config,
  callback,
  callback_param 
)
Value:
bt_gap_connect_ex(addr, HCI_BB_PACKET_TYPE_DM1 | \
HCI_BB_PACKET_TYPE_DH1 | \
HCI_BB_PACKET_TYPE_DM3 | \
HCI_BB_PACKET_TYPE_DH3 | \
HCI_BB_PACKET_TYPE_DM5 | \
HCI_BB_PACKET_TYPE_DH5, \
HCI_PAGE_SCAN_REPETITION_MODE_R0, HCI_ROLE_SWITCH_ALLOW, acl_config, 0, callback, callback_param)
bt_bool bt_gap_connect_ex(bt_bdaddr_t *addr, bt_uint packet_type, bt_byte pg_scan_rpt_mode, bt_byte role_switch, bt_uint acl_config, bt_uint clock_offset, bt_gap_callback_fp callback, void *callback_param)
Make a connection between two BR/EDR devices.

Make a connection between two BR/EDR devices.

This function makes an ACL connection between two BR/EDR devices. No other protocol connections are made. The connection is made with all packet types allowed, page scan repetition mode R0 and role switch allowed.

Parameters
addrThe address of the remote device.
acl_configConnection security settings. The acl_config parameter can be a combination of the following values:
  • HCI_CONFIG_ENABLE_AUTHENTICATION
  • HCI_CONFIG_ENABLE_ENCRYPTION If HCI_CONFIG_ENABLE_AUTHENTICATION is specified, pairing is initiated. If HCI_CONFIG_ENABLE_ENCRYPTION is specified, the link will be encrypted if pairing is successful.
callbackA callback function that is called when the link policy has been set.
callback_paramA pointer to arbitrary data to be passed to the callback.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
#define bt_gap_request_remote_name (   addr,
  name_buffer,
  name_buffer_len,
  callback,
  callback_param 
)    bt_gap_request_remote_name_ex(addr, HCI_PAGE_SCAN_REPETITION_MODE_R2, 0, name_buffer, name_buffer_len, callback, callback_param)

Request remote BR/EDR controller's name.

This function requests a remote BR/EDR controller's name. This is simplified version of bt_gap_request_remote_name_ex(). It can be used if only the address of the remote device is known. bt_gap_request_remote_name_ex() has 2 more parameters which can only be obtained during inquiry - page scan repetition mode and clock offset.

Parameters
addrThe address of the remote device.
name_bufferA pointer to a buffer where the remote device's name will be stored. The pointer has to be permanent, i.e., it cannot be allocate on the stack. The last byte of the buffer is always set to 0. So to receive N bytes of the remote name the buffer has to be N+1 bytes.
name_buffer_lenThe length of the name_buffer.
callbackA callback function that is called when the scan mode has been set.
callback_paramA pointer to arbitrary data to be passed to the callback.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.

Function Documentation

bt_bool bt_gap_cancel_find_devices ( void  )

Terminate inquiry started with bt_gap_find_devices().

This function terminates inquiry started with bt_gap_find_devices(). The function first checks if inquiry is already in progess and tries to terminate it. If inquiry has not yet started it goes through the GAP command queue and removes all pending requests.

Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
bt_bool bt_gap_connect_ex ( bt_bdaddr_t *  addr,
bt_uint  packet_type,
bt_byte  pg_scan_rpt_mode,
bt_byte  role_switch,
bt_uint  acl_config,
bt_uint  clock_offset,
bt_gap_callback_fp  callback,
void *  callback_param 
)

Make a connection between two BR/EDR devices.

This function makes an ACL connection between two BR/EDR devices. No other protocol connections are made.

Parameters
addrThe address of the remote device.
packet_typeA mask that defines which packets the controller can use on the connection. The packet_type parameter can be a combination of the following values:
  • HCI_BB_PACKET_TYPE_DM1
  • HCI_BB_PACKET_TYPE_DH1
  • HCI_BB_PACKET_TYPE_DM3
  • HCI_BB_PACKET_TYPE_DH3
  • HCI_BB_PACKET_TYPE_DM5
  • HCI_BB_PACKET_TYPE_DH5
pg_scan_rpt_modePage scan repetition mode. The value for this parameter is obtained from inquiry. It is safe to set this parameter to HCI_PAGE_SCAN_REPETITION_MODE_R2 if now known. The pg_scan_rpt_mode parameter can be one of the following values:
  • HCI_PAGE_SCAN_REPETITION_MODE_R0
  • HCI_PAGE_SCAN_REPETITION_MODE_R1
  • HCI_PAGE_SCAN_REPETITION_MODE_R2
role_switchDefines if role switch is allowed. The initiator of the connection is the master at the beginning, but the device which a connection is made to can change the role in the process. This parameter defines if the switch is allowed. The role_switch parameter can be one of the following values:
  • HCI_ROLE_SWITCH_DISALLOW
  • HCI_ROLE_SWITCH_ALLOW
acl_configConnection security settings. The acl_config parameter can be a combination of the following values:
  • HCI_CONFIG_ENABLE_AUTHENTICATION
  • HCI_CONFIG_ENABLE_ENCRYPTION If HCI_CONFIG_ENABLE_AUTHENTICATION is specified, pairing is initiated. If HCI_CONFIG_ENABLE_ENCRYPTION is specified, the link will be encrypted if pairing is successful.
clock_offsetRemote device's clock offset
callbackA callback function that is called when the connection has been created.
callback_paramA pointer to arbitrary data to be passed to the callback.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
bt_bool bt_gap_disconnect ( bt_bdaddr_t *  addr,
bt_gap_callback_fp  callback,
void *  callback_param 
)

Terminate a connection between two BR/EDR devices.

This function terminates an ACL connection between two BR/EDR devices.

Parameters
addrThe address of the remote device.
callbackA callback function that is called when the connection has been terminated.
callback_paramA pointer to arbitrary data to be passed to the callback.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
bt_bool bt_gap_eir_add ( bt_byte  data_type,
const bt_byte *  data,
bt_byte  length 
)

Add arbitrary EIR data.

This function does not send the data to controller. The data is only saved in an internal buffer. The actual write is initiated with bt_gap_eir_write().

Parameters
data_typeEIR data type. The data_type parameter can be on of the following values:
  • HCI_EIR_TYPE_FLAGS
  • HCI_EIR_TYPE_UUID16_LIST_MORE_AVAILABLE
  • HCI_EIR_TYPE_UUID16_LIST_COMPLETE
  • HCI_EIR_TYPE_UUID32_LIST_MORE_AVAILABLE
  • HCI_EIR_TYPE_UUID32_LIST_COMPLETE
  • HCI_EIR_TYPE_UUID128_LIST_MORE_AVAILABLE
  • HCI_EIR_TYPE_UUID128_LIST_COMPLETE
  • HCI_EIR_TYPE_LOCAL_NAME_SHORTENED
  • HCI_EIR_TYPE_LOCAL_NAME_COMPLETE
  • HCI_EIR_TYPE_TX_POWER_LEVEL
  • HCI_EIR_TYPE_OOB_COD
  • HCI_EIR_TYPE_OOB_HASH
  • HCI_EIR_TYPE_OOB_RANDOMIZER
  • HCI_EIR_TYPE_DEVICE_ID
  • HCI_EIR_TYPE_SM_TK_VALUE
  • HCI_EIR_TYPE_SM_OOB_FLAGS
  • HCI_EIR_TYPE_SLAVE_CONN_INTERVAL_RANGE
  • HCI_EIR_TYPE_SOLICITATION_UUID16_LIST
  • HCI_EIR_TYPE_SOLICITATION_UUID32_LIST
  • HCI_EIR_TYPE_SOLICITATION_UUID128_LIST
  • HCI_EIR_TYPE_SERVICE_DATA
  • HCI_EIR_TYPE_SERVICE_DATA_UUID16
  • HCI_EIR_TYPE_SERVICE_DATA_UUID32
  • HCI_EIR_TYPE_SERVICE_DATA_UUID128
  • HCI_EIR_TYPE_LE_SECURE_CONNECTIONS_CONFIRMATION_VALUE
  • HCI_EIR_TYPE_LE_SECURE_CONNECTIONS_RANDOM_VALUE
  • HCI_EIR_TYPE_PUBLIC_TARGET_ADDRESS
  • HCI_EIR_TYPE_RANDOM_TARGET_ADDRESS
  • HCI_EIR_TYPE_APPEARANCE
  • HCI_EIR_TYPE_ADVERTISING_INTERVAL
  • HCI_EIR_TYPE_LE_BLUETOOTH_DEVICE_ADDRESS
  • HCI_EIR_TYPE_LE_ROLE
  • HCI_EIR_TYPE_SIMPLE_PAIRING_HASH_C_256
  • HCI_EIR_TYPE_SIMPLE_PAIRING_RANDOMIZER_R_256
  • HCI_EIR_TYPE_3D_INFORMATION_DATA
  • HCI_EIR_TYPE_MANUFACTURER_SPECIFIC
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
bt_bool bt_gap_eir_add_device_id ( bt_uint  vendor_id_source,
bt_uint  vendor_id,
bt_uint  product_id,
bt_uint  version 
)

Add device Id EIR data.

This function does not send the data to controller. The data is only saved in an internal buffer. The actual write is initiated with bt_gap_eir_write().

Parameters
vendor_id_sourceVendor Id source.
vendor_idVendor Id.
product_idProduct Id.
versionVersion.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
bt_bool bt_gap_eir_add_local_name ( const char *  local_name)

Add local name EIR data.

This function does not send the data to controller. The data is only saved in an internal buffer. The actual write is initiated with bt_gap_eir_write().

Parameters
local_nameLocal device name.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
bt_bool bt_gap_eir_add_tx_power_level ( bt_byte  tx_power_level)

Add transmission power level EIR data.

This function does not send the data to controller. The data is only saved in an internal buffer. The actual write is initiated with bt_gap_eir_write().

Parameters
tx_power_levelTransmission power level.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
bt_bool bt_gap_eir_add_uuid128 ( bt_byte  data_type,
const bt_uuid_t *  uuid_list,
bt_byte  uuid_list_size 
)

Add a list of 128-bit UUIDs EIR data.

This function does not send the data to controller. The data is only saved in an internal buffer. The actual write is initiated with bt_gap_eir_write().

Parameters
data_typeEIR data type. The data_type parameter can be on of the following values:
  • HCI_EIR_TYPE_UUID128_LIST_MORE_AVAILABLE
  • HCI_EIR_TYPE_UUID128_LIST_COMPLETE
uuid_listA pointer to an array of 128-bit UUIDs.
uuid_list_sizeNumber of elements in the uuid_list.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
bt_bool bt_gap_eir_add_uuid16 ( bt_byte  data_type,
const bt_uint *  uuid_list,
bt_byte  uuid_list_size 
)

Add a list of 16-bit UUIDs EIR data.

This function does not send the data to controller. The data is only saved in an internal buffer. The actual write is initiated with bt_gap_eir_write().

Parameters
data_typeEIR data type. The data_type parameter can be on of the following values:
  • HCI_EIR_TYPE_UUID16_LIST_MORE_AVAILABLE
  • HCI_EIR_TYPE_UUID16_LIST_COMPLETE
uuid_listA pointer to an array of 16-bit UUIDs.
uuid_list_sizeNumber of elements in the uuid_list.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
bt_bool bt_gap_eir_add_uuid32 ( bt_byte  data_type,
const bt_uuid32 *  uuid_list,
bt_byte  uuid_list_size 
)

Add a list of 32-bit UUIDs EIR data.

This function does not send the data to controller. The data is only saved in an internal buffer. The actual write is initiated with bt_gap_eir_write().

Parameters
data_typeEIR data type. The data_type parameter can be on of the following values:
  • HCI_EIR_TYPE_UUID32_LIST_MORE_AVAILABLE
  • HCI_EIR_TYPE_UUID32_LIST_COMPLETE
uuid_listA pointer to an array of 32-bit UUIDs.
uuid_list_sizeNumber of elements in the uuid_list.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
bt_bool bt_gap_eir_add_vendor ( bt_uint  vendor_id,
bt_byte *  data,
bt_byte  data_len 
)

Add vendor specific EIR data.

This function does not send the data to controller. The data is only saved in an internal buffer. The actual write is initiated with bt_gap_eir_write().

Parameters
vendor_idVendor Id.
dataA pointer to vendor specific EIR data.
data_lenLength of the vendor specific EIR data.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
void bt_gap_eir_clear ( void  )

Clear EIR data list.

This function clears an internal buffer that stores EIR data.

Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
bt_bool bt_gap_eir_write ( bt_gap_callback_fp  callback,
void *  callback_param 
)

Write EIR data to controller.

This function writes the EIR data list creates with bt_gap_eir_add-functions to the controller.

Parameters
callbackA callback function that is called when the EIR data has been written.
callback_paramA pointer to arbitrary data to be passed to the callback.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
bt_bool bt_gap_exit_sniff_mode ( bt_bdaddr_t *  addr,
bt_gap_callback_fp  callback,
void *  callback_param 
)

Exit SNIFF mode.

This function ends the Sniff mode and puts a BR/EDR connection into Active mode.

Parameters
addrThe address of the remote device.
callbackA callback function that is called when the connection has been put into active mode.
callback_paramA pointer to arbitrary data to be passed to the callback.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
bt_bool bt_gap_find_devices ( bt_find_devices_t find,
bt_gap_callback_fp  callback,
void *  callback_param 
)

Discover nearby Bluetooth (BR/EDR) devices.

This function starts inquiry procedure to find nearby BR/EDR devices.

Parameters
findA pointer to a structure that is used to specify inquiry parameters and a buffer where to save information about found devices. The pointer has to be persistent, i.e., it cannot be allocate on the stack.
callbackA callback function that is called when inquiry is completed.
callback_paramA pointer to arbitrary data to be passed to the callback.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
void bt_gap_get_local_address ( bt_bdaddr_t *  addr)

Get the local BR/EDR controller's address.

This function returns the Bluetooth address of the local BR/EDR controller..

Parameters
addrA pointer to bt_bdaddr_t structure where the address is written to.
bt_bool bt_gap_get_rssi ( bt_bdaddr_t *  addr,
bt_char *  rssi,
bt_gap_callback_fp  callback,
void *  callback_param 
)

Get RSSI.

This function gets the RSSI value from a remote device.

Parameters
addrThe address of the remote device.
rssiA pointer to a buffer where the RSSI is stored. The buffer has to be persistent, i.e., it cannot be allocate on the stack.
callbackA callback function that is called when the RSSI value has been received.
callback_paramA pointer to arbitrary data to be passed to the callback.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
bt_bool bt_gap_le_ad_add ( bt_byte  data_type,
const bt_byte *  data,
bt_byte  length 
)

Add arbitrary LE Advertising data.

This function does not send the data to controller. The data is only saved in an internal buffer. The actual write is initiated with bt_gap_le_ad_set().

Parameters
data_typeAdvertising data type.
data_typeA pointer to Advertising data.
lengthLength of the Advertising data.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
bt_bool bt_gap_le_ad_add_device_id ( bt_uint  vendor_id_source,
bt_uint  vendor_id,
bt_uint  product_id,
bt_uint  version 
)

Add device Id LE Advertising data.

This function does not send the data to controller. The data is only saved in an internal buffer. The actual write is initiated with bt_gap_le_ad_set().

Parameters
vendor_id_sourceVendor Id source.
vendor_idVendor Id.
product_idProduct Id.
versionVersion.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
bt_bool bt_gap_le_ad_add_flags ( bt_byte  flags)

Add flags LE Advertising data.

This function does not send the data to controller. The data is only saved in an internal buffer. The actual write is initiated with bt_gap_le_ad_set().

Parameters
flagsFlags. The flags parameter is a combination of teh following values:
  • HCI_LE_ADVERTISING_FLAG_LIMITED_DISCOVERABLE_MODE
  • HCI_LE_ADVERTISING_FLAG_GENERAL_DISCOVERABLE_MODE
  • HCI_LE_ADVERTISING_FLAG_BREDR_NOT_SUPPORTED
  • HCI_LE_ADVERTISING_FLAG_SIMULTANEOUS_LE_BREDR_CONTROLLER
  • HCI_LE_ADVERTISING_FLAG_SIMULTANEOUS_LE_BREDR_HOST
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
bt_bool bt_gap_le_ad_add_ibeacon ( const bt_uuid_t *  uuid,
bt_uint  major,
bt_uint  minor,
bt_byte  tx_power_level 
)

Add Apple beacon Advertising data.

This function does not send the data to controller. The data is only saved in an internal buffer. The actual write is initiated with bt_gap_le_ad_set().

Parameters
uuidBeacon UUID.
majorMajor version number of the beacon.
minorMinor version number of the beacon.
tx_power_levelTransmission power level.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
bt_bool bt_gap_le_ad_add_local_name ( const char *  local_name)

Add local name LE Advertising data.

This function does not send the data to controller. The data is only saved in an internal buffer. The actual write is initiated with bt_gap_le_ad_set().

Parameters
tx_power_levelTransmission power level.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
bt_bool bt_gap_le_ad_add_tx_power_level ( bt_byte  tx_power_level)

Add transmission power level LE Advertising data.

This function does not send the data to controller. The data is only saved in an internal buffer. The actual write is initiated with bt_gap_le_ad_set().

Parameters
tx_power_levelTransmission power level.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
bt_bool bt_gap_le_ad_add_uuid128 ( bt_byte  data_type,
const bt_uuid_t *  uuid_list,
bt_byte  uuid_list_size 
)

Add a list of 128-bit UUIDs LE Advertising data.

This function does not send the data to controller. The data is only saved in an internal buffer. The actual write is initiated with bt_gap_le_ad_set().

Parameters
data_typeAdvertising data type. The data_type parameter can be on of the following values:
  • HCI_EIR_TYPE_UUID128_LIST_MORE_AVAILABLE
  • HCI_EIR_TYPE_UUID128_LIST_COMPLETE
uuid_listA pointer to an array of 128-bit UUIDs.
uuid_list_sizeNumber of elements in the uuid_list.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
bt_bool bt_gap_le_ad_add_uuid16 ( bt_byte  data_type,
const bt_uint *  uuid_list,
bt_byte  uuid_list_size 
)

Add a list of 16-bit UUIDs LE Advertising data.

This function does not send the data to controller. The data is only saved in an internal buffer. The actual write is initiated with bt_gap_le_ad_set().

Parameters
data_typeAdvertising data type. The data_type parameter can be on of the following values:
  • HCI_EIR_TYPE_UUID16_LIST_MORE_AVAILABLE
  • HCI_EIR_TYPE_UUID16_LIST_COMPLETE
uuid_listA pointer to an array of 16-bit UUIDs.
uuid_list_sizeNumber of elements in the uuid_list.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
bt_bool bt_gap_le_ad_add_uuid32 ( bt_byte  data_type,
const bt_uuid32 *  uuid_list,
bt_byte  uuid_list_size 
)

Add a list of 32-bit UUIDs LE Advertising data.

This function does not send the data to controller. The data is only saved in an internal buffer. The actual write is initiated with bt_gap_le_ad_set().

Parameters
data_typeAdvertising data type. The data_type parameter can be on of the following values:
  • HCI_EIR_TYPE_UUID32_LIST_MORE_AVAILABLE
  • HCI_EIR_TYPE_UUID32_LIST_COMPLETE
uuid_listA pointer to an array of 32-bit UUIDs.
uuid_list_sizeNumber of elements in the uuid_list.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
bt_bool bt_gap_le_ad_add_vendor ( bt_uint  vendor_id,
bt_byte *  data,
bt_byte  data_len 
)

Add vendor specific LE Advertising data.

This function does not send the data to controller. The data is only saved in an internal buffer. The actual write is initiated with bt_gap_le_ad_set().

Parameters
vendor_idVendor Id.
dataA pointer to vendor specific Advertising data.
data_lenLength of the vendor specific Advertising data.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
void bt_gap_le_ad_clear ( void  )

Clear LE Advertising data list.

This function clears an internal buffer that stores Advertising data.

Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
bt_bool bt_gap_le_ad_set ( bt_gap_callback_fp  callback,
void *  callback_param 
)

Write LE Advertising data to controller.

This function writes the Advertising data list created with bt_gap_le_ad__add-functions to the controller.

Parameters
callbackA callback function that is called when the Advertising data has been written.
callback_paramA pointer to arbitrary data to be passed to the callback.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
bt_bool bt_gap_le_advertise ( bt_bool  enable,
bt_gap_callback_fp  callback,
void *  callback_param 
)

Enable or disable advertising.

This function enables or disables advertising.

Parameters
enableMinimum advertising interval.
callbackA callback function that is called when the state of advertising has been set.
callback_paramA pointer to arbitrary data to be passed to the callback.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
bt_bool bt_gap_le_read_phy ( bt_bdaddr_t *  addr,
bt_gap_callback_fp  callback,
void *  callback_param 
)

Read current PHYs.

This function reads the current transmitter PHY and receiver PHY on the connection identified by address parameter.

Parameters
addrThe address of the remote device.
callbackA callback function that is called when PHYs have been read.
callback_paramA pointer to arbitrary data to be passed to the callback.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
bt_bool bt_gap_le_scan_add ( bt_byte  data_type,
const bt_byte *  data,
bt_byte  length 
)

Add arbitrary LE Scan data.

This function does not send the data to controller. The data is only saved in an internal buffer. The actual write is initiated with bt_gap_le_scan_set().

Parameters
data_typeScan data type.
data_typeA pointer to Scan data.
lengthLength of the Scan data.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
bt_bool bt_gap_le_scan_add_device_id ( bt_uint  vendor_id_source,
bt_uint  vendor_id,
bt_uint  product_id,
bt_uint  version 
)

Add device Id LE Scan data.

This function does not send the data to controller. The data is only saved in an internal buffer. The actual write is initiated with bt_gap_le_scan_set().

Parameters
vendor_id_sourceVendor Id source.
vendor_idVendor Id.
product_idProduct Id.
versionVersion.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
bt_bool bt_gap_le_scan_add_flags ( bt_byte  flags)

Add flags LE Scan data.

This function does not send the data to controller. The data is only saved in an internal buffer. The actual write is initiated with bt_gap_le_scan_set().

Parameters
flagsFlags. The flags parameter is a combination of teh following values:
  • HCI_LE_ADVERTISING_FLAG_LIMITED_DISCOVERABLE_MODE
  • HCI_LE_ADVERTISING_FLAG_GENERAL_DISCOVERABLE_MODE
  • HCI_LE_ADVERTISING_FLAG_BREDR_NOT_SUPPORTED
  • HCI_LE_ADVERTISING_FLAG_SIMULTANEOUS_LE_BREDR_CONTROLLER
  • HCI_LE_ADVERTISING_FLAG_SIMULTANEOUS_LE_BREDR_HOST
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
bt_bool bt_gap_le_scan_add_ibeacon ( const bt_uuid_t *  uuid,
bt_uint  major,
bt_uint  minor,
bt_byte  tx_power_level 
)

Add Apple beacon Scan data.

This function does not send the data to controller. The data is only saved in an internal buffer. The actual write is initiated with bt_gap_le_scan_set().

Parameters
uuidBeacon UUID.
majorMajor version number of the beacon.
minorMinor version number of the beacon.
tx_power_levelTransmission power level.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
bt_bool bt_gap_le_scan_add_local_name ( const char *  local_name)

Add local name LE Scan data.

This function does not send the data to controller. The data is only saved in an internal buffer. The actual write is initiated with bt_gap_le_scan_set().

Parameters
tx_power_levelTransmission power level.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
bt_bool bt_gap_le_scan_add_tx_power_level ( bt_byte  tx_power_level)

Add transmission power level LE Scan data.

This function does not send the data to controller. The data is only saved in an internal buffer. The actual write is initiated with bt_gap_le_scan_set().

Parameters
tx_power_levelTransmission power level.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
bt_bool bt_gap_le_scan_add_uuid128 ( bt_byte  data_type,
const bt_uuid_t *  uuid_list,
bt_byte  uuid_list_size 
)

Add a list of 128-bit UUIDs LE Scan data.

This function does not send the data to controller. The data is only saved in an internal buffer. The actual write is initiated with bt_gap_le_scan_set().

Parameters
data_typeScan data type. The data_type parameter can be on of the following values:
  • HCI_EIR_TYPE_UUID128_LIST_MORE_AVAILABLE
  • HCI_EIR_TYPE_UUID128_LIST_COMPLETE
uuid_listA pointer to an array of 128-bit UUIDs.
uuid_list_sizeNumber of elements in the uuid_list.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
bt_bool bt_gap_le_scan_add_uuid16 ( bt_byte  data_type,
const bt_uint *  uuid_list,
bt_byte  uuid_list_size 
)

Add a list of 16-bit UUIDs LE Scan data.

This function does not send the data to controller. The data is only saved in an internal buffer. The actual write is initiated with bt_gap_le_scan_set().

Parameters
data_typeScan data type. The data_type parameter can be on of the following values:
  • HCI_EIR_TYPE_UUID16_LIST_MORE_AVAILABLE
  • HCI_EIR_TYPE_UUID16_LIST_COMPLETE
uuid_listA pointer to an array of 16-bit UUIDs.
uuid_list_sizeNumber of elements in the uuid_list.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
bt_bool bt_gap_le_scan_add_uuid32 ( bt_byte  data_type,
const bt_uuid32 *  uuid_list,
bt_byte  uuid_list_size 
)

Add a list of 32-bit UUIDs LE Scan data.

This function does not send the data to controller. The data is only saved in an internal buffer. The actual write is initiated with bt_gap_le_scan_set().

Parameters
data_typeScan data type. The data_type parameter can be on of the following values:
  • HCI_EIR_TYPE_UUID32_LIST_MORE_AVAILABLE
  • HCI_EIR_TYPE_UUID32_LIST_COMPLETE
uuid_listA pointer to an array of 32-bit UUIDs.
uuid_list_sizeNumber of elements in the uuid_list.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
bt_bool bt_gap_le_scan_add_vendor ( bt_uint  vendor_id,
bt_byte *  data,
bt_byte  data_len 
)

Add vendor specific LE Scan data.

This function does not send the data to controller. The data is only saved in an internal buffer. The actual write is initiated with bt_gap_le_scan_set().

Parameters
vendor_idVendor Id.
dataA pointer to vendor specific Scan data.
data_lenLength of the vendor specific Scan data.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
void bt_gap_le_scan_clear ( void  )

Clear LE Scan data list.

This function clears an internal buffer that stores Scan data.

Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
bt_bool bt_gap_le_scan_set ( bt_gap_callback_fp  callback,
void *  callback_param 
)

Write LE Scan data to controller.

This function writes the Scan data list created with bt_gap_le_scan_add-functions to the controller.

Parameters
callbackA callback function that is called when the Scan data has been written.
callback_paramA pointer to arbitrary data to be passed to the callback.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
bt_bool bt_gap_le_set_advertising_parameters ( bt_uint  adv_interval_min,
bt_uint  adv_interval_max,
bt_byte  adv_type,
bt_byte  own_address_type,
bt_byte  direct_address_type,
bt_bdaddr_t *  direct_address,
bt_byte  adv_channel_map,
bt_byte  adv_filter_policy,
bt_gap_callback_fp  callback,
void *  callback_param 
)

Set Advertising parameters.

This function sets Advertising parameters. It should be called when advertising is disabled.

Parameters
adv_interval_minMinimum advertising interval.
adv_interval_maxMaximum advertising interval.
adv_typeAdvertising type. The adv_type parameter can be one of the following values:
  • HCI_LE_ADV_TYPE_CONN_UNDIRECT
  • HCI_LE_ADV_TYPE_DIRECT_HIGH
  • HCI_LE_ADV_TYPE_SCAN
  • HCI_LE_ADV_TYPE_NONCONN
  • HCI_LE_ADV_TYPE_DIRECT_LOW
own_address_typeLocal controller's address type. The own_address_type parameter can be one of the following values:
  • HCI_LE_ADDRESS_TYPE_PUBLIC
  • HCI_LE_ADDRESS_TYPE_RANDOM
direct_address_typeRemote controller's address type. This parameter is used only when adv_type is HCI_LE_ADV_TYPE_DIRECT_HIGH or HCI_LE_ADV_TYPE_DIRECT_LOW The direct_address_type parameter can be one of the following values:
  • HCI_LE_ADDRESS_TYPE_PUBLIC
  • HCI_LE_ADDRESS_TYPE_RANDOM
direct_addressRemote controller's address. This parameter is mandatory if adv_type is HCI_LE_ADV_TYPE_DIRECT_HIGH or HCI_LE_ADV_TYPE_DIRECT_LOW. Fro all other advertising types direct_address can be set to NULL.
adv_channel_mapAdvertising channel map. The adv_channel_map is a combination of the following values:
  • HCI_LE_ADV_CHANNEL_MAP_ENABLE_37
  • HCI_LE_ADV_CHANNEL_MAP_ENABLE_38
  • HCI_LE_ADV_CHANNEL_MAP_ENABLE_39
To enable advertising on all channels adv_channel_map can be set to HCI_LE_ADV_CHANNEL_MAP_ENABLE_ALL
adv_filter_policyAdvertising filter policy. The adv_filter_policy parameter can be one of the following values:
  • HCI_LE_FILTER_POLICY_NOT_USED
  • HCI_LE_FILTER_POLICY_WHITE_LIST
callbackA callback function that is called when the advertising parameters have been set.
callback_paramA pointer to arbitrary data to be passed to the callback.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
bt_bool bt_gap_le_set_default_phy ( bt_byte  all_phys,
bt_byte  tx_phys,
bt_byte  rx_phys,
bt_gap_callback_fp  callback,
void *  callback_param 
)

Set default PHYs.

This function sets default transmitter PHY and receiver PHY used on all subsequent connections.

Parameters
all_physSpecifies whether the host has no preference among the PHYs that the Controller supports in a given direction or whether it has specified particular PHYs that it prefers in the tx_phys or rx_phys parameter. This can be a combination of the following values:
  • HCO_LE_TX_PHY_NO_PREF
  • HCO_LE_RX_PHY_NO_PREF
tx_physIndicates the transmitter PHYs that the Host prefers the Controller to use. This can be a combination of the following values:
  • HCO_LE_TX_PHY_1M
  • HCO_LE_TX_PHY_2M
  • HCO_LE_TX_PHY_CODED
rx_physIndicates the receiver PHYs that the Host prefers the Controller to use. This can be a combination of the following values:
  • HCO_LE_RX_PHY_1M
  • HCO_LE_RX_PHY_2M
  • HCO_LE_RX_PHY_CODED
callbackA callback function that is called when PHYs have been set.
callback_paramA pointer to arbitrary data to be passed to the callback.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
bt_bool bt_gap_le_set_phy ( bt_bdaddr_t *  addr,
bt_byte  all_phys,
bt_byte  tx_phys,
bt_byte  rx_phys,
bt_uint  phy_options,
bt_gap_callback_fp  callback,
void *  callback_param 
)

Set current PHYs.

This function sets the PHYs preferences on the connection identified by addr parameter.

Parameters
addrThe address of the remote device.
all_physSpecifies whether the host has no preference among the PHYs that the Controller supports in a given direction or whether it has specified particular PHYs that it prefers in the tx_phys or rx_phys parameter. This can be a combination of the following values:
  • HCO_LE_TX_PHY_NO_PREF
  • HCO_LE_RX_PHY_NO_PREF
tx_physIndicates the transmitter PHYs that the Host prefers the Controller to use. This can be a combination of the following values:
  • HCO_LE_TX_PHY_1M
  • HCO_LE_TX_PHY_2M
  • HCO_LE_TX_PHY_CODED
rx_physIndicates the receiver PHYs that the Host prefers the Controller to use. This can be a combination of the following values:
  • HCO_LE_RX_PHY_1M
  • HCO_LE_RX_PHY_2M
  • HCO_LE_RX_PHY_CODED
phy_optionsPHY options. This can be one of the following values:
  • HCO_LE_TX_PHY_CODING_NO_PREF
  • HCO_LE_TX_PHY_PREF_CODING_S2
  • HCO_LE_TX_PHY_PREF_CODING_S8
callbackA callback function that is called when PHYs have been read.
callback_paramA pointer to arbitrary data to be passed to the callback.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
bt_bool bt_gap_le_update_conn_parameters ( bt_bdaddr_t *  addr,
bt_uint  min_interval,
bt_uint  max_interval,
bt_uint  slave_latency,
bt_uint  supervision_timeout,
bt_gap_callback_fp  callback,
void *  callback_param 
)

Update connection parameters.

This function updates connection parameters. The function can only be used if local device is Slave.

Parameters
addrThe address of the remote device.
min_intervalMinimum connection interval.
max_intervalMaximum connection interval.
slave_latencySlave latency.
supervision_timeoutConnection supervision timeout.
callbackA callback function that is called when connection parameters have been set.
callback_paramA pointer to arbitrary data to be passed to the callback.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
bt_bool bt_gap_request_remote_name_ex ( bt_bdaddr_t *  addr,
bt_byte  pg_scan_rpt_mode,
bt_int  clock_offset,
char *  name_buffer,
bt_uint  name_buffer_len,
bt_gap_callback_fp  callback,
void *  callback_param 
)

Request remote BR/EDR controller's name.

This function requests a remote BR/EDR controller's name.

Parameters
addrThe address of the remote device.
pg_scan_rpt_modePage Scan repetition mode. If the scan repetition mode of the remote device is unknown this parameters can be safely set HCI_PAGE_SCAN_REPETITION_MODE_R2. The scan repetition mode is obtained during inquiry. The pg_scan_rpt_mode parameter can be one of the following values:
  • HCI_PAGE_SCAN_REPETITION_MODE_R0
  • HCI_PAGE_SCAN_REPETITION_MODE_R1
  • HCI_PAGE_SCAN_REPETITION_MODE_R2
clock_offsetClock offset. If the clock offset of the remote device is unknown it can be safely set to 0. The clock offset is obtained during inquiry.
name_bufferA pointer to a buffer where the remote device's name will be stored. The pointer has to be permanent, i.e., it cannot be allocate on the stack. The last byte of the buffer is always set to 0. So to receive N bytes of the remote name the buffer has to be N+1 bytes.
name_buffer_lenThe length of the name_buffer.
callbackA callback function that is called when the scan mode has been set.
callback_paramA pointer to arbitrary data to be passed to the callback.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
bt_bool bt_gap_set_class_of_device ( bt_ulong  cod,
bt_gap_callback_fp  callback,
void *  callback_param 
)

Set the class of device of the local BR/EDR controller.

This function sets the class of device of the local BR/EDR controller..

Parameters
device_nameThe class of device.
callbackA callback function that is called when the class of device has been set.
callback_paramA pointer to arbitrary data to be passed to the callback.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
bt_bool bt_gap_set_link_policy ( bt_bdaddr_t *  addr,
bt_uint  policy,
bt_gap_callback_fp  callback,
void *  callback_param 
)

Set link policy.

This function sets the policy of an existing connection.

Parameters
addrThe address of the remote device.
policyThe new policy of the connection. The policy parameter can be a combination of the following values:
  • HCI_LINK_POLICY_ENABLE_ROLE_SWITCH
  • HCI_LINK_POLICY_ENABLE_HOLD_MODE
  • HCI_LINK_POLICY_ENABLE_SNIFF_MODE
  • HCI_LINK_POLICY_ENABLE_PARK_STATE
To enable all link modes use HCI_LINK_POLICY_ENABLE_ALL.
callbackA callback function that is called when the link policy has been set.
callback_paramA pointer to arbitrary data to be passed to the callback.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
bt_bool bt_gap_set_link_role ( bt_bdaddr_t *  addr,
bt_byte  role,
bt_gap_callback_fp  callback,
void *  callback_param 
)

Set link role.

This function sets the role of the local BR/EDR controller on an existing connection.

Parameters
addrThe address of the remote device.
roleThe new role of the local controller The role parameter can be one of the following values:
  • HCI_CONN_ROLE_MASTER
  • HCI_CONN_ROLE_SLAVE
callbackA callback function that is called when the role has been set.
callback_paramA pointer to arbitrary data to be passed to the callback.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
bt_bool bt_gap_set_local_name ( const char *  device_name,
bt_int  name_len,
bt_gap_callback_fp  callback,
void *  callback_param 
)

Set the name of the local BR/EDR controller.

This function set the name of the local BR/EDR controller..

Parameters
device_nameA pointer to a string that will be written to the controller.
name_lenThe length of the device_name.
callbackA callback function that is called when the name has been set.
callback_paramA pointer to arbitrary data to be passed to the callback.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
bt_bool bt_gap_set_scan_params ( bt_bool  discoverable,
bt_ulong  discoverable_period,
bt_byte  discoverable_mode,
bt_bool  connectable,
bt_ulong  connectable_period,
bt_gap_callback_fp  callback,
void *  callback_param 
)

Set discoverability and connectability of the local BR/EDR controller.

This function controls the discoverability and connectability of the local BR/EDR controller.

Parameters
discoverableDefines if the controller is discoverable or not.
discoverable_periodDefines the period (in seconds) for which the controller is discoverable. If this parameter is 0 the controller is discoverable forever.
discoverable_modeDefines the discoverable mode - general or limited. The discoverable_mode parameter can be one of the following values:
  • HCI_DISCOVERABLE_MODE_GENERAL
  • HCI_DISCOVERABLE_MODE_LIMITED
connectableDefines if the controller is connectable or not.
discoverable_periodDefines the period (in seconds) for which the controller is connectable. If this parameter is 0 the controller is connectable forever.
callbackA callback function that is called when the scan mode has been set.
callback_paramA pointer to arbitrary data to be passed to the callback.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.
bt_bool bt_gap_sniff_mode ( bt_bdaddr_t *  addr,
bt_int  min_interval,
bt_int  max_interval,
bt_int  attempt_slots,
bt_int  timeout,
bt_gap_callback_fp  callback,
void *  callback_param 
)

Put a connection into Sniff mode.

This function puts a BR/EDR connection into SNIFF mode.

Parameters
addrThe address of the remote device.
min_intervalMinimum sniff interval.
max_intervalMaximum sniff interval.
attempt_slotsNumber of baseband receive slots for sniff attempt.
timeoutNumber of baseband receive slots for sniff timeout.
callbackA callback function that is called when the connection has been put into sniff mode.
callback_paramA pointer to arbitrary data to be passed to the callback.
Returns
  • TRUE if the function succeeds.
  • FALSE otherwise.