# Perform Bluetooth GAP functions You can perform various Bluetooth GAP functions using the generic `gap_menu` options. Before you begin, set up the device and go to the `gap_menu` as described in [Set up device for Bluetooth GAP functions](https://docs.qualcomm.com/doc/80-70018-13/topic/gap_operation.html#section-kzq-ggb-1cc-navyanka-07-10-24-2044-49-668). ## Enable Bluetooth To enable Bluetooth on the device, run the following command: enable Copy to clipboard **Sample output** gap_menu ***************** Menu ******************* enable disable inquiry cancel_inquiry get_role_req eg. get_role_req 00:11:22:33:44:55 pair eg. pair 00:11:22:33:44:55 0(auto)/1(BREDR)/2(BLE) unpair eg. unpair 00:11:22:33:44:55 inquiry_list bonded_list get_state get_bt_name get_bt_address set_bt_name eg. set_bt_name MDM_Fluoride set_scan_mode eg. set_scan_mode 0 --0-BT_SCAN_MODE_NONE,1- BT_SCAN_MODE_CONNECTABLE,2-BT_SCAN_MODE_CONNECTABLE_DISCOVERABLE set_afh eg. set_afh 112233445566778899f0 send_hci_cmd eg. send_hci_cmd 01,04,05,33,8b,9e,0a,00 - For Inquiry read_clock eg. read_clock 0(local)/1(acl connection) 00:11:22:33:44:55 main_menu switch_role_req eg. switch_role_req 00:11:22:33:44:55 0 or get_role_req 00:11:22:33:44:55 1 ****************************************** enable current State = 0, new state = 1 BT State is ON Copy to clipboard ## Run Bluetooth inquiry scan To start an inquiry for nearby devices, run the following command: inquiry Copy to clipboard **Sample output** inquiry Inquiry Started Device Found details: Found device Addr: d8:b0:53:e5:6a:32 Found device Name: MyDeviceB Device Type is: 1 Device Found details: Found device Addr: f8:7d:76:9d:9b:6b Found device Name: MyDeviceA Device Type is: 1 Inquiry Stopped automatically Copy to clipboard ## Cancel Bluetooth inquiry scan To cancel an inquiry that’s in progress, run the following command: cancel_inquiry Copy to clipboard **Sample output** cancel_inquiry **************************** Inquiry List ********************************* 1 MyDeviceB d8:b0:53:e5:6a:32 2 MyDeviceA f8:7d:76:9d:9b:6b **************************** End of List ********************************* Inquiry Stopped due to user input Copy to clipboard ## Get Bluetooth/Bluetooth Low Energy device list To get the list of discovered devices, run the following command: inquiry_list Copy to clipboard **Sample output** inquiry_list **************************** Inquiry List ********************************* 1 MyDeviceB d8:b0:53:e5:6a:32 2 MyDeviceA f8:7d:76:9d:9b:6b **************************** End of List ********************************* Copy to clipboard ## Pair with remote Bluetooth device To initiate outgoing Secure Simple Pairing (SSP), run the following command: pair Copy to clipboard To accept the outgoing/incoming pairing, enter `yes`. To reject the outgoing/incoming pairing, enter `no`. Note Ensure that you provide the correct pin for the incoming legacy pairing. **Parameters** - `` is the Bluetooth address of the remote device. - `` is the radio for pairing. The value of the `` parameter can be: - `0`: Auto selection - `1`: BR/EDR - `2`: Bluetooth Low Energy **Example** To pair a remote device with `` `f8:7d:76:9d:9b:6b`, run the following command: pair f8:7d:76:9d:9b:6b 0 Copy to clipboard **Sample output** pair f8:7d:76:9d:9b:6b 0 Auto select in the stack ACL state:0 change with reason 00 for device: f8:7d:76:9d:9b:6b BT pairing_variant 0 ************************************************* BT pairing request::Device MyDeviceB::Pairing Code:: 999712 ************************************************* ** Please enter yes / no ** yes *****************DidInfoCb******************* MAC address:f8:7d:76:9d:9b:6b spec_id:0x102 : vendor:0x4c : vendor_id_source:0x1 : product:0x760a : vendor:0x4c : primary_record:0x1 : client_executable_url: : service_description:PnP Information : documentation_url: : DID info result :0 : *****************FINISH******************* ************************************************* Pairing state for MyDeviceB is BONDED ************************************************* Copy to clipboard ## Get the bonded/paired device list To get a verified list of paired devices, run the following command: bonded_list Copy to clipboard **Sample output** bonded_list **************************** Bonded Device List **************************** MyDeviceB f8:7d:76:9d:9b:6b **************************** End of List ********************************* Copy to clipboard ## Set the Bluetooth device name To change or set the local Bluetooth device name, run the following command: set_bt_name Copy to clipboard **Parameters** `` is the device name you intend to set or assign. **Example** To set the device name as `K2L`, run the following command: set_bt_name K2L Copy to clipboard **Sample output** get_bt_name BT Name : Pstack_test set_bt_name K2L BT name is set to K2L get_bt_name BT Name : K2L Copy to clipboard ## Get the Bluetooth name To get the Bluetooth device name, run the following command: get_bt_name Copy to clipboard **Sample output** In the following sample output of this command, the device name appears as `K2L`: get_bt_name BT Name : K2L Copy to clipboard ## Get the Bluetooth address To set the Bluetooth MAC address, see [General Access Profile](https://docs.qualcomm.com/doc/80-70018-13/topic/gap_operation.html#gap-operation). To get the Bluetooth device address, run the following command: get_bt_address Copy to clipboard **Sample output** In the following sample output of this command, the device address appears as `11:22:33:44:55:66`: get_bt_address BT Address : 11:22:33:44:55:66 Copy to clipboard ## Disable Bluetooth To disable Bluetooth, run the following command: disable Copy to clipboard **Sample output** gap_menu ***************** Menu ******************* enable disable inquiry cancel_inquiry get_role_req eg. get_role_req 00:11:22:33:44:55 pair eg. pair 00:11:22:33:44:55 0(auto)/1(BREDR)/2(BLE) unpair eg. unpair 00:11:22:33:44:55 inquiry_list bonded_list get_state get_bt_name get_bt_address set_bt_name eg. set_bt_name MDM_Fluoride set_scan_mode eg. set_scan_mode 0 --0-BT_SCAN_MODE_NONE,1- BT_SCAN_MODE_CONNECTABLE,2-BT_SCAN_MODE_CONNECTABLE_DISCOVERABLE set_afh eg. set_afh 112233445566778899f0 send_hci_cmd eg. send_hci_cmd 01,04,05,33,8b,9e,0a,00 - For Inquiry read_clock eg. read_clock 0(local)/1(acl connection) 00:11:22:33:44:55 main_menu switch_role_req eg. switch_role_req 00:11:22:33:44:55 0 or get_role_req 00:11:22:33:44:55 1 ******************************************* disable current State = 1, new state = 0 BT_AUDIO_HAL_INTEGRATION needs to be defined killall: qcbtdaemon: no process killed killall: wcnssfilter: no process killed BT State is OFF Copy to clipboard Last Published: Apr 02, 2025 [Previous Topic General Access Profile](https://docs.qualcomm.com/bundle/publicresource/80-70018-13/topics/gap_operation.md) [Next Topic Serial Port Profile](https://docs.qualcomm.com/bundle/publicresource/80-70018-13/topics/set_up_bluetooth_in_spp.md)