Files
cdev-1.7.2n/extensions/tclnew/cdevtcl.doc
2022-12-13 12:44:04 +01:00

58 lines
1.9 KiB
Plaintext

Interface tcl to cdev
Features:
Access all of cdev world from within the tcl shells.
Handle arbitrary cdevData tag/value pairs
Handle arbitrary cdevData arrays
Handle synchronous get/set
Handle asynchronous get/set/monitors
Set cdev context
Implementation:
Dynamically loadable module including all of cdev library for tcl7.5
Polls cdev 5 time a second
Soon: Install cdev filedescriptors in tcl select list
Important note: All communication is through strings, the cdevdata object takes care of all conversion.
Cdev service writers: Use a 'get' in your client code, 'find' will not do type conversions.
syntax:
cdev $service $message "$tag1 $val1" "$tag2 $val2" ...
Where $service is any cdev service, i.e. "model" or "IPM1A01"
and $message a message to that device, i.e "get elements" or "get XPOS"
the rest of the arguments are list of length 2 with the first entry the tag name, and the second the tag value.
List of length > 2 are handled as tag/string with spaces.
or
cdev $service $message "$tag1 $val1" "$tag2 $val2" $cb
The message is send asynchronously.
The result of the call will appear in the tcl array "$Control($cb)" in due time.
Return tags:
On return the 'value' tag will be converted into a tcl result, arbitrary dimensional results are handled.
Arbitrary tags will be converted using the -tags {$tag $tag2 ...} option
Context:
The context can be accessed by -context "$tag $value" ...
all tag/value pairs after the context switch will be put in the context
Error handling:
See code for 'status' and 'severity' tag handling, this will be superseded by proper cdev errorhandler interface
examples:
cdev IPM1S01 "get XPOS"
cdev lockarc1 "set status" "value Waiting for Beam"
the status is set to the string "Waiting for Beam"
cdev IPM1S01 "monitorOn XPOS" IPM1S01.XPOS
results appear in Control(IPM1S01.XPOS)
cdev model "get elements" "value Quadrupoles" "section {arc1 arc2 arc3}"