Skip to content

Commit c349cbe

Browse files
committed
update trouble version
1 parent 458a4ca commit c349cbe

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

examples/trouble/src/main.rs

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ where
6969
name: "Trouble",
7070
appearance: &appearance::GENERIC_POWER,
7171
}),
72-
);
72+
)
73+
.expect("Failed to create GATT server");
7374

7475
info!("Starting advertising and GATT service");
7576
let _ = join3(
@@ -87,13 +88,17 @@ async fn ble_task<C: Controller>(mut runner: Runner<'_, C>) -> Result<(), BleHos
8788
async fn gatt_task<C: Controller>(server: &Server<'_, '_, C>) {
8889
loop {
8990
match server.next().await {
90-
Ok(GattEvent::Write { handle, connection: _ }) => {
91-
let _ = server.get(handle, |value| {
92-
info!("[gatt] Write event on {:?}. Value written: {:?}", handle, value);
93-
});
91+
Ok(GattEvent::Write {
92+
value_handle,
93+
connection: _,
94+
}) => {
95+
info!("[gatt] Write event on {:?}", value_handle);
9496
}
95-
Ok(GattEvent::Read { handle, connection: _ }) => {
96-
info!("[gatt] Read event on {:?}", handle);
97+
Ok(GattEvent::Read {
98+
value_handle,
99+
connection: _,
100+
}) => {
101+
info!("[gatt] Read event on {:?}", value_handle);
97102
}
98103
Err(e) => {
99104
error!("[gatt] Error processing GATT events: {:?}", e);
@@ -134,7 +139,7 @@ async fn advertise_task<C: Controller>(
134139
Timer::after(Duration::from_secs(2)).await;
135140
tick = tick.wrapping_add(1);
136141
info!("[adv] notifying connection of tick {}", tick);
137-
let _ = server.notify(server.battery_service.level, &conn, &[tick]).await;
142+
let _ = server.notify(&server.battery_service.level, &conn, &tick).await;
138143
}
139144
}
140145
}

0 commit comments

Comments
 (0)