Hi all, I am trying to block connection from other devices to my nrf51dk board, except some specific devices. I used whitelist but it seem like the peripheral only block the devices inside the whitelist not vice versa.
Gap::Whitelist_t whitelist;
whitelist.size = 2;
whitelist.capacity = 2;
BLEProtocol::Address_t peerAddr[2];
peerAddr[0].type = BLEProtocol::AddressType::RANDOM_STATIC;
peerAddr[0].address[5] = 0x30;
peerAddr[0].address[4] = 0x75;
peerAddr[0].address[3] = 0x12;
peerAddr[0].address[2] = 0xa0;
peerAddr[0].address[1] = 0x74;
peerAddr[0].address[0] = 0x5a;
whitelist.addresses = peerAddr;
ble.gap().setWhitelist(whitelist);
ble.gap().setAdvertisingPolicyMode(Gap::ADV_POLICY_FILTER_ALL_REQS);
I tried to use that format to whitelist my phone but at the end, my phone was blocked by the peripheral.
After that I think about using button to grant my phone permission to connect to the peripheral device by using sd_ble_gap_sec_params_reply
to reply the BLE_GAP_EVT_SEC_PARAMS_REQUEST
follow this but when I do that in a switch-case, the connection still established without permission (button press). So do anyone know how to control the sd_ble_gap_sec_params_reply
or it is impossible to control it?
BTW I'm using S130 v2.0.