And then run the following script, using the tip of caffi module. Notice that the "get with callback" version prints an array of 11 elements, while the other 2 prints a scalar value.
from caffi import ca
from pprint import pprint
status, chid = ca.create_channel('MTEST:RAND')
assert status == ca.ECA.NORMAL
status = ca.pend_io(3)
assert status == ca.ECA.NORMAL
def getCB(args):
print('=== get with callback ===')
pprint(args['value'])
# get with callback
status, dbr = ca.get(chid, chtype=ca.DBR_CTRL_DOUBLE, count=0, callback=getCB)
assert status == ca.ECA.NORMAL
ca.pend_event(2)
# get without callback
status, dbr = ca.get(chid, chtype=ca.DBR_CTRL_DOUBLE, count=0)
assert status == ca.ECA.NORMAL
status = ca.pend_io(3)
assert status == ca.ECA.NORMAL
print('=== get w/o callback ===')
pprint(dbr.get())
def monCB(args):
print('=== monitor callback ===')
pprint(args['value'])
# monitor
status, evid = ca.create_subscription(chid, chtype=ca.DBR_CTRL_DOUBLE, count=0, callback=monCB)
assert status == ca.ECA.NORMAL
ca.pend_event(2)
This is the same fix when the requested count is 0 in ca_create_subscription.
This problem has not been discovered so far probably because it is seldom to pass 0 to ca_array_get_callback. And it results error when calling ca_array_get.
Use the dummy.py example,
And then run the following script, using the tip of
caffi
module. Notice that the "get with callback" version prints an array of 11 elements, while the other 2 prints a scalar value.