Package SamplePOSPrinter
Class POSPrinter
- All Implemented Interfaces:
JposBaseInterface
,POSPrinterInterface
Class implementing the POSPrinterInterface for the sample pos printer.
-
Field Summary
Fields inherited from class de.gmxhome.conrad.jpos.jpos_base.posprinter.POSPrinterProperties
CapCharacterSet, CapConcurrentJrnRec, CapConcurrentJrnSlp, CapConcurrentPageMode, CapConcurrentRecSlp, CapCoverSensor, CapJrn2Color, CapJrnBold, CapJrnCartridgeSensor, CapJrnColor, CapJrnDhigh, CapJrnDwide, CapJrnDwideDhigh, CapJrnEmptySensor, CapJrnItalic, CapJrnNearEndSensor, CapJrnPresent, CapJrnUnderline, CapMapCharacterSet, CapRec2Color, CapRecBarCode, CapRecBitmap, CapRecBold, CapRecCartridgeSensor, CapRecColor, CapRecDhigh, CapRecDwide, CapRecDwideDhigh, CapRecEmptySensor, CapRecItalic, CapRecLeft90, CapRecMarkFeed, CapRecNearEndSensor, CapRecPageMode, CapRecPapercut, CapRecPresent, CapRecRight90, CapRecRotate180, CapRecRuledLine, CapRecStamp, CapRecUnderline, CapSlp2Color, CapSlpBarCode, CapSlpBitmap, CapSlpBold, CapSlpBothSidesPrint, CapSlpCartridgeSensor, CapSlpColor, CapSlpDhigh, CapSlpDwide, CapSlpDwideDhigh, CapSlpEmptySensor, CapSlpFullslip, CapSlpItalic, CapSlpLeft90, CapSlpNearEndSensor, CapSlpPageMode, CapSlpPresent, CapSlpRight90, CapSlpRotate180, CapSlpRuledLine, CapSlpUnderline, CapTransaction, CartridgeNotify, CharacterSet, CharacterSetDef, CharacterSetList, CoverOpen, ErrorLevel, ErrorStation, ErrorString, FontTypefaceList, InsertionMode, JrnCartridgeState, JrnCurrentCartridge, JrnCurrentCartridgeDef, JrnEmpty, JrnLetterQuality, JrnLineChars, JrnLineCharsList, JrnLineHeight, JrnLineHeightDef, JrnLineSpacing, JrnLineSpacingDef, JrnLineWidth, JrnLineWidthDef, JrnNearEnd, MapCharacterSet, MapMode, PageModeArea, PageModeDescriptor, PageModeHorizontalPosition, PageModePrintArea, PageModePrintDirection, PageModeStation, PageModeVerticalPosition, RecBarCodeRotationList, RecBitmapRotationList, RecCartridgeState, RecCurrentCartridge, RecCurrentCartridgeDef, RecEmpty, RecLetterQuality, RecLineChars, RecLineCharsList, RecLineHeight, RecLineHeightDef, RecLineSpacing, RecLineSpacingDef, RecLinesToPaperCut, RecLinesToPaperCutDef, RecLineWidth, RecLineWidthDef, RecNearEnd, RecSidewaysMaxChars, RecSidewaysMaxCharsDef, RecSidewaysMaxLines, RecSidewaysMaxLinesDef, RemovalMode, RotateSpecial, SlpBarCodeRotationList, SlpBitmapRotationList, SlpCartridgeState, SlpCurrentCartridge, SlpCurrentCartridgeDef, SlpEmpty, SlpLetterQuality, SlpLineChars, SlpLineCharsList, SlpLineHeight, SlpLineHeightDef, SlpLinesNearEndToEnd, SlpLinesNearEndToEndDef, SlpLineSpacing, SlpLineSpacingDef, SlpLineWidth, SlpLineWidthDef, SlpMaxLines, SlpMaxLinesDef, SlpNearEnd, SlpPrintSide, SlpPrintSideDef, SlpSidewaysMaxChars, SlpSidewaysMaxCharsDef, SlpSidewaysMaxLines, SlpSidewaysMaxLinesDef
Fields inherited from class de.gmxhome.conrad.jpos.jpos_base.JposCommonProperties
AllowAlwaysSetProperties, AllowDeprecatedMethods, AsyncInputActive, AsyncMode, AutoDisable, CapStatisticsReporting, CapUpdateStatistics, CheckHealthText, Claimed, Claiming, ClaimWaiters, CurrentCommands, CurrentUnitID, DataCount, DataEventEnabled, DataEventList, Device, DeviceEnabled, DeviceServiceDescription, DeviceServiceVersion, DevProps, ErrorUnits, EventCB, EventList, EventSource, EventString, EventUnitID, EventUnits, ExclusiveAllowed, ExclusiveNo, ExclusiveUse, ExclusiveYes, FirstEnableHappened, FlagWhenIdle, FlagWhenIdleStatusValue, FreezeEvents, Index, LogicalName, MaximumConfirmationEventWaitingTime, OutputID, PowerNotify, PowerState, SerializedRequestRunner, SerializedRequests, State, StrictFIFOEventHandling, SuspendedCommands, SuspendedConcurrentCommands, UnitsOnline, UsesSubsystemUnits
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
characterSet(int value)
Final part of setting CharacterSet.void
checkHealth(int level)
Final part of CheckHealth method.void
claim(int timeout)
Final part of setting claim.void
Final part of CutPaper method.void
deviceEnabled(boolean enable)
Final part of setting DeviceEnabled.getLogoData(boolean top)
This method will be called whenever print data contain a logo print sequence ESC|tL or ESC|bL.void
mapMode(int i)
Final part of setting MapMode.printImmediate(int station, String data)
Validation part of PrintImmediate method.printNormal(int station, String data)
Validation part of PrintNormal method.void
printNormal(PrintNormal request)
Final part of PrintNormal method.void
recLineChars(int value)
Final part of setting RecLineChars.void
recLineHeight(int i)
Final part of setting RecLineHeight.void
recLineSpacing(int i)
Final part of setting RecLineSpacing.void
release()
Final part of release method.void
Final part of SetLogo method.void
transactionPrint(TransactionPrint request)
Final part of TransactionPrint method.void
validateData(int station, POSPrinterService.ControlChar ctrl)
Validate control character.void
validateData(int station, POSPrinterService.EscCut esc)
Validate cut sequence.void
validateData(int station, POSPrinterService.EscEmbedded esc)
Validate embedded data sequence.void
validateData(int station, POSPrinterService.EscFeed esc)
Validate feed sequence.void
validateData(int station, POSPrinterService.EscLogo esc)
Validate logo sequence.void
validateData(int station, POSPrinterService.PrintData data)
Validate printable character sequence.Methods inherited from class de.gmxhome.conrad.jpos.jpos_base.posprinter.POSPrinterProperties
beginInsertion, beginRemoval, cartridgeNotify, changePrintSide, clearErrorProperties, clearPrintArea, cutPaper, drawRuledLine, drawRuledLine, endInsertion, endRemoval, initOnEnable, initOnFirstEnable, initOnOpen, jrnCurrentCartridge, jrnLetterQuality, jrnLineChars, jrnLineHeight, jrnLineSpacing, mapCharacterSet, markFeed, markFeed, newJposOutputRequest, pageModeHorizontalPosition, pageModePrint, pageModePrint, pageModePrintArea, pageModePrintDirection, pageModeStation, pageModeVerticalPosition, printBarCode, printBarCode, printBitmap, printBitmap, printMemoryBitmap, printMemoryBitmap, printTwoNormal, printTwoNormal, recCurrentCartridge, recLetterQuality, rotatePrint, rotatePrint, rotateSpecial, setBitmap, slpCurrentCartridge, slpLetterQuality, slpLineChars, slpLineHeight, slpLineSpacing, transactionPrint, validateData, validateData, validateData, validateData, validateData, validateData, validateData, validateData, validateData, validateData, validateData, validateData, validateData, validateData, validateData
Methods inherited from class de.gmxhome.conrad.jpos.jpos_base.JposCommonProperties
addProperties, asyncMode, attachWaiter, autoDisable, checkForDeprecation, checkProperties, clearDataProperties, clearInput, clearOutput, clearOutputErrorProperties, close, compareFirmwareVersion, dataEventEnabled, directIO, directIO, flagWhenIdle, freezeEvents, getClaimingInstance, handlePowerStateOnEnable, initOnClaim, open, powerNotify, releaseWaiter, removeFromPropertySetList, resetStatistics, retrieveStatistics, retryInput, retryOutput, signalWaiter, unitDataCount, updateFirmware, updateFirmware, updateStatistics, waitWaiter
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface de.gmxhome.conrad.jpos.jpos_base.JposBaseInterface
asyncMode, autoDisable, clearInput, clearOutput, close, compareFirmwareVersion, dataEventEnabled, directIO, directIO, flagWhenIdle, freezeEvents, handlePowerStateOnEnable, open, powerNotify, removeFromPropertySetList, resetStatistics, retrieveStatistics, retryInput, retryOutput, unitDataCount, updateFirmware, updateFirmware, updateStatistics
-
Constructor Details
-
POSPrinter
Constructor. Gets instance of Device to be used as communication object. Device index for sample is always 0.- Parameters:
dev
- Instance of Device this object belongs to.
-
-
Method Details
-
claim
public void claim(int timeout) throws jpos.JposExceptionDescription copied from interface:JposBaseInterface
Final part of setting claim. Can be overwritten within derived classes. This method will be called only if the following plausibility checks lead to a positive result:- Device has not been closed,
- The device is not claimed,
- ExclusiveUse dos not equal ExclusiveNo,
- timeout is negative not equal to FOREVER.
- Specified by:
claim
in interfaceJposBaseInterface
- Overrides:
claim
in classJposCommonProperties
- Parameters:
timeout
- see UPOS specification, method Claim- Throws:
jpos.JposException
- If an error occurs while claiming the device
-
release
public void release() throws jpos.JposExceptionDescription copied from interface:JposBaseInterface
Final part of release method. Can be overwritten in derived class, if necessary. This method will be called only if the following plausibility checks lead to a positive result:- Device is claimed,
- ExclusiveUse equals ExclusiveYes: Device is not enabled.
- Specified by:
release
in interfaceJposBaseInterface
- Overrides:
release
in classJposCommonProperties
- Throws:
jpos.JposException
- See UPOS specification, method Release
-
deviceEnabled
public void deviceEnabled(boolean enable) throws jpos.JposExceptionDescription copied from interface:JposBaseInterface
Final part of setting DeviceEnabled. Can be overwritten within derived classes. Performs initOnEnable method of corresponding property set in addition to setting DeviceEnabled. This method will be called only if the following plausibility checks lead to a positive result:- Device has not been closed,
- ExclusiveUse equals ExclusiveYes: Device is claimed,
- DeviceEnabled != enabled.
- Specified by:
deviceEnabled
in interfaceJposBaseInterface
- Overrides:
deviceEnabled
in classJposCommonProperties
- Parameters:
enable
- True to enable, false to disable- Throws:
jpos.JposException
- If an error occurs during enable or disable
-
checkHealth
public void checkHealth(int level) throws jpos.JposExceptionDescription copied from interface:JposBaseInterface
Final part of CheckHealth method. Can be overwritten in derived class, if necessary. Keep in mind that dvice class specific checks (e.g. check of Claimed or DeviceEnabled) must be done within derived classes. This method will be called only if the following plausibility checks lead to a positive result:- Device is neither enabled nor claimed.
- Specified by:
checkHealth
in interfaceJposBaseInterface
- Overrides:
checkHealth
in classJposCommonProperties
- Parameters:
level
- See UPOS specification, method CheckHealth- Throws:
jpos.JposException
- See UPOS specification, method CheckHealth
-
mapMode
public void mapMode(int i) throws jpos.JposExceptionDescription copied from interface:POSPrinterInterface
Final part of setting MapMode. Can be overwritten within derived classes, if necessary. This method will be called only if the following plausibility checks lead to a positive result:- Device is enabled,
- The new value is one of MM_DOTS, MM_TWIPS, MM_ENGLISH or MM_METRIC.
- Specified by:
mapMode
in interfacePOSPrinterInterface
- Overrides:
mapMode
in classPOSPrinterProperties
- Parameters:
i
- New MapMode value- Throws:
jpos.JposException
- If an error occurs
-
characterSet
public void characterSet(int value) throws jpos.JposExceptionDescription copied from interface:POSPrinterInterface
Final part of setting CharacterSet. Can be overwritten within derived classes, if necessary. This method will be called only if the following plausibility checks lead to a positive result:- Device is enabled,
- CapJrnCartridgeSensor, CapRecCartridgeSensor or CapSlpCartridgeSensor is not 0,
- The new value is one of the values specified in CharacterSetList.
- Specified by:
characterSet
in interfacePOSPrinterInterface
- Overrides:
characterSet
in classPOSPrinterProperties
- Parameters:
value
- New character set value- Throws:
jpos.JposException
- If an error occurs
-
recLineChars
public void recLineChars(int value) throws jpos.JposExceptionDescription copied from interface:POSPrinterInterface
Final part of setting RecLineChars. Can be overwritten within derived classes, if necessary. This method will be called only if the following plausibility checks lead to a positive result:- Device is enabled,
- CapRecPresent is true,
- The new value is ≥ 0 and ≤ the maximum value specified in RecLineCharsList.
- Specified by:
recLineChars
in interfacePOSPrinterInterface
- Overrides:
recLineChars
in classPOSPrinterProperties
- Parameters:
value
- New RecLineChars value- Throws:
jpos.JposException
- If an error occurs
-
recLineHeight
public void recLineHeight(int i) throws jpos.JposExceptionDescription copied from interface:POSPrinterInterface
Final part of setting RecLineHeight. Can be overwritten within derived classes, if necessary. This method will be called only if the following plausibility checks lead to a positive result:- Device is enabled,
- CapRecPresent is true.
- Specified by:
recLineHeight
in interfacePOSPrinterInterface
- Overrides:
recLineHeight
in classPOSPrinterProperties
- Parameters:
i
- New RecLineHeight value- Throws:
jpos.JposException
- If an error occurs
-
recLineSpacing
public void recLineSpacing(int i) throws jpos.JposExceptionDescription copied from interface:POSPrinterInterface
Final part of setting RecLineSpacing. Can be overwritten within derived classes, if necessary. This method will be called only if the following plausibility checks lead to a positive result:- Device is enabled,
- CapRecPresent is true.
- Specified by:
recLineSpacing
in interfacePOSPrinterInterface
- Overrides:
recLineSpacing
in classPOSPrinterProperties
- Parameters:
i
- New RecLineSpacing value- Throws:
jpos.JposException
- If an error occurs
-
getLogoData
Description copied from interface:POSPrinterInterface
This method will be called whenever print data contain a logo print sequence ESC|tL or ESC|bL. Since it is possible that logos can be changed between the print call and execution of methods for asynchronous print, e.g. when transaction printing will be used, data describing the logo must be retrieved by POSPrinterService whenever an EscLogo object is generated. Every POSPrinter service implementation must overwrite this method because only the specific service stores information about the logo data. However, logo data are of type POSPrinterService.PrintDataPart[], where POSPrinterService.PrintDataPart is one of the objects supported by validateData(int, POSPrinterService.PrintDataPart). As default, this method returns an empty list of objects.- Specified by:
getLogoData
in interfacePOSPrinterInterface
- Overrides:
getLogoData
in classPOSPrinterProperties
- Parameters:
top
- Specifies which logo data shall be filled, true for top logo, false for bottom logo.- Returns:
- POSPrinterService.PrintDataPart array containing logo data. Array is empty if the requested logo has not been set.
-
setLogo
Description copied from interface:POSPrinterInterface
Final part of SetLogo method. Can be overwritten within derived classes, if necessary. This method will be called only if the following plausibility checks lead to a positive result:- Device is enabled,
- Selected location is L_TOP or L_BOTTOM,
- data is not null.
- Specified by:
setLogo
in interfacePOSPrinterInterface
- Overrides:
setLogo
in classPOSPrinterProperties
- Parameters:
location
- See UPOS specification, method SetLogo.data
- See UPOS specification, method SetLogo.- Throws:
jpos.JposException
- See UPOS specification, method SetLogo.
-
validateData
Description copied from interface:POSPrinterInterface
Validate printable character sequence. ESC sequences, CR and LF have been filtered out. Default behavior is that all other characters with character code ≤ 0x20 are invalid. If a service should support more characters, this method must be overwritten.
Keep in mind that data may contain an empty string. In that case, it marks the end of printable data in cases where the last character was a CR to support post-validation of CR.- Specified by:
validateData
in interfacePOSPrinterInterface
- Overrides:
validateData
in classPOSPrinterProperties
- Parameters:
station
- POSPrinter station, one of S_JOURNAL, S_RECEIPT or S_SLIP.data
- Data to be printed.- Throws:
jpos.JposException
- For details, see UPOS method ValidateData.
-
validateData
public void validateData(int station, POSPrinterService.ControlChar ctrl) throws jpos.JposExceptionDescription copied from interface:POSPrinterInterface
Validate control character. One of CR or LF. Default behavior is that both characters are valid. CR will be passed to ValidateData only once for any sequence of multiple CR in the original data stream and only if LF is neither the previous nor the following character. However, even if the printer supports CR, CR might be valid behind or in case of a following escape sequence.- Specified by:
validateData
in interfacePOSPrinterInterface
- Overrides:
validateData
in classPOSPrinterProperties
- Parameters:
station
- POSPrinter station, one of S_JOURNAL, S_RECEIPT or S_SLIP.ctrl
- ControlChar object, representing CR or LF.- Throws:
jpos.JposException
- For details, see UPOS method ValidateData.
-
validateData
Description copied from interface:POSPrinterInterface
Validate logo sequence. For details, see UPOS specification of ESC|xL. The default behavior is to assume that requests to print a logo are always valid. The following plausibility checks will be made before this method will be called:- The printer station is valid.
- Specified by:
validateData
in interfacePOSPrinterInterface
- Overrides:
validateData
in classPOSPrinterProperties
- Parameters:
station
- A valid printer station, S_RECEIPT, S_JOURNAL or S_SLIP.esc
- EscLogo object containing sequence attributes.- Throws:
jpos.JposException
- For details, see UPOS method ValidateData.
-
validateData
Description copied from interface:POSPrinterInterface
Validate feed sequence. For details, see UPOS specification of ESC|[#]xF. Default behavior is that all count values are valid. The following plausibility checks will be made before this method will be called:- The printer station is valid.
- Specified by:
validateData
in interfacePOSPrinterInterface
- Overrides:
validateData
in classPOSPrinterProperties
- Parameters:
station
- A valid printer station, S_RECEIPT, S_JOURNAL or S_SLIP.esc
- EscFeed object containing the sequence attributes.- Throws:
jpos.JposException
- For details, see UPOS method ValidateData.
-
validateData
Description copied from interface:POSPrinterInterface
Validate embedded data sequence. For details, see UPOS specification of ESC|[*]#E. Default behavior is that the given sequence is valid. The following plausibility checks will be made before this method will be called:- The printer station is valid.
- Specified by:
validateData
in interfacePOSPrinterInterface
- Overrides:
validateData
in classPOSPrinterProperties
- Parameters:
station
- A valid printer station, S_RECEIPT, S_JOURNAL or S_SLIP.esc
- EscEmbedded object containing sequence attributes.- Throws:
jpos.JposException
- For details, see UPOS method ValidateData.
-
validateData
Description copied from interface:POSPrinterInterface
Validate cut sequence. For details, see UPOS specification of ESC|[#][x]P. Default behavior is that a service supports only full cut and no cut (CP_FULLCUT and 0 percent). If a service supports more values, this method must be overwritten. The following plausibility checks will be made before this method will be called:- The printer station is valid,
- Capability CapXxxPapercut is true,
- EscCut attribute Stamp is false or CapXxxStamp is true.
- Specified by:
validateData
in interfacePOSPrinterInterface
- Overrides:
validateData
in classPOSPrinterProperties
- Parameters:
station
- S_RECEIPT.esc
- EscCut object containing sequence attributes.- Throws:
jpos.JposException
- For details, see UPOS method ValidateData.
-
cutPaper
Description copied from interface:POSPrinterInterface
Final part of CutPaper method. Can be overwritten within derived classes, if necessary. The parameters of the method will be passed via a CutPaper object. This method will be called when the corresponding operation shall be performed, either synchronously or asynchronously. All plausibility checks have been made before, only runtime errors can occur.
In case of asynchronous processing, the following additional checks have been made before invocation:- Receipt paper is present.
- Cover is closed.
- If present, cartridge is operational.
- Specified by:
cutPaper
in interfacePOSPrinterInterface
- Overrides:
cutPaper
in classPOSPrinterProperties
- Parameters:
request
- Output request object returned by validation method that contains all parameters to be used by CutPaper.- Throws:
jpos.JposException
- For details, see UPOS method CutPaper.
-
printNormal
Description copied from interface:POSPrinterInterface
Validation part of PrintNormal method. For details, see UPOS specification. Can be overwritten within derived classes, if necessary. This method shall only perform additional validation. It will be called before the service buffers the method call for synchronous or asynchronous execution. This method will be called only if the following plausibility checks lead to a positive result:- Device is enabled,
- If AsyncMode is false: State is S_IDLE, paper present, cover closed and if present, cartridge is operational,
- station is valid (S_JOURNAL, S_RECEIPT or S_SLIP and the corresponding CapXxxPresent is true),
- data is not null.
- Specified by:
printNormal
in interfacePOSPrinterInterface
- Overrides:
printNormal
in classPOSPrinterProperties
- Parameters:
station
- Print station, see UPOS method PrintNormal.data
- Print data. See UPOS method PrintNormal.- Returns:
- PrintNormal object for use in final part.
- Throws:
jpos.JposException
- For details, see UPOS method PrintNormal.
-
printImmediate
Description copied from interface:POSPrinterInterface
Validation part of PrintImmediate method. For details, see UPOS specification. Can be overwritten within derived classes, if necessary. This method shall only perform additional validation. It will be called before the service buffers the method call for synchronous or asynchronous (high-priority) execution. This method will be called only if the following plausibility checks lead to a positive result:- Device is enabled,
- Selected station is S_JOURNAL, S_RECEIPT or S_SLIP,
- The cover is closed, paper present, head ready and cartridge neither empty nor removed.
- Specified by:
printImmediate
in interfacePOSPrinterInterface
- Overrides:
printImmediate
in classPOSPrinterProperties
- Parameters:
station
- See UPOS specification, method PrintImmediate.data
- Print data. See UPOS specification, method PrintImmediate.- Returns:
- PrintImmediate object for use in final part.
- Throws:
jpos.JposException
- See UPOS specification, method PrintImmediate.
-
printNormal
Description copied from interface:POSPrinterInterface
Final part of PrintNormal method. Can be overwritten within derived classes, if necessary. The parameters of the method will be passed via a PrintNormal object. This method will be called when the corresponding operation shall be performed, either synchronously or asynchronously. All plausibility checks have been made before, only runtime errors can occur.
In case of asynchronous processing, the following additional checks have been made before invocation:- The station specified by request.getStation() is present.
- Cover is closed.
- If present, cartridge is operational.
- Specified by:
printNormal
in interfacePOSPrinterInterface
- Overrides:
printNormal
in classPOSPrinterProperties
- Parameters:
request
- Output request object returned by validation method that contains all parameters to be used by PrintNormal.- Throws:
jpos.JposException
- For details, see UPOS method PrintNormal.
-
transactionPrint
Description copied from interface:POSPrinterInterface
Final part of TransactionPrint method. Can be overwritten within derived classes, if necessary. The parameters of the method will be passed via a TransactionPrint object. This method will be called when the corresponding operation shall be performed, either synchronously or asynchronously. All plausibility checks have been made before, only runtime errors can occur.
In case of asynchronous processing, the following additional checks have been made before invocation:- The station specified by request.getStation() is present.
- Cover is closed.
- If present, cartridge is operational.
- Specified by:
transactionPrint
in interfacePOSPrinterInterface
- Overrides:
transactionPrint
in classPOSPrinterProperties
- Parameters:
request
- Output request object returned by validation method that contains all parameters to be used by TransactionPrint.- Throws:
jpos.JposException
- For details, see UPOS method TransactionPrint.
-