Add two solutions to param updates

This commit is contained in:
Nick 2020-08-02 15:51:38 -05:00
parent 880c6e0601
commit f23ca9d7ee
2 changed files with 29 additions and 7 deletions

View File

@ -76,10 +76,39 @@ static void security_changed(struct bt_conn *conn, bt_security_t level,
}
}
static bool le_param_req(struct bt_conn *conn, struct bt_le_conn_param *param) {
static struct bt_conn_info info;
bt_conn_get_info(conn, &info);
if (info.role == BT_CONN_ROLE_MASTER && (param->interval_min != 6 || param->latency != 30)) {
return false;
}
return true;
}
static void le_param_updated(struct bt_conn *conn, u16_t interval,
u16_t latency, u16_t timeout) {
static struct bt_conn_info info;
bt_conn_get_info(conn, &info);
if (info.role == BT_CONN_ROLE_MASTER && (interval != 6 || latency != 30)) {
bt_conn_le_param_update(conn, BT_LE_CONN_PARAM(0x0006, 0x0006, 30, 400));
}
LOG_DBG("Params updated: Interval: %d, Latency: %d", interval, latency);
};
static struct bt_conn_cb conn_callbacks = {
.connected = connected,
.disconnected = disconnected,
.security_changed = security_changed,
#if !IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL)
.le_param_req = le_param_req,
.le_param_updated = le_param_updated,
#endif
};
static void auth_passkey_display(struct bt_conn *conn, unsigned int passkey)

View File

@ -67,13 +67,6 @@ static u8_t split_central_notify_func(struct bt_conn *conn,
}
}
bt_conn_le_param_update(conn, BT_LE_CONN_PARAM(0x0006, 0x0006, 30, 400));
struct bt_conn_info info;
bt_conn_get_info(conn, &info);
LOG_DBG("Interval: %d, Latency: %d, PHY: %d", info.le.interval, info.le.latency, info.le.phy->rx_phy);
return BT_GATT_ITER_CONTINUE;
}