Closed ergo-furrer closed 1 year ago
See also #86 for input on bitmappers...
enums within the Java implementation: much better compared to the legacy version !excellent! enums within C / C++/ C# implementations: no issues expected at a glance
I find it a good improvement. Go with it!
Enum's: is this a small error (0,1,3)? should the number be consecutive? Can this be stated in the XSD definition?
Enum's: is this a small error (0,1,3)? enumerations may be device dependent.
what I did: I used XXX_NUL if 0 has no meaning. When enums are aligned different (thats most often the case) this can be aligned with a different ordinal lineup in the EID.
In the existing solution I supported re-mapping. This is difficult to understand as it changes with the RW lineup and to put the foot into the trap happens easily.
succestion:
or
However, with bitmaps we need the ordinals.
Enum's: is this a small error (0,1,3)? should the number be consecutive? Can this be stated in the XSD definition?
This is an error. The enum could be returned from the transport service as:
I plan to add an additional hexMask to the enum
definition to mask out other bits/values, that do not belong to the enumeration, but are part of the same register.
However, the example case 0, 1, 3 .. is not valid since it does not meet the rules given above ( = consecutive int's, or values with just one bit (2^X) exclusively set).
suggestion:
- have it aligned "beautiful" at generic layer and use the "real" ordinals at TransportSevice side.
- use no ordinals generic layer
My intent is to use the "real" ordinals (TransportService side ordinals) only and map them to string values at the generic side (no artificial beautifully aligned ordinals on generic side).
User Voice
Drawing from our experience, with heat pumps as an illustrative example, we have encountered substantial variations in enum and bitmap definitions across different products. Frequently, their meanings resist standardization for inclusion in a generalized functional profile.
The present XSD schema delineates all established product-specific enum and bitmap mappings. However, it is worth considering that, from a conceptual perspective, particulars exclusive to each product should find representation within the EI-XML. It is advisable to refrain from embedding product-specific information directly into the XSD. Such an approach would necessitate recurrent schema updates for every novel product accommodating fresh enum or bitmap values.
Hence, the XSD should be designed to facilitate a versatile enum and bitmap mapping mechanism within the EI-XML, while completely excluding any product-specific elements from the XSD itself.
Suggested Solution
Enum's
The XSD defines an enum such that the EI-XML for the generic data points reads as follows:
<sgr:ordinal>
is numeric 0, 1, 2 ......The according XSD is as follows:
enumVal
.enumVal
used by the SGrJava implementation to represent the read/written enumeration value, since the generic API returns the XSD generated classes (and therefore needs a container for the read/write value).Bitmap's
The XSD defines a bitmap such that the EI-XML for generic data points reads as follows:
<sgr:hexMask>
is a hex value and used as bitmask to determine whether a status indicator is set.The XSD is as follows:
boolVal
. The value is used by the SGrJava implementation to return the status of the respective status indicator (as a result of the 'register-value & mask' operation).Alternatives
Acceptance Criteria
Enum's
Bitmaps
Open Questions
To be discussed regarding enums within the Java implementation:
The Java implementation supports 2 API methods to set a value:
setVal(String: functionalProfileName, String: dataPointName, String: value)
setValByGDPType(String: functionProfileName, String: dataPointName, SGrGenDataType: value)
For the String value API the usage is very simple and straight forward:
setVal("HeatPumpBase", "HPOpModeCmd", "HP_OFF")
whereHP_OFF
is the enum literal. The validation and conversion of the status literal to the SGrGenDataType is done within the CommHandler library.For
setValByGDPType
this is more complex since we need to create a valid instance of SGrGenDatatype to provide it as a value. The complete code is as follows:setVal("HeatPumpBase", "HPOpModeCmd", "HP_OFF")
?Example convenience function usage: