Handling many interrelated API options

I am looking for a library or something similar for dealing with options, somewhat similar to inet:getopts/2 and inet:setopts/2, but for many (80+) options and interdependencies between them. In this particular case, we are talking about options dealing with an interface to an RF tranceiver.

They may be simple options, such as a flag (CRC enable/disable) or a numeric value (number of sync bytes). It may also be that a user meaningful value needs to be converted to an internal value (2fsk → 0, ask → 3 etc). It may also be that a given option needs to be converted to multiple register values. When reading back an option in then the internal value has to be converted back to a user meaningful value.
When specifying options, the specified value must be checked against allowed values. These can be discrete values or ranges of values or even combinations thereof.

Options are also dependent on each other, usually by group. Packet handling options are not applicable in stream mode and allowed bandwidth values depend on the carrier frequency.
Instead of programming all options and their dependencies, I am looking for something more declarative. Is anyone familiar with such a library or may know about something handy?


1 Like