Beispiel #1
0
    def search_and_connect(self, pvName, callback, *user_args):
        """Attempt to establish a connection to a process variable.
        Parameters:
            pvName: process variable name
            callback: function called when connection completes and connection
            status changes later on.
            *user_args: user provided arguments that are passed to callback when
            it is invoked.

        >>> chan = CaChannel('catest')
        >>> def connCB(epicsArgs, userArgs):
        ...     if epicsArgs[1] == 6:
        ...         print ca.name(epicsArgs[0]), "is connected"
        >>> chan.search_and_connect(None, connCB, chan)
        >>> status = chan.pend_event(2)
        catest is connected
        """
        if pvName == None:
            pvName = self.pvname
        else:
            self.pvname = pvName
        self._callbacks['connCB']=(callback, user_args)
        try:
            self.__chid = ca.search(pvName, self._conn_callback)
        except ca.error, msg:
            raise CaChannelException,msg 
Beispiel #2
0
    def search_and_connect(self, pvName, callback, *user_args):
        """Attempt to establish a connection to a process variable.
        Parameters:
            pvName: process variable name
            callback: function called when connection completes and connection
            status changes later on.
            *user_args: user provided arguments that are passed to callback when
            it is invoked.

        >>> chan = CaChannel('catest')
        >>> def connCB(epicsArgs, userArgs):
        ...     if epicsArgs[1] == 6:
        ...         print ca.name(epicsArgs[0]), "is connected"
        >>> chan.search_and_connect(None, connCB, chan)
        >>> status = chan.pend_event(2)
        catest is connected
        """
        if pvName == None:
            pvName = self.pvname
        else:
            self.pvname = pvName
        self._callbacks['connCB'] = (callback, user_args)
        try:
            self.__chid = ca.search(pvName, self._conn_callback)
        except ca.error, msg:
            raise CaChannelException, msg
Beispiel #3
0
    def search(self, pvName=None):
        """Attempt to establish a connection to a process variable.
        Parameters:
            pvName: process variable name

        >>> chan = CaChannel()
        >>> chan.search('catest')
        >>> status = chan.pend_io(1)
        >>> chan.state()
        2
        """
        if pvName == None:
            pvName = self.pvname
        else:
            self.pvname = pvName
        try:
            self.__chid = ca.search(pvName, None)
        except ca.error, msg:
            raise CaChannelException,msg
Beispiel #4
0
    def search(self, pvName=None):
        """Attempt to establish a connection to a process variable.
        Parameters:
            pvName: process variable name

        >>> chan = CaChannel()
        >>> chan.search('catest')
        >>> status = chan.pend_io(1)
        >>> chan.state()
        2
        """
        if pvName == None:
            pvName = self.pvname
        else:
            self.pvname = pvName
        try:
            self.__chid = ca.search(pvName, None)
        except ca.error, msg:
            raise CaChannelException, msg
Beispiel #5
0
 def searchw(self, pvName=None):
     """Attempt to establish a connection to a process variable.
     Parameters:
         pvName: process variable name
     >>> chan = CaChannel('non-exist-channel')
     >>> chan.searchw()
     Traceback (most recent call last):
         ...
     CaChannelException: User specified timeout on IO operation expired
     """
     if pvName is None:
         pvName = self.pvname
     else:
         self.pvname = pvName
     self.__chid = ca.search(pvName, None)
     if self.__timeout is None:
         timeout = CaChannel.ca_timeout
     else:
         timeout = self.__timeout
     status = ca.pend_io(timeout)
     if status != 0:
         raise CaChannelException, ca.caError._caErrorMsg[status]
Beispiel #6
0
 def searchw(self, pvName=None):
     """Attempt to establish a connection to a process variable.
     Parameters:
         pvName: process variable name
     >>> chan = CaChannel('non-exist-channel')
     >>> chan.searchw()
     Traceback (most recent call last):
         ...
     CaChannelException: User specified timeout on IO operation expired
     """
     if pvName is None:
         pvName = self.pvname
     else:
         self.pvname = pvName
     self.__chid = ca.search(pvName, None)
     if self.__timeout is None:
         timeout = CaChannel.ca_timeout
     else:
         timeout = self.__timeout
     status = ca.pend_io(timeout)
     if status != 0:
         raise CaChannelException, ca.caError._caErrorMsg[status]