Exemplo n.º 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)
Exemplo n.º 2
0
    def set_is_data_only(self, data_only, timeout=None):
        """
        Sets the data-only flag.

        @param data_only True to set data-only; False for verbose.
        @param timeout Timeout for the wait on each instrument interaction,
                self.generic_timeout by default.
        @throws TimeoutException
        """

        assert isinstance(data_only, bool)

        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'" % repr(buffer))
        string = trhph.get_cycle_time(buffer)
        log.debug("VALUE='%s'" % string)

        log.debug("send 2 to change verbose setting")
        self.send("2")
        self.expect_generic_prompt(timeout=timeout)

        if data_only:
            log.debug("send 1 to change verbose setting to just data")
            self.send("1")
        else:
            log.debug("send 2 to change verbose setting to verbose")
            self.send("2")

        self.expect_generic_prompt(timeout=timeout)

        log.debug("send 9 to return to main menu")
        self.send("9")
        self.expect_generic_prompt(timeout=timeout)
Exemplo n.º 3
0
 def test_get_cycle_time(self):
     val = trhph.get_cycle_time(trhph.SYSTEM_PARAMETER_MENU)
     self.assertEqual(val, '20 Seconds')