![]() |
MT2523 API Reference
LinkIt SDK v4
|
This section describes the Generic Access Profile (GAP) APIs for Bluetooth with Enhanced Data Rate (EDR). More...
This section describes the Generic Access Profile (GAP) APIs for Bluetooth with Enhanced Data Rate (EDR).
The GAP defines the generic procedures related to discovery of Bluetooth devices and link management aspects of connecting to Bluetooth devices.
| Terms | Details |
|---|---|
| GAP | Generic Access Profile. This profile defines the generic procedures related to discovery of Bluetooth devices and link management aspects of connecting to Bluetooth devices. It also defines procedures related to use of different security levels. |
| RSSI | Received Signal Strength Indication. For more information, please refer to Wikipedia. |
| SSP | Secure Simple Pairing. Simplifies the pairing process and improves Bluetooth security. |
| IO Capability | Input/Output Capability. It is used in pairing feature exchange process to determine which pairing method to use. |
| MITM | Man-in-the-middle Protection. For more information, please refer to Wikipedia. |
| COD | Class of Device, indicating the type of device. |
| EIR | Extended Inquiry Response data. It is sent during the inquiry response state. It can contain device name, transmit power level, service class UUIDs and more. |
| HCI | Host Controller Interface. For more information, please refer to Wikipedia. |
GAP confirmation or indication event structures define the information required by the upper layer. The required data is an event parameter.
The event callback function, implemented by the upper layer, processes the received confirmation or indication events based on the event type.
Functions | |
| bt_status_t | bt_gap_set_scan_mode (bt_gap_scan_mode_t mode) |
| This function sets the accessible mode. More... | |
| bt_status_t | bt_gap_inquiry (uint8_t duration, uint8_t max_count) |
| This function inquires the search for nearby devices. More... | |
| bt_status_t | bt_gap_cancel_inquiry (void) |
| This function stops the inquiry. More... | |
| bt_status_t | bt_gap_exit_sniff_mode (bt_gap_connection_handle_t handle) |
| This function exits the sniff mode for the link. More... | |
| bt_status_t | bt_gap_disconnect (bt_gap_connection_handle_t handle) |
| This function disconnects the special link. More... | |
| bt_status_t | bt_gap_set_role (bt_gap_connection_handle_t handle, bt_role_t role) |
| This function changes the device's role type. More... | |
| bt_status_t | bt_gap_get_role (bt_gap_connection_handle_t handle) |
| This function gets the device's role type. More... | |
| bt_status_t | bt_gap_read_remote_name (const bt_bd_addr_t *address) |
| This function gets the device's name, no need to be connected to the device. More... | |
| bt_status_t | bt_gap_cancel_name_request (const bt_bd_addr_t *address) |
| This function cancels the request of bt_gap_read_remote_name(). More... | |
| bt_status_t | bt_gap_enter_test_mode (void) |
| This function sets the device into a test mode. More... | |
| bt_status_t | bt_gap_set_extended_inquiry_response (uint8_t *eir_data, uint32_t data_length) |
| This function sets the EIR data. More... | |
| bt_status_t | bt_gap_write_inquiry_tx (int8_t tx_power) |
| This function writes the inquiry transmit power. More... | |
| bt_status_t | bt_gap_read_inquiry_response_tx (void) |
| This function reads the inquiry response transmit power. More... | |
| bt_status_t | bt_gap_write_page_scan_activity (uint16_t interval, uint16_t window) |
| This function writes the values for the interval and the window of page scanning. More... | |
| bt_status_t | bt_gap_write_inquiry_scan_activity (uint16_t interval, uint16_t window) |
| This function writes values for the interval and the window of inquiry scanning. More... | |
| const bt_bd_addr_t * | bt_gap_get_remote_address (bt_gap_connection_handle_t handle) |
| This function gets the address of a connected device. More... | |
| bt_status_t | bt_gap_read_rssi (bt_gap_connection_handle_t handle) |
| This function reads the RSSI of the connected device. More... | |
| const bt_gap_pin_code_information_t * | bt_gap_get_pin_code (void) |
| This is a user defined callback to get the pin code and pass it to the GAP process. More... | |
| bt_status_t | bt_gap_reply_io_capability_request (bt_gap_oob_data_presented_t oob_present, bt_gap_security_auth_request_t auth_request) |
| This function sends a reply to the BT_GAP_IO_CAPABILITY_REQ_IND event with Out-of-band data presented and security authentication request. More... | |
| bt_status_t | bt_gap_reject_io_capability_request (void) |
| This function rejects the BT_GAP_IO_CAPABILITY_REQ_IND event and terminates the bonding. More... | |
| bt_status_t | bt_gap_reply_passkey_request (const uint32_t *passkey) |
| This function is a reply to the BT_GAP_USER_REPLY_PASSKEY_IND event. More... | |
| bt_status_t | bt_gap_reply_user_confirm_request (bool accept) |
| This function is a reply to the BT_GAP_USER_CONFIRM_REQ_IND event. More... | |
| void | bt_gap_get_link_key (bt_gap_link_key_notification_ind_t *key_information) |
| This is a user defined callback to get the link key and pass it to the GAP process. More... | |
| const bt_gap_config_t * | bt_gap_get_local_configuration (void) |
| This is a user defined callback to get the configuration parameters for the GAP initialization process. More... | |
| bt_status_t | bt_gap_set_default_sniff_parameters (const bt_gap_default_sniff_params_t *sniff_params) |
| This function sets the default sniff parameters. More... | |
| bt_status_t | bt_gap_set_default_sniff_subrating_parameters (const bt_gap_default_sniff_subrating_params_t *sniff_subrating_params) |
| This function sets the default subrating_parameters. More... | |
| bt_gap_accept_connection_status_t | bt_gap_check_connect_request (bt_bd_addr_ptr_t address, uint32_t cod) |
| This is a user defined callback to check whether to accept the connecting request or reject it. More... | |
Modules | |
| Define | |
| Define Classic Bluetooth GAP data types and values. | |
| Struct | |
| Define Classic Bluetooth GAP structures for GAP APIs and events. | |
| bt_status_t bt_gap_cancel_inquiry | ( | void | ) |
This function stops the inquiry.
| bt_status_t bt_gap_cancel_name_request | ( | const bt_bd_addr_t * | address | ) |
This function cancels the request of bt_gap_read_remote_name().
| [in] | address | is the address of the remote device. |
| bt_gap_accept_connection_status_t bt_gap_check_connect_request | ( | bt_bd_addr_ptr_t | address, |
| uint32_t | cod | ||
| ) |
This is a user defined callback to check whether to accept the connecting request or reject it.
| [in] | address | is the address of a connecting device. |
| [in] | cod | is the class of a device. |
| bt_status_t bt_gap_disconnect | ( | bt_gap_connection_handle_t | handle | ) |
This function disconnects the special link.
| [in] | handle | is the link handle to be disconnected. |
| bt_status_t bt_gap_enter_test_mode | ( | void | ) |
This function sets the device into a test mode.
| bt_status_t bt_gap_exit_sniff_mode | ( | bt_gap_connection_handle_t | handle | ) |
This function exits the sniff mode for the link.
| [in] | handle | is the link handle. |
| void bt_gap_get_link_key | ( | bt_gap_link_key_notification_ind_t * | key_information | ) |
This is a user defined callback to get the link key and pass it to the GAP process.
| [in,out] | key_information | provide the key and key_type for a given address. |
| const bt_gap_config_t* bt_gap_get_local_configuration | ( | void | ) |
This is a user defined callback to get the configuration parameters for the GAP initialization process.
| const bt_gap_pin_code_information_t* bt_gap_get_pin_code | ( | void | ) |
This is a user defined callback to get the pin code and pass it to the GAP process.
| const bt_bd_addr_t* bt_gap_get_remote_address | ( | bt_gap_connection_handle_t | handle | ) |
This function gets the address of a connected device.
| [in] | handle | is the connection handle. |
| bt_status_t bt_gap_get_role | ( | bt_gap_connection_handle_t | handle | ) |
This function gets the device's role type.
The BT_GAP_GET_ROLE_CNF event is received when finished.
| [in] | handle | is the link handle. |
| bt_status_t bt_gap_inquiry | ( | uint8_t | duration, |
| uint8_t | max_count | ||
| ) |
This function inquires the search for nearby devices.
The BT_GAP_INQUIRY_IND event is received once a new device is found.
| [in] | duration | is the maximum time of the inquiry. The inquiry stops after the timeout. The range is from 0x01 to 0x30. Time = N * 1.28sec. |
| [in] | max_count | is the maximum device count of the inquiry, stops the inquiry, if the number of searched devices reaches the max_count. The range is from 0x00 to 0xFF, 0 - unlimited number of responses. |
| bt_status_t bt_gap_read_inquiry_response_tx | ( | void | ) |
This function reads the inquiry response transmit power.
The BT_GAP_READ_INQUIRY_RESPONSE_TX_CNF event is received once the operation is complete.
| bt_status_t bt_gap_read_remote_name | ( | const bt_bd_addr_t * | address | ) |
This function gets the device's name, no need to be connected to the device.
The BT_GAP_READ_REMOTE_NAME_COMPLETE_IND event is received once the operation is complete.
| [in] | address | is the address of the remote device. |
| bt_status_t bt_gap_read_rssi | ( | bt_gap_connection_handle_t | handle | ) |
This function reads the RSSI of the connected device.
BT_GAP_READ_RSSI_CNF event is received once the operation is complete.
| [in] | handle | is the link handle. |
| bt_status_t bt_gap_reject_io_capability_request | ( | void | ) |
This function rejects the BT_GAP_IO_CAPABILITY_REQ_IND event and terminates the bonding.
| bt_status_t bt_gap_reply_io_capability_request | ( | bt_gap_oob_data_presented_t | oob_present, |
| bt_gap_security_auth_request_t | auth_request | ||
| ) |
This function sends a reply to the BT_GAP_IO_CAPABILITY_REQ_IND event with Out-of-band data presented and security authentication request.
| [in] | oob_present | is the Out-of-band data presented. |
| [in] | auth_request | is the security authentication request. |
| bt_status_t bt_gap_reply_passkey_request | ( | const uint32_t * | passkey | ) |
This function is a reply to the BT_GAP_USER_REPLY_PASSKEY_IND event.
| [in] | passkey | is a pointer to the user's passkey. If it is NULL, the reply is rejected. |
| bt_status_t bt_gap_reply_user_confirm_request | ( | bool | accept | ) |
This function is a reply to the BT_GAP_USER_CONFIRM_REQ_IND event.
| [in] | accept | defines whether the pairing is accepted. |
| bt_status_t bt_gap_set_default_sniff_parameters | ( | const bt_gap_default_sniff_params_t * | sniff_params | ) |
This function sets the default sniff parameters.
The default settings remain effective till the system reboot.
| [in] | sniff_params | is the default sniff parameters. |
| bt_status_t bt_gap_set_default_sniff_subrating_parameters | ( | const bt_gap_default_sniff_subrating_params_t * | sniff_subrating_params | ) |
This function sets the default subrating_parameters.
The default settings remain effective till the system reboot.
| [in] | sniff_subrating_params | is the default sniff subrating parameters. |
| bt_status_t bt_gap_set_extended_inquiry_response | ( | uint8_t * | eir_data, |
| uint32_t | data_length | ||
| ) |
This function sets the EIR data.
| [in] | eir_data | is the content of EIR data. |
| [in] | data_length | is the size of the EIR data, the maximum length is 240. |
| bt_status_t bt_gap_set_role | ( | bt_gap_connection_handle_t | handle, |
| bt_role_t | role | ||
| ) |
This function changes the device's role type.
The BT_GAP_ROLE_CHANGED_IND event is received when the role changed.
| [in] | handle | is the link handle to change. |
| [in] | role | is the role to change. |
| bt_status_t bt_gap_set_scan_mode | ( | bt_gap_scan_mode_t | mode | ) |
This function sets the accessible mode.
| [in] | mode | is the accessing mode. |
| bt_status_t bt_gap_write_inquiry_scan_activity | ( | uint16_t | interval, |
| uint16_t | window | ||
| ) |
This function writes values for the interval and the window of inquiry scanning.
The BT_GAP_WRITING_INQUIRY_SCAN_CNF event will be received when finished.
| [in] | interval | is the inquiry scan interval, default value is 0x1000, the range is from 0x12 to 0x1000. Time = N * 0.626 ms. |
| [in] | window | is the inquiry scan window, it shall be less than or equal to interval, default value is 0x0012, the range is from 0x12 to 0x1000. Time = N * 0.626 ms. |
| bt_status_t bt_gap_write_inquiry_tx | ( | int8_t | tx_power | ) |
This function writes the inquiry transmit power.
| [in] | tx_power | is the transmit power, the range is from -70 to 20. |
| bt_status_t bt_gap_write_page_scan_activity | ( | uint16_t | interval, |
| uint16_t | window | ||
| ) |
This function writes the values for the interval and the window of page scanning.
The BT_GAP_WRITING_PAGE_SCAN_CNF event is received once the operation is complete.
| [in] | interval | is the page scan interval, default value is 0x0800, the range is from 0x12 to 0x1000. Time = N * 0.626 ms. |
| [in] | window | is the page scan window, it shall be less than or equal to interval, default value is 0x0012, the range is from 0x12 to 0x1000. Time = N * 0.626 ms. |