Skip to content

Commit

Permalink
Merge pull request #9 from embassy-rs/conn-update
Browse files Browse the repository at this point in the history
    improve scanning and connection handling
  • Loading branch information
lulf authored Apr 10, 2024
2 parents f63f245 + 8fd359a commit a3bb133
Show file tree
Hide file tree
Showing 13 changed files with 644 additions and 246 deletions.
4 changes: 2 additions & 2 deletions examples/nrf-sdc/src/bin/ble_bas_peripheral.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ const PACKET_POOL_SIZE: usize = 10;

fn build_sdc<'d, const N: usize>(
p: nrf_sdc::Peripherals<'d>,
rng: &'d RngPool<'d>,
mpsl: &'d MultiprotocolServiceLayer<'d>,
rng: &'d RngPool,
mpsl: &'d MultiprotocolServiceLayer,
mem: &'d mut sdc::Mem<N>,
) -> Result<nrf_sdc::SoftdeviceController<'d>, nrf_sdc::Error> {
sdc::Builder::new()?
Expand Down
6 changes: 3 additions & 3 deletions examples/nrf-sdc/src/bin/ble_l2cap_central.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ const PACKET_POOL_SIZE: usize = (L2CAP_TXQ + L2CAP_RXQ) as usize;

fn build_sdc<'d, const N: usize>(
p: nrf_sdc::Peripherals<'d>,
rng: &'d RngPool<'d>,
mpsl: &'d MultiprotocolServiceLayer<'d>,
rng: &'d RngPool,
mpsl: &'d MultiprotocolServiceLayer,
mem: &'d mut sdc::Mem<N>,
) -> Result<nrf_sdc::SoftdeviceController<'d>, nrf_sdc::Error> {
sdc::Builder::new()?
Expand Down Expand Up @@ -142,7 +142,7 @@ async fn main(spawner: Spawner) {
info!("Connected, creating l2cap channel");
const PAYLOAD_LEN: usize = 27;
let mut ch1: L2capChannel<'_, '_, _, PAYLOAD_LEN> =
unwrap!(L2capChannel::create(&adapter, &conn, 0x2349, PAYLOAD_LEN as u16).await);
unwrap!(L2capChannel::create(&adapter, &conn, 0x2349, PAYLOAD_LEN as u16, Default::default()).await);
info!("New l2cap channel created, sending some data!");
for i in 0..10 {
let tx = [i; PAYLOAD_LEN];
Expand Down
6 changes: 3 additions & 3 deletions examples/nrf-sdc/src/bin/ble_l2cap_peripheral.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ const PACKET_POOL_SIZE: usize = (L2CAP_TXQ + L2CAP_RXQ) as usize;

fn build_sdc<'d, const N: usize>(
p: nrf_sdc::Peripherals<'d>,
rng: &'d RngPool<'d>,
mpsl: &'d MultiprotocolServiceLayer<'d>,
rng: &'d RngPool,
mpsl: &'d MultiprotocolServiceLayer,
mem: &'d mut sdc::Mem<N>,
) -> Result<nrf_sdc::SoftdeviceController<'d>, nrf_sdc::Error> {
sdc::Builder::new()?
Expand Down Expand Up @@ -152,7 +152,7 @@ async fn main(spawner: Spawner) {
info!("Connection established");

let mut ch1: L2capChannel<'_, '_, _, PAYLOAD_LEN> =
unwrap!(L2capChannel::accept(&adapter, &conn, 0x2349, PAYLOAD_LEN as u16).await);
unwrap!(L2capChannel::accept(&adapter, &conn, &[0x2349], PAYLOAD_LEN as u16, Default::default()).await);

info!("L2CAP channel accepted");

Expand Down
2 changes: 1 addition & 1 deletion host/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ categories = [
resolver = "2"

[dependencies]
bt-hci = { version = "0.1.0" }
bt-hci = { version = "0.1.0", features = ["embassy-time"] }
embedded-io-async = { version = "0.6" }
embassy-sync = "0.5"
embassy-time = "0.3"
Expand Down
254 changes: 145 additions & 109 deletions host/src/adapter.rs

Large diffs are not rendered by default.

Loading

0 comments on commit a3bb133

Please sign in to comment.