@@ -6,9 +6,9 @@ use crate::web::AppState;
66use anyhow:: anyhow;
77use backon:: { ExponentialBuilder , Retryable } ;
88use bluer:: {
9- agent:: { Agent , AgentHandle } ,
9+ agent:: Agent ,
1010 rfcomm:: { Profile , ProfileHandle , Role , Stream } ,
11- Adapter , Address , Device , Session , Uuid ,
11+ Adapter , Address , Device , Uuid ,
1212} ;
1313use futures:: StreamExt ;
1414use simplelog:: * ;
@@ -17,7 +17,6 @@ use std::time::{Duration, Instant};
1717use tokio:: io:: AsyncReadExt ;
1818use tokio:: io:: AsyncWriteExt ;
1919use tokio:: sync:: Notify ;
20- use tokio:: task:: JoinHandle ;
2120use tokio:: time:: timeout;
2221
2322include ! ( concat!( env!( "OUT_DIR" ) , "/protos/mod.rs" ) ) ;
@@ -55,12 +54,8 @@ enum MessageId {
5554}
5655
5756pub struct Bluetooth {
58- session : Session ,
5957 adapter : Adapter ,
6058 handle_aa : ProfileHandle ,
61- handle_hsp : Option < ProfileHandle > ,
62- task_hsp : Option < JoinHandle < ( ) > > ,
63- handle_agent : AgentHandle ,
6459 btle_handle : Option < bluer:: gatt:: local:: ApplicationHandle > ,
6560 adv_handle : Option < bluer:: adv:: AdvertisementHandle > ,
6661}
@@ -101,7 +96,7 @@ pub async fn init(
10196
10297 // Default agent is probably needed when pairing for the first time
10398 let agent = Agent :: default ( ) ;
104- let handle_agent = session. register_agent ( agent) . await ?;
99+ let _ = session. register_agent ( agent) . await ?;
105100
106101 // AA Wireless profile
107102 let profile = Profile {
@@ -116,8 +111,6 @@ pub async fn init(
116111 let handle_aa = session. register_profile ( profile) . await ?;
117112 info ! ( "{} 📱 AA Wireless Profile: registered" , NAME ) ;
118113
119- let handle_hsp = None ;
120- let mut task_hsp = None ;
121114 if !dongle_mode {
122115 // Headset profile
123116 let profile = Profile {
@@ -132,7 +125,7 @@ pub async fn init(
132125 info ! ( "{} 🎧 Headset Profile (HSP): registered" , NAME ) ;
133126 // handling connection to headset profile in own task
134127 // it only accepts each incoming connection
135- task_hsp = Some ( tokio:: spawn ( async move {
128+ let _ = Some ( tokio:: spawn ( async move {
136129 loop {
137130 let req = handle. next ( ) . await . expect ( "received no connect request" ) ;
138131 info ! (
@@ -154,12 +147,8 @@ pub async fn init(
154147 }
155148
156149 Ok ( Bluetooth {
157- session,
158150 adapter,
159151 handle_aa,
160- handle_hsp,
161- task_hsp,
162- handle_agent,
163152 btle_handle : None ,
164153 adv_handle : None ,
165154 } )
0 commit comments