Exemplo n.º 1
0
    def __init__(self,
                 default_timeout=5,
                 device_prefix=None,
                 default_wait_time=1.0):
        """
        Initializes this ChannelAccess object.

        Args:
            device_prefix: The device prefix which will be added to the start of all pvs.
            default_timeout: The default time out to wait for an assertion on a PV to become true.
            default_wait_time: The default time to wait after a set_pv_value
        Returns:
            None.
        """
        self.ca = CaChannelWrapper()
        self.default_wait_time = default_wait_time

        # Silence CA errors
        CaChannelWrapper.errorLogFunc = lambda *a, **kw: None
        try:
            hcom = ctypes.cdll.LoadLibrary("COM.DLL")
            hcom.eltc(ctypes.c_int(0))
        except Exception as e:
            print("Unable to disable CA errors: ", e)

        self.prefix = os.environ["testing_prefix"]
        self._default_timeout = default_timeout
        if not self.prefix.endswith(':'):
            self.prefix += ':'
        if device_prefix is not None:
            self.prefix += "{}:".format(device_prefix)