Beispiel #1
0
def caput(pvname, value, timeout=1.0, **kw):
    try:
        pv = Pv(pvname)
        pv.connect(timeout)
        pv.get(ctrl=False, timeout=timeout)
        try:
            if kw['enum']:
                pv.set_string_enum(True)
        except:
            pass
        pv.put(value, timeout=timeout)
        pv.disconnect()
    except pyca.pyexc, e:
        print 'pyca exception: %s' % (e)
Beispiel #2
0
def caget(pvname, timeout=1.0, **kw):
    try:
        pv = Pv(pvname)
        pv.connect(timeout)
        try:
            if kw['enum']:
                pv.set_string_enum(True)
        except:
            pass
        pv.get(ctrl=False, timeout=timeout)
        v = pv.value
        pv.disconnect()
        return v
    except pyca.pyexc as e:
        print('pyca exception: %s' % (e))
        return None
    except pyca.caexc as e:
        print('channel access exception: %s' % (e))
        return None