Skip to content

Commit 9781622

Browse files
committed
Refactor BLE server code by removing unused imports and simplifying advertisement handling. Update the advertisement setup to eliminate unnecessary synchronization, improving code clarity.
1 parent 8d47c1c commit 9781622

File tree

1 file changed

+3
-14
lines changed

1 file changed

+3
-14
lines changed

src/cla/ble/server.rs

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,7 @@
11
#[cfg(target_os = "linux")]
2-
use crate::consts::ble::{ACK, ADV_NAME, NOTIFY_CHAR_UUID, SERVICE_UUID, WRITE_CHAR_UUID};
2+
use crate::consts::ble::{ADV_NAME, SERVICE_UUID};
33
#[cfg(target_os = "linux")]
4-
use bluer::{
5-
adv::Advertisement,
6-
gatt::local::{
7-
Application, Characteristic, CharacteristicFlags, CharacteristicNotify, Service,
8-
},
9-
Address,
10-
};
11-
#[cfg(target_os = "linux")]
12-
use std::sync::{Arc, Mutex};
4+
use bluer::adv::Advertisement;
135
#[cfg(target_os = "linux")]
146
use tokio::time::{sleep, Duration};
157

@@ -22,9 +14,6 @@ async fn main() -> anyhow::Result<()> {
2214

2315
println!("Using Bluetooth adapter: {}", adapter.name());
2416

25-
let received_data = Arc::new(Mutex::new(Vec::<u8>::new()));
26-
let received_data_clone = received_data.clone();
27-
2817
// Create a simple advertisement
2918
let advertisement = Advertisement {
3019
local_name: Some(ADV_NAME.to_string()),
@@ -33,7 +22,7 @@ async fn main() -> anyhow::Result<()> {
3322
..Default::default()
3423
};
3524

36-
let handle = adapter.advertise(advertisement).await?;
25+
let _handle = adapter.advertise(advertisement).await?;
3726
println!("Advertising BLE Peripheral...");
3827

3928
// For now, we'll just keep the advertising running

0 commit comments

Comments
 (0)