Error with Bluetooth HCI function: bt_hci_cmd_send_sync

Hi,

I am developing the nRF52833 DK with NCS v2.00. I am using a function in my source code that reads the current RSSI of the connection. The function, read_conn_rssi (attached below), is taken from the Bluetooth sample, Bluetooth: HCI Power Control. I am getting the following error with the bt_hci_cmd_send_sync function in my code:

<wrn> bt_hci_core: opcode ox1405 status 0x01

Read RSSI err: -5 reason 0x00

I have been trying to find the error & status codes but have not been able to - where can I find them so that I can see what they mean?

Thanks,

Adam

static void read_conn_rssi(uint16_t handle, int8_t *rssi)
{
	struct net_buf *buf, *rsp = NULL;
	struct bt_hci_cp_read_rssi *cp;
	struct bt_hci_rp_read_rssi *rp;

	int err;

	buf = bt_hci_cmd_create(BT_HCI_OP_READ_RSSI, sizeof(*cp));
	if (!buf) {
		printk("Unable to allocate command buffer\n");
		return;
	}

	cp = net_buf_add(buf, sizeof(*cp));
	cp->handle = sys_cpu_to_le16(handle);

	err = bt_hci_cmd_send_sync(BT_HCI_OP_READ_RSSI, buf, &rsp);
	if (err) {
		uint8_t reason = rsp ?
			((struct bt_hci_rp_read_rssi *)rsp->data)->status : 0;
		printk("Read RSSI err: %d reason 0x%02x\n", err, reason);
		return;
	}

	rp = (void *)rsp->data;
	*rssi = rp->rssi;

	net_buf_unref(rsp);
}

Related