Return-Path: X-Original-To: apmail-mynewt-commits-archive@minotaur.apache.org Delivered-To: apmail-mynewt-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7C05A18DA3 for ; Mon, 21 Dec 2015 22:07:51 +0000 (UTC) Received: (qmail 62362 invoked by uid 500); 21 Dec 2015 22:07:51 -0000 Delivered-To: apmail-mynewt-commits-archive@mynewt.apache.org Received: (qmail 62334 invoked by uid 500); 21 Dec 2015 22:07:51 -0000 Mailing-List: contact commits-help@mynewt.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@mynewt.incubator.apache.org Delivered-To: mailing list commits@mynewt.incubator.apache.org Received: (qmail 62325 invoked by uid 99); 21 Dec 2015 22:07:51 -0000 Received: from Unknown (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 21 Dec 2015 22:07:51 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id E29FDC08DF for ; Mon, 21 Dec 2015 22:07:50 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.779 X-Spam-Level: * X-Spam-Status: No, score=1.779 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-0.001] autolearn=disabled Received: from mx1-us-east.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id fpKDDX81VGPW for ; Mon, 21 Dec 2015 22:07:49 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-us-east.apache.org (ASF Mail Server at mx1-us-east.apache.org) with SMTP id A2C62439D3 for ; Mon, 21 Dec 2015 22:07:48 +0000 (UTC) Received: (qmail 62269 invoked by uid 99); 21 Dec 2015 22:07:48 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 21 Dec 2015 22:07:48 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 08998E0974; Mon, 21 Dec 2015 22:07:48 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ccollins@apache.org To: commits@mynewt.incubator.apache.org Date: Mon, 21 Dec 2015 22:07:49 -0000 Message-Id: In-Reply-To: <703fb8c93beb41ba9453fac4ef67d872@git.apache.org> References: <703fb8c93beb41ba9453fac4ef67d872@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [2/2] incubator-mynewt-larva git commit: Combine all GAP slave connection procedures. Combine all GAP slave connection procedures. The various discoverability and connectability modes can be "mixed and matched," so it doesn't make sense to have separate functions for each. Instead, the application specifies both modes in a single function call (ble_gap_conn_advertise()). 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/dc628945 Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/tree/dc628945 Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/diff/dc628945 Branch: refs/heads/master Commit: dc6289454141eeb33cdadd1f218cc4fc939f00a0 Parents: 9ef0a5e Author: Christopher Collins Authored: Mon Dec 21 14:06:26 2015 -0800 Committer: Christopher Collins Committed: Mon Dec 21 14:06:26 2015 -0800 ---------------------------------------------------------------------- net/nimble/host/include/host/ble_gap.h | 18 +- net/nimble/host/src/ble_gap_conn.c | 316 ++++++----------------- net/nimble/host/src/test/ble_hs_conn_test.c | 9 +- 3 files changed, 104 insertions(+), 239 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/dc628945/net/nimble/host/include/host/ble_gap.h ---------------------------------------------------------------------- diff --git a/net/nimble/host/include/host/ble_gap.h b/net/nimble/host/include/host/ble_gap.h index d4a9f64..8cb9d0f 100644 --- a/net/nimble/host/include/host/ble_gap.h +++ b/net/nimble/host/include/host/ble_gap.h @@ -58,13 +58,19 @@ struct ble_gap_conn_event { typedef void ble_gap_connect_fn(struct ble_gap_conn_event *event, void *arg); +#define BLE_GAP_CONN_MODE_NULL 0 +#define BLE_GAP_CONN_MODE_NON 1 +#define BLE_GAP_CONN_MODE_DIR 2 +#define BLE_GAP_CONN_MODE_UND 3 + +#define BLE_GAP_DISC_MODE_NULL 0 +#define BLE_GAP_DISC_MODE_NON 1 +#define BLE_GAP_DISC_MODE_LTD 2 +#define BLE_GAP_DISC_MODE_GEN 3 + void ble_gap_conn_set_cb(ble_gap_connect_fn *cb, void *arg); -int ble_gap_conn_non_discoverable(void); -int ble_gap_conn_limited_discoverable(void); -int ble_gap_conn_general_discoverable(void); -int ble_gap_conn_non_connectable(void); -int ble_gap_conn_direct_connectable(int addr_type, uint8_t *addr); -int ble_gap_conn_undirect_connectable(void); +int ble_gap_conn_advertise(uint8_t discoverable_mode, uint8_t connectable_mode, + uint8_t *peer_addr, uint8_t peer_addr_type); int ble_gap_conn_gen_disc(uint32_t duration_ms); int ble_gap_conn_direct_connect(int addr_type, uint8_t *addr); int ble_gap_conn_terminate(uint16_t handle); http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/dc628945/net/nimble/host/src/ble_gap_conn.c ---------------------------------------------------------------------- diff --git a/net/nimble/host/src/ble_gap_conn.c b/net/nimble/host/src/ble_gap_conn.c index 0b614b6..1e4db01 100644 --- a/net/nimble/host/src/ble_gap_conn.c +++ b/net/nimble/host/src/ble_gap_conn.c @@ -91,6 +91,9 @@ #define BLE_GAP_CONN_S_MODE_UND_CONN 5 #define BLE_GAP_CONN_S_MODE_MAX 6 +#define BLE_GAP_CONN_MODE_MAX 4 +#define BLE_GAP_DISC_MODE_MAX 4 + static int ble_gap_conn_adv_params_tx(void *arg); static int ble_gap_conn_adv_power_tx(void *arg); static int ble_gap_conn_adv_data_tx(void *arg); @@ -109,16 +112,18 @@ static ble_hci_sched_tx_fn * const [BLE_GAP_CONN_S_STATE_DIR_ENABLE] = ble_gap_conn_adv_enable_tx, }; -static int ble_gap_conn_slave_mode; +static uint8_t ble_gap_conn_s_conn_mode; +static uint8_t ble_gap_conn_s_disc_mode; -static struct hci_adv_params - ble_gap_conn_adv_params[BLE_GAP_CONN_S_MODE_MAX]; +static struct hci_adv_params ble_gap_conn_adv_params; static ble_gap_connect_fn *ble_gap_conn_cb; static void *ble_gap_conn_arg; static int ble_gap_conn_master_state; static int ble_gap_conn_slave_state; +static uint8_t ble_gap_conn_master_addr_type; +static uint8_t ble_gap_conn_slave_addr_type; static uint8_t ble_gap_conn_master_addr[BLE_DEV_ADDR_LEN]; static uint8_t ble_gap_conn_slave_addr[BLE_DEV_ADDR_LEN]; static struct os_callout_func ble_gap_conn_master_timer; @@ -203,7 +208,8 @@ static void ble_gap_conn_slave_reset_state(void) { ble_gap_conn_slave_state = BLE_GAP_CONN_STATE_IDLE; - ble_gap_conn_slave_mode = BLE_GAP_CONN_S_MODE_NONE; + ble_gap_conn_s_conn_mode = BLE_GAP_CONN_MODE_NULL; + ble_gap_conn_s_disc_mode = BLE_GAP_DISC_MODE_NULL; } /** @@ -296,26 +302,6 @@ ble_gap_conn_slave_in_progress(void) return ble_gap_conn_slave_state != BLE_GAP_CONN_STATE_IDLE; } -static int -ble_gap_conn_adv_is_directed(int mode) -{ - switch (mode) { - case BLE_GAP_CONN_S_MODE_NON_DISC: - case BLE_GAP_CONN_S_MODE_LTD_DISC: - case BLE_GAP_CONN_S_MODE_GEN_DISC: - case BLE_GAP_CONN_S_MODE_NON_CONN: - case BLE_GAP_CONN_S_MODE_UND_CONN: - return 0; - - case BLE_GAP_CONN_S_MODE_DIR_CONN: - return 1; - - default: - assert(0); - return 0; - } -} - /** * Attempts to complete the master connection process in response to a * "connection complete" event from the controller. If the master connection @@ -370,7 +356,7 @@ ble_gap_conn_accept_slave_conn(uint8_t addr_type, uint8_t *addr) switch (ble_gap_conn_slave_state) { case BLE_GAP_CONN_S_STATE_MAX: /* XXX: Check address type. */ - if (!ble_gap_conn_adv_is_directed(ble_gap_conn_slave_mode) || + if (ble_gap_conn_s_conn_mode != BLE_GAP_CONN_MODE_DIR || memcmp(ble_gap_conn_slave_addr, addr, BLE_DEV_ADDR_LEN) == 0) { os_callout_stop(&ble_gap_conn_master_timer.cf_c); @@ -651,8 +637,26 @@ ble_gap_conn_adv_params_tx(void *arg) struct hci_adv_params hap; int rc; - hap = ble_gap_conn_adv_params[ble_gap_conn_slave_mode]; - memcpy(hap.peer_addr, ble_gap_conn_slave_addr, sizeof hap.peer_addr); + hap = ble_gap_conn_adv_params; + + switch (ble_gap_conn_s_conn_mode) { + case BLE_GAP_CONN_MODE_NON: + hap.adv_type = BLE_HCI_ADV_TYPE_ADV_NONCONN_IND; + break; + + case BLE_GAP_CONN_MODE_DIR: + hap.adv_type = BLE_HCI_ADV_TYPE_ADV_DIRECT_IND_HD; + memcpy(hap.peer_addr, ble_gap_conn_slave_addr, sizeof hap.peer_addr); + break; + + case BLE_GAP_CONN_MODE_UND: + hap.adv_type = BLE_HCI_ADV_TYPE_ADV_IND; + break; + + default: + assert(0); + break; + } ble_hci_ack_set_callback(ble_gap_conn_adv_ack, NULL); rc = host_hci_cmd_le_set_adv_params(&hap); @@ -671,13 +675,13 @@ ble_gap_conn_adv_initiate(void) assert(!ble_gap_conn_slave_in_progress()); - if (ble_gap_conn_adv_is_directed(ble_gap_conn_slave_mode)) { + if (ble_gap_conn_s_conn_mode == BLE_GAP_CONN_MODE_DIR) { ble_gap_conn_slave_state = BLE_GAP_CONN_S_STATE_DIR_PARAMS; - rc = ble_hci_sched_enqueue(ble_gap_conn_adv_params_tx, NULL); } else { ble_gap_conn_slave_state = BLE_GAP_CONN_S_STATE_UND_PARAMS; - rc = ble_hci_sched_enqueue(ble_gap_conn_adv_params_tx, NULL); } + + rc = ble_hci_sched_enqueue(ble_gap_conn_adv_params_tx, NULL); if (rc != 0) { ble_gap_conn_slave_reset_state(); return rc; @@ -686,167 +690,79 @@ ble_gap_conn_adv_initiate(void) return 0; } -/***************************************************************************** - * $non-discoverable mode * - *****************************************************************************/ - /** - * Enables Non-Discoverable Mode, as described in vol. 3, part C, section - * 9.2.2. + * Enables the specified discoverable mode and connectable mode, and initiates + * the advertising process. * - * @return 0 on success; nonzero on failure. - */ -int -ble_gap_conn_non_discoverable(void) -{ - int rc; - - /* Make sure no slave connection attempt is already in progress. */ - if (ble_gap_conn_slave_in_progress()) { - return BLE_HS_EALREADY; - } - - ble_gap_conn_slave_mode = BLE_GAP_CONN_S_MODE_NON_DISC; - - rc = ble_gap_conn_adv_initiate(); - return rc; -} - -/***************************************************************************** - * $limited-discoverable mode * - *****************************************************************************/ - -/** - * Enables Limited-Discoverable Mode, as described in vol. 3, part C, section - * 9.2.3. + * @param discoverable_mode One of the following constants: + * o BLE_GAP_DISC_MODE_NON + * (non-discoverable; 3.C.9.2.2). + * o BLE_GAP_DISC_MODE_LTD + * (limited-discoverable; 3.C.9.2.3). + * o BLE_GAP_DISC_MODE_GEN + * (general-discoverable; 3.C.9.2.4). + * @param connectable_mode One of the following constants: + * o BLE_GAP_CONN_MODE_NON + * (non-connectable; 3.C.9.3.2). + * o BLE_GAP_CONN_MODE_DIR + * (directed-connectable; 3.C.9.3.3). + * o BLE_GAP_CONN_MODE_UND + * (undirected-connectable; 3.C.9.3.4). + * @param peer_addr The address of the peer who is allowed to + * connect; only meaningful for directed + * connectable mode. For other modes, specify + * NULL. + * @param peer_addr_type The type of address specified for the + * "peer_addr" parameter; only meaningful for + * directed connectable mode. For other + * modes, specify 0. For directed connectable + * mode, this should be one of the following + * constants: + * o BLE_HCI_ADV_PEER_ADDR_PUBLIC + * o BLE_HCI_ADV_PEER_ADDR_RANDOM * * @return 0 on success; nonzero on failure. */ int -ble_gap_conn_limited_discoverable(void) +ble_gap_conn_advertise(uint8_t discoverable_mode, uint8_t connectable_mode, + uint8_t *peer_addr, uint8_t peer_addr_type) { int rc; - /* Make sure no slave connection attempt is already in progress. */ - if (ble_gap_conn_slave_in_progress()) { - return BLE_HS_EALREADY; - } - - ble_gap_conn_slave_mode = BLE_GAP_CONN_S_MODE_LTD_DISC; - - rc = ble_gap_conn_adv_initiate(); - return rc; -} + if (discoverable_mode >= BLE_GAP_DISC_MODE_MAX || + connectable_mode >= BLE_GAP_CONN_MODE_MAX) { -/***************************************************************************** - * $general-discoverable mode * - *****************************************************************************/ - -/** - * Enables General-Discoverable Mode, as described in vol. 3, part C, section - * 9.2.4. - * - * @return 0 on success; nonzero on failure. - */ -int -ble_gap_conn_general_discoverable(void) -{ - int rc; - - /* Make sure no slave connection attempt is already in progress. */ - if (ble_gap_conn_slave_in_progress()) { - return BLE_HS_EALREADY; + return BLE_HS_EINVAL; } - ble_gap_conn_slave_mode = BLE_GAP_CONN_S_MODE_GEN_DISC; - - rc = ble_gap_conn_adv_initiate(); - return rc; -} - -/***************************************************************************** - * $non-connectable mode * - *****************************************************************************/ - -/** - * Enables Non-Connectable Mode, as described in vol. 3, part C, section 9.3.2. - * - * @return 0 on success; nonzero on failure. - */ -int -ble_gap_conn_non_connectable(void) -{ - int rc; - /* Make sure no slave connection attempt is already in progress. */ if (ble_gap_conn_slave_in_progress()) { return BLE_HS_EALREADY; } - ble_gap_conn_slave_mode = BLE_GAP_CONN_S_MODE_NON_CONN; - - rc = ble_gap_conn_adv_initiate(); - return rc; -} - -/***************************************************************************** - * $directed connectable mode * - *****************************************************************************/ + /* Don't initiate a connection procedure if we won't be able to allocate a + * connection object on completion. + */ + if (connectable_mode != BLE_GAP_CONN_MODE_NON && + !ble_hs_conn_can_alloc()) { -/** - * Enables Directed Connectable Mode, as described in vol. 3, part C, section - * 9.3.3. - * - * @param addr_type The peer's address type; one of: - * o BLE_HCI_ADV_PEER_ADDR_PUBLIC - * o BLE_HCI_ADV_PEER_ADDR_RANDOM - * o BLE_HCI_ADV_PEER_ADDR_PUBLIC_IDENT - * o BLE_HCI_ADV_PEER_ADDR_RANDOM_IDENT - * @param addr The address of the peer to connect to. - * - * @return 0 on success; nonzero on failure. - */ -int -ble_gap_conn_direct_connectable(int addr_type, uint8_t *addr) -{ - int rc; + return BLE_HS_ENOMEM; + } - /* Make sure no slave connection attempt is already in progress. */ - if (ble_gap_conn_slave_in_progress()) { - return BLE_HS_EALREADY; + if (connectable_mode == BLE_GAP_CONN_MODE_DIR) { + ble_gap_conn_slave_addr_type = peer_addr_type; + memcpy(ble_gap_conn_slave_addr, peer_addr, 6); } - ble_gap_conn_slave_mode = BLE_GAP_CONN_S_MODE_DIR_CONN; - memcpy(ble_gap_conn_slave_addr, addr, BLE_DEV_ADDR_LEN); + ble_gap_conn_s_conn_mode = connectable_mode; + ble_gap_conn_s_disc_mode = discoverable_mode; rc = ble_gap_conn_adv_initiate(); - return rc; -} - -/***************************************************************************** - * $undirected connectable mode * - *****************************************************************************/ - -/** - * Enables Undirected Connectable Mode, as described in vol. 3, part C, section - * 9.3.4. - * - * @return 0 on success; nonzero on failure. - */ -int -ble_gap_conn_undirect_connectable(void) -{ - int rc; - - /* Make sure no slave connection attempt is already in progress. */ - if (ble_gap_conn_slave_in_progress()) { - return BLE_HS_EALREADY; + if (rc != 0) { + return rc; } - ble_gap_conn_slave_mode = BLE_GAP_CONN_S_MODE_UND_CONN; - - rc = ble_gap_conn_adv_initiate(); - return rc; + return 0; } /***************************************************************************** @@ -1043,6 +959,7 @@ ble_gap_conn_direct_connect(int addr_type, uint8_t *addr) } ble_gap_conn_master_state = BLE_GAP_CONN_M_STATE_DIRECT_PENDING; + ble_gap_conn_master_addr_type = addr_type; memcpy(ble_gap_conn_master_addr, addr, BLE_DEV_ADDR_LEN); rc = ble_hci_sched_enqueue(ble_gap_conn_direct_connect_tx, NULL); @@ -1113,69 +1030,7 @@ ble_gap_conn_terminate(uint16_t handle) static void ble_gap_conn_init_slave_params(void) { - ble_gap_conn_adv_params[BLE_GAP_CONN_S_MODE_NON_DISC] = - (struct hci_adv_params) { - - .adv_itvl_min = BLE_GAP_ADV_FAST_INTERVAL1_MIN, - .adv_itvl_max = BLE_GAP_ADV_FAST_INTERVAL1_MAX, - .adv_type = BLE_HCI_ADV_TYPE_ADV_IND, - .own_addr_type = BLE_HCI_ADV_OWN_ADDR_PUBLIC, - .peer_addr_type = BLE_HCI_ADV_PEER_ADDR_PUBLIC, - .adv_channel_map = BLE_HCI_ADV_CHANMASK_DEF, - .adv_filter_policy = BLE_HCI_ADV_FILT_DEF, - }; - - ble_gap_conn_adv_params[BLE_GAP_CONN_S_MODE_LTD_DISC] = - (struct hci_adv_params) { - - .adv_itvl_min = BLE_GAP_ADV_FAST_INTERVAL1_MIN, - .adv_itvl_max = BLE_GAP_ADV_FAST_INTERVAL1_MAX, - .adv_type = BLE_HCI_ADV_TYPE_ADV_IND, - .own_addr_type = BLE_HCI_ADV_OWN_ADDR_PUBLIC, - .peer_addr_type = BLE_HCI_ADV_PEER_ADDR_PUBLIC, - .adv_channel_map = BLE_HCI_ADV_CHANMASK_DEF, - .adv_filter_policy = BLE_HCI_ADV_FILT_DEF, - }; - - ble_gap_conn_adv_params[BLE_GAP_CONN_S_MODE_GEN_DISC] = - (struct hci_adv_params) { - - .adv_itvl_min = BLE_GAP_ADV_FAST_INTERVAL1_MIN, - .adv_itvl_max = BLE_GAP_ADV_FAST_INTERVAL1_MAX, - .adv_type = BLE_HCI_ADV_TYPE_ADV_IND, - .own_addr_type = BLE_HCI_ADV_OWN_ADDR_PUBLIC, - .peer_addr_type = BLE_HCI_ADV_PEER_ADDR_PUBLIC, - .adv_channel_map = BLE_HCI_ADV_CHANMASK_DEF, - .adv_filter_policy = BLE_HCI_ADV_FILT_DEF, - }; - - ble_gap_conn_adv_params[BLE_GAP_CONN_S_MODE_NON_CONN] = - (struct hci_adv_params) { - - .adv_itvl_min = BLE_GAP_ADV_FAST_INTERVAL1_MIN, - .adv_itvl_max = BLE_GAP_ADV_FAST_INTERVAL1_MAX, - .adv_type = BLE_HCI_ADV_TYPE_ADV_IND, - .own_addr_type = BLE_HCI_ADV_OWN_ADDR_PUBLIC, - .peer_addr_type = BLE_HCI_ADV_PEER_ADDR_PUBLIC, - .adv_channel_map = BLE_HCI_ADV_CHANMASK_DEF, - .adv_filter_policy = BLE_HCI_ADV_FILT_DEF, - }; - - ble_gap_conn_adv_params[BLE_GAP_CONN_S_MODE_DIR_CONN] = - (struct hci_adv_params) { - - .adv_itvl_min = BLE_GAP_ADV_FAST_INTERVAL1_MIN, - .adv_itvl_max = BLE_GAP_ADV_FAST_INTERVAL1_MAX, - .adv_type = BLE_HCI_ADV_TYPE_ADV_DIRECT_IND_HD, - .own_addr_type = BLE_HCI_ADV_OWN_ADDR_PUBLIC, - .peer_addr_type = BLE_HCI_ADV_PEER_ADDR_PUBLIC, - .adv_channel_map = BLE_HCI_ADV_CHANMASK_DEF, - .adv_filter_policy = BLE_HCI_ADV_FILT_DEF, - }; - - ble_gap_conn_adv_params[BLE_GAP_CONN_S_MODE_UND_CONN] = - (struct hci_adv_params) { - + ble_gap_conn_adv_params = (struct hci_adv_params) { .adv_itvl_min = BLE_GAP_ADV_FAST_INTERVAL1_MIN, .adv_itvl_max = BLE_GAP_ADV_FAST_INTERVAL1_MAX, .adv_type = BLE_HCI_ADV_TYPE_ADV_IND, @@ -1190,7 +1045,8 @@ int ble_gap_conn_init(void) { ble_gap_conn_cb = NULL; - ble_gap_conn_slave_mode = BLE_GAP_CONN_S_MODE_NONE; + ble_gap_conn_s_conn_mode = BLE_GAP_CONN_MODE_NULL; + ble_gap_conn_s_disc_mode = BLE_GAP_DISC_MODE_NULL; ble_gap_conn_master_state = BLE_GAP_CONN_STATE_IDLE; ble_gap_conn_slave_state = BLE_GAP_CONN_STATE_IDLE; memset(ble_gap_conn_master_addr, 0, sizeof ble_gap_conn_master_addr); http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/dc628945/net/nimble/host/src/test/ble_hs_conn_test.c ---------------------------------------------------------------------- diff --git a/net/nimble/host/src/test/ble_hs_conn_test.c b/net/nimble/host/src/test/ble_hs_conn_test.c index c4e5e8c..ba05b7d 100644 --- a/net/nimble/host/src/test/ble_hs_conn_test.c +++ b/net/nimble/host/src/test/ble_hs_conn_test.c @@ -138,7 +138,8 @@ TEST_CASE(ble_hs_conn_test_direct_connectable_success) TEST_ASSERT(ble_hs_conn_first() == NULL); /* Initiate advertising. */ - rc = ble_gap_conn_direct_connectable(0, addr); + rc = ble_gap_conn_advertise(BLE_GAP_DISC_MODE_NON, BLE_GAP_CONN_MODE_DIR, + addr, BLE_HCI_ADV_PEER_ADDR_PUBLIC); TEST_ASSERT(rc == 0); ble_hci_sched_wakeup(); @@ -185,7 +186,8 @@ TEST_CASE(ble_hs_conn_test_direct_connectable_hci_errors) TEST_ASSERT(ble_hs_conn_first() == NULL); /* Initiate connection. */ - rc = ble_gap_conn_direct_connectable(0, addr); + rc = ble_gap_conn_advertise(BLE_GAP_DISC_MODE_NON, BLE_GAP_CONN_MODE_DIR, + addr, BLE_HCI_ADV_PEER_ADDR_PUBLIC); TEST_ASSERT(rc == 0); ble_hci_sched_wakeup(); @@ -230,7 +232,8 @@ TEST_CASE(ble_hs_conn_test_undirect_connectable_success) TEST_ASSERT(ble_hs_conn_first() == NULL); /* Initiate advertising. */ - rc = ble_gap_conn_undirect_connectable(); + rc = ble_gap_conn_advertise(BLE_GAP_DISC_MODE_NON, BLE_GAP_CONN_MODE_UND, + NULL, 0); TEST_ASSERT(rc == 0); ble_hci_sched_wakeup();