コード例 #1
0
    def get_data_collection_params(self, timeout=None):
        """
        Gets the tuple (seconds, is_data_only), that is,
                    the cycle time (int) and the data only flag (bool).

        @param timeout Timeout for the wait on each instrument interaction,
                   self.generic_timeout by default.
        @retval (seconds, is_data_only), that is,
                    the cycle time (int) and the data only flag (bool).
        @throws TrhphClientException if received string could not be matched
        @throws TimeoutException
        """

        timeout = timeout or self.generic_timeout
        self.go_to_system_param_menu(timeout=timeout)
        self._assert_state(State.SYSTEM_PARAM_MENU)

        buffer = self.get_last_buffer()
        log.debug("BUFFER=[%s]" % str(buffer))

        # capture seconds
        seconds_string = trhph.get_cycle_time(buffer)
        log.debug("seconds_string='%s'" % seconds_string)
        if seconds_string is None:
            raise TrhphClientException("seconds_string could not be matched")
        seconds = trhph.get_cycle_time_seconds(seconds_string)
        if seconds is None:
            raise TrhphClientException("Seconds could not be matched")

        # capture verbose thing
        data_only_string = trhph.get_verbose_vs_data_only(buffer)
        log.info("data_only_string='%s'" % data_only_string)
        is_data_only = trhph.DATA_ONLY == data_only_string

        log.debug("send 9 to return to main menu")
        self.send('9')
        self.expect_generic_prompt(timeout=timeout)

        return (seconds, is_data_only)
コード例 #2
0
 def test_get_verbose_vs_data_only(self):
     val = trhph.get_verbose_vs_data_only(trhph.SYSTEM_PARAMETER_MENU)
     self.assertEqual(val, 'Data Only')