Previous Topic

Next Topic

Book Contents

Book Index

Pairing Using Console Commands

The supported pairing modes can be manipulated using console commands form the BLE group. (See Getting Help about a Command.)

The commands used in the authentication process are:

When a device pairing procedure is started from the console via the pair command and it requires user interaction, a message will be printed on the console:

ble>$pair 12
Confirm passkey 591. Use 'confirm 7C:46:85:32:2D:1F y' command:
ble>$confirm 7C:46:85:32:2D:1F y

Example

The following example illustrates the pairing process using console commands with a notebook or a smart phone.

Because the notebook or smart phone are scanned as BR/EDR devices, you first need to set Discovery Transport = BREDR in the Tinyb Driver Configuration.

After the device is paired it changes its state to CONNECTED and after this to DISCONNECTED. The reason for this is that BLE driver maps services resolved state to CONNECTED and the smart phone does not export services.

ble>$lescan

ble>$ls

DevID]     [Device Address]  [Type] [RSSI]  [Name]                              [State][Connected]

------- ----------------- ------ ------ ----------------------------- ------------ -----------

0            B4:07:55:E5:25:DE public 0     "CISS-"                              DISCONNECTED false            

1            C4:64:E3:11:5E:B1 public 0     "TDL:5E:B1"                          DISCONNECTED false            

2            08:B7:38:13:7D:11 public 0     "HP Bluetooth Keyboard K4000"        DISCONNECTED false            

3            74:70:FD:85:91:7E public -47    "mara"                               DISCONNECTED false            

4            54:6C:0E:E2:A8:01 public 0      "Bosch DataLogger"                   DISCONNECTED false            

5            18:04:ED:62:5B:B9 public 0      "SCD-SCD-5B:B9"                      DISCONNECTED false            

6            B8:27:EB:BC:49:9A public 0      "pi3"                                DISCONNECTED false            

7            B8:27:EB:AB:3C:BD public -67    "raspberrypi"                        DISCONNECTED false            

8            B8:27:EB:83:36:B7 public -63    "raspberrypi"                        DISCONNECTED false            

9            B8:27:EB:FF:6E:FF public -74    "raspberrypi"                        DISCONNECTED false            

10           34:12:F9:E3:AE:3B public -84    "HUAWEI Y5 2018"                     DISCONNECTED false            

11           DC:A6:32:0D:1B:12 public -73    "raspberrypi"                        DISCONNECTED false            

12           7C:46:85:32:2D:1F public -54    "[Lenovo K33a48 (331)]0"             DISCONNECTED false            

ble>$sub *

...

ble>$pair 12

ble>$Pairing BtleDevice[7C:46:85:32:2D:1F [Lenovo K33a48 (331)]0] in state: DISCONNECTED

### Event [mbs/btle/device/state/changed]

# Properties: {Address=7C:46:85:32:2D:1F,ControllerAddress=00:1A:7D:DA:71:15,State=3,dumpState=CONNECTING}

### Event [mbs/btle/device/state/changed]

# Properties: {Address=7C:46:85:32:2D:1F,ControllerAddress=00:1A:7D:DA:71:15,State=5,dumpState=INITIALIZING}

Confirm passkey 591. Use 'confirm 7C:46:85:32:2D:1F y' command:

ble>$confirm 7C:46:85:32:2D:1F y

ble>$### Event [mbs/btle/device/state/changed]

# Properties: {Address=7C:46:85:32:2D:1F,ControllerAddress=00:1A:7D:DA:71:15,State=4,dumpState=CONNECTED}

Device Paired.

ble>$

ble>$### Event [mbs/btle/device/state/changed]

# Properties: {Address=7C:46:85:32:2D:1F,ControllerAddress=00:1A:7D:DA:71:15,State=1,dumpState=DISCONNECTED}