eculocate

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit f25a53908402b280f0090cf75e91c9ea8d379675
parent a729199926b82e9102e0998998893bc56d2c384a
Author: Daniel Barlow <dan@telent.net>
Date:   Sun,  1 Feb 2026 16:43:45 +0000

log when current_network_index is changed

Diffstat:
Mecu-esp32/src/wibble.rs | 42++++++++++++++++++++++--------------------
1 file changed, 22 insertions(+), 20 deletions(-)

diff --git a/ecu-esp32/src/wibble.rs b/ecu-esp32/src/wibble.rs @@ -107,30 +107,32 @@ async fn ble_task<C: Controller, P: PacketPool>(mut runner: Runner<'_, C, P>) { /// /// This function will handle the GATT events and process them. /// This is how we interact with read and write requests. -async fn gatt_events_task<P: PacketPool>(_server: &Server<'_>, conn: &GattConnection<'_, '_, P>) -> Result<(), Error> { - // let level = server.battery_service.level; +async fn gatt_events_task<P: PacketPool>(server: &Server<'_>, conn: &GattConnection<'_, '_, P>) -> Result<(), Error> { + let current_index = server.wifi_provisioning_service.current_network_index; let reason = loop { match conn.next().await { GattConnectionEvent::Disconnected { reason } => break reason, GattConnectionEvent::Gatt { event } => { - // match &event { - // // are these clauses important? they don't do anything - // // except log - // GattEvent::Read(event) => { - // if event.handle() == level.handle { - // let value = server.get(&level); - // info!("[gatt] Read Event to Level Characteristic: {:?}", value); - // } - // } - // GattEvent::Write(event) => { - // if event.handle() == level.handle { - // info!("[gatt] Write Event to Level Characteristic: {:?}", event.data()); - // } - // } - // _ => {} - // }; - // This step is also performed at drop(), but writing it explicitly is necessary - // in order to ensure reply is sent. + match &event { + // // are these clauses important? they don't do anything + // // except log + // GattEvent::Read(event) => { + // if event.handle() == level.handle { + // let value = server.get(&level); + // info!("[gatt] Read Event to Level Characteristic: {:?}", value); + // } + // } + GattEvent::Write(event) => { + info!("[gatt] write handle {:?}", event.handle()); + if event.handle() == current_index.handle { + info!("[gatt] switch current index: {:?}", event.data()); + } + }, + _ => {} + }; + // This step is also performed at drop(), but writing + // it explicitly is necessary in order to ensure reply + // is sent. match event.accept() { Ok(reply) => reply.send().await, Err(e) => warn!("[gatt] error sending response: {:?}", e),