use crate::ble::battery_service::BatteryService; use crate::ble::battery_service::BatteryServiceEvent; use defmt::info; use nrf_softdevice::ble::gatt_server; use nrf_softdevice::ble::Connection; use nrf_softdevice::ble::DisconnectedError; #[nrf_softdevice::gatt_server] pub struct Server { pub bas: BatteryService, } pub async fn run(conn: &Connection, server: &Server) -> DisconnectedError { info!("gatt started"); gatt_server::run(conn, server, |e| match e { ServerEvent::Bas(e) => match e { BatteryServiceEvent::BatteryLevelCccdWrite { notifications } => { info!("battery notifications: {}", notifications) } }, }) .await }