mirror of
https://github.com/espressif/esp-nimble.git
synced 2026-08-26 11:51:27 +00:00
nimble/util: Use VS HCI command for reading static random address
Use dedicated VS command for reading static address instead of calling controller code from host. This is required to properly support multi-core MCUs where host and controller runs on separate cores.
This commit is contained in:
@@ -19,23 +19,21 @@
|
||||
|
||||
#include "host/ble_hs.h"
|
||||
#include "host/util/util.h"
|
||||
|
||||
#if MYNEWT_VAL(BLE_CONTROLLER)
|
||||
#include "controller/ble_hw.h"
|
||||
#endif
|
||||
#include "../src/ble_hs_hci_priv.h"
|
||||
|
||||
static int
|
||||
ble_hs_util_load_rand_addr(ble_addr_t *addr)
|
||||
{
|
||||
/* XXX: It is unfortunate that the function to retrieve the random address
|
||||
* is in the controller package. A host-only device ought to be able to
|
||||
* automically restore a random address.
|
||||
*/
|
||||
#if MYNEWT_VAL(BLE_CONTROLLER)
|
||||
#if MYNEWT_VAL(BLE_HCI_VS)
|
||||
struct ble_hci_vs_rd_static_addr_rp rsp;
|
||||
int rc;
|
||||
|
||||
rc = ble_hw_get_static_addr(addr);
|
||||
rc = ble_hs_hci_cmd_tx(BLE_HCI_OP(BLE_HCI_OGF_VENDOR,
|
||||
BLE_HCI_OCF_VS_RD_STATIC_ADDR),
|
||||
NULL, 0, &rsp, sizeof(rsp));
|
||||
if (rc == 0) {
|
||||
addr->type = BLE_ADDR_RANDOM;
|
||||
memcpy(addr->val, rsp.addr, sizeof(addr->val));
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user