summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorAlbert Skog <mail@albertskog.se>2021-10-15 11:24:36 +0200
committerAlbert Skog <mail@albertskog.se>2021-10-15 11:24:36 +0200
commitfd48489c0ffc58c8ae02d32d9904162a2777df3c (patch)
treef86a630279aeaf89d57a2151e19872c41f75d205 /examples
parentae537dcbf67dc2366574c583740b2c7823c733d1 (diff)
downloadnrf-softdevice-fd48489c0ffc58c8ae02d32d9904162a2777df3c.zip
make CCCD write a single event
Diffstat (limited to 'examples')
-rw-r--r--examples/src/bin/ble_bas_peripheral.rs24
-rw-r--r--examples/src/bin/ble_peripheral_onoff.rs5
2 files changed, 20 insertions, 9 deletions
diff --git a/examples/src/bin/ble_bas_peripheral.rs b/examples/src/bin/ble_bas_peripheral.rs
index 8793c82..8d76ec3 100644
--- a/examples/src/bin/ble_bas_peripheral.rs
+++ b/examples/src/bin/ble_bas_peripheral.rs
@@ -28,7 +28,13 @@ async fn softdevice_task(sd: &'static Softdevice) {
struct BatteryService {
#[characteristic(uuid = "2a19", read, write, notify)]
battery_level: u8,
- #[characteristic(uuid = "3a4a1f7e-22d8-11eb-a3aa-1b3b1d4e4a0d", read, write, notify)]
+ #[characteristic(
+ uuid = "3a4a1f7e-22d8-11eb-a3aa-1b3b1d4e4a0d",
+ read,
+ write,
+ notify,
+ indicate
+ )]
foo: u16,
}
@@ -70,14 +76,18 @@ async fn bluetooth_task(sd: &'static Softdevice) {
info!("send notification error: {:?}", e);
}
}
- BatteryServiceEvent::BatteryLevelNotificationsEnabled => {
- info!("battery notifications enabled")
+ BatteryServiceEvent::BatteryLevelCccdWrite { notifications } => {
+ info!("battery notifications: {}", notifications)
}
- BatteryServiceEvent::BatteryLevelNotificationsDisabled => {
- info!("battery notifications disabled")
+ BatteryServiceEvent::FooCccdWrite {
+ indications,
+ notifications,
+ } => {
+ info!(
+ "foo indications: {}, notifications: {}",
+ indications, notifications
+ )
}
- BatteryServiceEvent::FooNotificationsEnabled => info!("foo notifications enabled"),
- BatteryServiceEvent::FooNotificationsDisabled => info!("foo notifications disabled"),
})
.await;
diff --git a/examples/src/bin/ble_peripheral_onoff.rs b/examples/src/bin/ble_peripheral_onoff.rs
index e3f3943..47b9dfd 100644
--- a/examples/src/bin/ble_peripheral_onoff.rs
+++ b/examples/src/bin/ble_peripheral_onoff.rs
@@ -63,8 +63,9 @@ async fn run_bluetooth(sd: &'static Softdevice, server: &FooService) {
info!("send notification error: {:?}", e);
}
}
- FooServiceEvent::FooNotificationsEnabled => info!("notifications enabled"),
- FooServiceEvent::FooNotificationsDisabled => info!("notifications disabled"),
+ FooServiceEvent::FooCccdWrite { notifications } => {
+ info!("foo notifications: {}", notifications)
+ }
})
.await;