Automatic Status Back (ASB) - RuVP/seiko-dpu-printer GitHub Wiki
The Seiko DPU-D2 printer used as slip printer in GM atlas 5.0.2 has an automatic status callback mechanism that the manufacturer calls as ASB (Automatic Status Back).
For any event that happens at the printer, it can send out an integer status that represents the event. i.e. for any change detected by the printer, the printer sends a number as a callback to the calling method.
This document describes how to decode that status code.
To know more about how to subscribe and set ASB, please refer Technical Documentation of the Printer available along with the printer driver.
To understand the meaning of the status code, we must convert the number to binary format. Typically received codes are: 0, 16, 48, 262192 and 262160.
We shall use examples to understand how this works. But before that we need a chart for reference.
Bit Position | Byte | Byte Bit Position | Function | Value 0 | Value 1 | Remarks |
---|---|---|---|---|---|---|
0 | 1 | 0 | Identifier | Fixed to β0β | N/A | Ignore bit. |
1 | 1 | 1 | Motor drive | Stop | Work | Helps determine whether or not the printer is currently printing. |
2 | 1 | 2 | Reserved | Fixed to β0β | N/A | Ignore bit. |
3 | 1 | 3 | Undefined | Fixed to β0β | N/A | Ignore bit. |
4 | 1 | 4 | Identifier | Fixed to β1β | N/A | Ignore bit. |
5 | 1 | 5 | Paper cover sensor status | Closed | Opened | Helps determine whether printer door is opened or closed. |
6 | 1 | 6 | Paper feed switch | OFF | ON | Indicates feed switch on printer was pressed. |
7 | 1 | 7 | Identifier | Fixed to β0β | N/A | Ignore bit. |
8 | 2 | 0 | Undefined | Fixed to β0β | N/A | Ignore bit. |
9 | 2 | 1 | Undefined | Fixed to β0β | N/A | Ignore bit. |
10 | 2 | 2 | Reserved | Fixed to β0β | N/A | Ignore bit. |
11 | 2 | 3 | Reserved | Fixed to β0β | N/A | Ignore bit. |
12 | 2 | 4 | Identifier | Fixed to β0β | N/A | Ignore bit. |
13 | 2 | 5 | Unrecoverable error | No | Yes | Indicates that an unrecoverable error has occurred at the printer. |
14 | 2 | 6 | Automatic recovery error | No | Yes,βIndicates that an error has occurred at the printer | but can be recovered automatically.β |
15 | 2 | 7 | Identifier | Fixed to β0β | N/A | Ignore bit. |
16 | 3 | 0 | Undefined | Fixed to β0β | N/A | Ignore bit. |
17 | 3 | 1 | Undefined | Fixed to β0β | N/A | Ignore bit. |
18 | 3 | 2 | Out-of-paper sensor | Paper | No paper | Indicates whether or not the printer is out of paper. |
19 | 3 | 3 | Undefined | Fixed to β0β | N/A | Ignore bit. |
20 | 3 | 4 | Identifier | Fixed to β0β | N/A | Ignore bit. |
21 | 3 | 5 | Undefined | Fixed to β0β | N/A | Ignore bit. |
22 | 3 | 6 | Reserved | Fixed to β0β | N/A | Ignore bit. |
23 | 3 | 7 | Identifier | Fixed to β0β | N/A | Ignore bit. |
From this chart, the only bits that are of interest to us are bit positions: 1, 5, 6, 13, 14 and 18.
Back to examples.
Example 1: Status Code = 48
Suppose we get the status from the printer as 48, how do we figure out what it means?
Convert the integer to its binary equivalent. 48 (decimal) = β0011 0000β¬ (binary)
We can see that there is 1 byte of data (8 bits) and have been tabulated as below. The bits of interest to us have been highlighted in green and bold.
Bit Position | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
---|---|---|---|---|---|---|---|---|
Value | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 |
Meaning | Paper feed switch is not pressed. | Printer door is open since the value is 1. | Motor drive is stopped indicating printer is not printing. |
Example 2: Status Code = 262160
Convert the integer to its binary equivalent. 262160 (decimal) = β0100 0000 0000 0001 0000β¬β¬ (binary)
We can see that there is 1 byte of data (8 bits) and have been tabulated as below. The bits of interest to us have been highlighted in green and bold.
Bit Position | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Value | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 |
Meaning | Indicates that printer is out of paper since value is 1. | Indicates no error at printer. | Indicates no error at printer. | Paper feed switch is not pressed. | Printer door is closed. | Motor drive is stopped indicating printer is not printing. |
Similarly for any integer code received from the printer, we can decode the meaning in this manner.
Cheat Sheet (Common Status Codes)
Sl. No. | Status Code | Meaning |
---|---|---|
1 | 0 | Printer not connected. |
2 | 16 | Printer is currently not printing (idle state). |
3 | 18 | Printer is currently printing. |
4 | 48 | Printer door is open. |
5 | 80 | Paper feed switch is pressed, but printer is not printing yet. |
6 | 82 | Paper feed switch is pressed, and printer is printing. |
7 | 262160 | Printer is out of paper. |
8 | 262162 | Printer is out of paper but printing (print motor is running). |
9 | 262192 | Printer is out of paper and printer door is open. |