/* NOTE: we currently only send this event when we have a reason to send it; not when it fails. */
void ble_ll_disconn_comp_event_send(struct ble_ll_conn_sm *connsm, uint8_t reason)
/* NOTE: we currently only send this event when we have a reason to send it; not when it fails. */
void ble_ll_disconn_comp_event_send(struct ble_ll_conn_sm *connsm, uint8_t reason)
{
    struct ble_hci_ev_disconn_cmp *ev;
    struct ble_hci_ev *hci_ev;
    if (ble_ll_hci_is_event_enabled(BLE_HCI_EVCODE_DISCONN_CMP)) {
        hci_ev = (void *) ble_hci_trans_buf_alloc(BLE_HCI_TRANS_BUF_EVT_HI);
        if (hci_ev) {
            hci_ev->opcode = BLE_HCI_EVCODE_DISCONN_CMP;
            hci_ev->length = sizeof(*ev);
            ev = (void *) hci_ev->data;
            ev->status = BLE_ERR_SUCCESS;
            ev->conn_handle = htole16(connsm->conn_handle);
            ev->reason = reason;
            ble_ll_hci_event_send(hci_ev);
        }
    }
}