8 """@module visaofifos.py
10 The visaofifos python module provides the basic interface to a VisAO FIFO device.
16 import os, time, math, select, errno, signal, numpy
19 from visaoutils
import *
24 A basic VisAO FIFO device. Establishes basic fifo bichannel communications with a VisAO process.
26 Derived classes should provide self.base_name in their __init__ method, and should set connected = 0 and control = 0.
30 Construct the script fifo paths based on the base_name variable.
41 Open the script fifo channel to this device.
45 fd = os.open(self.
fifo_in_name, os.O_RDONLY|os.O_NONBLOCK)
48 self.pollobj.register(fd, select.POLLIN)
53 ready = self.pollobj.poll(1)
54 except select.error, v:
55 if v[0] != errno.EINTR:
raise
57 if len(ready) > 0: self.fifo_in.read()
61 Write com to the script fifo for this device, read and return the response.
63 self.fifo_out.write(com)
67 ready = self.pollobj.poll(2000)
68 except select.error, v:
69 if v[0] != errno.EINTR:
raise
73 return self.fifo_in.read()
80 Close the fifo channel.
88 Connect to the script fifos of this device.
98 Take SCRIPT control of this device.
100 Input: override Default is 0, no override. If 1, override.
109 ans = ans.rstrip(
'\n\x00')
111 print 'you have Script Control of ' + self.base_name
116 print 'Error taking Script Control of ' + self.base_name
117 print 'Response was: ' + ans
123 Give up SCRIPT control of this process, returning to its default.
129 ans = ans.rstrip(
'\n\x00')
130 if ans ==
'NONE' or ans ==
'REMOTE' or ans ==
'LOCAL' or ans ==
'AUTO':
131 print 'We no longer have Script Control of ' + self.base_name
136 print 'Error relinquishing Script Control of ' + self.base_name
137 print 'Response was: ' + ans
def setup_fifo_names(self)
def write_fifoch(self, com)