mirror of
https://github.com/espressif/esp-nimble.git
synced 2026-06-06 05:14:45 +00:00
Nimble: Check stack status before executing stack command
Added change of checking stack status in the APIs exposed to user
This commit is contained in:
+201
-6
@@ -482,6 +482,10 @@ ble_gap_conn_find(uint16_t handle, struct ble_gap_conn_desc *out_desc)
|
||||
{
|
||||
struct ble_hs_conn *conn;
|
||||
|
||||
if (!ble_hs_is_enabled()) {
|
||||
return BLE_HS_EDISABLED;
|
||||
}
|
||||
|
||||
ble_hs_lock();
|
||||
|
||||
conn = ble_hs_conn_find(handle);
|
||||
@@ -504,6 +508,10 @@ ble_gap_conn_find_by_addr(const ble_addr_t *addr,
|
||||
{
|
||||
struct ble_hs_conn *conn;
|
||||
|
||||
if (!ble_hs_is_enabled()) {
|
||||
return BLE_HS_EDISABLED;
|
||||
}
|
||||
|
||||
ble_hs_lock();
|
||||
|
||||
conn = ble_hs_conn_find_by_addr(addr);
|
||||
@@ -551,6 +559,10 @@ ble_gap_extract_conn_cb(uint16_t conn_handle,
|
||||
int
|
||||
ble_gap_set_priv_mode(const ble_addr_t *peer_addr, uint8_t priv_mode)
|
||||
{
|
||||
if (!ble_hs_is_enabled()) {
|
||||
return BLE_HS_EDISABLED;
|
||||
}
|
||||
|
||||
return ble_hs_pvcy_set_mode(peer_addr, priv_mode);
|
||||
}
|
||||
|
||||
@@ -562,6 +574,10 @@ ble_gap_read_le_phy(uint16_t conn_handle, uint8_t *tx_phy, uint8_t *rx_phy)
|
||||
struct ble_hs_conn *conn;
|
||||
int rc;
|
||||
|
||||
if (!ble_hs_is_enabled()) {
|
||||
return BLE_HS_EDISABLED;
|
||||
}
|
||||
|
||||
ble_hs_lock();
|
||||
conn = ble_hs_conn_find(conn_handle);
|
||||
ble_hs_unlock();
|
||||
@@ -606,6 +622,10 @@ ble_gap_set_prefered_default_le_phy(uint8_t tx_phys_mask, uint8_t rx_phys_mask)
|
||||
return BLE_ERR_INV_HCI_CMD_PARMS;
|
||||
}
|
||||
|
||||
if (!ble_hs_is_enabled()) {
|
||||
return BLE_HS_EDISABLED;
|
||||
}
|
||||
|
||||
memset(&cmd, 0, sizeof(cmd));
|
||||
|
||||
if (tx_phys_mask == 0) {
|
||||
@@ -632,6 +652,10 @@ ble_gap_set_prefered_le_phy(uint16_t conn_handle, uint8_t tx_phys_mask,
|
||||
struct ble_hci_le_set_phy_cp cmd;
|
||||
struct ble_hs_conn *conn;
|
||||
|
||||
if (!ble_hs_is_enabled()) {
|
||||
return BLE_HS_EDISABLED;
|
||||
}
|
||||
|
||||
ble_hs_lock();
|
||||
conn = ble_hs_conn_find(conn_handle);
|
||||
ble_hs_unlock();
|
||||
@@ -2123,6 +2147,10 @@ ble_gap_set_event_cb(uint16_t conn_handle, ble_gap_event_fn *cb, void *cb_arg)
|
||||
{
|
||||
struct ble_hs_conn *conn;
|
||||
|
||||
if (!ble_hs_is_enabled()) {
|
||||
return BLE_HS_EDISABLED;
|
||||
}
|
||||
|
||||
ble_hs_lock();
|
||||
|
||||
conn = ble_hs_conn_find(conn_handle);
|
||||
@@ -2221,6 +2249,10 @@ ble_gap_wl_tx_rmv(const ble_addr_t *addr)
|
||||
return BLE_HS_EINVAL;
|
||||
}
|
||||
|
||||
if (!ble_hs_is_enabled()) {
|
||||
return BLE_HS_EDISABLED;
|
||||
}
|
||||
|
||||
memcpy(cmd.addr, addr->val, BLE_DEV_ADDR_LEN);
|
||||
cmd.addr_type = addr->type;
|
||||
|
||||
@@ -2244,6 +2276,10 @@ ble_gap_wl_set(const ble_addr_t *addrs, uint8_t white_list_count)
|
||||
|
||||
STATS_INC(ble_gap_stats, wl_set);
|
||||
|
||||
if (!ble_hs_is_enabled()) {
|
||||
return BLE_HS_EDISABLED;
|
||||
}
|
||||
|
||||
ble_hs_lock();
|
||||
|
||||
for (i = 0; i < white_list_count; i++) {
|
||||
@@ -2348,6 +2384,10 @@ ble_gap_adv_stop(void)
|
||||
#if NIMBLE_BLE_ADVERTISE && !MYNEWT_VAL(BLE_EXT_ADV)
|
||||
int rc;
|
||||
|
||||
if (!ble_hs_is_enabled()) {
|
||||
return BLE_HS_EDISABLED;
|
||||
}
|
||||
|
||||
ble_hs_lock();
|
||||
rc = ble_gap_adv_stop_no_lock();
|
||||
ble_hs_unlock();
|
||||
@@ -2545,6 +2585,10 @@ ble_gap_adv_start(uint8_t own_addr_type, const ble_addr_t *direct_addr,
|
||||
|
||||
STATS_INC(ble_gap_stats, adv_start);
|
||||
|
||||
if (!ble_hs_is_enabled()) {
|
||||
return BLE_HS_EDISABLED;
|
||||
}
|
||||
|
||||
ble_hs_lock();
|
||||
|
||||
rc = ble_gap_adv_validate(own_addr_type, direct_addr, adv_params);
|
||||
@@ -2561,11 +2605,6 @@ ble_gap_adv_start(uint8_t own_addr_type, const ble_addr_t *direct_addr,
|
||||
}
|
||||
}
|
||||
|
||||
if (!ble_hs_is_enabled()) {
|
||||
rc = BLE_HS_EDISABLED;
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (ble_gap_is_preempted()) {
|
||||
rc = BLE_HS_EPREEMPTED;
|
||||
goto done;
|
||||
@@ -2630,6 +2669,10 @@ ble_gap_adv_set_data(const uint8_t *data, int data_len)
|
||||
|
||||
STATS_INC(ble_gap_stats, adv_set_data);
|
||||
|
||||
if (!ble_hs_is_enabled()) {
|
||||
return BLE_HS_EDISABLED;
|
||||
}
|
||||
|
||||
/* Check for valid parameters */
|
||||
if (((data == NULL) && (data_len != 0)) ||
|
||||
(data_len > BLE_HCI_MAX_ADV_DATA_LEN)) {
|
||||
@@ -2654,6 +2697,9 @@ ble_gap_adv_rsp_set_data(const uint8_t *data, int data_len)
|
||||
struct ble_hci_le_set_scan_rsp_data_cp cmd;
|
||||
uint16_t opcode;
|
||||
|
||||
if (!ble_hs_is_enabled()) {
|
||||
return BLE_HS_EDISABLED;
|
||||
}
|
||||
|
||||
/* Check for valid parameters */
|
||||
if (((data == NULL) && (data_len != 0)) ||
|
||||
@@ -2680,6 +2726,10 @@ ble_gap_adv_set_fields(const struct ble_hs_adv_fields *adv_fields)
|
||||
uint8_t buf_sz;
|
||||
int rc;
|
||||
|
||||
if (!ble_hs_is_enabled()) {
|
||||
return BLE_HS_EDISABLED;
|
||||
}
|
||||
|
||||
rc = ble_hs_adv_set_fields(adv_fields, buf, &buf_sz, sizeof buf);
|
||||
if (rc != 0) {
|
||||
return rc;
|
||||
@@ -2704,6 +2754,10 @@ ble_gap_adv_rsp_set_fields(const struct ble_hs_adv_fields *rsp_fields)
|
||||
uint8_t buf_sz;
|
||||
int rc;
|
||||
|
||||
if (!ble_hs_is_enabled()) {
|
||||
return BLE_HS_EDISABLED;
|
||||
}
|
||||
|
||||
rc = ble_hs_adv_set_fields(rsp_fields, buf, &buf_sz, sizeof buf);
|
||||
if (rc != 0) {
|
||||
return rc;
|
||||
@@ -2871,6 +2925,10 @@ ble_gap_ext_adv_configure(uint8_t instance,
|
||||
return BLE_HS_EINVAL;
|
||||
}
|
||||
|
||||
if (!ble_hs_is_enabled()) {
|
||||
return BLE_HS_EDISABLED;
|
||||
}
|
||||
|
||||
rc = ble_gap_ext_adv_params_validate(params);
|
||||
if (rc) {
|
||||
return rc;
|
||||
@@ -2935,6 +2993,10 @@ ble_gap_ext_adv_set_addr(uint8_t instance, const ble_addr_t *addr)
|
||||
return BLE_HS_EINVAL;
|
||||
}
|
||||
|
||||
if (!ble_hs_is_enabled()) {
|
||||
return BLE_HS_EDISABLED;
|
||||
}
|
||||
|
||||
ble_hs_lock();
|
||||
rc = ble_gap_ext_adv_set_addr_no_lock(instance, addr->val);
|
||||
ble_hs_unlock();
|
||||
@@ -2955,6 +3017,10 @@ ble_gap_ext_adv_start(uint8_t instance, int duration, int max_events)
|
||||
return BLE_HS_EINVAL;
|
||||
}
|
||||
|
||||
if (!ble_hs_is_enabled()) {
|
||||
return BLE_HS_EDISABLED;
|
||||
}
|
||||
|
||||
ble_hs_lock();
|
||||
if (!ble_gap_slave[instance].configured) {
|
||||
ble_hs_unlock();
|
||||
@@ -3232,6 +3298,11 @@ ble_gap_ext_adv_set_data(uint8_t instance, struct os_mbuf *data)
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (!ble_hs_is_enabled()) {
|
||||
rc = BLE_HS_EDISABLED;
|
||||
goto done;
|
||||
}
|
||||
|
||||
ble_hs_lock();
|
||||
rc = ble_gap_ext_adv_set_data_validate(instance, data);
|
||||
if (rc != 0) {
|
||||
@@ -3299,6 +3370,11 @@ ble_gap_ext_adv_rsp_set_data(uint8_t instance, struct os_mbuf *data)
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (!ble_hs_is_enabled()) {
|
||||
rc = BLE_HS_EDISABLED;
|
||||
goto done;
|
||||
}
|
||||
|
||||
ble_hs_lock();
|
||||
rc = ble_gap_ext_adv_rsp_set_validate(instance, data);
|
||||
if (rc != 0) {
|
||||
@@ -3327,6 +3403,10 @@ ble_gap_ext_adv_remove(uint8_t instance)
|
||||
return BLE_HS_EINVAL;
|
||||
}
|
||||
|
||||
if (!ble_hs_is_enabled()) {
|
||||
return BLE_HS_EDISABLED;
|
||||
}
|
||||
|
||||
ble_hs_lock();
|
||||
if (!ble_gap_slave[instance].configured) {
|
||||
ble_hs_unlock();
|
||||
@@ -3360,6 +3440,10 @@ ble_gap_ext_adv_clear(void)
|
||||
uint8_t instance;
|
||||
uint16_t opcode;
|
||||
|
||||
if (!ble_hs_is_enabled()) {
|
||||
return BLE_HS_EDISABLED;
|
||||
}
|
||||
|
||||
ble_hs_lock();
|
||||
|
||||
for (instance = 0; instance < BLE_ADV_INSTANCES; instance++) {
|
||||
@@ -3453,6 +3537,10 @@ ble_gap_periodic_adv_configure(uint8_t instance,
|
||||
return BLE_HS_EINVAL;
|
||||
}
|
||||
|
||||
if (!ble_hs_is_enabled()) {
|
||||
return BLE_HS_EDISABLED;
|
||||
}
|
||||
|
||||
rc = ble_gap_periodic_adv_params_validate(params);
|
||||
if (rc) {
|
||||
return rc;
|
||||
@@ -3499,6 +3587,10 @@ ble_gap_periodic_adv_start(uint8_t instance)
|
||||
return BLE_HS_EINVAL;
|
||||
}
|
||||
|
||||
if (!ble_hs_is_enabled()) {
|
||||
return BLE_HS_EDISABLED;
|
||||
}
|
||||
|
||||
ble_hs_lock();
|
||||
|
||||
/* Periodic advertising cannot start unless it is configured before */
|
||||
@@ -3646,6 +3738,11 @@ ble_gap_periodic_adv_set_data(uint8_t instance, struct os_mbuf *data)
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (!ble_hs_is_enabled()) {
|
||||
rc = BLE_HS_EDISABLED;
|
||||
goto done;
|
||||
}
|
||||
|
||||
ble_hs_lock();
|
||||
|
||||
rc = ble_gap_periodic_adv_set_data_validate(instance, data);
|
||||
@@ -3694,6 +3791,10 @@ ble_gap_periodic_adv_stop(uint8_t instance)
|
||||
return BLE_HS_EINVAL;
|
||||
}
|
||||
|
||||
if (!ble_hs_is_enabled()) {
|
||||
return BLE_HS_EDISABLED;
|
||||
}
|
||||
|
||||
ble_hs_lock();
|
||||
rc = ble_gap_periodic_adv_stop_no_lock(instance);
|
||||
ble_hs_unlock();
|
||||
@@ -3750,6 +3851,10 @@ ble_gap_periodic_adv_sync_create(const ble_addr_t *addr, uint8_t adv_sid,
|
||||
return BLE_HS_EINVAL;
|
||||
}
|
||||
|
||||
if (!ble_hs_is_enabled()) {
|
||||
return BLE_HS_EDISABLED;
|
||||
}
|
||||
|
||||
ble_hs_lock();
|
||||
|
||||
/* No sync can be created if another sync is still pending */
|
||||
@@ -3838,6 +3943,10 @@ ble_gap_periodic_adv_sync_terminate(uint16_t sync_handle)
|
||||
uint16_t opcode;
|
||||
int rc;
|
||||
|
||||
if (!ble_hs_is_enabled()) {
|
||||
return BLE_HS_EDISABLED;
|
||||
}
|
||||
|
||||
ble_hs_lock();
|
||||
|
||||
if (ble_gap_sync.op == BLE_GAP_OP_SYNC) {
|
||||
@@ -3884,6 +3993,10 @@ ble_gap_periodic_adv_sync_reporting(uint16_t sync_handle, bool enable)
|
||||
uint16_t opcode;
|
||||
int rc;
|
||||
|
||||
if (!ble_hs_is_enabled()) {
|
||||
return BLE_HS_EDISABLED;
|
||||
}
|
||||
|
||||
ble_hs_lock();
|
||||
|
||||
if (ble_gap_sync.op == BLE_GAP_OP_SYNC) {
|
||||
@@ -3920,6 +4033,10 @@ ble_gap_periodic_adv_sync_transfer(uint16_t sync_handle, uint16_t conn_handle,
|
||||
uint16_t opcode;
|
||||
int rc;
|
||||
|
||||
if (!ble_hs_is_enabled()) {
|
||||
return BLE_HS_EDISABLED;
|
||||
}
|
||||
|
||||
ble_hs_lock();
|
||||
|
||||
conn = ble_hs_conn_find(conn_handle);
|
||||
@@ -3964,6 +4081,10 @@ ble_gap_periodic_adv_sync_set_info(uint8_t instance, uint16_t conn_handle,
|
||||
return BLE_HS_EINVAL;
|
||||
}
|
||||
|
||||
if (!ble_hs_is_enabled()) {
|
||||
return BLE_HS_EDISABLED;
|
||||
}
|
||||
|
||||
ble_hs_lock();
|
||||
if (ble_gap_slave[instance].periodic_op != BLE_GAP_OP_S_PERIODIC_ADV) {
|
||||
/* periodic adv not enabled */
|
||||
@@ -4026,6 +4147,10 @@ ble_gap_periodic_adv_sync_receive(uint16_t conn_handle,
|
||||
struct ble_hs_conn *conn;
|
||||
int rc;
|
||||
|
||||
if (!ble_hs_is_enabled()) {
|
||||
return BLE_HS_EDISABLED;
|
||||
}
|
||||
|
||||
ble_hs_lock();
|
||||
|
||||
conn = ble_hs_conn_find(conn_handle);
|
||||
@@ -4086,6 +4211,10 @@ ble_gap_add_dev_to_periodic_adv_list(const ble_addr_t *peer_addr,
|
||||
return BLE_ERR_INV_HCI_CMD_PARMS;
|
||||
}
|
||||
|
||||
if (!ble_hs_is_enabled()) {
|
||||
return BLE_HS_EDISABLED;
|
||||
}
|
||||
|
||||
cmd.peer_addr_type = peer_addr->type;
|
||||
memcpy(cmd.peer_addr, peer_addr->val, BLE_DEV_ADDR_LEN);
|
||||
cmd.sid = adv_sid;
|
||||
@@ -4106,6 +4235,10 @@ ble_gap_rem_dev_from_periodic_adv_list(const ble_addr_t *peer_addr, uint8_t adv_
|
||||
return BLE_ERR_INV_HCI_CMD_PARMS;
|
||||
}
|
||||
|
||||
if (!ble_hs_is_enabled()) {
|
||||
return BLE_HS_EDISABLED;
|
||||
}
|
||||
|
||||
cmd.peer_addr_type = peer_addr->type;
|
||||
memcpy(cmd.peer_addr, peer_addr->val, BLE_DEV_ADDR_LEN);
|
||||
cmd.sid = adv_sid;
|
||||
@@ -4313,6 +4446,10 @@ ble_gap_disc_cancel(void)
|
||||
#if NIMBLE_BLE_SCAN
|
||||
int rc;
|
||||
|
||||
if (!ble_hs_is_enabled()) {
|
||||
return BLE_HS_EDISABLED;
|
||||
}
|
||||
|
||||
ble_hs_lock();
|
||||
rc = ble_gap_disc_cancel_no_lock();
|
||||
ble_hs_unlock();
|
||||
@@ -4406,6 +4543,10 @@ ble_gap_ext_disc(uint8_t own_addr_type, uint16_t duration, uint16_t period,
|
||||
|
||||
STATS_INC(ble_gap_stats, discover);
|
||||
|
||||
if (!ble_hs_is_enabled()) {
|
||||
return BLE_HS_EDISABLED;
|
||||
}
|
||||
|
||||
ble_hs_lock();
|
||||
|
||||
rc = ble_gap_disc_ext_validate(own_addr_type);
|
||||
@@ -4532,6 +4673,10 @@ ble_gap_disc(uint8_t own_addr_type, int32_t duration_ms,
|
||||
#if MYNEWT_VAL(BLE_EXT_ADV)
|
||||
struct ble_gap_ext_disc_params p = {0};
|
||||
|
||||
if (!ble_hs_is_enabled()) {
|
||||
return BLE_HS_EDISABLED;
|
||||
}
|
||||
|
||||
p.itvl = disc_params->itvl;
|
||||
p.passive = disc_params->passive;
|
||||
p.window = disc_params->window;
|
||||
@@ -4553,6 +4698,10 @@ ble_gap_disc(uint8_t own_addr_type, int32_t duration_ms,
|
||||
|
||||
STATS_INC(ble_gap_stats, discover);
|
||||
|
||||
if (!ble_hs_is_enabled()) {
|
||||
return BLE_HS_EDISABLED;
|
||||
}
|
||||
|
||||
ble_hs_lock();
|
||||
|
||||
/* Make a copy of the parameter strcuture and fill unspecified values with
|
||||
@@ -4912,7 +5061,8 @@ ble_gap_ext_connect(uint8_t own_addr_type, const ble_addr_t *peer_addr,
|
||||
}
|
||||
|
||||
if (!ble_hs_is_enabled()) {
|
||||
return BLE_HS_EDISABLED;
|
||||
rc = BLE_HS_EDISABLED;
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (ble_gap_is_preempted()) {
|
||||
@@ -5204,6 +5354,10 @@ ble_gap_terminate(uint16_t conn_handle, uint8_t hci_reason)
|
||||
|
||||
STATS_INC(ble_gap_stats, terminate);
|
||||
|
||||
if (!ble_hs_is_enabled()) {
|
||||
return BLE_HS_EDISABLED;
|
||||
}
|
||||
|
||||
ble_hs_lock();
|
||||
|
||||
conn = ble_hs_conn_find(conn_handle);
|
||||
@@ -5280,6 +5434,10 @@ ble_gap_conn_cancel(void)
|
||||
#if MYNEWT_VAL(BLE_ROLE_CENTRAL)
|
||||
int rc;
|
||||
|
||||
if (!ble_hs_is_enabled()) {
|
||||
return BLE_HS_EDISABLED;
|
||||
}
|
||||
|
||||
ble_hs_lock();
|
||||
rc = ble_gap_conn_cancel_no_lock();
|
||||
ble_hs_unlock();
|
||||
@@ -5538,6 +5696,10 @@ ble_gap_update_params(uint16_t conn_handle,
|
||||
return BLE_HS_EINVAL;
|
||||
}
|
||||
|
||||
if (!ble_hs_is_enabled()) {
|
||||
return BLE_HS_EDISABLED;
|
||||
}
|
||||
|
||||
STATS_INC(ble_gap_stats, update);
|
||||
memset(&l2cap_params, 0, sizeof l2cap_params);
|
||||
entry = NULL;
|
||||
@@ -5633,7 +5795,12 @@ ble_gap_security_initiate(uint16_t conn_handle)
|
||||
|
||||
STATS_INC(ble_gap_stats, security_initiate);
|
||||
|
||||
if (!ble_hs_is_enabled()) {
|
||||
return BLE_HS_EDISABLED;
|
||||
}
|
||||
|
||||
ble_hs_lock();
|
||||
|
||||
conn = ble_hs_conn_find(conn_handle);
|
||||
if (conn != NULL) {
|
||||
conn_flags = conn->bhc_flags;
|
||||
@@ -5694,6 +5861,10 @@ ble_gap_pair_initiate(uint16_t conn_handle)
|
||||
{
|
||||
int rc;
|
||||
|
||||
if (!ble_hs_is_enabled()) {
|
||||
return BLE_HS_EDISABLED;
|
||||
}
|
||||
|
||||
rc = ble_sm_pair_initiate(conn_handle);
|
||||
|
||||
return rc;
|
||||
@@ -5711,6 +5882,10 @@ ble_gap_encryption_initiate(uint16_t conn_handle,
|
||||
ble_hs_conn_flags_t conn_flags;
|
||||
int rc;
|
||||
|
||||
if (!ble_hs_is_enabled()) {
|
||||
return BLE_HS_EDISABLED;
|
||||
}
|
||||
|
||||
rc = ble_hs_atomic_conn_flags(conn_handle, &conn_flags);
|
||||
if (rc != 0) {
|
||||
return rc;
|
||||
@@ -5733,6 +5908,10 @@ ble_gap_unpair(const ble_addr_t *peer_addr)
|
||||
{
|
||||
struct ble_hs_conn *conn;
|
||||
|
||||
if (!ble_hs_is_enabled()) {
|
||||
return BLE_HS_EDISABLED;
|
||||
}
|
||||
|
||||
if (ble_addr_cmp(peer_addr, BLE_ADDR_ANY) == 0) {
|
||||
return BLE_HS_EINVAL;
|
||||
}
|
||||
@@ -5759,6 +5938,10 @@ ble_gap_unpair_oldest_peer(void)
|
||||
int num_peers;
|
||||
int rc;
|
||||
|
||||
if (!ble_hs_is_enabled()) {
|
||||
return BLE_HS_EDISABLED;
|
||||
}
|
||||
|
||||
rc = ble_store_util_bonded_peers(
|
||||
&oldest_peer_id_addr, &num_peers, 1);
|
||||
if (rc != 0) {
|
||||
@@ -5784,6 +5967,10 @@ ble_gap_unpair_oldest_except(const ble_addr_t *peer_addr)
|
||||
int num_peers;
|
||||
int rc, i;
|
||||
|
||||
if (!ble_hs_is_enabled()) {
|
||||
return BLE_HS_EDISABLED;
|
||||
}
|
||||
|
||||
rc = ble_store_util_bonded_peers(
|
||||
&peer_id_addrs[0], &num_peers, MYNEWT_VAL(BLE_STORE_MAX_BONDS));
|
||||
if (rc != 0) {
|
||||
@@ -5903,6 +6090,10 @@ ble_gap_conn_rssi(uint16_t conn_handle, int8_t *out_rssi)
|
||||
{
|
||||
int rc;
|
||||
|
||||
if (!ble_hs_is_enabled()) {
|
||||
return BLE_HS_EDISABLED;
|
||||
}
|
||||
|
||||
rc = ble_hs_hci_util_read_rssi(conn_handle, out_rssi);
|
||||
return rc;
|
||||
}
|
||||
@@ -6144,6 +6335,10 @@ ble_gap_event_listener_register(struct ble_gap_event_listener *listener,
|
||||
struct ble_gap_event_listener *evl = NULL;
|
||||
int rc;
|
||||
|
||||
if (!ble_hs_is_enabled()) {
|
||||
return BLE_HS_EDISABLED;
|
||||
}
|
||||
|
||||
SLIST_FOREACH(evl, &ble_gap_event_listener_list, link) {
|
||||
if (evl == listener) {
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user