I have to read/write an XML file that stores its data as bit masked values.
e.g.
<panel>
<options arming="21" opt_b="51" opt_c="6" />
</panel>
in this case, arming
has the value 21
, but this corresponds to the following string of bytes:
10101
and those bytes correspond to options 0,2,4 in the following list:
- Bit 0: Forced arm
- Bit 1: Final door
- Bit 2: Exit fault
- Bit 3: Inhibit tamper
- Bit 4: Display
- Bit 8: Rearm
- Bit 9: Line
- Bit 10: Extend block
What's the best way for me to
- convert this from the decimal value of
21
to an object model that represents the options? - use that object to display these as options for the user to select and deselect?