Class ScaleProperties
java.lang.Object
de.gmxhome.conrad.jpos.jpos_base.JposCommonProperties
de.gmxhome.conrad.jpos.jpos_base.scale.ScaleProperties
- All Implemented Interfaces:
JposBaseInterface,ScaleInterface
- Direct Known Subclasses:
Device.SampleScaleAccessor
Class containing the scales specific properties, their default values and default implementations of
ScaleInterface.
For details about properties, methods and method parameters, see UPOS specification, chapter Scale.
-
Field Summary
FieldsModifier and TypeFieldDescriptionbooleanUPOS property CapDisplay.booleanUPOS property CapDisplayText.booleanUPOS property CapFreezeValue.booleanUPOS property CapPriceCalculating.booleanUPOS property CapReadLiveWeightWithTare.booleanUPOS property CapSetPriceCalculationMode.booleanUPOS property CapSetUnitPriceWithWeightUnit.booleanUPOS property CapSpecialTare.booleanUPOS property CapStatusUpdate.booleanUPOS property CapTarePriority.booleanUPOS property CapTareWeight.booleanUPOS property CapZeroScale.intUPOS property MaxDisplayTextChars.intUPOS property MaximumWeight.intUPOS property MinimumWeight.longUPOS property SalesPrice.intUPOS property ScaleLiveWeight.intUPOS property StatusNotify.intUPOS property TareWeight.intDefault value of TareWeight property.longUPOS property UnitPrice.intUPOS property WeightUnit.booleanUPOS property ZeroValid.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, ErrorString, 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 TypeMethodDescriptionvoiddisplayText(String data)Final part of DisplayText method.doPriceCalculating(int[] weightData, int[] tare, long[] unitPrice, long[] unitPriceX, int[] weightUnitX, int[] weightNumeratorX, int[] weightDenominatorX, long[] price, int timeout)Validation part of DoPriceCalculating method.voiddoPriceCalculating(DoPriceCalculating request)Final part of DoPriceCalculating method.voidfreezeValue(int item, boolean freeze)Final part of FreezeValue method.booleanInitialize properties that must be initialized whenever the device will be enabled the first time-voidInitialization of properties that must be initialized during open.readLiveWeightWithTare(int[] weightData, int[] tare, int timeout)Validation part of ReadLiveWeightWithTare method.voidreadLiveWeightWithTare(ReadLiveWeightWithTare request)Final part of ReadLiveWeightWithTare method.readWeight(int[] weightData, int timeout)Validation part of ReadWeight method.voidreadWeight(ReadWeight request)Final part of ReadWeight method.voidsetPriceCalculationMode(int mode)Final part of SetPriceCalculationMode method.voidsetSpecialTare(int mode, int data)Final part of SetSpecialTare method.voidsetTarePriority(int priority)Final part of SetTarePriority method.voidsetUnitPriceWithWeightUnit(long unitPrice, int weightUnit, int weightNumerator, int weightDenominator)Final part of SetUnitPriceWithWeightUnit method.voidstatusNotify(int notify)Final part of setting StatusNotify.voidtareWeight(int i)Final part of setting TareWeight.voidunitPrice(long l)Final part of setting UnitPrice.voidFinal part of ZeroScale method.voidzeroValid(boolean flag)Final part of setting ZeroValid.Methods inherited from class de.gmxhome.conrad.jpos.jpos_base.JposCommonProperties
addProperties, asyncMode, attachWaiter, autoDisable, checkForDeprecation, checkHealth, checkProperties, claim, clearDataProperties, clearErrorProperties, clearInput, clearOutput, clearOutputErrorProperties, close, compareFirmwareVersion, dataEventEnabled, deviceEnabled, directIO, directIO, flagWhenIdle, freezeEvents, getClaimingInstance, handlePowerStateOnEnable, initOnClaim, initOnEnable, newJposOutputRequest, open, powerNotify, release, releaseWaiter, removeFromPropertySetList, resetStatistics, retrieveStatistics, retryInput, retryOutput, signalWaiter, unitDataCount, updateFirmware, updateFirmware, updateStatistics, waitWaiterMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface de.gmxhome.conrad.jpos.jpos_base.JposBaseInterface
asyncMode, autoDisable, checkHealth, claim, clearInput, clearOutput, close, compareFirmwareVersion, dataEventEnabled, deviceEnabled, directIO, directIO, flagWhenIdle, freezeEvents, handlePowerStateOnEnable, newJposOutputRequest, open, powerNotify, release, removeFromPropertySetList, resetStatistics, retrieveStatistics, retryInput, retryOutput, unitDataCount, updateFirmware, updateFirmware, updateStatistics
-
Field Details
-
CapDisplay
public boolean CapDisplayUPOS property CapDisplay. Default: false. Can be overwritten by objects derived from JposDevice within the changeDefaults method. -
CapDisplayText
public boolean CapDisplayTextUPOS property CapDisplayText. Default: false. Can be overwritten by objects derived from JposDevice within the changeDefaults method. -
CapFreezeValue
public boolean CapFreezeValueUPOS property CapFreezeValue. Default: false. Can be overwritten by objects derived from JposDevice within the changeDefaults method. -
CapPriceCalculating
public boolean CapPriceCalculatingUPOS property CapPriceCalculating. Default: false. Can be overwritten by objects derived from JposDevice within the changeDefaults method. -
CapReadLiveWeightWithTare
public boolean CapReadLiveWeightWithTareUPOS property CapReadLiveWeightWithTare. Default: false. Can be overwritten by objects derived from JposDevice within the changeDefaults method. -
CapSetPriceCalculationMode
public boolean CapSetPriceCalculationModeUPOS property CapSetPriceCalculationMode. Default: false. Can be overwritten by objects derived from JposDevice within the changeDefaults method. -
CapSetUnitPriceWithWeightUnit
public boolean CapSetUnitPriceWithWeightUnitUPOS property CapSetUnitPriceWithWeightUnit. Default: false. Can be overwritten by objects derived from JposDevice within the changeDefaults method. -
CapSpecialTare
public boolean CapSpecialTareUPOS property CapSpecialTare. Default: false. Can be overwritten by objects derived from JposDevice within the changeDefaults method. -
CapStatusUpdate
public boolean CapStatusUpdateUPOS property CapStatusUpdate. Default: false. Can be overwritten by objects derived from JposDevice within the changeDefaults method. -
CapTarePriority
public boolean CapTarePriorityUPOS property CapTarePriority. Default: false. Can be overwritten by objects derived from JposDevice within the changeDefaults method. -
CapTareWeight
public boolean CapTareWeightUPOS property CapTareWeight. Default: false. Can be overwritten by objects derived from JposDevice within the changeDefaults method. -
CapZeroScale
public boolean CapZeroScaleUPOS property CapZeroScale. Default: false. Can be overwritten by objects derived from JposDevice within the changeDefaults method. -
MaxDisplayTextChars
public int MaxDisplayTextCharsUPOS property MaxDisplayTextChars. Default: 0. Can be overwritten by objects derived from JposDevice within the changeDefaults method. -
MaximumWeight
public int MaximumWeightUPOS property MaximumWeight. Default: 0. Can be overwritten by objects derived from JposDevice within the changeDefaults method. -
MinimumWeight
public int MinimumWeightUPOS property MinimumWeight. Default: 0. Can be overwritten by objects derived from JposDevice within the changeDefaults method. -
TareWeightDef
public int TareWeightDefDefault value of TareWeight property. Default: 0. Can be overwritten by objects derived from JposDevice within the changeDefaults method. -
WeightUnit
public int WeightUnitUPOS property WeightUnit. Default: SCAL_WU_KILOGRAM. Can be overwritten by objects derived from JposDevice within the changeDefaults method. -
SalesPrice
public long SalesPriceUPOS property SalesPrice. -
ScaleLiveWeight
public int ScaleLiveWeightUPOS property ScaleLiveWeight. -
StatusNotify
public int StatusNotifyUPOS property StatusNotify. -
TareWeight
public int TareWeightUPOS property TareWeight. -
UnitPrice
public long UnitPriceUPOS property UnitPrice. -
ZeroValid
public boolean ZeroValidUPOS property ZeroValid.
-
-
Constructor Details
-
ScaleProperties
public ScaleProperties(int dev)Constructor.- Parameters:
dev- Device index
-
-
Method Details
-
initOnOpen
public void initOnOpen()Description copied from class:JposCommonPropertiesInitialization of properties that must be initialized during open.- Overrides:
initOnOpenin classJposCommonProperties
-
initOnFirstEnable
public boolean initOnFirstEnable()Description copied from class:JposCommonPropertiesInitialize properties that must be initialized whenever the device will be enabled the first time-- Overrides:
initOnFirstEnablein classJposCommonProperties- Returns:
- Returns true in case of first enable.
-
statusNotify
public void statusNotify(int notify) throws jpos.JposExceptionDescription copied from interface:ScaleInterfaceFinal part of setting StatusNotify. 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 not enabled,
- CapStatusUpdate is true,
- The new status value is one of the predefined values,
- internal property AllowAlwaysSetProperties is true or notify equals the previous value of StatusNotify.
- Specified by:
statusNotifyin interfaceScaleInterface- Parameters:
notify- New StatusNotify value- Throws:
jpos.JposException- If an error occurs
-
tareWeight
public void tareWeight(int i) throws jpos.JposExceptionDescription copied from interface:ScaleInterfaceFinal part of setting TareWeight. 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 tare value is between 0 and MaximumWeight.
- Specified by:
tareWeightin interfaceScaleInterface- Parameters:
i- New TareWeight value- Throws:
jpos.JposException- If an error occurs
-
unitPrice
public void unitPrice(long l) throws jpos.JposExceptionDescription copied from interface:ScaleInterfaceFinal part of setting UnitPrice. 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,
- New price is not negative.
- Specified by:
unitPricein interfaceScaleInterface- Parameters:
l- New UnitPrice value- Throws:
jpos.JposException- If an error occurs
-
zeroValid
public void zeroValid(boolean flag) throws jpos.JposExceptionDescription copied from interface:ScaleInterfaceFinal part of setting ZeroValid. 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 not closed,
- internal property AllowAlwaysSetProperties is true or flag equals the previous value of ZeroValid.
- Specified by:
zeroValidin interfaceScaleInterface- Parameters:
flag- New ZeroValid value- Throws:
jpos.JposException- If an error occurs
-
displayText
Description copied from interface:ScaleInterfaceFinal part of DisplayText 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,
- CapDisplayText is true,
- The new text is not null and its length is not longer than MaxDisplayTextChars.
- Specified by:
displayTextin interfaceScaleInterface- Parameters:
data- The string of characters to display.- Throws:
jpos.JposException- See UPOS specification, method DisplayText.
-
doPriceCalculating
public DoPriceCalculating doPriceCalculating(int[] weightData, int[] tare, long[] unitPrice, long[] unitPriceX, int[] weightUnitX, int[] weightNumeratorX, int[] weightDenominatorX, long[] price, int timeout) throws jpos.JposExceptionDescription copied from interface:ScaleInterfaceValidation part of DoPriceCalculating 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,
- The device state is not S_BUSY,
- CapSetUnitPriceWithWeightUnit is true,
- The dimension of the given array parameters is 1,
- In case of AsyncMode = false: The timeout is ≥ 0 or JPOS_FOREVER.
Since the UPOS specification is very unclear for this method, further checks might be necessary and must be implemented within this method in derived classes:
- Check whether SetUnitPriceWithWeightUnit has been called previously.
In addition, this method must return the current values for initPriceX, weightUnitX, weightNumeratorX and weightDenominatorX as set via method SetUnitPriceWithWeightUnit.
A service may perform the full weight process inside this method, but this is not recommended, especially in asynchronous operation. The recommended functionality is to perform only validation in this method and to perform weighing inside the final part. If implemented the latter way, a DoPriceCalculating object created with weightData[0], tare[0], unitPrice[0], unitPriceX[0], weightUnitX[0], weightNumeratorX[0], weightDenominatorX[0], price[0] and timeout as parameters must be returned.- Specified by:
doPriceCalculatingin interfaceScaleInterface- Parameters:
weightData- The value for the net weight in the price calculation algorithm.tare- The value used to determine the item net weight in the price calculation algorithm.unitPrice- The cost per measurement unit that is used in the price calcuation algorithm.unitPriceX- See UPOS specification, chapter Scale - Methods - doPriceCalculating Method.weightUnitX- See UPOS specification, chapter Scale - Methods - doPriceCalculating Method.weightNumeratorX- See UPOS specification, chapter Scale - Methods - doPriceCalculating Method.weightDenominatorX- See UPOS specification, chapter Scale - Methods - doPriceCalculating Method.price- The calculated monetary value for the item on the scale.timeout- The number of milliseconds to wait for a settled weight before failing the method.- Returns:
- DoPriceCalculating object for use in final part.
- Throws:
jpos.JposException- See UPOS specification, method DoPriceCalculating.
-
doPriceCalculating
Description copied from interface:ScaleInterfaceFinal part of DoPriceCalculating method. Can be overwritten within derived classes, if necessary. The parameters of the method will be passed via a DoPriceCalculating 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 as well:- Timeout ≥ 0 or JPOS_FOREVER.
This method will only be called if the validation method threw a JposException with ErrorCode = 0.- Specified by:
doPriceCalculatingin interfaceScaleInterface- Parameters:
request- Input request object that contains all parameters to be used by DoPriceCalculating.- Throws:
jpos.JposException- If an error occurs.
-
freezeValue
public void freezeValue(int item, boolean freeze) throws jpos.JposExceptionDescription copied from interface:ScaleInterfaceFinal part of FreezeValue 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,
- CapFreezeValue is true,
- The given item is a bitwise combination of SCAL_SFR_MANUAL_TARE, SCAL_SFR_PERCENT_TARE, SCAL_SFR_WEIGHTED_TARE and SCAL_SFR_UNITPRICE.
- Specified by:
freezeValuein interfaceScaleInterface- Parameters:
item- The bitwise value setting the state of the selected parameter item(s).freeze- Specifies behavior after readWeight method finished. See UPOS specification, chapter Scale - Methods - doPriceCalculating Method.- Throws:
jpos.JposException- See UPOS specification, method FreezeValue.
-
readLiveWeightWithTare
public ReadLiveWeightWithTare readLiveWeightWithTare(int[] weightData, int[] tare, int timeout) throws jpos.JposExceptionDescription copied from interface:ScaleInterfaceValidation part of ReadLiveWeightWithTare 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,
- CapReadLiveWeightWithTare is true,
- Device state is not S_BUSY,
- The dimension of weightData and tare is 1,
- If AsyncMode = false: timeout ≥ 0 or JPOS_FOREVER.
A service may perform the full weight process inside this method, but this is not recommended, especially in asynchronous operation. The recommended functionality is to perform only validation in this method and to perform weighing inside the final part. If implemented the latter way, a ReadLiveWeightWithTare object created with weightData[0], tare[0] and timeout as parameters must be returned.- Specified by:
readLiveWeightWithTarein interfaceScaleInterface- Parameters:
weightData- On return, net weight calculated by the scale.tare- On return, tare weight used to calculate the net weight.timeout- Number of milliseconds to wait for a settled weight before failing the method.- Returns:
- ReadLiveWeightWithTare object for use in final part.
- Throws:
jpos.JposException- See UPOS specification, method ReadLiveWeightWithTare.
-
readLiveWeightWithTare
Description copied from interface:ScaleInterfaceFinal part of ReadLiveWeightWithTare method. Can be overwritten within derived classes, if necessary. The parameters of the method will be passed via a ReadLiveWeightWithTare 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 as well:- Timeout ≥ 0 or JPOS_FOREVER.
This method will only be called if the validation method threw a JposException with ErrorCode = 0.- Specified by:
readLiveWeightWithTarein interfaceScaleInterface- Parameters:
request- Output request object that contains all parameters to be used by ReadLiveWeightWithTare.- Throws:
jpos.JposException- If an error occurs.
-
readWeight
Description copied from interface:ScaleInterfaceValidation part of ReadWeight 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,
- Device state is not S_BUSY,
- The dimension of weightData is 1,
- If AsyncMode = false: timeout ≥ 0 or JPOS_FOREVER.
A service may perform the full weight process inside this method, but this is not recommended, especially in asynchronous operation. The recommended functionality is to perform only validation in this method and to perform weighing inside the final part. If implemented the latter way, a ReadWeight object created with weightData[0] and timeout as parameters must be returned.- Specified by:
readWeightin interfaceScaleInterface- Parameters:
weightData- The weight measured by the scale.timeout- The number of milliseconds to wait for a settled weight before failing the method.- Returns:
- ReadWeight object for use in final part.
- Throws:
jpos.JposException- See UPOS specification, method ReadWeight.
-
readWeight
Description copied from interface:ScaleInterfaceFinal part of ReadWeight method. Can be overwritten within derived classes, if necessary. The parameters of the method will be passed via a ReadWeight 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 as well:- Timeout ≥ 0 or JPOS_FOREVER.
This method will only be called if the validation method threw a JposException with ErrorCode = 0.- Specified by:
readWeightin interfaceScaleInterface- Parameters:
request- Output request object that contains all parameters to be used by ReadWeight.- Throws:
jpos.JposException- If an error occurs.
-
setPriceCalculationMode
public void setPriceCalculationMode(int mode) throws jpos.JposExceptionDescription copied from interface:ScaleInterfaceFinal part of SetPriceCalculationMode 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,
- CapSetPriceCalculationMode is true,
- The new mode is one of SCAL_PCM_PRICE_LABELING, SCAL_PCM_SELF_SERVICE or SCAL_PCM_OPERATOR.
- Specified by:
setPriceCalculationModein interfaceScaleInterface- Parameters:
mode- The operation functionality selected for the scale.- Throws:
jpos.JposException- See UPOS specification, method SetPriceCalculationMode.
-
setSpecialTare
public void setSpecialTare(int mode, int data) throws jpos.JposExceptionDescription copied from interface:ScaleInterfaceFinal part of SetSpecialTare 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,
- CapSpecialTare is true,
- The new mode value is one of SCAL_SST_DEFAULT, SCAL_SST_MANUAL, SCAL_SST_PERCENT or SCAL_SST_WEIGHTED,
- The new tare specifier is ≥ 0,
- In case of SCAL_SST_DEFAULT and SCAL_SST_MANUAL: The new tare is ≤ MaximumWeight.
- Specified by:
setSpecialTarein interfaceScaleInterface- Parameters:
mode- Select the tare mode that is to be modified.data- Provides additional information specific to the mode.- Throws:
jpos.JposException- See UPOS specification, method SetSpecialTare.
-
setTarePriority
public void setTarePriority(int priority) throws jpos.JposExceptionDescription copied from interface:ScaleInterfaceFinal part of SetTarePriority 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,
- CapTarePriority is true,
- The new priority is one of SCAL_STP_FIRST or SCAL_STP_NONE.
- Specified by:
setTarePriorityin interfaceScaleInterface- Parameters:
priority- The sequence in which a tare value is used when determining the net weight.- Throws:
jpos.JposException- See UPOS specification, method SetTarePriority.
-
setUnitPriceWithWeightUnit
public void setUnitPriceWithWeightUnit(long unitPrice, int weightUnit, int weightNumerator, int weightDenominator) throws jpos.JposExceptionDescription copied from interface:ScaleInterfaceFinal part of SetUnitPriceWithWeightUnit 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,
- CapSetUnitPriceWithWeightUnit is true,
- The new weight unit is one of SCAL_WU_GRAM, SCAL_WU_KILOGRAM, SCAL_WU_OUNCE or SCAL_WU_POUND,
- The new unitPrice is ≥ 0,
- weightNumerator and weightDenominator are ≥0, both.
- Specified by:
setUnitPriceWithWeightUnitin interfaceScaleInterface- Parameters:
unitPrice- The cost per unit price as calculated by this method.weightUnit- The value representing the new unit of weight that differs from the default value for the scale.weightNumerator- The dividend which is the weight value based on the current unit weight.weightDenominator- The divisor which is the weight value based on the new unit weight.- Throws:
jpos.JposException- See UPOS specification, method SetUnitPriceWithWeightUnit.
-
zeroScale
public void zeroScale() throws jpos.JposExceptionDescription copied from interface:ScaleInterfaceFinal part of ZeroScale 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,
- CapZeroScale is true,
- Device state is not S_BUSY.
- Specified by:
zeroScalein interfaceScaleInterface- Throws:
jpos.JposException- See UPOS specification, method ZeroScale.
-