... | ... | @@ -144,5 +144,31 @@ Andrey, Richard |
|
|
|
|
|
## Package Overview for printerbackend:
|
|
|
![PrinterBackend.svg](uploads/0359a1b084241740a97e5afde116a21e/PrinterBackend.svg)
|
|
|
|
|
|
### Extension
|
|
|
To add a new printer without any special modes to the system, just use the Printercapability NORMALPRINTER in the config.
|
|
|
|
|
|
If a new printermode is discovered, please inherit from the **AbstractDocumentBuilder** to ensure that your new class has the same *contract* for the **PrintDirector** as all the other builder classes.
|
|
|
If would be beneficial to make a abstract class representing the printer itself, so let it inherit from **AbstractDocumentBuilder**, name it accordingly (e.g. PRINTERNAME_BUILDER), then create an class representing the protocol for the desired printermode, and inherit from the logical abstract class representing the printer.
|
|
|
You can add all the special byte sequences for the printer in the logical class, so that you do not need to use specific byte, but human readable abbreviations.
|
|
|
You can also set defaults if the documentation of the printer is verbose enough.
|
|
|
|
|
|
For example like in the **AbstractIndexV4Builder**:
|
|
|
|
|
|
```java
|
|
|
abstract class AbstractIndexV4Builder<T extends PrintableData> extends AbstractDocumentBuilder<T> {
|
|
|
|
|
|
/**
|
|
|
* Standard byte Sequence to announce StartTemporary document ([ESC]D).
|
|
|
* Must be always at the beginning.
|
|
|
*/
|
|
|
|
|
|
final byte[] mStartTemporaryDoc = new byte[] {0x1B, 0x44};
|
|
|
|
|
|
final byte[] mStartFloatingMode = new byte[] {0x1B, 0x46};
|
|
|
|
|
|
final byte[] mNewLine = new byte[] {0x0A};
|
|
|
|
|
|
```
|
|
|
## Package Overview for brailleparser:
|
|
|
![brailleparser.svg](uploads/66abd2031fbd218077c664ad1fd99129/brailleparser.svg) |
|
|
\ No newline at end of file |