In 95% of callbacks is used one command per callbacks. This is reason why template shows this example, but this not RULE. My experience is that is better used one command for one attribute, because it does not make so many troubles witch cache. I try describe two tricks, how you can solve this problem.
- TRICK 1 --------------------------------------------
Value of your public attribute is combination of two commands (XXX:YYY and WWW:ZZZ ). In this case you can create two hidden attributes for your commands. Your public attribute sets/gets these hidden attributes. Use following flags for public attributes: IVI_VAL_DONT_CHECK_STATUS | IVI_VAL_USE_CALLBACKS_FOR_SIMULATION | IVI_VAL_NEVER_CACHE.
Reason are following:
Never Cache - v
alues are cached in your hidden attributes. You do not need cache again. This can be source of troubles if you store one value on two places.
Use for simulation: - Your callbacks do not write/read data to/from instrument and it only sets other attributes. This must be simulated.
Don't Check Status: - Because callbacks does not write/read data to/from instrument you do not need check status. This attribute cannot make any error in the instrument, because callback does not send any data to instrument.
One Suggestion: All checking should be in public attribute. Do not implement check callbacks for hidden attributes.
- TRICK 2 ---------------------------------------------
One command sets two values. (UUU:QQQ ,) In this case implement one hidden attribute type of ViString and two public attributes. Your public attributes gets second attribute, build parameter of string attribue and sets string attribute. These public attributes has flags: IVI_VAL_DONT_CHECK_STATUS
| IVI_VAL_USE_CALLBACKS_FOR_SIMULATION | IVI_VAL_NEVER_CACHE. Reason is above.
See attached example.
Regards,
Zdenek