Closed owagner closed 9 years ago
The rationale for getNumericValue() remains valid, I think, though? If I simply want to convert into a numeric value from a generic DPTXlator instance, I still have to do type-based branching...
Yes, it does. My comment was only for that one particular method.
-- added DTPXlator.getUnit() to get the string denoting the DPT's unit of measurement individually (even if appendUnit is set to false).
Rationale: Useful if value and unit are handled independently. No impact on existing API.
-- added a double getNumericValue() method in DPTXlator, which returns a numeric representation of the first value, if possible. Throws KNXFormatException if no numeric representation is available.
Rationale: Currently, there is no base-class method to get the numeric representation of a DPT value, although most of them actually deal with numeric values. There is getValueFloat(), getValueSigned(), getValueUnsigned() etc. in the individual subclasses, but no common base-class method which can be called without prior type identification and casting. Useful when using the unspecialized DPTxlator base class. No impact on existing APIs.