20"""TODO: complete this docstring
33Pyro4.config.SERIALIZERS_ACCEPTED.add(
"pickle")
34Pyro4.config.SERIALIZER =
"pickle"
40 """Base Client object that makes methods on proxy available locally."""
42 def __init__(self, url):
48 """Connect to a proxy and set up self passthrough to proxy methods."""
50 self.
_proxy._pyroGetMetadata()
54 m[0]
for m
in inspect.getmembers(self, predicate=inspect.ismethod)
56 methods = set(self.
_proxy._pyroMethods).difference(my_methods)
60 for m
in inspect.getmembers(
61 self.__class__, predicate=inspect.isdatadescriptor
64 properties = set(self.
_proxy._pyroAttrs).difference(my_properties)
66 for attr
in itertools.chain(methods, properties):
67 setattr(self, attr, getattr(self.
_proxy, attr))
71 """A client that can receive and buffer data."""
73 def __init__(self, url):
77 if self.
_url.split(
"@")[1].split(
":")[0]
in [
"127.0.0.1",
"localhost"]:
82 iface = socket.gethostbyname(socket.gethostname())
83 if iface
not in LISTENERS:
84 LISTENERS[iface] = Pyro4.Daemon(host=iface)
85 lthread = threading.Thread(target=LISTENERS[iface].requestLoop)
91 """Set the client on the remote and enable it."""
99 def receiveData(self, data, timestamp, *args):
101 self.
_buffer.put((data, timestamp))
103 def trigger_and_wait(self):
104 if not hasattr(self,
"trigger"):
105 raise Exception(
"Device has no trigger method.")
107 return self.
_buffer.get(block=
True)