Beispiel #1
0
    def test_capabilities(self):
        """
        Verify the FSM reports capabilities as expected.  All states defined in this dict must
        also be defined in the protocol FSM.
        """
        capabilities = {
            ProtocolState.UNKNOWN: [ProtocolEvent.DISCOVER],
            ProtocolState.COMMAND: [
                ProtocolEvent.GET, ProtocolEvent.SET,
                ProtocolEvent.START_DIRECT, ProtocolEvent.START_AUTOSAMPLE,
                ProtocolEvent.ACQUIRE_STATUS, ProtocolEvent.RUN_WIPER,
                ProtocolEvent.ACQUIRE_SAMPLE, ProtocolEvent.CLOCK_SYNC
            ],
            ProtocolState.AUTOSAMPLE: [
                ProtocolEvent.STOP_AUTOSAMPLE,
                ProtocolEvent.RUN_WIPER_SCHEDULED,
                ProtocolEvent.SCHEDULED_CLOCK_SYNC,
                ProtocolEvent.SCHEDULED_ACQUIRE_STATUS, ProtocolEvent.GET
            ],
            ProtocolState.DIRECT_ACCESS:
            [ProtocolEvent.STOP_DIRECT, ProtocolEvent.EXECUTE_DIRECT]
        }

        driver = InstrumentDriver(self._got_data_event_callback)
        self.assert_capabilities(driver, capabilities)
Beispiel #2
0
 def test_driver_schema(self):
     """
     Get the driver schema and verify it is configured properly
     """
     driver = InstrumentDriver(self._got_data_event_callback)
     self.assert_driver_schema(driver, self._driver_parameters,
                               self._driver_capabilities)
Beispiel #3
0
    def test_got_data(self):
        """
        Verify sample data passed through the got data method produces the correct data particles
        """
        # Create and initialize the instrument driver with a mock port agent
        driver = InstrumentDriver(self._got_data_event_callback)
        self.assert_initialize_driver(driver)

        self.assert_raw_particle_published(driver, True)

        # Start validating data particles
        self.assert_particle_published(driver, SAMPLE_MNU_RESPONSE, self.assert_particle_mnu, True)
        self.assert_particle_published(driver, SAMPLE_SAMPLE_RESPONSE, self.assert_particle_sample, True)
Beispiel #4
0
    def test_capabilities(self):
        """
        Verify the FSM reports capabilities as expected.  All states defined in this dict must
        also be defined in the protocol FSM.
        """
        capabilities = {
            ProtocolState.UNKNOWN: ['DRIVER_EVENT_DISCOVER', 'DRIVER_EVENT_START_DIRECT'],
            ProtocolState.COMMAND: ['DRIVER_EVENT_GET',
                                    'DRIVER_EVENT_SET',
                                    'DRIVER_EVENT_START_AUTOSAMPLE',
                                    'DRIVER_EVENT_START_DIRECT',
                                    'PROTOCOL_EVENT_GET_MENU',
                                    'PROTOCOL_EVENT_GET_METADATA',
                                    'PROTOCOL_EVENT_INTERRUPT_INSTRUMENT'],
            ProtocolState.AUTOSAMPLE: ['DRIVER_EVENT_STOP_AUTOSAMPLE',
                                       'PROTOCOL_EVENT_INTERRUPT_INSTRUMENT'],
            ProtocolState.DIRECT_ACCESS: ['DRIVER_EVENT_STOP_DIRECT', 'EXECUTE_DIRECT']
        }

        driver = InstrumentDriver(self._got_data_event_callback)
        self.assert_capabilities(driver, capabilities)