From 37585e1ffafbfa5b32c9136472ddb3f4ae136856 Mon Sep 17 00:00:00 2001 From: Ulf Lilleengen Date: Mon, 11 Oct 2021 12:14:12 +0200 Subject: Derive event variant from struct field name --- examples/src/bin/ble_bas_peripheral.rs | 4 ++-- examples/src/bin/ble_peripheral_onoff.rs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'examples') diff --git a/examples/src/bin/ble_bas_peripheral.rs b/examples/src/bin/ble_bas_peripheral.rs index ff30375..511513b 100644 --- a/examples/src/bin/ble_bas_peripheral.rs +++ b/examples/src/bin/ble_bas_peripheral.rs @@ -69,7 +69,7 @@ async fn bluetooth_task(sd: &'static Softdevice) { // Run the GATT server on the connection. This returns when the connection gets disconnected. let res = gatt_server::run(&conn, &server, |e| match e { - ServerEvent::BatteryService(e) => match e { + ServerEvent::Bas(e) => match e { BatteryServiceEvent::BatteryLevelNotificationsEnabled => { info!("battery notifications enabled") } @@ -77,7 +77,7 @@ async fn bluetooth_task(sd: &'static Softdevice) { info!("battery notifications disabled") } }, - ServerEvent::FooService(e) => match e { + ServerEvent::Foo(e) => match e { FooServiceEvent::FooWrite(val) => { info!("wrote foo: {}", val); if let Err(e) = server.foo.foo_notify(&conn, val + 1) { diff --git a/examples/src/bin/ble_peripheral_onoff.rs b/examples/src/bin/ble_peripheral_onoff.rs index 82d0599..067f1d4 100644 --- a/examples/src/bin/ble_peripheral_onoff.rs +++ b/examples/src/bin/ble_peripheral_onoff.rs @@ -62,16 +62,16 @@ async fn run_bluetooth(sd: &'static Softdevice, server: &Server) { info!("advertising done!"); let res = gatt_server::run(&conn, server, |e| match e { - ServerEvent::FooService(FooServiceEvent::FooWrite(val)) => { + ServerEvent::Foo(FooServiceEvent::FooWrite(val)) => { info!("wrote foo level: {}", val); if let Err(e) = server.foo.foo_notify(&conn, val + 1) { info!("send notification error: {:?}", e); } } - ServerEvent::FooService(FooServiceEvent::FooNotificationsEnabled) => { + ServerEvent::Foo(FooServiceEvent::FooNotificationsEnabled) => { info!("notifications enabled") } - ServerEvent::FooService(FooServiceEvent::FooNotificationsDisabled) => { + ServerEvent::Foo(FooServiceEvent::FooNotificationsDisabled) => { info!("notifications disabled") } }) -- cgit v1.2.3