use crate::charset::InternationalCharset;
use crate::codepage::CodePage;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Alignment {
Left,
Center,
Right,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum CutMode {
Full,
Partial,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum UnderlineMode {
Off,
Single,
Double,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum FontFamily {
A,
B,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum DrawerPin {
Pin2,
Pin5,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum BarcodeSystem {
UpcA,
UpcE,
Ean13,
Ean8,
Code39,
Code128,
Itf,
Codabar,
Code93,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct BarcodeData {
pub system: BarcodeSystem,
pub data: String,
pub width: u8,
pub height: u8,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum QrCorrectionLevel {
L,
M,
Q,
H,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct QrData {
pub data: String,
pub model: u8,
pub cell_size: u8,
pub correction: QrCorrectionLevel,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ImageData {
pub width: u32,
pub height: u32,
pub pixels: Vec<u8>,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub enum PrintDensity {
Light,
#[default]
Normal,
Dark,
HighContrast,
Custom(u8),
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct HeatingParameters {
pub max_heating_dots: u8,
pub heating_time: u8,
pub heating_interval: u8,
}
impl Default for HeatingParameters {
fn default() -> Self {
Self {
max_heating_dots: 7, heating_time: 80, heating_interval: 2, }
}
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum Command {
Init,
Text(String),
Feed(u8),
Cut(CutMode),
Align(Alignment),
Bold(bool),
Underline(UnderlineMode),
Invert(bool),
DoubleHeight(bool),
DoubleWidth(bool),
Font(FontFamily),
Barcode(BarcodeData),
QrCode(QrData),
Image(ImageData),
DrawerKick(DrawerPin),
Beep {
count: u8,
duration: u8,
},
LineSpacing(Option<u8>),
UpsideDown(bool),
CodePage(CodePage),
InternationalCharset(InternationalCharset),
PrintDensity(PrintDensity),
HeatingParameters(HeatingParameters),
Raw(Vec<u8>),
}