Skip to content

Commit

Permalink
continue - WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
TamarZanzouri committed Mar 2, 2024
1 parent 756cf51 commit 9b6ebd4
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
9 changes: 6 additions & 3 deletions api/src/opentrons/drivers/rpi_drivers/interfaces.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
from typing import List
from typing import List, Union
from typing_extensions import Protocol

from opentrons.hardware_control.modules.types import ModuleAtPort
from opentrons.hardware_control.modules.types import (
ModuleAtPort,
SimulatingModuleAtPort,
)


class USBDriverInterface(Protocol):
def match_virtual_ports(
self,
virtual_port: List[ModuleAtPort],
virtual_port: Union[List[ModuleAtPort], List[SimulatingModuleAtPort]],
) -> List[ModuleAtPort]:
...
14 changes: 10 additions & 4 deletions api/src/opentrons/drivers/rpi_drivers/usb_simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,21 @@
A class to convert info from the usb bus into a
more readable format.
"""
from typing import List
from typing import List, Union

from opentrons.hardware_control.modules.types import ModuleAtPort
from opentrons.hardware_control.modules.types import (
ModuleAtPort,
SimulatingModuleAtPort,
)

from .interfaces import USBDriverInterface


class USBBusSimulator(USBDriverInterface):
def match_virtual_ports(
self, virtual_port: List[ModuleAtPort]
) -> List[ModuleAtPort]:
self,
virtual_port: Union[
List[ModuleAtPort], List[SimulatingModuleAtPort]
], # should probably one use simulating
) -> Union[List[ModuleAtPort], List[SimulatingModuleAtPort]]:
return virtual_port
6 changes: 1 addition & 5 deletions api/src/opentrons/hardware_control/modules/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,8 @@ class ModuleAtPort:
usb_port: USBPort = USBPort(name="", port_number=0)


@dataclass
class SimulatingModuleAtPort:
class SimulatingModuleAtPort(ModuleAtPort):
serial_numer: str
port: str
name: str
usb_port: USBPort = USBPort(name="", port_number=0)


class BundledFirmware(NamedTuple):
Expand Down

0 comments on commit 9b6ebd4

Please sign in to comment.