File: ca_connection_callback.py

package info (click to toggle)
python-pyepics 3.5.7%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,336 kB
  • sloc: python: 10,539; makefile: 112; javascript: 104; sh: 53
file content (21 lines) | stat: -rw-r--r-- 541 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#
# example of using a connection callback that will be called
# for any change in connection status

import epics
import time
import pvnames



import sys
write = sys.stdout.write
def onConnectionChange(pvname=None,  **kws):
    write('ca connection status changed:  %s %s\n' % ( pvname, repr(kws)))
    
chid = epics.ca.create_channel(pvnames.long_pv, callback=onConnectionChange)

write('Now, restart simulation IOC -- waiting, watching values and connection changes:\n')
t0 = time.time()
while time.time()-t0 < 15:
    time.sleep(0.001)