Status¶
Decoders for the printer's status replies (full status, paper sensor, off-line and error bytes) and numeric maintenance readings.
vkp80iii.status ¶
Decoding of the status bytes the VKP80III sends back.
The printer answers real-time status requests (DLE EOT n), the paper-sensor
query (ESC v) and the full-status request (DLE EOT 0x14) with packed
status bytes. These helpers turn those bytes into readable dataclasses.
Bit meanings follow the VKP80III emulation "STATUS COMMANDS" chapter of the commands manual.
PaperStatus
dataclass
¶
Decoded paper situation from the paper sensor (ESC v / roll sensor).
These commands only report paper presence and low-paper; the richer paper
flags (ticket in output, virtual paper end, black mark) are part of the full
status -- see :class:FullStatus.
Source code in src/vkp80iii/status.py
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 | |
from_paper_sensor
classmethod
¶
from_paper_sensor(byte: int) -> PaperStatus
Decode the single byte returned by ESC v.
bits 0-1 (0x03) -> near-paper-end (low paper); bits 2-3 (0x0C) -> paper-end (no paper).
Source code in src/vkp80iii/status.py
34 35 36 37 38 39 40 41 42 43 | |
from_roll_sensor
classmethod
¶
from_roll_sensor(byte: int) -> PaperStatus
Decode DLE EOT 4 (paper roll sensor): 0x0C low, 0x60 absent.
Source code in src/vkp80iii/status.py
45 46 47 48 | |
FullStatus
dataclass
¶
The 6-byte full-status block (DLE EOT 0x14 / automatic status-back).
Byte layout: 10 0F <paper> <user> <recoverable> <unrecoverable>.
Source code in src/vkp80iii/status.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | |
ready
property
¶
ready: bool
True if the printer can print right now (paper present, closed, no errors).
parse
classmethod
¶
parse(data: bytes) -> FullStatus
Parse the 6 bytes returned for a full-status request.
Tolerates a leading 10 0F header or a bare 4-byte status block.
Source code in src/vkp80iii/status.py
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | |
problems ¶
problems() -> list[str]
Human-readable list of the active fault/attention flags.
Source code in src/vkp80iii/status.py
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | |
decode_offline_status ¶
decode_offline_status(byte: int) -> dict[str, bool]
Decode DLE EOT 2 (off-line status) into named flags.
Source code in src/vkp80iii/status.py
179 180 181 182 183 184 185 186 | |
decode_error_status ¶
decode_error_status(byte: int) -> dict[str, bool]
Decode DLE EOT 3 (error status) into named flags.
Source code in src/vkp80iii/status.py
189 190 191 192 193 194 195 | |
parse_reading ¶
parse_reading(reply: bytes) -> int
Parse a numeric reading reply such as b'510cm' or b'785cuts'.
Returns the leading integer (cm, count, ...). The caller knows the unit.
Source code in src/vkp80iii/status.py
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 | |