summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorJacob Rosenthal <jacobrosenthal@gmail.com>2020-11-09 19:44:18 +0100
committerDario Nieuwenhuis <dirbaio@dirbaio.net>2020-11-09 19:44:18 +0100
commit7aab09e30071cd10fea784b0d5aa1aa49ae75815 (patch)
treed88c58951a4661a1c2f141a7224bb7084cbc0a80 /examples
parent6a33fc8bb70a248c904c16f9b4eb594be7eb9815 (diff)
downloadnrf-softdevice-7aab09e30071cd10fea784b0d5aa1aa49ae75815.zip
AATT MTU and data length negotiations
Diffstat (limited to 'examples')
-rw-r--r--examples/src/bin/ble_bas_central.rs8
-rw-r--r--examples/src/bin/ble_bas_peripheral.rs7
-rw-r--r--examples/src/bin/ble_peripheral_gattspam.rs7
3 files changed, 15 insertions, 7 deletions
diff --git a/examples/src/bin/ble_bas_central.rs b/examples/src/bin/ble_bas_central.rs
index c1cbe7a..9af9e59 100644
--- a/examples/src/bin/ble_bas_central.rs
+++ b/examples/src/bin/ble_bas_central.rs
@@ -77,12 +77,12 @@ impl gatt_client::Client for BatteryServiceClient {
}
#[task]
-async fn ble_central_task(sd: &'static Softdevice) {
+async fn ble_central_task(sd: &'static Softdevice, config: central::Config) {
let addrs = &[Address::new_random_static([
0x59, 0xf9, 0xb1, 0x9c, 0x01, 0xf5,
])];
- let conn = central::connect(sd, addrs)
+ let conn = central::connect(sd, addrs, config)
.await
.dexpect(intern!("connect"));
info!("connected");
@@ -161,7 +161,9 @@ fn main() -> ! {
let executor = EXECUTOR.put(Executor::new(cortex_m::asm::sev));
executor.spawn(softdevice_task(sd)).dewrap();
- executor.spawn(ble_central_task(sd)).dewrap();
+ executor
+ .spawn(ble_central_task(sd, central::Config::default()))
+ .dewrap();
loop {
executor.run();
diff --git a/examples/src/bin/ble_bas_peripheral.rs b/examples/src/bin/ble_bas_peripheral.rs
index f81cc53..eb755f2 100644
--- a/examples/src/bin/ble_bas_peripheral.rs
+++ b/examples/src/bin/ble_bas_peripheral.rs
@@ -30,7 +30,7 @@ struct BatteryService {
}
#[task]
-async fn bluetooth_task(sd: &'static Softdevice) {
+async fn bluetooth_task(sd: &'static Softdevice, config: peripheral::Config) {
let server: BatteryService = gatt_server::register(sd).dewrap();
#[rustfmt::skip]
let adv_data = &[
@@ -50,6 +50,7 @@ async fn bluetooth_task(sd: &'static Softdevice) {
adv_data,
scan_data,
},
+ config,
)
.await
.dewrap();
@@ -122,7 +123,9 @@ fn main() -> ! {
let executor = EXECUTOR.put(Executor::new(cortex_m::asm::sev));
executor.spawn(softdevice_task(sd)).dewrap();
- executor.spawn(bluetooth_task(sd)).dewrap();
+ executor
+ .spawn(bluetooth_task(sd, peripheral::Config::default()))
+ .dewrap();
loop {
executor.run();
diff --git a/examples/src/bin/ble_peripheral_gattspam.rs b/examples/src/bin/ble_peripheral_gattspam.rs
index c97ec00..902ad23 100644
--- a/examples/src/bin/ble_peripheral_gattspam.rs
+++ b/examples/src/bin/ble_peripheral_gattspam.rs
@@ -23,7 +23,7 @@ async fn softdevice_task(sd: &'static Softdevice) {
}
#[task]
-async fn bluetooth_task(sd: &'static Softdevice) {
+async fn bluetooth_task(sd: &'static Softdevice, config: peripheral::Config) {
for i in 0..24 {
let service_uuid = Uuid::new_16(0x4200 + i);
@@ -106,6 +106,7 @@ async fn bluetooth_task(sd: &'static Softdevice) {
adv_data,
scan_data,
},
+ config,
)
.await
.dewrap();
@@ -160,7 +161,9 @@ fn main() -> ! {
let executor = EXECUTOR.put(Executor::new(cortex_m::asm::sev));
executor.spawn(softdevice_task(sd)).dewrap();
- executor.spawn(bluetooth_task(sd)).dewrap();
+ executor
+ .spawn(bluetooth_task(sd, peripheral::Config::default()))
+ .dewrap();
loop {
executor.run();