diff options
author | Albert Skog <mail@albertskog.se> | 2021-10-15 11:24:36 +0200 |
---|---|---|
committer | Albert Skog <mail@albertskog.se> | 2021-10-15 11:24:36 +0200 |
commit | fd48489c0ffc58c8ae02d32d9904162a2777df3c (patch) | |
tree | f86a630279aeaf89d57a2151e19872c41f75d205 /examples/src/bin/ble_bas_peripheral.rs | |
parent | ae537dcbf67dc2366574c583740b2c7823c733d1 (diff) | |
download | nrf-softdevice-fd48489c0ffc58c8ae02d32d9904162a2777df3c.zip |
make CCCD write a single event
Diffstat (limited to 'examples/src/bin/ble_bas_peripheral.rs')
-rw-r--r-- | examples/src/bin/ble_bas_peripheral.rs | 24 |
1 files changed, 17 insertions, 7 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; |