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 TypeFieldDescriptionboolean
UPOS property CapDisplay.boolean
UPOS property CapDisplayText.boolean
UPOS property CapFreezeValue.boolean
UPOS property CapPriceCalculating.boolean
UPOS property CapReadLiveWeightWithTare.boolean
UPOS property CapSetPriceCalculationMode.boolean
UPOS property CapSetUnitPriceWithWeightUnit.boolean
UPOS property CapSpecialTare.boolean
UPOS property CapStatusUpdate.boolean
UPOS property CapTarePriority.boolean
UPOS property CapTareWeight.boolean
UPOS property CapZeroScale.int
UPOS property MaxDisplayTextChars.int
UPOS property MaximumWeight.int
UPOS property MinimumWeight.long
UPOS property SalesPrice.int
UPOS property ScaleLiveWeight.int
UPOS property StatusNotify.int
UPOS property TareWeight.int
Default value of TareWeight property.long
UPOS property UnitPrice.int
UPOS property WeightUnit.boolean
UPOS 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 TypeMethodDescriptionvoid
displayText(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.void
doPriceCalculating(DoPriceCalculating request)
Final part of DoPriceCalculating method.void
freezeValue(int item, boolean freeze)
Final part of FreezeValue method.boolean
Initialize properties that must be initialized whenever the device will be enabled the first time-void
Initialization of properties that must be initialized during open.readLiveWeightWithTare(int[] weightData, int[] tare, int timeout)
Validation part of ReadLiveWeightWithTare method.void
readLiveWeightWithTare(ReadLiveWeightWithTare request)
Final part of ReadLiveWeightWithTare method.readWeight(int[] weightData, int timeout)
Validation part of ReadWeight method.void
readWeight(ReadWeight request)
Final part of ReadWeight method.void
setPriceCalculationMode(int mode)
Final part of SetPriceCalculationMode method.void
setSpecialTare(int mode, int data)
Final part of SetSpecialTare method.void
setTarePriority(int priority)
Final part of SetTarePriority method.void
setUnitPriceWithWeightUnit(long unitPrice, int weightUnit, int weightNumerator, int weightDenominator)
Final part of SetUnitPriceWithWeightUnit method.void
statusNotify(int notify)
Final part of setting StatusNotify.void
tareWeight(int i)
Final part of setting TareWeight.void
unitPrice(long l)
Final part of setting UnitPrice.void
Final part of ZeroScale method.void
zeroValid(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, 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, 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:JposCommonProperties
Initialization of properties that must be initialized during open.- Overrides:
initOnOpen
in classJposCommonProperties
-
initOnFirstEnable
public boolean initOnFirstEnable()Description copied from class:JposCommonProperties
Initialize properties that must be initialized whenever the device will be enabled the first time-- Overrides:
initOnFirstEnable
in classJposCommonProperties
- Returns:
- Returns true in case of first enable.
-
statusNotify
public void statusNotify(int notify) throws jpos.JposExceptionDescription copied from interface:ScaleInterface
Final 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:
statusNotify
in 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:ScaleInterface
Final 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:
tareWeight
in 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:ScaleInterface
Final 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:
unitPrice
in 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:ScaleInterface
Final 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:
zeroValid
in interfaceScaleInterface
- Parameters:
flag
- New ZeroValid value- Throws:
jpos.JposException
- If an error occurs
-
displayText
Description copied from interface:ScaleInterface
Final 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:
displayText
in 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:ScaleInterface
Validation 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:
doPriceCalculating
in 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:ScaleInterface
Final 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:
doPriceCalculating
in 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:ScaleInterface
Final 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:
freezeValue
in 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:ScaleInterface
Validation 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:
readLiveWeightWithTare
in 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:ScaleInterface
Final 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:
readLiveWeightWithTare
in 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:ScaleInterface
Validation 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:
readWeight
in 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:ScaleInterface
Final 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:
readWeight
in 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:ScaleInterface
Final 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:
setPriceCalculationMode
in 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:ScaleInterface
Final 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:
setSpecialTare
in 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:ScaleInterface
Final 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:
setTarePriority
in 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:ScaleInterface
Final 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:
setUnitPriceWithWeightUnit
in 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:ScaleInterface
Final 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:
zeroScale
in interfaceScaleInterface
- Throws:
jpos.JposException
- See UPOS specification, method ZeroScale.
-