I already know the phone's Bluetooth address, I want to write the address directly into the device, the device - directed broadcast, how do I put the address in the program?
I already know the phone's Bluetooth address, I want to write the address directly into the device, the device - directed broadcast, how do I put the address in the program?
See this message sequence chart.
When you start directed advertisement you will get a BLE_ADV_EVT_PEER_ADDR_REQUEST event. There you will have to call ble_advertising_peer_addr_reply(ble_gap_addr_t * p_peer_addr) with the peer address.
See this message sequence chart.
When you start directed advertisement you will get a BLE_ADV_EVT_PEER_ADDR_REQUEST event. There you will have to call ble_advertising_peer_addr_reply(ble_gap_addr_t * p_peer_addr) with the peer address.
I set up err_code = ble_advertising_peer_addr_reply ( &peer_address ) ; on_adv_evt ( ble_adv_evt_t ble_adv_evt ), but ,other phones can still be linked to devices, you can write a routine to help me?Thank you very much
You have to enable the directed advertisement and set the interval and timeout for directed slow advertisement. Add this to advertising_init()
:
options.ble_adv_directed_enabled = BLE_ADV_DIRECTED_ENABLED;
options.ble_adv_directed_slow_enabled = BLE_ADV_DIRECTED_SLOW_ENABLED;
options.ble_adv_directed_slow_interval = APP_ADV_DIRECTED_INTERVAL;
options.ble_adv_directed_slow_timeout = APP_ADV_DIRECTED_TIMEOUT_IN_SECONDS;
Ok,thank you very much. SmartRF shown on the Packet Sniffer is a directional broadcasting,However, the mobile phone to the device cannot be found.Address of the bluetooth settings are correct.Excuse me, Is this what causes it?