| Bluetooth Low Energy scripts

Security_PassKeyEntry_Slave_Role.py File Reference

## Detailed Description

This script implements the Peripheral role which configures a BLE device as Peripheral, with I/O capability "Display only", security authentication requirements with no fixed pin and then enter in discoverable mode. Once connected with the BLE Master device, BLE Peripheral starts ACI_GAP_SLAVE_SECURITY_REQ procedure. The BLE Peripheral generates a random key and it sets it through ACI_GAP_PASS_KEY_RESP command after the ACI_GAP_PASS_KEY_REQ_EVENT event is generated. At this stage, a input window is diplayed on Central device for allowing user to insert the key displayed on Peripheral device. The Pairing is completed and the bonded device is displayed.

- The script is implemented using the new BlueNRG GUI language scripts based on the BLE ACI APIs. The BlueNRG GUI with script engine is delivered within BlueNRG GUI SW package.
- The script can also be run using the script launcher standalone utility available within BlueNRG GUI SW package.
- A PC running Windows Vista/7 operating systems (64 and 32 bit version) or Windows XP operating systems (32 bit edition), with available USB ports is required for installing the BlueNRG GUI SW package.

# Security_PassKeyEntry_Slave_Role.py script, preliminary setup steps: configure a GAP Central device using the Security_PassKeyEntry_Master_Role.py script

- Open BlueNRG GUI
- BlueNRG/BlueNRG-MS platform configuration steps:
  1. Connect the selected platform to a PC USB port
  2. Put selected platform in DFU mode and download the "C:\Program Files (x86)\STMicroelectronics\BlueNRG GUI x.x.x\Firmware\STM32L1_prebuilt_images\BlueNRG_VCOM_x_x.hex" using the BlueNRG GUI, Tools, Flash Motherboard FW... utility
- BlueNRG-1 platform configuration steps:
  1. Connect the selected platform to a PC USB port
  2. Download the "C:\Program Files (x86)\STMicroelectronics\BlueNRG GUI x.x.x\Firmware\BlueNRG1\DTM\DTM_UART_16MHz.hex or DTM_SPI.hex" file on the BlueNRG-1 platform using the BlueNRG Flasher utility available on BlueNRG-1 DK SW package (STSW-BLUENRG1-DK )
     - NOTES: SPI Network coprocessor configuration file (DTM_SPI.hex) requires some HW changes to be applied to the BlueNRG-1 development platform. Refer to STSW-BNRGUI user manual UM2058.
- On BlueNRG GUI, open the USB Port associated to the plugged platform
- On BlueNRG GUI, select the Scripts window
- On BlueNRG GUI, Scripts window, Scripts Engine section, click on ... tab and browse to the Security_PassKeyEntry_Master_Role.py script location and select it
- On BlueNRG GUI, click on Run Script tab for running the selected script
- BLE Central device starts direct connection procedure.

# Security_PassKeyEntry_Slave_Role.py script execution steps through BlueNRG GUI Script Engine

- Open BlueNRG GUI
- BlueNRG/BlueNRG-MS platform configuration steps:
  1. Connect the selected platform to a PC USB port
  2. Put selected platform in DFU mode and download the "C:\Program Files (x86)\STMicroelectronics\BlueNRG GUI x.x.x\Firmware\STM32L1_prebuilt_images\BlueNRG_VCOM_x_x.hex" using the BlueNRG GUI, Tools, Flash Motherboard FW... utility
- BlueNRG-1 platform configuration steps:
  1. Connect the selected platform to a PC USB port
  2. Download the "C:\Program Files (x86)\STMicroelectronics\BlueNRG GUI x.x.x\Firmware\BlueNRG1\DTM\DTM_UART_16MHz.hex or DTM_SPI.hex" file on the BlueNRG-1 platform using the BlueNRG Flasher utility available on BlueNRG-1 DK SW package (STSW-BLUENRG1-DK)
     - NOTES: SPI Network coprocessor configuration file (DTM_SPI.hex) requires some HW changes to be applied to the BlueNRG-1 development platform. Refer to STSW-BNRGUI user manual UM2058.
- On BlueNRG GUI, open the USB Port associated to the plugged platform
- On BlueNRG GUI, select the Scripts window
- On BlueNRG GUI, Scripts window, Scripts Engine section, click on ... tab and browse to the Security_PassKeyEntry_Slave_Role.py script location and select it
- On BlueNRG GUI, click on Run Script tab for running the selected script
- BLE Peripheral device enters in discoverable mode and then it connects once it receives the connection request from the BLE Central device
- BLE Peripheral device starts the security process by calling ACI_GAP_SLAVE_SECURITY_REQ procedure. Then ACI_GAP_PASS_KEY_REQ_EVENT event is raised and BLE Peripheral generates a random key and it sets it through ACI_GAP_PASS_KEY_RESP command
- Once the displayed BLE Peripheral random key is inserted on BLE Master device, the pairing process is completed and the bonded device is displayed.

# Supported platforms

- BlueNRG-1 development platform (order code: STEVAL-IDB007V1)
- BlueNRG-MS development platform (order code: STEVAL-IDB005V1)
- BlueNRG-MS Daughter Board (order code: STEVAL-IDB005V1D)
- BlueNRG-MS USB dongle (order code: STEVAL-IDB006V1)
- BlueNRG development platform (order code: STEVAL-IDB002V1)
- BlueNRG USB dongle (order code: STEVAL-IDB003V1)

# Supported BLE devices and stack versions

- BlueNRG-1 stack v1.x
- BlueNRG-MS stack v7.2x
- BlueNRG stack v6.4x