BioImager  4.9.0
A .NET microscopy imaging application based on Bio library. Supports various microscopes by using imported libraries & GUI automation. Supports XInput game controllers to move stage, take images, run ImageJ macros on images or Bio C# scripts.
Loading...
Searching...
No Matches
microscope.clients.DataClient Class Reference
Inheritance diagram for microscope.clients.DataClient:
microscope.clients.Client

Public Member Functions

 __init__ (self, url)
 
 enable (self)
 
 receiveData (self, data, timestamp, *args)
 
 trigger_and_wait (self)
 
- Public Member Functions inherited from microscope.clients.Client

Protected Attributes

 _buffer = queue.Queue()
 
 _client_uri = LISTENERS[iface].register(self)
 
- Protected Attributes inherited from microscope.clients.Client
 _url = url
 
 _proxy = None
 

Additional Inherited Members

- Public Attributes inherited from microscope.clients.Client
list _proxy
 
- Protected Member Functions inherited from microscope.clients.Client
 _connect (self)
 

Detailed Description

A client that can receive and buffer data.

Definition at line 70 of file clients.py.

Constructor & Destructor Documentation

◆ __init__()

microscope.clients.DataClient.__init__ ( self,
url )

Reimplemented from microscope.clients.Client.

Definition at line 73 of file clients.py.

73 def __init__(self, url):
74 super().__init__(url)
75 self._buffer = queue.Queue()
76 # Register self with a listener.
77 if self._url.split("@")[1].split(":")[0] in ["127.0.0.1", "localhost"]:
78 iface = "127.0.0.1"
79 else:
80 # TODO: support multiple interfaces. Could use ifaddr.get_adapters() to
81 # query ip addresses then pick first interface on the same subnet.
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)
86 lthread.daemon = True
87 lthread.start()
88 self._client_uri = LISTENERS[iface].register(self)
89

Member Function Documentation

◆ enable()

microscope.clients.DataClient.enable ( self)
Set the client on the remote and enable it.

Definition at line 90 of file clients.py.

90 def enable(self):
91 """Set the client on the remote and enable it."""
92 self.set_client(self._client_uri)
93 self._proxy.enable()
94

◆ receiveData()

microscope.clients.DataClient.receiveData ( self,
data,
timestamp,
* args )

Definition at line 99 of file clients.py.

99 def receiveData(self, data, timestamp, *args):
100 del args
101 self._buffer.put((data, timestamp))
102

◆ trigger_and_wait()

microscope.clients.DataClient.trigger_and_wait ( self)

Definition at line 103 of file clients.py.

103 def trigger_and_wait(self):
104 if not hasattr(self, "trigger"):
105 raise Exception("Device has no trigger method.")
106 self.trigger()
107 return self._buffer.get(block=True)

Member Data Documentation

◆ _buffer

microscope.clients.DataClient._buffer = queue.Queue()
protected

Definition at line 75 of file clients.py.

◆ _client_uri

microscope.clients.DataClient._client_uri = LISTENERS[iface].register(self)
protected

Definition at line 88 of file clients.py.


The documentation for this class was generated from the following file: