use psdk_father::types::psdk_types::PsdkPrinterCommandEnumValue;
#[derive(Clone, Debug)]
pub enum CodeType {
Code39,
Code128,
Code93,
Codabar,
Ean8,
Ean13,
Upca,
Upce,
I2Of5,
I20F5,
}
impl PsdkPrinterCommandEnumValue for CodeType {
fn command_value(&self) -> String {
match self {
CodeType::Code39 => "39",
CodeType::Code128 => "128",
CodeType::Code93 => "93",
CodeType::Codabar => "CODABAR",
CodeType::Ean8 => "EAN8",
CodeType::Ean13 => "EAN13",
CodeType::Upca => "UPCA",
CodeType::Upce => "UPCE",
CodeType::I2Of5 | CodeType::I20F5 => "I2OF5",
}
.to_string()
}
}
impl CodeType {
pub fn width(&self) -> u32 {
match self {
CodeType::Code39 => 2,
CodeType::Code128 => 2,
CodeType::Code93 => 1,
CodeType::Codabar => 2,
CodeType::Ean8 => 2,
CodeType::Ean13 => 2,
CodeType::Upca => 2,
CodeType::Upce => 2,
CodeType::I2Of5 | CodeType::I20F5 => 2,
}
}
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum CodeRotation {
Rotation0,
Rotation90,
}
impl PsdkPrinterCommandEnumValue for CodeRotation {
fn command_value(&self) -> String {
match self {
CodeRotation::Rotation0 => "B",
CodeRotation::Rotation90 => "VB",
}
.to_string()
}
}
#[derive(Clone, Debug)]
pub enum Font {
Tss16,
Tss20,
Tss20Max1,
Tss24,
Tss28,
Tss32,
Tss24Max1,
Tss28Max1,
Tss32Max1,
Tss24Max2,
Tss28Max2,
Tss32Max2,
}
impl Font {
pub fn get_ex(&self) -> u32 {
match self {
Font::Tss16 | Font::Tss20 | Font::Tss24 | Font::Tss28 | Font::Tss32 => 1,
Font::Tss20Max1 | Font::Tss24Max1 | Font::Tss28Max1 | Font::Tss32Max1 => 2,
Font::Tss24Max2 | Font::Tss28Max2 | Font::Tss32Max2 => 3,
}
}
pub fn get_ey(&self) -> u32 {
match self {
Font::Tss16 | Font::Tss20 | Font::Tss24 | Font::Tss28 | Font::Tss32 => 1,
Font::Tss20Max1 | Font::Tss24Max1 | Font::Tss28Max1 | Font::Tss32Max1 => 2,
Font::Tss24Max2 | Font::Tss28Max2 | Font::Tss32Max2 => 3,
}
}
pub fn get_family(&self) -> u32 {
match self {
Font::Tss16 => 55,
Font::Tss20 | Font::Tss20Max1 => 6,
Font::Tss28 | Font::Tss28Max1 | Font::Tss28Max2 => 7,
Font::Tss24 | Font::Tss24Max1 | Font::Tss24Max2 => 24,
Font::Tss32 | Font::Tss32Max1 | Font::Tss32Max2 => 4,
}
}
pub fn get_size(&self) -> u32 {
match self {
Font::Tss16 | Font::Tss20 | Font::Tss24 | Font::Tss28 | Font::Tss32 => 0,
Font::Tss20Max1
| Font::Tss24Max1
| Font::Tss28Max1
| Font::Tss32Max1
| Font::Tss24Max2
| Font::Tss28Max2
| Font::Tss32Max2 => 0,
}
}
pub fn get_height(&self) -> u32 {
match self {
Font::Tss16 => 16,
Font::Tss20 => 20,
Font::Tss20Max1 => 40,
Font::Tss24 => 24,
Font::Tss28 => 28,
Font::Tss32 => 32,
Font::Tss24Max1 => 48,
Font::Tss28Max1 => 56,
Font::Tss32Max1 => 64,
Font::Tss24Max2 => 72,
Font::Tss28Max2 => 84,
Font::Tss32Max2 => 96,
}
}
}
#[derive(Clone, Debug)]
pub enum Rotation {
Rotation0,
Rotation90,
Rotation180,
Rotation270,
}
impl PsdkPrinterCommandEnumValue for Rotation {
fn command_value(&self) -> String {
match self {
Rotation::Rotation0 => "",
Rotation::Rotation90 => "90",
Rotation::Rotation180 => "180",
Rotation::Rotation270 => "270",
}
.to_string()
}
}
#[derive(Clone, Debug)]
pub enum Mode {
Normal,
Horizontal,
Mirror,
}
impl Mode {
pub fn get_mode(&self) -> u32 {
match self {
Mode::Normal => 0,
Mode::Horizontal => 1,
Mode::Mirror => 2,
}
}
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum CorrectLevel {
L,
M,
Q,
H,
}
impl CorrectLevel {
pub fn get_level(&self) -> String {
match self {
CorrectLevel::L => "L".to_string(),
CorrectLevel::M => "M".to_string(),
CorrectLevel::Q => "Q".to_string(),
CorrectLevel::H => "H".to_string(),
}
}
pub fn get_level_num(&self) -> u32 {
match self {
CorrectLevel::L => 0,
CorrectLevel::M => 1,
CorrectLevel::Q => 2,
CorrectLevel::H => 3,
}
}
}