Skip to main content
User1655833706281357277
Associate III
September 13, 2022
Solved

What is the API call to get the stm32wb to reject all pairing requests? The bonding_mode argument to aci_gap_set_authentication_requirement() looks like it honors pairing requests always.

  • September 13, 2022
  • 10 replies
  • 2465 views

..

This topic has been closed for replies.
Best answer by User1655833706281357277

It isn't at all obvious how you do that from the link you provided, but okay, uncle. The whitelist option isn't great if you don't know ahead of time the devices you want to whitelist. As I stated before, other vendors let you do this. You might want to think about it.

10 replies

Remy ISSALYS
ST Technical Moderator
September 21, 2022

Hello,

There isn't any API to reject all pairing requests, it's sufficient to not answer to the pairing request. Can you explain a bit more your use case ? Are you working with a PC, a smartphone or another STM32WB ?

Best Regards

WMcKi.1924
Associate II
September 26, 2022

Sorry for the long delay, I didn't see a notice that there was a response. For my device I'm using a passkey to pair to an iOS device. The only API calls that I see that have anything to do with pairing are the ones that ask me for the passkey and tell me pairing is complete. I don't see a callback that tells me a pairing request has come in. Are you saying just don't respond to the passkey callback to effectively disable pairing?

Remy ISSALYS
ST Technical Moderator
October 12, 2022

Hello,

Which smartphone application are you using? Can you explain why you want to reject the pairing, if you don't ask pairing from the smartphone, I don't really understand your use case.

Best Regards

User1655833706281357277
Associate III
October 12, 2022

This isn't that hard a question. There are other BLE/microprocessor systems out there that make this easy. I know, we have fielded them. We have a custom iOS application that is part of a medical device system. You can probably understand why I want complete control of the pairing process. It should be simple to just refuse the pairing request. The ST part really can't do this?

Remy ISSALYS
ST Technical Moderator
October 14, 2022

Hello,

The pairing request are managed by the BLE Stack and not by the application. Indeed, there isn't any API to reject all pairing requests. If you want to have only specific devices that can connect to your device, you can use the whitelist mechanism. If you want to ignore every pairing request, you can bypass the SMP using the ACI_HAL_WRITE_CONFIG_DATA command, see STM32WB_BLE_Wireless_Interface.html documentation.

Best Regards

User1655833706281357277
User1655833706281357277AuthorBest answer
Associate III
October 17, 2022

It isn't at all obvious how you do that from the link you provided, but okay, uncle. The whitelist option isn't great if you don't know ahead of time the devices you want to whitelist. As I stated before, other vendors let you do this. You might want to think about it.

Remy ISSALYS
ST Technical Moderator
October 18, 2022

Hello,

To bypass the SMP, call ACI_HAL_WRITE_CONFIG_DATA command with the following parameters in Ble_Hci_Gap_Gatt_Init function (app_ble.c):

static const uint8_t SMP_bypass = 0x01;
 
ret = aci_hal_write_config_data(CONFIG_DATA_SMP_MODE_OFFSET, CONFIG_DATA_SMP_MODE_LEN, &SMP_bypass);
if (ret != BLE_STATUS_SUCCESS)
{
 APP_DBG_MSG(" Fail : aci_hal_write_config_data command - CONFIG_DATA_SMP_MODE_OFFSET, result: 0x%x \n", ret);
}
else
{
 APP_DBG_MSG(" Success: aci_hal_write_config_data command - CONFIG_DATA_SMP_MODE_OFFSET\n");
}

When the SMP is bypassed, the pairing request will be ignored by the BLE Stack.

Best Regards

User1655833706281357277
Associate III
October 19, 2022

All right, just to complain a little more then: I really don't want to bypass the security manager and wonder what else happens when that's set. I have to use at least security level three for my application. This started because I was using aci_gap_set_authentication_requirement() and was surprised that the "no bonding mode" argument still let clients temporarily pair and connect it. I have a workaround for this, but it still seems to me to be a deficiency in the API.

Vincent H
Explorer
March 17, 2023

I totally agree with you.

The "documentation" mentions 3 modes ("normal", "bypass", "no blacklist"), without any explanation whatsoever.

If changing the SMP mode, we're left to guess what the mode actually does and wonder about potential effects we may encounter.

Guessing and wondering aren't fitting well with embedded programming.

Remy ISSALYS
ST Technical Moderator
October 26, 2022

Hello,

The "bonding mode" parameter allow if enabled (0x01) to store the bonding information in flash.

Best Regards