示例#1
0
    def on_insert_sine_action_triggered(self):
        if self.something_is_selected:
            num_samples = self.selection_area.width
        else:
            num_samples = None

        original_data = self.signal.iq_array.data if self.signal is not None else None
        if original_data is None:
            logger.critical("No data to insert a sine wave to")
            return

        dialog = self.insert_sine_plugin.get_insert_sine_dialog(
            original_data=original_data,
            position=self.paste_position,
            sample_rate=self.sample_rate,
            num_samples=num_samples)
        dialog.show()
    def __send_messages(self, messages, sample_rates):
        """

        :type messages: list of Message
        :type sample_rates: list of int
        :param sample_rates: Sample Rate for each messages, this is needed to calculate the wait time,
                             as the pause for a message is given in samples
        :return:
        """
        self.is_sending = True
        sock = self.prepare_send_connection()
        if sock is None:
            return
        try:
            for i, msg in enumerate(messages):
                if self.__sending_interrupt_requested:
                    break
                assert isinstance(msg, Message)
                wait_time = msg.pause / sample_rates[i]

                self.current_send_message_changed.emit(i)
                error = self.send_data(
                    self.bit_str_to_bytearray(msg.encoded_bits_str) + b"\n",
                    sock)
                if not error:
                    logger.debug("Sent message {0}/{1}".format(
                        i + 1, len(messages)))
                    logger.debug(
                        "Waiting message pause: {0:.2f}s".format(wait_time))
                    if self.__sending_interrupt_requested:
                        break
                    time.sleep(wait_time)
                else:
                    logger.critical("Could not connect to {0}:{1}".format(
                        self.client_ip, self.client_port))
                    break
            logger.debug("Sending finished")
        finally:
            self.is_sending = False
            self.shutdown_socket(sock)
示例#3
0
def on_fatal_device_error_occurred(error: str):
    logger.critical(error.strip())
    sys.exit(1)
示例#4
0
文件: urh_cli.py 项目: jopohl/urh
def on_fatal_device_error_occurred(error: str):
    logger.critical(error.strip())
    sys.exit(1)