From 5c646764e9c6ea841383819a5c92b27f9ff83b76 Mon Sep 17 00:00:00 2001 From: Lars Jaeger Date: Tue, 17 Sep 2024 01:02:39 +0200 Subject: [PATCH] add capabilities support for adf simplex --- Cargo.toml | 2 +- src/capabilities.rs | 14 +- test-data/capabilities/canon_ts7450.xml | 196 ++++++++++++++++++++++++ 3 files changed, 208 insertions(+), 4 deletions(-) create mode 100644 test-data/capabilities/canon_ts7450.xml diff --git a/Cargo.toml b/Cargo.toml index 4b530e7..3255203 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "escl" -version = "0.2.0" +version = "0.3.0" authors = ["Jonathan LEI "] license = "MIT OR Apache-2.0" edition = "2021" diff --git a/src/capabilities.rs b/src/capabilities.rs index d500c97..a4b5f53 100644 --- a/src/capabilities.rs +++ b/src/capabilities.rs @@ -17,6 +17,7 @@ pub struct ScannerCapabilities { #[serde(default, skip_serializing_if = "Certifications::is_empty")] pub certifications: Certifications, pub platen: Platen, + pub adf: Option, #[serde(default, skip_serializing_if = "Option::is_none")] pub compression_factor_support: Option, #[serde(default, skip_serializing_if = "SupportedMediaTypes::is_empty")] @@ -41,12 +42,18 @@ pub struct Certification { #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] #[serde(rename_all = "PascalCase")] pub struct Platen { - pub platen_input_caps: PlatenInputCaps, + pub platen_input_caps: InputCaps, } #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] #[serde(rename_all = "PascalCase")] -pub struct PlatenInputCaps { +pub struct Adf { + pub adf_simplex_input_caps: InputCaps, +} + +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct InputCaps { pub min_width: u32, pub max_width: u32, pub min_height: u32, @@ -77,7 +84,7 @@ pub struct SettingProfile { pub document_formats: DocumentFormats, pub supported_resolutions: SupportedResolutions, pub color_spaces: ColorSpaces, - pub ccd_channels: CcdChannels, + pub ccd_channels: Option, } #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] @@ -473,6 +480,7 @@ mod tests { for raw_xml in [ include_str!("../test-data/capabilities/brother_mfc_j497dw.xml"), include_str!("../test-data/capabilities/canon_ts5300_series.xml"), + include_str!("../test-data/capabilities/canon_ts7450.xml"), ] .into_iter() { diff --git a/test-data/capabilities/canon_ts7450.xml b/test-data/capabilities/canon_ts7450.xml new file mode 100644 index 0000000..eceba71 --- /dev/null +++ b/test-data/capabilities/canon_ts7450.xml @@ -0,0 +1,196 @@ + + +2.63 +Canon TS7400 series +Canon +0018d7024a10 +00000000-0000-1000-8000-0018d7024a10 +http://c7BBC7300000.local./index.html?page=PAGE_AAP +http://c7BBC7300000.local./icon/printer_icon.png + + +mopria-certified-scan +1.3 + + + + + +1 +2550 +1 +3508 +1 + + + +Grayscale8 +RGB24 + + +Photo +Text +TextAndPhoto +Halftone +Thru +Auto + + +image/jpeg +application/pdf +image/jpeg +application/pdf + + + + +75 +75 + + +100 +100 + + +150 +150 + + +200 +200 + + +300 +300 + + +600 +600 + + +1200 +1200 + + + + +sRGB + + +NTSC + + + + +Document +Photo +Preview +TextAndGraphic +Auto + +1200 +1200 +0 +0 +0 +0 + + + + + + +1 +2550 +1 +4200 +1 + + + +Grayscale8 +RGB24 + + +Photo +Text +TextAndPhoto +Halftone +Thru +Auto + + +image/jpeg +application/pdf +image/jpeg +application/pdf + + + + +75 +75 + + +100 +100 + + +150 +150 + + +200 +200 + + +300 +300 + + +600 +600 + + + + +sRGB + + + + +Document +Photo +Preview +TextAndGraphic +Auto + +600 +600 +0 +0 +0 +0 + +35 + +DetectPaperLoaded + + + + +0 +1 +1 +1 + + +BackgroundReduction + + +0 +1 +0 +1 + +