summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorUlf Lilleengen <lulf@redhat.com>2021-10-11 12:14:12 +0200
committerUlf Lilleengen <lulf@redhat.com>2021-10-11 12:14:12 +0200
commit37585e1ffafbfa5b32c9136472ddb3f4ae136856 (patch)
tree4f9c6f790ac0a713ee8019e0548ae84dcdd206e4 /examples
parent1f73a93a6ddce925ff749d63f4528e50e9efae02 (diff)
downloadnrf-softdevice-37585e1ffafbfa5b32c9136472ddb3f4ae136856.zip
Derive event variant from struct field name
Diffstat (limited to 'examples')
-rw-r--r--examples/src/bin/ble_bas_peripheral.rs4
-rw-r--r--examples/src/bin/ble_peripheral_onoff.rs6
2 files changed, 5 insertions, 5 deletions
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")
}
})