summaryrefslogtreecommitdiff
path: root/examples/src/bin
diff options
context:
space:
mode:
authorUlf Lilleengen <ulf.lilleengen@gmail.com>2021-10-07 09:46:38 +0200
committerUlf Lilleengen <ulf.lilleengen@gmail.com>2021-10-07 09:46:38 +0200
commit40c9680b46580009feaa5c8b54477eb48e7ee038 (patch)
treede651564dc10347ec19298221594a5e4ec77e617 /examples/src/bin
parent21617efac6256f1d0905dd4c9385507c03c56f97 (diff)
downloadnrf-softdevice-40c9680b46580009feaa5c8b54477eb48e7ee038.zip
Fix remaining example
Diffstat (limited to 'examples/src/bin')
-rw-r--r--examples/src/bin/ble_peripheral_onoff.rs14
1 files changed, 9 insertions, 5 deletions
diff --git a/examples/src/bin/ble_peripheral_onoff.rs b/examples/src/bin/ble_peripheral_onoff.rs
index e3f3943..7670c44 100644
--- a/examples/src/bin/ble_peripheral_onoff.rs
+++ b/examples/src/bin/ble_peripheral_onoff.rs
@@ -18,7 +18,10 @@ use embassy_nrf::gpiote::PortInput;
use embassy_nrf::interrupt::Priority;
use futures::pin_mut;
-use nrf_softdevice::ble::{gatt_server, peripheral};
+use nrf_softdevice::ble::{
+ gatt_server::{self, Server},
+ peripheral,
+};
use nrf_softdevice::{raw, Softdevice};
static EXECUTOR: Forever<Executor> = Forever::new();
@@ -56,15 +59,16 @@ async fn run_bluetooth(sd: &'static Softdevice, server: &FooService) {
info!("advertising done!");
- let res = gatt_server::run(&conn, server, |e| match e {
- FooServiceEvent::FooWrite(val) => {
+ let res = gatt_server::run(&conn, |e| match server.on_write(e) {
+ Some(FooServiceEvent::FooWrite(val)) => {
info!("wrote foo level: {}", val);
if let Err(e) = server.foo_notify(&conn, val + 1) {
info!("send notification error: {:?}", e);
}
}
- FooServiceEvent::FooNotificationsEnabled => info!("notifications enabled"),
- FooServiceEvent::FooNotificationsDisabled => info!("notifications disabled"),
+ Some(FooServiceEvent::FooNotificationsEnabled) => info!("notifications enabled"),
+ Some(FooServiceEvent::FooNotificationsDisabled) => info!("notifications disabled"),
+ None => {}
})
.await;