Repository: incubator-mynewt-larva Updated Branches: refs/heads/master 1742527ad -> 9f7eb9c78
Add read remote used features and feature exchange control procedure Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/commit/9f7eb9c7 Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/tree/9f7eb9c7 Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/diff/9f7eb9c7 Branch: refs/heads/master Commit: 9f7eb9c7858360252ef12df260a59fb8d9612ff1 Parents: 1742527 Author: wes3 <w...@micosa.io> Authored: Mon Jan 25 09:29:19 2016 -0800 Committer: wes3 <w...@micosa.io> Committed: Mon Jan 25 09:29:19 2016 -0800 ---------------------------------------------------------------------- .../controller/include/controller/ble_ll_conn.h | 1 + .../controller/include/controller/ble_ll_ctrl.h | 2 + net/nimble/controller/src/ble_ll.c | 9 +-- net/nimble/controller/src/ble_ll_conn.c | 5 +- net/nimble/controller/src/ble_ll_conn_hci.c | 34 +++++++++ net/nimble/controller/src/ble_ll_conn_priv.h | 1 + net/nimble/controller/src/ble_ll_ctrl.c | 75 +++++++++++++++++++- net/nimble/controller/src/ble_ll_hci.c | 12 +++- net/nimble/controller/src/ble_ll_hci_ev.c | 24 ++++++- net/nimble/host/include/host/host_hci.h | 1 + net/nimble/host/src/host_dbg.c | 16 +++++ net/nimble/host/src/host_hci_cmd.c | 16 +++++ net/nimble/include/nimble/hci_common.h | 6 ++ project/bletest/src/main.c | 12 ++-- 14 files changed, 197 insertions(+), 17 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/9f7eb9c7/net/nimble/controller/include/controller/ble_ll_conn.h ---------------------------------------------------------------------- diff --git a/net/nimble/controller/include/controller/ble_ll_conn.h b/net/nimble/controller/include/controller/ble_ll_conn.h index 4df87b7..f4ad0e5 100644 --- a/net/nimble/controller/include/controller/ble_ll_conn.h +++ b/net/nimble/controller/include/controller/ble_ll_conn.h @@ -111,6 +111,7 @@ struct ble_ll_conn_sm uint8_t cur_ctrl_proc; uint8_t disconnect_reason; uint8_t rxd_disconnect_reason; + uint8_t common_features; /* Just a uint8 for now */ uint16_t pending_ctrl_procs; uint16_t event_cntr; uint16_t conn_handle; http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/9f7eb9c7/net/nimble/controller/include/controller/ble_ll_ctrl.h ---------------------------------------------------------------------- diff --git a/net/nimble/controller/include/controller/ble_ll_ctrl.h b/net/nimble/controller/include/controller/ble_ll_ctrl.h index 1f3de56..0dfe129 100644 --- a/net/nimble/controller/include/controller/ble_ll_ctrl.h +++ b/net/nimble/controller/include/controller/ble_ll_ctrl.h @@ -237,5 +237,7 @@ void ble_ll_hci_ev_datalen_chg(struct ble_ll_conn_sm *connsm); void ble_ll_hci_ev_rem_conn_parm_req(struct ble_ll_conn_sm *connsm, struct ble_ll_conn_params *cp); void ble_ll_hci_ev_conn_update(struct ble_ll_conn_sm *connsm, uint8_t status); +void ble_ll_hci_ev_read_rem_used_feat(struct ble_ll_conn_sm *connsm, + uint8_t status); #endif /* H_BLE_LL_CTRL_ */ http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/9f7eb9c7/net/nimble/controller/src/ble_ll.c ---------------------------------------------------------------------- diff --git a/net/nimble/controller/src/ble_ll.c b/net/nimble/controller/src/ble_ll.c index 4eb4a8e..49435e8 100644 --- a/net/nimble/controller/src/ble_ll.c +++ b/net/nimble/controller/src/ble_ll.c @@ -53,6 +53,7 @@ #undef BLE_LL_CFG_FEAT_CONN_PARAM_REQ #undef BLE_LL_CFG_FEAT_LE_ENCRYPTION #undef BLE_LL_CFG_FEAT_EXT_REJECT_IND +#define BLE_LL_CFG_FEAT_SLAVE_INIT_FEAT_XCHG /* The global BLE LL data object */ struct ble_ll_obj g_ble_ll_data; @@ -80,10 +81,7 @@ struct ble_ll_log #define BLE_LL_LOG_LEN (256) -#if !defined(nzbss_t) -#define nzbss_t -#endif -static nzbss_t struct ble_ll_log g_ble_ll_log[BLE_LL_LOG_LEN]; +static sec_bss_nz_core struct ble_ll_log g_ble_ll_log[BLE_LL_LOG_LEN]; static uint8_t g_ble_ll_log_index; void @@ -950,6 +948,9 @@ ble_ll_init(void) #ifdef BLE_LL_CFG_FEAT_EXT_REJECT_IND features |= BLE_LL_FEAT_EXTENDED_REJ; #endif +#ifdef BLE_LL_CFG_FEAT_SLAVE_INIT_FEAT_XCHG + features |= BLE_LL_FEAT_SLAVE_INIT; +#endif lldata->ll_supp_features = features; http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/9f7eb9c7/net/nimble/controller/src/ble_ll_conn.c ---------------------------------------------------------------------- diff --git a/net/nimble/controller/src/ble_ll_conn.c b/net/nimble/controller/src/ble_ll_conn.c index 92ad621..ad3d52e 100644 --- a/net/nimble/controller/src/ble_ll_conn.c +++ b/net/nimble/controller/src/ble_ll_conn.c @@ -142,10 +142,7 @@ struct ble_ll_conn_sm *g_ble_ll_conn_create_sm; struct ble_ll_conn_sm *g_ble_ll_conn_cur_sm; /* Connection state machine array */ -#if !defined(nzbss_t) -#define nzbss_t -#endif -nzbss_t struct ble_ll_conn_sm g_ble_ll_conn_sm[BLE_LL_CFG_CONN_MAX_CONNS]; +sec_bss_nz_core struct ble_ll_conn_sm g_ble_ll_conn_sm[BLE_LL_CFG_CONN_MAX_CONNS]; /* List of active connections */ struct ble_ll_conn_active_list g_ble_ll_conn_active_list; http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/9f7eb9c7/net/nimble/controller/src/ble_ll_conn_hci.c ---------------------------------------------------------------------- diff --git a/net/nimble/controller/src/ble_ll_conn_hci.c b/net/nimble/controller/src/ble_ll_conn_hci.c index 4a26a9d..2d28f83 100644 --- a/net/nimble/controller/src/ble_ll_conn_hci.c +++ b/net/nimble/controller/src/ble_ll_conn_hci.c @@ -427,6 +427,39 @@ ble_ll_conn_process_conn_params(uint8_t *cmdbuf, struct ble_ll_conn_sm *connsm) } /** + * Called when the host issues the read remote features command + * + * @param cmdbuf + * + * @return int + */ +int +ble_ll_conn_read_rem_features(uint8_t *cmdbuf) +{ + uint16_t handle; + struct ble_ll_conn_sm *connsm; + + /* If no connection handle exit with error */ + handle = le16toh(cmdbuf); + connsm = ble_ll_conn_find_active_conn(handle); + if (!connsm) { + return BLE_ERR_UNK_CONN_ID; + } + + /* See if we support this feature */ + if (connsm->conn_role == BLE_LL_CONN_ROLE_SLAVE) { + if ((ble_ll_read_supp_features() & BLE_LL_FEAT_SLAVE_INIT) == 0) { + return BLE_ERR_UNSUPP_FEATURE; + } + } + + /* Start the control procedure */ + ble_ll_ctrl_proc_start(connsm, BLE_LL_CTRL_PROC_FEATURE_XCHG); + + return BLE_ERR_SUCCESS; +} + +/** * Called to process a connection update command. * * @param cmdbuf @@ -588,6 +621,7 @@ ble_ll_conn_create_cancel(void) int rc; struct ble_ll_conn_sm *connsm; + /* WWW: BUG! I send the event before the command complete. Not good. */ /* * If we receive this command and we have not got a connection * create command, we have to return disallowed. The spec does not say http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/9f7eb9c7/net/nimble/controller/src/ble_ll_conn_priv.h ---------------------------------------------------------------------- diff --git a/net/nimble/controller/src/ble_ll_conn_priv.h b/net/nimble/controller/src/ble_ll_conn_priv.h index 5c3a700..39d4353 100644 --- a/net/nimble/controller/src/ble_ll_conn_priv.h +++ b/net/nimble/controller/src/ble_ll_conn_priv.h @@ -105,6 +105,7 @@ void ble_ll_conn_comp_event_send(struct ble_ll_conn_sm *connsm, uint8_t status); void ble_ll_conn_timeout(struct ble_ll_conn_sm *connsm, uint8_t ble_err); int ble_ll_conn_hci_chk_conn_params(uint16_t itvl_min, uint16_t itvl_max, uint16_t latency, uint16_t spvn_tmo); +int ble_ll_conn_read_rem_features(uint8_t *cmdbuf); #endif /* H_BLE_LL_CONN_PRIV_ */ http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/9f7eb9c7/net/nimble/controller/src/ble_ll_ctrl.c ---------------------------------------------------------------------- diff --git a/net/nimble/controller/src/ble_ll_ctrl.c b/net/nimble/controller/src/ble_ll_ctrl.c index 04b965e..7531873 100644 --- a/net/nimble/controller/src/ble_ll_ctrl.c +++ b/net/nimble/controller/src/ble_ll_ctrl.c @@ -297,6 +297,9 @@ ble_ll_ctrl_proc_unk_rsp(struct ble_ll_conn_sm *connsm, uint8_t *dptr) ble_ll_ctrl_proc_stop(connsm, ctrl_proc); if (ctrl_proc == BLE_LL_CTRL_PROC_CONN_PARAM_REQ) { ble_ll_hci_ev_conn_update(connsm, BLE_ERR_UNSUPP_FEATURE); + } else if (ctrl_proc == BLE_LL_CTRL_PROC_FEATURE_XCHG) { + /* XXX: should only get this if a slave initiated this */ + ble_ll_hci_ev_read_rem_used_feat(connsm, BLE_ERR_UNSUPP_FEATURE); } } } @@ -505,6 +508,34 @@ ble_ll_ctrl_rx_conn_update(struct ble_ll_conn_sm *connsm, uint8_t *dptr, return rsp_opcode; } +/** + * Called when we receive a feature request or a slave initiated feature + * request. + * + * + * @param connsm + * @param dptr + * @param rspbuf + * + * @return int + */ +static int +ble_ll_ctrl_rx_feature_req(struct ble_ll_conn_sm *connsm, uint8_t *dptr, + uint8_t *rspbuf) +{ + uint8_t rsp_opcode; + + /* Add put logical AND of their features and our features*/ + /* XXX: right now, there is only one byte of supported features */ + /* XXX: Used proper macros later */ + rsp_opcode = BLE_LL_CTRL_FEATURE_RSP; + connsm->common_features = dptr[0] & ble_ll_read_supp_features(); + memset(rspbuf + 1, 0, 8); + rspbuf[1] = connsm->common_features; + + return rsp_opcode; +} + static int ble_ll_ctrl_rx_conn_param_req(struct ble_ll_conn_sm *connsm, uint8_t *dptr, uint8_t *rspbuf) @@ -641,6 +672,14 @@ ble_ll_ctrl_proc_init(struct ble_ll_conn_sm *connsm, int ctrl_proc) opcode = BLE_LL_CTRL_LENGTH_REQ; ble_ll_ctrl_datalen_upd_make(connsm, dptr); break; + case BLE_LL_CTRL_PROC_FEATURE_XCHG: + if (connsm->conn_role == BLE_LL_CONN_ROLE_MASTER) { + opcode = BLE_LL_CTRL_FEATURE_REQ; + } else { + opcode = BLE_LL_CTRL_SLAVE_FEATURE_REQ; + } + dptr[1] = ble_ll_read_supp_features(); + break; case BLE_LL_CTRL_PROC_TERMINATE: opcode = BLE_LL_CTRL_TERMINATE_IND; dptr[1] = connsm->disconnect_reason; @@ -895,6 +934,9 @@ ble_ll_ctrl_rx_pdu(struct ble_ll_conn_sm *connsm, struct os_mbuf *om) case BLE_LL_CTRL_LENGTH_REQ: feature = BLE_LL_FEAT_DATA_LEN_EXT; break; + case BLE_LL_CTRL_SLAVE_FEATURE_REQ: + feature = BLE_LL_FEAT_SLAVE_INIT; + break; case BLE_LL_CTRL_CONN_PARM_REQ: case BLE_LL_CTRL_CONN_PARM_RSP: feature = BLE_LL_FEAT_CONN_PARM_REQ; @@ -958,13 +1000,42 @@ ble_ll_ctrl_rx_pdu(struct ble_ll_conn_sm *connsm, struct os_mbuf *om) ble_ll_ctrl_proc_unk_rsp(connsm, dptr); break; + case BLE_LL_CTRL_FEATURE_REQ: + if (connsm->conn_role == BLE_LL_CONN_ROLE_SLAVE) { + rsp_opcode = ble_ll_ctrl_rx_feature_req(connsm, dptr, rspbuf); + } else { + /* XXX: not sure this is correct but do it anyway */ + /* Construct unknown pdu */ + rspbuf[1] = opcode; + rsp_opcode = BLE_LL_CTRL_UNKNOWN_RSP; + } + break; + + /* XXX: check to see if ctrl procedure was running? Do we care? */ + case BLE_LL_CTRL_FEATURE_RSP: + /* Stop the control procedure */ + connsm->common_features = dptr[0]; + if (IS_PENDING_CTRL_PROC_M(connsm, BLE_LL_CTRL_PROC_FEATURE_XCHG)) { + ble_ll_hci_ev_read_rem_used_feat(connsm, BLE_ERR_SUCCESS); + } + ble_ll_ctrl_proc_stop(connsm, BLE_LL_CTRL_PROC_FEATURE_XCHG); + break; + + case BLE_LL_CTRL_SLAVE_FEATURE_REQ: + if (connsm->conn_role == BLE_LL_CONN_ROLE_MASTER) { + rsp_opcode = ble_ll_ctrl_rx_feature_req(connsm, dptr, rspbuf); + } else { + /* Construct unknown pdu */ + rspbuf[1] = opcode; + rsp_opcode = BLE_LL_CTRL_UNKNOWN_RSP; + } + break; + /* XXX: remember to check if feature supported */ case BLE_LL_CTRL_CHANNEL_MAP_REQ: case BLE_LL_CTRL_ENC_REQ: case BLE_LL_CTRL_START_ENC_REQ: - case BLE_LL_CTRL_FEATURE_REQ: case BLE_LL_CTRL_PAUSE_ENC_REQ: - case BLE_LL_CTRL_SLAVE_FEATURE_REQ: /* Construct unknown pdu */ rspbuf[1] = opcode; rsp_opcode = BLE_LL_CTRL_UNKNOWN_RSP; http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/9f7eb9c7/net/nimble/controller/src/ble_ll_hci.c ---------------------------------------------------------------------- diff --git a/net/nimble/controller/src/ble_ll_hci.c b/net/nimble/controller/src/ble_ll_hci.c index 112e7e8..da29324 100644 --- a/net/nimble/controller/src/ble_ll_hci.c +++ b/net/nimble/controller/src/ble_ll_hci.c @@ -37,7 +37,8 @@ uint8_t g_ble_ll_hci_event_mask[BLE_HCI_SET_EVENT_MASK_LEN]; * Returns the number of command packets that the host is allowed to send * to the controller. * - * @return uint8_t + * + * wOPCODE = opcode;@return uint8_t */ static uint8_t ble_ll_hci_get_num_cmd_pkts(void) @@ -342,6 +343,15 @@ ble_ll_hci_le_cmd_proc(uint8_t *cmdbuf, uint16_t ocf, uint8_t *rsplen) rc += (BLE_ERR_MAX + 1); break; + /* XXX: implement */ + case BLE_HCI_OCF_LE_RD_REM_FEAT: + if (len == BLE_HCI_CONN_RD_REM_FEAT_LEN) { + rc = ble_ll_conn_read_rem_features(cmdbuf); + } + /* This is a hack; command status gets sent instead of cmd complete */ + rc += (BLE_ERR_MAX + 1); + break; + case BLE_HCI_OCF_LE_REM_CONN_PARAM_NRR: if (len == BLE_HCI_CONN_PARAM_NEG_REPLY_LEN) { rc = ble_ll_conn_param_reply(cmdbuf, 0); http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/9f7eb9c7/net/nimble/controller/src/ble_ll_hci_ev.c ---------------------------------------------------------------------- diff --git a/net/nimble/controller/src/ble_ll_hci_ev.c b/net/nimble/controller/src/ble_ll_hci_ev.c index 6fb2157..fa77a3f 100644 --- a/net/nimble/controller/src/ble_ll_hci_ev.c +++ b/net/nimble/controller/src/ble_ll_hci_ev.c @@ -77,7 +77,7 @@ ble_ll_hci_ev_rem_conn_parm_req(struct ble_ll_conn_sm *connsm, } /** - * Send a data length change event for a connection to the host. + * Send a connection update event. * * @param connsm Pointer to connection state machine * @param status The error code. @@ -104,3 +104,25 @@ ble_ll_hci_ev_conn_update(struct ble_ll_conn_sm *connsm, uint8_t status) } } } + +void +ble_ll_hci_ev_read_rem_used_feat(struct ble_ll_conn_sm *connsm, uint8_t status) +{ + uint8_t *evbuf; + + if (ble_ll_hci_is_le_event_enabled(BLE_HCI_LE_SUBEV_CONN_UPD_COMPLETE)) { + evbuf = os_memblock_get(&g_hci_cmd_pool); + if (evbuf) { + evbuf[0] = BLE_HCI_EVCODE_LE_META; + evbuf[1] = BLE_HCI_LE_RD_REM_USED_FEAT_LEN; + evbuf[2] = BLE_HCI_LE_SUBEV_RD_REM_USED_FEAT; + evbuf[3] = status; + if (status == BLE_ERR_SUCCESS) { + htole16(evbuf + 4, connsm->conn_handle); + memset(evbuf + 6, 0, BLE_HCI_RD_LOC_SUPP_FEAT_RSPLEN); + evbuf[6] = connsm->common_features; + } + ble_ll_hci_event_send(evbuf); + } + } +} http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/9f7eb9c7/net/nimble/host/include/host/host_hci.h ---------------------------------------------------------------------- diff --git a/net/nimble/host/include/host/host_hci.h b/net/nimble/host/include/host/host_hci.h index fbf1b02..6d94a9d 100644 --- a/net/nimble/host/include/host/host_hci.h +++ b/net/nimble/host/include/host/host_hci.h @@ -33,6 +33,7 @@ int host_hci_cmd_le_set_rand_addr(uint8_t *addr); int host_hci_cmd_le_set_event_mask(uint64_t event_mask); int host_hci_cmd_le_read_buffer_size(void); int host_hci_cmd_le_read_loc_supp_feat(void); +int host_hci_cmd_le_read_rem_used_feat(uint16_t handle); int host_hci_cmd_le_set_adv_enable(uint8_t enable); int host_hci_cmd_le_set_scan_params(uint8_t scan_type, uint16_t scan_itvl, uint16_t scan_window, http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/9f7eb9c7/net/nimble/host/src/host_dbg.c ---------------------------------------------------------------------- diff --git a/net/nimble/host/src/host_dbg.c b/net/nimble/host/src/host_dbg.c index 2d98945..bdff5b9 100644 --- a/net/nimble/host/src/host_dbg.c +++ b/net/nimble/host/src/host_dbg.c @@ -104,6 +104,22 @@ host_hci_dbg_le_event_disp(uint8_t subev, uint8_t len, uint8_t *evdata) le16toh(evdata + 4), le16toh(evdata + 6), le16toh(evdata + 8)); break; + + case BLE_HCI_LE_SUBEV_RD_REM_USED_FEAT: + status = evdata[0]; + if (status == BLE_ERR_SUCCESS) { + console_printf("LE Remote Used Features. handle=%u feat=", + le16toh(evdata + 1)); + for (i = 0; i < BLE_HCI_RD_LOC_SUPP_FEAT_RSPLEN; ++i) { + console_printf("%02x ", evdata[3 + i]); + } + console_printf("\n"); + } else { + console_printf("LE Remote Used Features. FAIL (status=%u)\n", + status); + } + break; + default: console_printf("\tUnknown LE event\n"); break; http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/9f7eb9c7/net/nimble/host/src/host_hci_cmd.c ---------------------------------------------------------------------- diff --git a/net/nimble/host/src/host_hci_cmd.c b/net/nimble/host/src/host_hci_cmd.c index 521639c..304efab 100644 --- a/net/nimble/host/src/host_hci_cmd.c +++ b/net/nimble/host/src/host_hci_cmd.c @@ -284,6 +284,22 @@ host_hci_cmd_le_read_loc_supp_feat(void) return rc; } +/** + * OGF=LE, OCF=0x0016 + */ +int +host_hci_cmd_le_read_rem_used_feat(uint16_t handle) +{ + int rc; + uint8_t cmd[BLE_HCI_CONN_RD_REM_FEAT_LEN]; + + htole16(cmd, handle); + rc = host_hci_le_cmd_send(BLE_HCI_OCF_LE_RD_REM_FEAT, + BLE_HCI_CONN_RD_REM_FEAT_LEN, + cmd); + return rc; +} + int host_hci_cmd_le_set_adv_enable(uint8_t enable) { http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/9f7eb9c7/net/nimble/include/nimble/hci_common.h ---------------------------------------------------------------------- diff --git a/net/nimble/include/nimble/hci_common.h b/net/nimble/include/nimble/hci_common.h index caa11ec..53278bc 100644 --- a/net/nimble/include/nimble/hci_common.h +++ b/net/nimble/include/nimble/hci_common.h @@ -261,6 +261,9 @@ /* --- LE connection update (OCF 0x0013) */ #define BLE_HCI_CONN_UPDATE_LEN (14) +/* --- LE read remote features (OCF 0x0016) */ +#define BLE_HCI_CONN_RD_REM_FEAT_LEN (2) + /* --- LE remote connection parameter request reply (OCF 0x0020) */ #define BLE_HCI_CONN_PARAM_REPLY_LEN (14) @@ -400,6 +403,9 @@ /* LE connection update complete event (sub event 0x03) */ #define BLE_HCI_LE_CONN_UPD_LEN (10) +/* LE connection update complete event (sub event 0x03) */ +#define BLE_HCI_LE_RD_REM_USED_FEAT_LEN (12) + /* LE remote connection parameter request event (sub event 0x06) */ #define BLE_HCI_LE_REM_CONN_PARM_REQ_LEN (11) http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/9f7eb9c7/project/bletest/src/main.c ---------------------------------------------------------------------- diff --git a/project/bletest/src/main.c b/project/bletest/src/main.c index 78ffae3..3793a27 100755 --- a/project/bletest/src/main.c +++ b/project/bletest/src/main.c @@ -66,7 +66,7 @@ os_membuf_t g_mbuf_buffer[MBUF_MEMPOOL_SIZE]; #define BLETEST_ROLE_ADVERTISER (0) #define BLETEST_ROLE_SCANNER (1) #define BLETEST_ROLE_INITIATOR (2) -#define BLETEST_CFG_ROLE (BLETEST_ROLE_INITIATOR) +#define BLETEST_CFG_ROLE (BLETEST_ROLE_ADVERTISER) #define BLETEST_CFG_FILT_DUP_ADV (0) #define BLETEST_CFG_ADV_ITVL (60000 / BLE_HCI_ADV_ITVL) #define BLETEST_CFG_ADV_TYPE BLE_HCI_ADV_TYPE_ADV_IND @@ -93,10 +93,7 @@ int g_bletest_state; struct os_eventq g_bletest_evq; struct os_callout_func g_bletest_timer; struct os_task bletest_task; -#if !defined(nzbss_t) -#define nzbss_t -#endif -nzbss_t os_stack_t bletest_stack[BLETEST_STACK_SIZE]; +sec_bss_nz_core os_stack_t bletest_stack[BLETEST_STACK_SIZE]; uint32_t g_bletest_conn_end; uint8_t g_bletest_current_conns; uint8_t g_bletest_cur_peer_addr[BLE_DEV_ADDR_LEN]; @@ -492,6 +489,11 @@ bletest_execute(void) /* advertising better be stopped! */ assert(ble_ll_adv_enabled() == 0); + /* Send the remote used features command */ + rc = host_hci_cmd_le_read_rem_used_feat(handle); + host_hci_outstanding_opcode = 0; + assert(rc == 0); + /* Add to current connections */ ++g_bletest_current_conns;