Ejemplo n.º 1
0
    def __init__(self, prompts, newline, driver_event, connections=None):
        """
        Constructor.
        @param prompts Enum class containing possible device prompts used for
        command response logic.
        @param newline The device newline.
        @driver_event The callback for asynchronous driver events.
        """
        if not type(connections) is list:
            raise InstrumentProtocolException(
                'Unable to instantiate multi connection protocol without connection list'
            )
        self._param_dict2 = ProtocolParameterDict()

        # Construct superclass.
        WorkhorseProtocol.__init__(self, prompts, newline, driver_event)

        # Create multiple connection versions of the pieces of protocol involving data to/from the instrument
        self._linebuf = {connection: '' for connection in connections}
        self._promptbuf = {connection: '' for connection in connections}
        self._last_data_timestamp = {
            connection: None
            for connection in connections
        }
        self.connections = {connection: None for connection in connections}
        self.chunkers = {
            connection: StringChunker(self.sieve_function)
            for connection in connections
        }
Ejemplo n.º 2
0
    def __init__(self, prompts, newline, driver_event, connections=None):
        """
        Constructor.
        @param prompts Enum class containing possible device prompts used for
        command response logic.
        @param newline The device newline.
        @driver_event The callback for asynchronous driver events.
        """
        if not type(connections) is list:
            raise InstrumentProtocolException('Unable to instantiate multi connection protocol without connection list')
        self._param_dict2 = ProtocolParameterDict()

        # Construct superclass.
        WorkhorseProtocol.__init__(self, prompts, newline, driver_event)

        # Create multiple connection versions of the pieces of protocol involving data to/from the instrument
        self._linebuf = {connection: '' for connection in connections}
        self._promptbuf = {connection: '' for connection in connections}
        self._last_data_timestamp = {connection: None for connection in connections}
        self.connections = {connection: None for connection in connections}
        self.chunkers = {connection: StringChunker(self.sieve_function) for connection in connections}
Ejemplo n.º 3
0
 def __init__(self, prompts, newline, driver_event):
     log.debug("IN Protocol.__init__")
     WorkhorseProtocol.__init__(self, prompts, newline, driver_event)
     self.initialize_scheduler()
Ejemplo n.º 4
0
 def _build_protocol(self):
     """
     Construct the driver protocol state machine.
     """
     self._protocol = WorkhorseProtocol(WorkhorsePrompt, NEWLINE,
                                        self._driver_event)