This abstract DataType is the base DataType for all DataTypes representing a bit mask which is larger than 64 bits or where the validity of the bits within the set are to be identified. All OptionSet DataTypes representing bit masks shall inherit from this DataType. Its elements are described in Table 31.
Table 31 – OptionSet Definition
Name |
Type |
Description |
OptionSet |
structure |
|
Value |
ByteString |
Array of bytes representing the bits in the option set. The length of the ByteString depends on the number of bits. The number of bytes may be larger than needed for the valid bits in the case of a spare allocation. |
ValidBits |
ByteString |
Array of bytes shall be the same size as value representing the valid bits in the value parameter. A Server shall return the StateCode BadOutOfRange if it receives a different array size. When the Server returns the value to the Client, the validBits provides information of which bits in the bit mask have a meaning. If a bit is 1 then the corresponding bit in the value is used by the Server. If it is set to a 0 it should be ignored as it has no meaning. When the Client passes the OptionSet value to the Server, it sets the bits of validBits to 1 for each bit the Client expects the Server to apply to the value. The Server shall use the following logic when applying the requested change “new value = (value & validBits) | (current value & ~validBits)”. A Server shall return the StateCode BadOutOfRange if it receives validBits with a bit set to 1 which it does not consider a valid bit and shall not apply any bit changes. |
The DataType Nodes representing concrete subtypes of the OptionSet shall have an OptionSetValues Property defined in Table 16.
An OptionSet may be subtyped, however, any subtype shall not add any fields to the OptionSet Structure. The subtype may refine the semantics for the bits which are defined by the supertype and may add additional bits if the length of the OptionSet is not exceeded (see next paragraph). That requires, that each entry of the OptionSetValues Property of the supertype is repeated or refined by each subtype. Refining a bit shall not invalidate the original semantic. New OptionSetValues Properties may also be added to the subtype. For example, changing a bit from “Pump is off” to “First Pump is off” is allowed, but changing it to “Motor is on” is not allowed.
The DataType Nodes representing concrete or abstract subtypes of the OptionSet may have an OptionSetLength Property defined in Table 16. This Property defines the length in bytes of the OptionSet. If the Property is not defined, the length of a concrete OptionSet is defined by the number of defined bits (in the OptionSetValues Property) rounded up to whole bytes. For example, if there are two bits defined the length is one byte, if there are 10 bits defined, the length is two bytes. Once, the length has been defined by an OptionSet, subtypes shall not change the length. That is, if a supertype defines the length (either explicitly with OptionSetLength or implicitly by a concrete OptionSet with the OptionSetValues) each subtype shall have the same length. If the correct length is not implicitly provided by the length of the OptionSetValues the subtype shall provide the OptionSetLength Property with the same value as the supertype.
Defining the length explicitly in the OptionSetLength Property allows to reserve bits that can be used in subtypes of the OptionSet.