You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ry...@apache.org on 2020/05/08 13:40:56 UTC
[mynewt-nimble] 01/05: nimble/ll: Parse hci disconnect in ble_ll_hci
This is an automated email from the ASF dual-hosted git repository.
rymek pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git
commit 2a39d40ac098d88bde33fe26333d438f7294b3bf
Author: Ćukasz Rymanowski <lu...@codecoup.pl>
AuthorDate: Thu Apr 16 15:06:42 2020 +0200
nimble/ll: Parse hci disconnect in ble_ll_hci
This will be used later when LL will have to decide if it is ACL or CIS
to disconnect
---
nimble/controller/src/ble_ll_conn_hci.c | 7 +------
nimble/controller/src/ble_ll_conn_priv.h | 2 +-
nimble/controller/src/ble_ll_hci.c | 16 +++++++++++++++-
3 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/nimble/controller/src/ble_ll_conn_hci.c b/nimble/controller/src/ble_ll_conn_hci.c
index 1350fdc..b84b690 100644
--- a/nimble/controller/src/ble_ll_conn_hci.c
+++ b/nimble/controller/src/ble_ll_conn_hci.c
@@ -1128,16 +1128,11 @@ ble_ll_conn_create_cancel(ble_ll_hci_post_cmd_complete_cb *post_cmd_cb)
* @return int
*/
int
-ble_ll_conn_hci_disconnect_cmd(const uint8_t *cmdbuf, uint8_t len)
+ble_ll_conn_hci_disconnect_cmd(const struct ble_hci_lc_disconnect_cp *cmd)
{
int rc;
uint16_t handle;
struct ble_ll_conn_sm *connsm;
- const struct ble_hci_lc_disconnect_cp *cmd = (const void *) cmdbuf;
-
- if (len != sizeof (*cmd)) {
- return BLE_ERR_INV_HCI_CMD_PARMS;
- }
/* Check for valid parameters */
handle = le16toh(cmd->conn_handle);
diff --git a/nimble/controller/src/ble_ll_conn_priv.h b/nimble/controller/src/ble_ll_conn_priv.h
index f2f72d1..a836bfe 100644
--- a/nimble/controller/src/ble_ll_conn_priv.h
+++ b/nimble/controller/src/ble_ll_conn_priv.h
@@ -164,7 +164,7 @@ bool ble_ll_conn_init_pending_aux_conn_rsp(void);
void ble_ll_disconn_comp_event_send(struct ble_ll_conn_sm *connsm,
uint8_t reason);
void ble_ll_auth_pyld_tmo_event_send(struct ble_ll_conn_sm *connsm);
-int ble_ll_conn_hci_disconnect_cmd(const uint8_t *cmdbuf, uint8_t len);
+int ble_ll_conn_hci_disconnect_cmd(const struct ble_hci_lc_disconnect_cp *cmd);
int ble_ll_conn_hci_rd_rem_ver_cmd(const uint8_t *cmdbuf, uint8_t len);
int ble_ll_conn_create(const uint8_t *cmdbuf, uint8_t len);
int ble_ll_conn_hci_update(const uint8_t *cmdbuf, uint8_t len);
diff --git a/nimble/controller/src/ble_ll_hci.c b/nimble/controller/src/ble_ll_hci.c
index b82adc2..14f71de 100644
--- a/nimble/controller/src/ble_ll_hci.c
+++ b/nimble/controller/src/ble_ll_hci.c
@@ -1174,6 +1174,20 @@ ble_ll_hci_le_cmd_proc(const uint8_t *cmdbuf, uint8_t len, uint16_t ocf,
return rc;
}
+static int
+ble_ll_hci_disconnect(const uint8_t *cmdbuf, uint8_t len)
+{
+ const struct ble_hci_lc_disconnect_cp *cmd;
+
+ cmd = (const void *) cmdbuf;
+
+ if (len != sizeof (*cmd)) {
+ return BLE_ERR_INV_HCI_CMD_PARMS;
+ }
+
+ return ble_ll_conn_hci_disconnect_cmd(cmd);
+}
+
/**
* Process a link control command sent from the host to the controller. The HCI
* command has a 3 byte command header followed by data. The header is:
@@ -1194,7 +1208,7 @@ ble_ll_hci_link_ctrl_cmd_proc(const uint8_t *cmdbuf, uint8_t len, uint16_t ocf)
switch (ocf) {
case BLE_HCI_OCF_DISCONNECT_CMD:
- rc = ble_ll_conn_hci_disconnect_cmd(cmdbuf, len);
+ rc = ble_ll_hci_disconnect(cmdbuf, len);
/* Send command status instead of command complete */
rc += (BLE_ERR_MAX + 1);
break;