libRBR  v1.2.3
RBR instrument communication API
Working with Bit Fields

There are a few settings where the instrument will self-report which options are available depending on the factory configuration (for example, available serial baud rates, or data memory storage formats). When we anticipate that the number of possible options will remain quite small, we represent them as an enumeration of bit flags.

The functions which report the lists of options all return a bit field with the flags of the supported options set. The availability of a specific option can be confirmed using bitwise operators.

For example, if all five streaming output formats are available:

RBRInstrument_getAvailableOutputFormats(instrument, &outputFormats);
assert(outputFormats == RBRINSTRUMENT_CALTEXT01
| RBRINSTRUMENT_CALTEXT02
| RBRINSTRUMENT_CALTEXT03
| RBRINSTRUMENT_CALTEXT04
| RBRINSTRUMENT_CALTEXT07);

And to check if a specific format is supported, e.g., caltext03:

RBRInstrument_getAvailableOutputFormats(instrument, &outputFormats);
if (outputFormats | RBRINSTRUMENT_CALTEXT03)
{
...
}
RBRInstrument_getAvailableOutputFormats
RBRInstrumentError RBRInstrument_getAvailableOutputFormats(RBRInstrument *instrument, RBRInstrumentOutputFormat *outputFormats)
Report a list of available output formats.
RBRInstrumentOutputFormat
RBRInstrumentOutputFormat
Instrument output formats.
Definition: RBRInstrumentStreaming.h:122