Interface ScaleInterface
- All Superinterfaces:
JposBaseInterface
- All Known Implementing Classes:
Device.SampleScaleAccessor
,ScaleProperties
Interface for methods that implement property setter and method calls for the Scale device category.
For details about properties, methods and method parameters, see UPOS specification, chapter Scale.
Further details about error handling can be found in introduction - Device Behavior Models - Errors.
-
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.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 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
-
Method Details
-
statusNotify
void statusNotify(int notify) throws jpos.JposExceptionFinal 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.
- Parameters:
notify
- New StatusNotify value- Throws:
jpos.JposException
- If an error occurs
-
tareWeight
void tareWeight(int i) throws jpos.JposExceptionFinal 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.
- Parameters:
i
- New TareWeight value- Throws:
jpos.JposException
- If an error occurs
-
unitPrice
void unitPrice(long l) throws jpos.JposExceptionFinal 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.
- Parameters:
l
- New UnitPrice value- Throws:
jpos.JposException
- If an error occurs
-
zeroValid
void zeroValid(boolean flag) throws jpos.JposExceptionFinal 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.
- Parameters:
flag
- New ZeroValid value- Throws:
jpos.JposException
- If an error occurs
-
displayText
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.
- Parameters:
data
- The string of characters to display.- Throws:
jpos.JposException
- See UPOS specification, method DisplayText.
-
doPriceCalculating
DoPriceCalculating doPriceCalculating(int[] weightData, int[] tare, long[] unitPrice, long[] unitPriceX, int[] weightUnitX, int[] weightNumeratorX, int[] weightDenominatorX, long[] price, int timeout) throws jpos.JposExceptionValidation 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.- 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
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.- Parameters:
request
- Input request object that contains all parameters to be used by DoPriceCalculating.- Throws:
jpos.JposException
- If an error occurs.
-
freezeValue
void freezeValue(int item, boolean freeze) throws jpos.JposExceptionFinal 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.
- 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
ReadLiveWeightWithTare readLiveWeightWithTare(int[] weightData, int[] tare, int timeout) throws jpos.JposExceptionValidation 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.- 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
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.- Parameters:
request
- Output request object that contains all parameters to be used by ReadLiveWeightWithTare.- Throws:
jpos.JposException
- If an error occurs.
-
readWeight
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.- 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
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.- Parameters:
request
- Output request object that contains all parameters to be used by ReadWeight.- Throws:
jpos.JposException
- If an error occurs.
-
setPriceCalculationMode
void setPriceCalculationMode(int mode) throws jpos.JposExceptionFinal 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.
- Parameters:
mode
- The operation functionality selected for the scale.- Throws:
jpos.JposException
- See UPOS specification, method SetPriceCalculationMode.
-
setSpecialTare
void setSpecialTare(int mode, int data) throws jpos.JposExceptionFinal 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.
- 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
void setTarePriority(int priority) throws jpos.JposExceptionFinal 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.
- 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
void setUnitPriceWithWeightUnit(long unitPrice, int weightUnit, int weightNumerator, int weightDenominator) throws jpos.JposExceptionFinal 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.
- 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
void zeroScale() throws jpos.JposExceptionFinal 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.
- Throws:
jpos.JposException
- See UPOS specification, method ZeroScale.
-