From 40c9680b46580009feaa5c8b54477eb48e7ee038 Mon Sep 17 00:00:00 2001 From: Ulf Lilleengen Date: Thu, 7 Oct 2021 09:46:38 +0200 Subject: Fix remaining example --- examples/src/bin/ble_peripheral_onoff.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'examples') 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 = 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; -- cgit v1.2.3