mirror of
https://github.com/bec-project/ophyd_devices.git
synced 2026-01-22 09:32:19 +01:00
fix: changed dependency injection for controller classes; closes #13
This commit is contained in:
@@ -1,15 +1,17 @@
|
||||
import abc
|
||||
import socket
|
||||
import functools
|
||||
import time
|
||||
import socket
|
||||
import threading
|
||||
import time
|
||||
|
||||
from typeguard import typechecked
|
||||
from ophyd import PositionerBase, Signal
|
||||
from ophyd.device import Device, Component as Cpt
|
||||
from ophyd.device import Component as Cpt
|
||||
from ophyd.device import Device
|
||||
from prettytable import PrettyTable
|
||||
from typeguard import typechecked
|
||||
|
||||
from ophyd_devices.utils.controller import threadlocked
|
||||
from ophyd_devices.utils.socket import raise_if_disconnected
|
||||
from ophyd_devices.utils.controller import SingletonController, threadlocked
|
||||
|
||||
|
||||
def channel_checked(fcn):
|
||||
@@ -23,7 +25,9 @@ def channel_checked(fcn):
|
||||
return wrapper
|
||||
|
||||
|
||||
class NPointController(SingletonController):
|
||||
class NPointController:
|
||||
_controller_instance = None
|
||||
|
||||
NUM_CHANNELS = 3
|
||||
_read_single_loc_bit = "A0"
|
||||
_write_single_loc_bit = "A2"
|
||||
@@ -37,11 +41,17 @@ class NPointController(SingletonController):
|
||||
server_ip: str = "129.129.99.87",
|
||||
server_port: int = 23,
|
||||
) -> None:
|
||||
self._lock = threading.RLock()
|
||||
super().__init__()
|
||||
self._server_and_port_name = (server_ip, server_port)
|
||||
self.socket = comm_socket
|
||||
self.connected = False
|
||||
|
||||
def __new__(cls, *args, **kwargs):
|
||||
if not NPointController._controller_instance:
|
||||
NPointController._controller_instance = object.__new__(cls)
|
||||
return NPointController._controller_instance
|
||||
|
||||
@classmethod
|
||||
def create(cls):
|
||||
return cls(SocketIO())
|
||||
|
||||
Reference in New Issue
Block a user