mirror of
https://github.com/espressif/esp-idf
synced 2025-03-10 17:49:10 -04:00
fix(nimble): fix and enable connection subrating
This commit is contained in:
parent
360e9e20d8
commit
5d8f076745
@ -1173,3 +1173,10 @@ config BT_NIMBLE_EATT_CHAN_NUM
|
|||||||
depends on BT_NIMBLE_ENABLED
|
depends on BT_NIMBLE_ENABLED
|
||||||
help
|
help
|
||||||
Defines the number of channels EATT bearers can use
|
Defines the number of channels EATT bearers can use
|
||||||
|
|
||||||
|
config BT_NIMBLE_SUBRATE
|
||||||
|
bool "Enable Subrate Change"
|
||||||
|
default n
|
||||||
|
depends on BT_NIMBLE_ENABLED
|
||||||
|
help
|
||||||
|
Enable connection subrate change feature
|
||||||
|
@ -429,28 +429,39 @@ bleprph_gap_event(struct ble_gap_event *event, void *arg)
|
|||||||
event->pathloss_threshold.zone_entered);
|
event->pathloss_threshold.zone_entered);
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if MYNEWT_VAL(BLE_EATT_CHAN_NUM) > 0
|
#if MYNEWT_VAL(BLE_EATT_CHAN_NUM) > 0
|
||||||
case BLE_GAP_EVENT_EATT:
|
case BLE_GAP_EVENT_EATT:
|
||||||
MODLOG_DFLT(INFO, "EATT %s : conn_handle=%d cid=%d",
|
MODLOG_DFLT(INFO, "EATT %s : conn_handle=%d cid=%d",
|
||||||
event->eatt.status ? "disconnected" : "connected",
|
event->eatt.status ? "disconnected" : "connected",
|
||||||
event->eatt.conn_handle,
|
event->eatt.conn_handle,
|
||||||
event->eatt.cid);
|
event->eatt.cid);
|
||||||
if (event->eatt.status) {
|
if (event->eatt.status) {
|
||||||
/* Abort if disconnected */
|
/* Abort if disconnected */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
cids[bearers] = event->eatt.cid;
|
cids[bearers] = event->eatt.cid;
|
||||||
bearers += 1;
|
bearers += 1;
|
||||||
if (bearers != MYNEWT_VAL(BLE_EATT_CHAN_NUM)) {
|
if (bearers != MYNEWT_VAL(BLE_EATT_CHAN_NUM)) {
|
||||||
/* Wait until all EATT bearers are connected before proceeding */
|
/* Wait until all EATT bearers are connected before proceeding */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/* Set the default bearer to use for further procedures */
|
/* Set the default bearer to use for further procedures */
|
||||||
rc = ble_att_set_default_bearer_using_cid(event->eatt.conn_handle, cids[0]);
|
rc = ble_att_set_default_bearer_using_cid(event->eatt.conn_handle, cids[0]);
|
||||||
if (rc != 0) {
|
if (rc != 0) {
|
||||||
MODLOG_DFLT(INFO, "Cannot set default EATT bearer, rc = %d\n", rc);
|
MODLOG_DFLT(INFO, "Cannot set default EATT bearer, rc = %d\n", rc);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if MYNEWT_VAL(BLE_CONN_SUBRATING)
|
||||||
|
case BLE_GAP_EVENT_SUBRATE_CHANGE:
|
||||||
|
MODLOG_DFLT(INFO, "Subrate change event : conn_handle=%d status=%d factor=%d",
|
||||||
|
event->subrate_change.conn_handle,
|
||||||
|
event->subrate_change.status,
|
||||||
|
event->subrate_change.subrate_factor);
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user