linux-rust: implement bluetooth logic with ui

finally! only copying all ui from android to first release
This commit is contained in:
Kavish Devar
2025-11-08 02:12:24 +05:30
parent a2cda688d4
commit bf6630dbd1
8 changed files with 581 additions and 370 deletions

View File

@@ -1,13 +1,16 @@
use std::collections::HashMap;
use std::sync::Arc;
use iced::{Background, Border, Length, Theme};
use iced::widget::{container, text, column, row, Space, combo_box};
use crate::bluetooth::att::ATTManager;
use crate::devices::enums::{DeviceData, DeviceInformation, NothingState};
use crate::ui::window::Message;
pub fn nothing_view<'a>(
mac: &str,
devices_list: &HashMap<String, DeviceData>,
state: &NothingState
state: &NothingState,
att_manager: Arc<ATTManager>
) -> iced::widget::Container<'a, Message> {
let mut information_col = iced::widget::column![];
let mac = mac.to_string();
@@ -21,7 +24,7 @@ pub fn nothing_view<'a>(
style
}
))
.push(iced::widget::Space::with_height(iced::Length::from(10)))
.push(Space::with_height(iced::Length::from(10)))
.push(
iced::widget::row![
text("Serial Number").size(16).style(
@@ -31,7 +34,7 @@ pub fn nothing_view<'a>(
style
}
),
iced::widget::Space::with_width(iced::Length::Fill),
Space::with_width(Length::Fill),
text(nothing_info.serial_number.clone()).size(16)
]
)
@@ -44,7 +47,7 @@ pub fn nothing_view<'a>(
style
}
),
iced::widget::Space::with_width(iced::Length::Fill),
Space::with_width(Length::Fill),
text(nothing_info.firmware_version.clone()).size(16)
]
);
@@ -74,4 +77,20 @@ pub fn nothing_view<'a>(
.padding(20)
.center_x(Length::Fill)
.height(Length::Fill)
}
}
// if let Err(e) = manager.write(
// ATTHandles::NothingEverything,
// &[
// 0x55,
// 0x60, 0x01,
// 0x0F, 0xF0,
// 0x03, 0x00,
// 0x00, 0x01, // the 0x00 is an incremental counter, but it works without it
// mode.to_byte(), 0x00,
// 0x00, 0x00 // these both bytes were something random, 0 works too
// ]
// ).await {
// log::error!("Failed to set noise cancellation mode for device {}: {}", mac, e);
// }