def array_put_callback(self, value, req_type, count, callback, *user_args): """Write a value or array of values to a channel and execute the user supplied callback after the put has completed. Parameters: value: data to be written. For multiple values use a list or tuple. req_type: database request type. Defaults to be the native data type. count: number of data values to write, Defaults to be the native count. callback: function called when the write is completed. *user_args: user provided arguments that are passed to callback when it is invoked. >>> def putCB(epicsArgs, userArgs): ... print ca.name(epicsArgs['chid']), 'put completed' >>> chan = CaChannel('catest') >>> chan.searchw() >>> chan.array_put_callback(145, None, None, putCB) >>> status = chan.pend_event(1) catest put completed >>> chan = CaChannel('cabo') >>> chan.searchw() >>> chan.array_put_callback('Busy', ca.DBR_STRING, None, putCB) >>> status = chan.pend_event(1) cabo put completed >>> chan = CaChannel('cawave') >>> chan.searchw() >>> chan.array_put_callback([1,2,3], None, None, putCB) >>> status = chan.pend_event(1) cawave put completed >>> chan = CaChannel('cawavec') >>> chan.searchw() >>> chan.array_put_callback('123', None, None, putCB) >>> status = chan.pend_event(1) cawavec put completed """ if req_type is None: req_type = -1 val = self._setup_put(value, req_type, count) self._callbacks['putCB']=(callback, user_args) try: ca.put(self.__chid, val, None, self._put_callback, req_type) except ca.error,msg: raise CaChannelException,msg
def array_put_callback(self, value, req_type, count, callback, *user_args): """Write a value or array of values to a channel and execute the user supplied callback after the put has completed. Parameters: value: data to be written. For multiple values use a list or tuple. req_type: database request type. Defaults to be the native data type. count: number of data values to write, Defaults to be the native count. callback: function called when the write is completed. *user_args: user provided arguments that are passed to callback when it is invoked. >>> def putCB(epicsArgs, userArgs): ... print ca.name(epicsArgs['chid']), 'put completed' >>> chan = CaChannel('catest') >>> chan.searchw() >>> chan.array_put_callback(145, None, None, putCB) >>> status = chan.pend_event(1) catest put completed >>> chan = CaChannel('cabo') >>> chan.searchw() >>> chan.array_put_callback('Busy', ca.DBR_STRING, None, putCB) >>> status = chan.pend_event(1) cabo put completed >>> chan = CaChannel('cawave') >>> chan.searchw() >>> chan.array_put_callback([1,2,3], None, None, putCB) >>> status = chan.pend_event(1) cawave put completed >>> chan = CaChannel('cawavec') >>> chan.searchw() >>> chan.array_put_callback('123', None, None, putCB) >>> status = chan.pend_event(1) cawavec put completed """ if req_type is None: req_type = -1 val = self._setup_put(value, req_type, count) self._callbacks['putCB'] = (callback, user_args) try: ca.put(self.__chid, val, None, self._put_callback, req_type) except ca.error, msg: raise CaChannelException, msg
def putw(self, value, req_type=None): """Write a value or array of values to a channel Parameters: value: data to be written. For multiple values use a list or tuple req_type: database request type. Defaults to be the native data type. >>> chan = CaChannel('catest') >>> chan.searchw() >>> chan.putw(145) >>> chan.getw() 145.0 >>> chan = CaChannel('cabo') >>> chan.searchw() >>> chan.putw('Busy', ca.DBR_STRING) >>> chan.getw() 1 >>> chan.getw(ca.DBR_STRING) 'Busy' >>> chan = CaChannel('cawave') >>> chan.searchw() >>> chan.putw([1,2,3]) >>> chan.getw(req_type=ca.DBR_LONG,count=4) [1, 2, 3, 0] >>> chan = CaChannel('cawavec') >>> chan.searchw() >>> chan.putw('123') >>> chan.getw(count=4) [49, 50, 51, 0] >>> chan = CaChannel('cawaves') >>> chan.searchw() >>> chan.putw(['string 1','string 2']) >>> chan.getw() ['string 1', 'string 2', ''] """ if req_type is None: req_type = -1 val = self._setup_put(value, req_type) try: ca.put(self.__chid, val, None, None, req_type) except ca.error,msg: raise CaChannelException,msg
def putw(self, value, req_type=None): """Write a value or array of values to a channel Parameters: value: data to be written. For multiple values use a list or tuple req_type: database request type. Defaults to be the native data type. >>> chan = CaChannel('catest') >>> chan.searchw() >>> chan.putw(145) >>> chan.getw() 145.0 >>> chan = CaChannel('cabo') >>> chan.searchw() >>> chan.putw('Busy', ca.DBR_STRING) >>> chan.getw() 1 >>> chan.getw(ca.DBR_STRING) 'Busy' >>> chan = CaChannel('cawave') >>> chan.searchw() >>> chan.putw([1,2,3]) >>> chan.getw(req_type=ca.DBR_LONG,count=4) [1, 2, 3, 0] >>> chan = CaChannel('cawavec') >>> chan.searchw() >>> chan.putw('123') >>> chan.getw(count=4) [49, 50, 51, 0] >>> chan = CaChannel('cawaves') >>> chan.searchw() >>> chan.putw(['string 1','string 2']) >>> chan.getw() ['string 1', 'string 2', ''] """ if req_type is None: req_type = -1 val = self._setup_put(value, req_type) try: ca.put(self.__chid, val, None, None, req_type) except ca.error, msg: raise CaChannelException, msg
def array_put(self, value, req_type=None, count=None): """Write a value or array of values to a channel Parameters: value: data to be written. For multiple values use a list or tuple req_type: database request type. Defaults to be the native data type. count: number of data values to write, Defaults to be the native count. >>> chan = CaChannel('catest') >>> chan.searchw() >>> chan.array_put(123) >>> chan.pend_io(1) >>> chan.getw() 123.0 >>> chan = CaChannel('cabo') >>> chan.searchw() >>> chan.array_put('Busy', ca.DBR_STRING) >>> chan.pend_io(1) >>> chan.getw() 1 >>> chan = CaChannel('cawave') >>> chan.searchw() >>> chan.array_put([1,2,3]) >>> chan.pend_io(1) >>> chan.getw() [1.0, 2.0, 3.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] >>> chan = CaChannel('cawavec') >>> chan.searchw() >>> chan.array_put('1234',count=3) >>> chan.pend_io(1) >>> chan.getw(count=4) [49, 50, 51, 0] """ if req_type is None: req_type = -1 val = self._setup_put(value, req_type, count) try: ca.put(self.__chid, val, None, None, req_type) except ca.error,msg: raise CaChannelException,msg
def array_put(self, value, req_type=None, count=None): """Write a value or array of values to a channel Parameters: value: data to be written. For multiple values use a list or tuple req_type: database request type. Defaults to be the native data type. count: number of data values to write, Defaults to be the native count. >>> chan = CaChannel('catest') >>> chan.searchw() >>> chan.array_put(123) >>> chan.pend_io(1) >>> chan.getw() 123.0 >>> chan = CaChannel('cabo') >>> chan.searchw() >>> chan.array_put('Busy', ca.DBR_STRING) >>> chan.pend_io(1) >>> chan.getw() 1 >>> chan = CaChannel('cawave') >>> chan.searchw() >>> chan.array_put([1,2,3]) >>> chan.pend_io(1) >>> chan.getw() [1.0, 2.0, 3.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] >>> chan = CaChannel('cawavec') >>> chan.searchw() >>> chan.array_put('1234',count=3) >>> chan.pend_io(1) >>> chan.getw(count=4) [49, 50, 51, 0] """ if req_type is None: req_type = -1 val = self._setup_put(value, req_type, count) try: ca.put(self.__chid, val, None, None, req_type) except ca.error, msg: raise CaChannelException, msg