-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add partial support for viewing service data
- Loading branch information
Showing
7 changed files
with
80 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
use ratatui::{ | ||
layout::Constraint, | ||
style::{Color, Modifier, Style}, | ||
widgets::{Block, Borders, Row, Table}, | ||
}; | ||
|
||
use crate::structs::DeviceInfo; | ||
|
||
/// Provides an overlay with the selected device's service data. | ||
pub fn inspect_overlay(selected_device: &DeviceInfo) -> Table<'static> { | ||
// Iterate through the selected device's service_data to create rows | ||
let rows: Vec<Row> = selected_device | ||
.service_data | ||
.iter() | ||
.map(|(uuid, data)| { | ||
let data_str = data | ||
.iter() | ||
.map(|byte| format!("{:02x}", byte)) | ||
.collect::<Vec<String>>() | ||
.join(" "); | ||
// Create a row for each UUID and its corresponding data | ||
Row::new(vec![uuid.to_string(), data_str]) | ||
}) | ||
.collect(); | ||
|
||
let table = Table::new( | ||
rows, | ||
[Constraint::Percentage(50), Constraint::Percentage(50)], | ||
) | ||
.header(Row::new(vec!["UUID", "Data"]).style(Style::default().fg(Color::Yellow))) | ||
.block( | ||
Block::default() | ||
.borders(Borders::ALL) | ||
.title("Data Overview"), | ||
) | ||
.highlight_style(Style::default().add_modifier(Modifier::BOLD)); | ||
|
||
table | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
pub mod detail_table; | ||
pub mod device_table; | ||
pub mod info_table; | ||
pub mod inspect_overlay; |