Skip to content

Commit 38f49a2

Browse files
committed
cargo fmt run
1 parent 27dc57b commit 38f49a2

File tree

3 files changed

+15
-9
lines changed

3 files changed

+15
-9
lines changed

src/handlers.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,19 @@ pub struct SubscriptionFlags {
3939

4040
impl SubscriptionFlags {
4141
pub fn none() -> Self {
42-
SubscriptionFlags { regular: false, raw: false }
42+
SubscriptionFlags {
43+
regular: false,
44+
raw: false,
45+
}
4346
}
44-
47+
4548
pub fn from_flags(flags: u32) -> Self {
4649
SubscriptionFlags {
4750
regular: flags == 0 || (flags & SUBSCRIPTION_RAW_ADVERTISEMENTS) == 0,
4851
raw: (flags & SUBSCRIPTION_RAW_ADVERTISEMENTS) != 0,
4952
}
5053
}
51-
54+
5255
pub fn is_subscribed(&self) -> bool {
5356
self.regular || self.raw
5457
}
@@ -251,15 +254,15 @@ pub async fn subscribe_bluetooth_le_advertisements_request(
251254
"Handling SubscribeBluetoothLEAdvertisementsRequest from {}",
252255
stream.peer_addr()?.ip()
253256
);
254-
257+
255258
let req = SubscribeBluetoothLEAdvertisementsRequest::parse_from_bytes(payload)?;
256259
let subscription_flags = SubscriptionFlags::from_flags(req.flags);
257-
260+
258261
info!(
259262
"BLE advertisement subscription flags: {:?} (raw flags: 0x{:02x})",
260263
subscription_flags, req.flags
261264
);
262-
265+
263266
Ok(subscription_flags)
264267
}
265268

src/main.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,10 @@ async fn main() -> std::io::Result<()> {
5050

5151
// Validate HCI adapter exists before proceeding
5252
if utils::get_bt_mac(cli.hci).is_none() {
53-
log::error!("Bluetooth adapter hci{} does not exist or is not accessible", cli.hci);
53+
log::error!(
54+
"Bluetooth adapter hci{} does not exist or is not accessible",
55+
cli.hci
56+
);
5457
log::error!("Fatal: Check available adapters with 'hciconfig' or 'bluetoothctl list'");
5558
std::process::exit(1);
5659
}
@@ -94,7 +97,7 @@ async fn main() -> std::io::Result<()> {
9497

9598
// first cut: use bluez stack, ask for active scanning
9699
let mut ble_handle = tokio::spawn(ble::run_bluez_advertisement_listener(cli.hci, tx.clone()));
97-
100+
98101
// Check if BLE listener started successfully
99102
tokio::select! {
100103
_ = tokio::time::sleep(tokio::time::Duration::from_millis(100)) => {

src/server.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ async fn handle_client(
9393
match ble_msg {
9494
Ok(advert) => {
9595
if subscription_flags.is_subscribed() {
96-
debug!("Forwarding BLE advertisement to {} (flags: {:?})",
96+
debug!("Forwarding BLE advertisement to {} (flags: {:?})",
9797
stream.peer_addr()?.ip(), subscription_flags);
9898
forward_ble_advertisement(&mut stream, advert).await?;
9999
}

0 commit comments

Comments
 (0)