Skip to main content

Prerequisites

Before you begin, set up the device as described in Set up the device for Bluetooth GAP functions.

Enable Bluetooth

To enable Bluetooth on the device, run the following command:
power on
Sample output
[bluetooth]# power on
[CHG] Controller 22:22:F1:C1:99:C0 Class: 0x007c0000
Changing power on succeeded
[CHG] Controller 22:22:F1:C1:99:C0 Powered: yes

Run Bluetooth inquiry scan

To start an inquiry for nearby devices, run the following command:
scan on
Sample output
[bluetooth]# scan on
Discovery started
[CHG] Controller 22:22:9B:2C:79:1E Discovering: yes
[NEW] Device A4:30:7A:EE:AF:EF [TV] MyDeviceA 8 Series (43)
[NEW] Device 7E:08:AE:BC:66:58 7E-08-AE-BC-66-58
[CHG] Device A4:30:7A:EE:AF:EF RSSI: -91
[CHG] Device A4:30:7A:EE:AF:EF Modalias: bluetooth: v04E8p8080d0000
[CHG] Device A4:30:7A:EE:AF:EF UUIDs: 0000110a-0000-1000-8000-00805f9b34fb
[CHG] Device A4:30:7A:EE:AF:EF UUIDs: 0000110b-0000-1000-8000-00805f9b34fb
[CHG] Device A4:30:7A:EE:AF:EF UUIDs: 0000110c-0000-1000-8000-00805f9b34fb
[CHG] Device A4:30:7A:EE:AF:EF UUIDs: 0000110e-0000-1000-8000-00805f9b34fb
[CHG] Device A4:30:7A:EE:AF:EF UUIDs: 00001112-0000-1000-8000-00805f9b34fb
[CHG] Device A4:30:7A:EE:AF:EF UUIDs: 0000111f-0000-1000-8000-00805f9b34fb
[CHG] Device A4:30:7A:EE:AF:EF UUIDs: 00001200-0000-1000-8000-00805f9b34fb
[CHG] Device A4:30:7A:EE:AF:EF ManufacturerData Key: 0xff19
[CHG] Device A4:30:7A:EE:AF:EF ManufacturerData Value:
00 75 00 09 01 00 00 00 06 01 00 00 00 00 00 00 .u...............
00 00 00 00 00 00 00 00                            .........
[NEW] Device F8:7D:76:9D:9B:6B MyDeviceB
[CHG] Device 7E:08:AE:BC:66:58 RSSI: -73

Stop Bluetooth inquiry scan

To stop an inquiry that’s in progress, run the following command:
scan off
Sample output
[bluetooth]# scan off
Discovery stopped
[CHG] Device 00:95:01:ED:A3:1C RSSI is nil
[DEL] Device 00:95:01:ED:A3:1C 00-95-01-ED-A3-1C
[CHG] Device 8C:FD:F0:0F:41:DB RSSI is nil
[DEL] Device 8C:FD:F0:0F:41:DB 8C-FD-F0-0F-41-DB
[CHG] Device 3F:5C:33:B2:F4:13 RSSI is nil
[DEL] Device 3F:5C:33:B2:F4:13 3F-5C-33-B2-F4-13
[CHG] Device C8:12:0B:50:F2:51 RSSI is nil
[DEL] Device C8:12:0B:50:F2:51 C8-12-0B-50-F2-51
[CHG] Device 8C:FD:F0:0F:1B:B8 RSSI is nil
[DEL] Device 8C:FD:F0:0F:1B:B8 8C-FD-F0-0F-1B-B8
[CHG] Device 0E:19:D7:85:53:8A RSSI is nil
[DEL] Device 0E:19:D7:85:53:8A 0E-19-D7-85-53-8A
[CHG] Device 75:AD:91:DD:40:2A TxPower is nil
[CHG] Device 75:AD:91:DD:40:2A RSSI is nil
[CHG] Device E4:24:2C:94:28:BC RSSI is nil
[CHG] Device 94:7C:00:B0:38:28 RSSI is nil
[CHG] Controller 8C:FD:F0:21:84:23 Discovering: no

Pair with a remote Bluetooth device

