mirror of
https://github.com/espressif/esp-nimble.git
synced 2026-09-03 07:40:04 +00:00
nimble/ll/css: Add HCI vs command to read current slot for connection
This commit is contained in:
@@ -268,6 +268,37 @@ ble_ll_hci_vs_css_set_conn_slot(const uint8_t *cmdbuf, uint8_t cmdlen,
|
||||
return BLE_ERR_SUCCESS;
|
||||
}
|
||||
|
||||
static int
|
||||
ble_ll_hci_vs_css_read_conn_slot(const uint8_t *cmdbuf, uint8_t cmdlen,
|
||||
uint8_t *rspbuf, uint8_t *rsplen)
|
||||
{
|
||||
const struct ble_hci_vs_css_read_conn_slot_cp *cmd = (const void *)cmdbuf;
|
||||
struct ble_hci_vs_css_read_conn_slot_rp *rsp = (void *)rspbuf;
|
||||
struct ble_ll_conn_sm *connsm;
|
||||
uint16_t conn_handle;
|
||||
|
||||
if (cmdlen != sizeof(*cmd)) {
|
||||
return BLE_ERR_INV_HCI_CMD_PARMS;
|
||||
}
|
||||
|
||||
if (!ble_ll_sched_css_is_enabled()) {
|
||||
return BLE_ERR_CMD_DISALLOWED;
|
||||
}
|
||||
|
||||
conn_handle = le16toh(cmd->conn_handle);
|
||||
connsm = ble_ll_conn_find_by_handle(conn_handle);
|
||||
if (!connsm) {
|
||||
return BLE_ERR_UNK_CONN_ID;
|
||||
}
|
||||
|
||||
*rsplen = sizeof(*rsp);
|
||||
rsp->opcode = cmd->opcode;
|
||||
rsp->conn_handle = cmd->conn_handle;
|
||||
rsp->slot_idx = htole16(connsm->css_slot_idx);
|
||||
|
||||
return BLE_ERR_SUCCESS;
|
||||
}
|
||||
|
||||
static int
|
||||
ble_ll_hci_vs_css(uint16_t ocf, const uint8_t *cmdbuf, uint8_t cmdlen,
|
||||
uint8_t *rspbuf, uint8_t *rsplen)
|
||||
@@ -291,6 +322,8 @@ ble_ll_hci_vs_css(uint16_t ocf, const uint8_t *cmdbuf, uint8_t cmdlen,
|
||||
return ble_ll_hci_vs_css_set_next_slot(cmdbuf, cmdlen, rspbuf, rsplen);
|
||||
case BLE_HCI_VS_CSS_OP_SET_CONN_SLOT:
|
||||
return ble_ll_hci_vs_css_set_conn_slot(cmdbuf, cmdlen, rspbuf, rsplen);
|
||||
case BLE_HCI_VS_CSS_OP_READ_CONN_SLOT:
|
||||
return ble_ll_hci_vs_css_read_conn_slot(cmdbuf, cmdlen, rspbuf, rsplen);
|
||||
}
|
||||
|
||||
return BLE_ERR_INV_HCI_CMD_PARMS;
|
||||
|
||||
@@ -1168,6 +1168,16 @@ struct ble_hci_vs_css_set_conn_slot_cp {
|
||||
uint16_t conn_handle;
|
||||
uint16_t slot_idx;
|
||||
} __attribute__((packed));
|
||||
#define BLE_HCI_VS_CSS_OP_READ_CONN_SLOT 0x05
|
||||
struct ble_hci_vs_css_read_conn_slot_cp {
|
||||
uint8_t opcode;
|
||||
uint16_t conn_handle;
|
||||
} __attribute__((packed));
|
||||
struct ble_hci_vs_css_read_conn_slot_rp {
|
||||
uint8_t opcode;
|
||||
uint16_t conn_handle;
|
||||
uint16_t slot_idx;
|
||||
} __attribute__((packed));
|
||||
|
||||
/* Command Specific Definitions */
|
||||
/* --- Set controller to host flow control (OGF 0x03, OCF 0x0031) --- */
|
||||
|
||||
Reference in New Issue
Block a user