pub fn common_info(ui: &mut egui::Ui, device_info: Option<&dfudev::DeviceInfo>) {
    ui.group(|ui| {
        ui.set_width(ui.available_width() / 3.0);
        ui.set_height(ui.available_height());

        match device_info {
            Some(device_info) => {
                ui.vertical(|ui| {
                    ui.heading("ID");
                    ui.add_space(5.0);
                    egui::Grid::new("device_info").show(ui, |ui| {
                        ui.label("Vendor ID:");
                        ui.label(format!("0x{:04X}", device_info.vendor_id));
                        ui.end_row();

                        ui.label("Product ID:");
                        ui.label(format!("0x{:04X}", device_info.product_id));
                        ui.end_row();

                        ui.label("Device Version:");
                        ui.label(device_info.device_version.to_owned());
                        ui.end_row();

                        ui.label("Serial No:");
                        ui.label(device_info.serial_number_string.to_owned());
                        ui.end_row();

                        ui.label("DFU Version:");
                        let version_info = if device_info.dfu_version == 0x011A {
                            "(DfuSe)"
                        } else {
                            ""
                        };
                        ui.label(format!(
                            "0x{:04X} {}",
                            device_info.dfu_version, version_info
                        ));
                        ui.end_row();
                    });
                });
            }
            None => {
                ui.centered_and_justified(|ui| {
                    ui.label("No device selected");
                });
            }
        }
    });
}
/// Show box with common device information
Show box with common device information
Show box with common device information
pub fn common_info(ui: &mut egui::Ui, device_info: Option<&dfudev::DeviceInfo>) {
    ui.group(|ui| {
        ui.set_width(ui.available_width() / 3.0);
        ui.set_height(ui.available_height());
        match device_info {
            Some(device_info) => {
                ui.vertical(|ui| {
                    ui.heading("ID");
                    ui.add_space(5.0);
                    egui::Grid::new("device_info").show(ui, |ui| {
                        ui.label("Vendor ID:");
                        ui.label(format!("0x{:04X}", device_info.vendor_id));
                        ui.end_row();
                        ui.label("Product ID:");
                        ui.label(format!("0x{:04X}", device_info.product_id));
                        ui.end_row();
                        ui.label("Device Version:");
                        ui.label(device_info.device_version.to_owned());
                        ui.end_row();
                        ui.label("Serial No:");
                        ui.label(device_info.serial_number_string.to_owned());
                        ui.end_row();
                        ui.label("DFU Version:");
                        let version_info = if device_info.dfu_version == 0x011A {
                            "(DfuSe)"
                        } else {
                            ""
                        };
                        ui.label(format!(
                            "0x{:04X} {}",
                            device_info.dfu_version, version_info
                        ));
                        ui.end_row();
                    });
                });
            }
            None => {
                ui.centered_and_justified(|ui| {
                    ui.label("No device selected");
                });
            }
        }
    });
}
pub fn common_info ( ui : & mut egui :: Ui , device_info : Option < & dfudev :: DeviceInfo > ) { ui . group ( | ui | { ui . set_width ( ui . available_width ( ) / 3.0 ) ; ui . set_height ( ui . available_height ( ) ) ; match device_info { Some ( device_info ) => { ui . vertical ( | ui | { ui . heading ( " " ) ; ui . add_space ( 5.0 ) ; egui :: Grid :: new ( " " ) . show ( ui , | ui | { ui . label ( " " ) ; ui . label ( format ! ( " " device_info vendor_id ) ) ; ui . end_row ( ) ; ui . label ( " " ) ; ui . label ( format ! ( " " device_info product_id ) ) ; ui . end_row ( ) ; ui . label ( " " ) ; ui . label ( device_info . device_version . to_owned ( ) ) ; ui . end_row ( ) ; ui . label ( " " ) ; ui . label ( device_info . serial_number_string . to_owned ( ) ) ; ui . end_row ( ) ; ui . label ( " " ) ; let version_info = if device_info . dfu_version == 0x011A { " " } else { " " } ; ui . label ( format ! ( " " device_info dfu_version version_info ) ) ; ui . end_row ( ) ; } ) ; } ) ; } None => { ui . centered_and_justified ( | ui | { ui . label ( " " ) ; } ) ; } } } ) ; }
Show box with common device information
Show box with common device information
ui
&mut egui::Ui
device_info
Option<&dfudev::DeviceInfo>