Before you pair a remote device, run a Bluetooth inquiry scan to ensure that the remote device is available. To pair with a remote Bluetooth device, run the following command:
pair <bt_address>
To accept the outgoing/incoming pairing, enter yes. To reject the outgoing/incoming pairing, enter no. Parameters <bt_address> is the Bluetooth address of the remote device. Example To pair with a remote device with <bt_address> F8:7D:76:9D:9B:6B, run the following command:
pair F8:7D:76:9D:9B:6B
Sample output
[bluetooth]# pair F8:7D:76:9D:9B:6B
Attempting to pair with F8:7D:76:9D:9B:6B
[CHG] Device F8:7D:76:9D:9B:6B Connected: yes
[CHG] Device F8:7D:76:9D:9B:6B Name: MyDeviceB
[CHG] Device F8:7D:76:9D:9B:6B Alias: MyDeviceB
Request /*-9
[agent] Confirm passkey 068560 (yes/no): yes
[CHG] Device F8:7D:76:9D:9B:6B Bonded: yes
[DEL] Device 28:DE:65:7B:59:54 28-DE-65-7B-59-54
[CHG] Device F8:7D:76:9D:9B:6B Modalias: bluetooth:v004Cp760Ad1160
[CHG] Device F8:7D:76:9D:9B:6B UUIDs: 00000000-deca-fade-deca-deafdecacafe
[CHG] Device F8:7D:76:9D:9B:6B UUIDs: 00001000-0000-1000-8000-00805f9b34fb
[CHG] Device F8:7D:76:9D:9B:6B UUIDs: 0000110a-0000-1000-8000-00805f9b34fb
[CHG] Device F8:7D:76:9D:9B:6B UUIDs: 0000110c-0000-1000-8000-00805f9b34fb
[CHG] Device F8:7D:76:9D:9B:6B UUIDs: 0000110e-0000-1000-8000-00805f9b34fb
[CHG] Device F8:7D:76:9D:9B:6B UUIDs: 00001116-0000-1000-8000-00805f9b34fb
[CHG] Device F8:7D:76:9D:9B:6B UUIDs: 0000111f-0000-1000-8000-00805f9b34fb
[CHG] Device F8:7D:76:9D:9B:6B UUIDs: 0000112f-0000-1000-8000-00805f9b34fb
[CHG] Device F8:7D:76:9D:9B:6B UUIDs: 00001132-0000-1000-8000-00805f9b34fb
[CHG] Device F8:7D:76:9D:9B:6B UUIDs: 00001200-0000-1000-8000-00805f9b34fb
[CHG] Device F8:7D:76:9D:9B:6B UUIDs: 00001801-0000-1000-8000-00805f9b34fb
[CHG] Device F8:7D:76:9D:9B:6B UUIDs: 02030302-1d19-415f-86f2-22a2106a0a77
[CHG] Device F8:7D:76:9D:9B:6B UUIDs: 1ff31936-572e-4b36-a2bf-b2409b1aa6f4
[CHG] Device F8:7D:76:9D:9B:6B ServicesResolved: yes
[CHG] Device F8:7D:76:9D:9B:6B Paired: yes
Pairing successful
[DEL] Device 28:DE:65:7B:5B:71 28-DE-65-7B-5B-71
[CHG] Device F8:7D:76:9D:9B:6B ServicesResolved: no
[CHG] Device F8:7D:76:9D:9B:6B Connected: no

Get the bonded/paired device list

To get a verified list of paired devices, run the following command:
devices
Sample output
[bluetooth]# devices
Device F8:7D:76:9D:9B:6B MyDeviceB

Unpair a device

To unpair a device, run the following command: Example To unpair a device with the address F8:7D:76:9D:9B:6B, run the following command:
remove F8:7D:76:9D:9B:6B
Sample output
[bluetooth]# remove F8:7D:76:9D:9B:6B
[DEL] Device F8:7D:76:9D:9B:6B MyDeviceB
Device has been removed

Enable device discovery

To enable discovery mode in the DUT, run the following command:
discoverable on
Sample output
[bluetooth]# discoverable on
Changing discoverable on succeeded
[CHG] Controller 8C:FD:F0:21:84:23 Discoverable: yes

Disable Bluetooth

To disable Bluetooth on the device, run the following command:
power off
Sample output
[bluetooth]# power off
[CHG] Controller 8C:FD:F0:21:84:23 Discoverable: no
Changing power off succeeded
[CHG] Controller 8C:FD:F0:21:84:23 Powered: no
[CHG] Controller 8C:FD:F0:21:84:23 Discovering: no
[CHG] Controller 8C:FD:F0:21:84:23 Class: 0x00000000