1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
use super::{PrinterProfile};
use crate::command::Font;
pub enum PrinterModel {
ZKTeco,
TMT20
}
impl PrinterModel {
pub fn vp_id(&self) -> (u16, u16) {
match self {
PrinterModel::ZKTeco => (0x6868, 0x0200),
PrinterModel::TMT20 => (0x04b8, 0x0e15)
}
}
pub fn profile(&self) -> PrinterProfile {
let (vendor_id, product_id) = self.vp_id();
match self {
PrinterModel::ZKTeco => {
PrinterProfile {
vendor_id,
product_id,
columns_per_font: vec![(Font::FontA, 32), (Font::FontB, 42)].into_iter().collect(),
width: 384,
endpoint: Some(0x02),
timeout: std::time::Duration::from_secs(2)
}
},
PrinterModel::TMT20 => {
PrinterProfile {
vendor_id,
product_id,
columns_per_font: vec![(Font::FontA, 48)].into_iter().collect(),
width: 576,
endpoint: Some(0x01),
timeout: std::time::Duration::from_secs(2)
}
}
}
}
}