INNER CODE UNIT · Rust
is_ble_enabled
qaul/qaul.net · rust/ble_module/src/lib.rs:35
pub async fn is_ble_enabled() -> bool {
return IdleBleService::is_ble_enabled().await;
}
/// Start the setup and main loop of this library
async fn main_loop(mut sys_rpc_callback: Box<dyn FnMut(Vec<u8>) + Send>, ble_rpc_receiver: BleRpc) {
let ble_service = IdleBleService::new().await.unwrap_or_else(|err| {
error!("{:#?}", err);
std::process::exit(1);
});
let (tx, mut rx) = tokio::sync::mpsc::unbounded_channel::<Vec<u8>>();
tokio::task::spawn_local(async move {
while let Some(result) = rx.recv().await {
sys_rpc_callback(result)
}
});