Skip to content

Commit

Permalink
add capabilities support for adf simplex
Browse files Browse the repository at this point in the history
  • Loading branch information
Lars Jaeger committed Sep 16, 2024
1 parent 3841e86 commit 5c64676
Show file tree
Hide file tree
Showing 3 changed files with 208 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "escl"
version = "0.2.0"
version = "0.3.0"
authors = ["Jonathan LEI <me@xjonathan.dev>"]
license = "MIT OR Apache-2.0"
edition = "2021"
Expand Down
14 changes: 11 additions & 3 deletions src/capabilities.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ pub struct ScannerCapabilities {
#[serde(default, skip_serializing_if = "Certifications::is_empty")]
pub certifications: Certifications,
pub platen: Platen,
pub adf: Option<Adf>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub compression_factor_support: Option<CompressionFactorSupport>,
#[serde(default, skip_serializing_if = "SupportedMediaTypes::is_empty")]
Expand All @@ -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,
Expand Down Expand Up @@ -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<CcdChannels>,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
Expand Down Expand Up @@ -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()
{
Expand Down
196 changes: 196 additions & 0 deletions test-data/capabilities/canon_ts7450.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
<!-- -->
<scan:ScannerCapabilities xmlns:scan="http://schemas.hp.com/imaging/escl/2011/05/03" xmlns:pwg="http://www.pwg.org/schemas/2010/12/sm" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.hp.com/imaging/escl/2011/05/03 eSCL.xsd">
<pwg:Version>2.63</pwg:Version>
<pwg:MakeAndModel>Canon TS7400 series</pwg:MakeAndModel>
<scan:Manufacturer>Canon</scan:Manufacturer>
<pwg:SerialNumber>0018d7024a10</pwg:SerialNumber>
<scan:UUID>00000000-0000-1000-8000-0018d7024a10</scan:UUID>
<scan:AdminURI>http://c7BBC7300000.local./index.html?page=PAGE_AAP</scan:AdminURI>
<scan:IconURI>http://c7BBC7300000.local./icon/printer_icon.png</scan:IconURI>
<scan:Certifications>
<scan:Certification>
<scan:Name>mopria-certified-scan</scan:Name>
<scan:Version>1.3</scan:Version>
</scan:Certification>
</scan:Certifications>
<scan:Platen>
<!-- FB start -->
<scan:PlatenInputCaps>
<scan:MinWidth>1</scan:MinWidth>
<scan:MaxWidth>2550</scan:MaxWidth>
<scan:MinHeight>1</scan:MinHeight>
<scan:MaxHeight>3508</scan:MaxHeight>
<scan:MaxScanRegions>1</scan:MaxScanRegions>
<scan:SettingProfiles>
<scan:SettingProfile>
<scan:ColorModes>
<scan:ColorMode>Grayscale8</scan:ColorMode>
<scan:ColorMode scan:default="true">RGB24</scan:ColorMode>
</scan:ColorModes>
<scan:ContentTypes>
<pwg:ContentType>Photo</pwg:ContentType>
<pwg:ContentType>Text</pwg:ContentType>
<pwg:ContentType>TextAndPhoto</pwg:ContentType>
<pwg:ContentType>Halftone</pwg:ContentType>
<pwg:ContentType>Thru</pwg:ContentType>
<pwg:ContentType>Auto</pwg:ContentType>
</scan:ContentTypes>
<scan:DocumentFormats>
<pwg:DocumentFormat>image/jpeg</pwg:DocumentFormat>
<pwg:DocumentFormat>application/pdf</pwg:DocumentFormat>
<scan:DocumentFormatExt scan:default="true">image/jpeg</scan:DocumentFormatExt>
<scan:DocumentFormatExt>application/pdf</scan:DocumentFormatExt>
</scan:DocumentFormats>
<scan:SupportedResolutions>
<scan:DiscreteResolutions>
<scan:DiscreteResolution>
<scan:XResolution>75</scan:XResolution>
<scan:YResolution>75</scan:YResolution>
</scan:DiscreteResolution>
<scan:DiscreteResolution>
<scan:XResolution>100</scan:XResolution>
<scan:YResolution>100</scan:YResolution>
</scan:DiscreteResolution>
<scan:DiscreteResolution>
<scan:XResolution>150</scan:XResolution>
<scan:YResolution>150</scan:YResolution>
</scan:DiscreteResolution>
<scan:DiscreteResolution>
<scan:XResolution>200</scan:XResolution>
<scan:YResolution>200</scan:YResolution>
</scan:DiscreteResolution>
<scan:DiscreteResolution>
<scan:XResolution scan:default="true">300</scan:XResolution>
<scan:YResolution scan:default="true">300</scan:YResolution>
</scan:DiscreteResolution>
<scan:DiscreteResolution>
<scan:XResolution>600</scan:XResolution>
<scan:YResolution>600</scan:YResolution>
</scan:DiscreteResolution>
<scan:DiscreteResolution>
<scan:XResolution>1200</scan:XResolution>
<scan:YResolution>1200</scan:YResolution>
</scan:DiscreteResolution>
</scan:DiscreteResolutions>
</scan:SupportedResolutions>
<scan:ColorSpaces>
<scan:ColorSpace>sRGB</scan:ColorSpace>
</scan:ColorSpaces>
<scan:CcdChannels>
<scan:CcdChannel>NTSC</scan:CcdChannel>
</scan:CcdChannels>
</scan:SettingProfile>
</scan:SettingProfiles>
<scan:SupportedIntents>
<scan:Intent>Document</scan:Intent>
<scan:Intent>Photo</scan:Intent>
<scan:Intent>Preview</scan:Intent>
<scan:Intent>TextAndGraphic</scan:Intent>
<scan:Intent>Auto</scan:Intent>
</scan:SupportedIntents>
<scan:MaxOpticalXResolution>1200</scan:MaxOpticalXResolution>
<scan:MaxOpticalYResolution>1200</scan:MaxOpticalYResolution>
<scan:RiskyLeftMargin>0</scan:RiskyLeftMargin>
<scan:RiskyRightMargin>0</scan:RiskyRightMargin>
<scan:RiskyTopMargin>0</scan:RiskyTopMargin>
<scan:RiskyBottomMargin>0</scan:RiskyBottomMargin>
</scan:PlatenInputCaps>
</scan:Platen>
<!-- FB end -->
<scan:Adf>
<!-- ADF start -->
<scan:AdfSimplexInputCaps>
<scan:MinWidth>1</scan:MinWidth>
<scan:MaxWidth>2550</scan:MaxWidth>
<scan:MinHeight>1</scan:MinHeight>
<scan:MaxHeight>4200</scan:MaxHeight>
<scan:MaxScanRegions>1</scan:MaxScanRegions>
<scan:SettingProfiles>
<scan:SettingProfile>
<scan:ColorModes>
<scan:ColorMode>Grayscale8</scan:ColorMode>
<scan:ColorMode scan:default="true">RGB24</scan:ColorMode>
</scan:ColorModes>
<scan:ContentTypes>
<pwg:ContentType>Photo</pwg:ContentType>
<pwg:ContentType>Text</pwg:ContentType>
<pwg:ContentType>TextAndPhoto</pwg:ContentType>
<pwg:ContentType>Halftone</pwg:ContentType>
<pwg:ContentType>Thru</pwg:ContentType>
<pwg:ContentType>Auto</pwg:ContentType>
</scan:ContentTypes>
<scan:DocumentFormats>
<pwg:DocumentFormat>image/jpeg</pwg:DocumentFormat>
<pwg:DocumentFormat>application/pdf</pwg:DocumentFormat>
<scan:DocumentFormatExt scan:default="true">image/jpeg</scan:DocumentFormatExt>
<scan:DocumentFormatExt>application/pdf</scan:DocumentFormatExt>
</scan:DocumentFormats>
<scan:SupportedResolutions>
<scan:DiscreteResolutions>
<scan:DiscreteResolution>
<scan:XResolution>75</scan:XResolution>
<scan:YResolution>75</scan:YResolution>
</scan:DiscreteResolution>
<scan:DiscreteResolution>
<scan:XResolution>100</scan:XResolution>
<scan:YResolution>100</scan:YResolution>
</scan:DiscreteResolution>
<scan:DiscreteResolution>
<scan:XResolution>150</scan:XResolution>
<scan:YResolution>150</scan:YResolution>
</scan:DiscreteResolution>
<scan:DiscreteResolution>
<scan:XResolution>200</scan:XResolution>
<scan:YResolution>200</scan:YResolution>
</scan:DiscreteResolution>
<scan:DiscreteResolution>
<scan:XResolution scan:default="true">300</scan:XResolution>
<scan:YResolution scan:default="true">300</scan:YResolution>
</scan:DiscreteResolution>
<scan:DiscreteResolution>
<scan:XResolution>600</scan:XResolution>
<scan:YResolution>600</scan:YResolution>
</scan:DiscreteResolution>
</scan:DiscreteResolutions>
</scan:SupportedResolutions>
<scan:ColorSpaces>
<scan:ColorSpace>sRGB</scan:ColorSpace>
</scan:ColorSpaces>
</scan:SettingProfile>
</scan:SettingProfiles>
<scan:SupportedIntents>
<scan:Intent>Document</scan:Intent>
<scan:Intent>Photo</scan:Intent>
<scan:Intent>Preview</scan:Intent>
<scan:Intent>TextAndGraphic</scan:Intent>
<scan:Intent>Auto</scan:Intent>
</scan:SupportedIntents>
<scan:MaxOpticalXResolution>600</scan:MaxOpticalXResolution>
<scan:MaxOpticalYResolution>600</scan:MaxOpticalYResolution>
<scan:RiskyLeftMargin>0</scan:RiskyLeftMargin>
<scan:RiskyRightMargin>0</scan:RiskyRightMargin>
<scan:RiskyTopMargin>0</scan:RiskyTopMargin>
<scan:RiskyBottomMargin>0</scan:RiskyBottomMargin>
</scan:AdfSimplexInputCaps>
<scan:FeederCapacity>35</scan:FeederCapacity>
<scan:AdfOptions>
<scan:AdfOption>DetectPaperLoaded</scan:AdfOption>
</scan:AdfOptions>
</scan:Adf>
<!-- ADF end -->
<scan:CompressionFactorSupport>
<scan:Min>0</scan:Min>
<scan:Max>1</scan:Max>
<scan:Normal>1</scan:Normal>
<scan:Step>1</scan:Step>
</scan:CompressionFactorSupport>
<scan:SupportedMediaTypes>
<scan:MediaType>BackgroundReduction</scan:MediaType>
</scan:SupportedMediaTypes>
<scan:SharpenSupport>
<scan:Min>0</scan:Min>
<scan:Max>1</scan:Max>
<scan:Normal>0</scan:Normal>
<scan:Step>1</scan:Step>
</scan:SharpenSupport>
</scan:ScannerCapabilities>

0 comments on commit 5c64676

Please sign in to comment.