Example #1
0
 def __init__(self,
              port: str,
              simulating: bool,
              loop: asyncio.AbstractEventLoop = None) -> None:
     super().__init__(port, simulating, loop)
     if mag_locks.get(port):
         self._driver = mag_locks[port][1]
     else:
         self._driver = self._build_driver(simulating)  # type: ignore
Example #2
0
    def __init__(self,
                 port: str,
                 simulating: bool,
                 loop: asyncio.AbstractEventLoop = None) -> None:
        self._port = port
        if mag_locks.get(port):
            self._driver = mag_locks[port][1]
        else:
            self._driver = self._build_driver(simulating)  # type: ignore

        if None is loop:
            self._loop = asyncio.get_event_loop()
        else:
            self._loop = loop

        self._device_info = None
Example #3
0
 def __init__(self,
              port: str,
              execution_manager: ExecutionManager,
              simulating: bool,
              loop: asyncio.AbstractEventLoop = None,
              sim_model: str = None) -> None:
     super().__init__(port=port,
                      simulating=simulating,
                      loop=loop,
                      execution_manager=execution_manager,
                      sim_model=sim_model)
     self._device_info: Mapping[str, str] = {}
     self._driver: Union['SimulatingDriver', 'MagDeckDriver']
     if mag_locks.get(port):
         self._driver = mag_locks[port][1]
     else:
         self._driver = self._build_driver(simulating, sim_model)
Example #4
0
 def connect(self):
     '''
     Connect to the serial port
     '''
     if self._port:
         if mag_locks.get(self._port):
             self._driver = mag_locks[self._port][1]
         else:
             self._driver = MagDeckDriver()
         if not self._driver.is_connected():
             self._driver.connect(self._port)
         self._device_info = self._driver.get_device_info()
     else:
         # Sanity check: Should never happen, because connect should
         # never be called without a port on Module
         raise MissingDevicePortError(
             "MagDeck couldnt connect to port {}".format(self._port))