On Thursday, July 26, 2012, Hinko Kocevar wrote:
On 07/26/2012 02:04 PM, Benjamin Franksen wrote:
On Thursday, July 26, 2012, Hinko Kocevar wrote:
While developing writing Asyn device driver support for our products
running on Linux OS, we were faced with the need to support more than
16 enumeration values that are to be represented using mbbi / mbbo
records.
I'm looking for solutions to this problem. We are trying to stay
within EPICS base provided record types as much as possible, but we
have no problems to include additional EPICS extensions to out soft
IOC in order to gain record support. Last resort would be to provide
a new record type.
Writing a new record type with, say, 32 choices based on the existing
16- choices versions wouldn't be hard. The problem is that the result
won't be very useful because CA (Channel Access) limits the number of
choices for type DBR_XXX_ENUM to 16 which is hard coded in the
protocol (see db_access.h). So, for instance, a menu button in an
operator panel would not see all 32 choices but only the first 16; and
so on.
A possible work-around would be to somehow split the choices into
smaller (related) groups, then provide a 'master' mbbi/o for the
choice of the group, and separate mbbi/o for chosing inside the
groups.
My version would not even include the 'master' mbbi/mbbo. I was thinking
about splitting too large enumerations into 16 or less values to fit
single mbbi/mbbo.
For example: 20 enums
- 0 - 15 in mbbi1 record
- 16 -19 in mbbi2 record
If your choices do not lend themselves naturally to grouping into smaller
sets of sub-choices, then this approach makes sense. I would, however, use
only 15 choices, reserving the 16th to indicate that the actual choice
should be made from the next record in the chain. You could also reserve yet
another choice to indicate that this record dos not apply, i.e. to indicate
'undefined' (see below).
You can have arbitraryly many choices if you chain records in this way.
What will mbbi1 value be if eg. enum 17 should be set?
If you reserve the 16th choice, then "Other" comes to mind, "More..." if you
think of user interfaces.
What will mbbi2 value be if eg. enum 4 should be set?
"n/a" or just ""
Can it be 'undefined'?
Reserve yet one more choice for this. Or: set the UDF field of a record e.g.
via db link from another record. If you also have DISS=INVALID you have a
good idication of an undefined state.
Or should we leave one enum state reserved in
this case and set it when other mbbiX is in use..
Yes, see above.