Ejemplo n.º 1
0
    def update_view(self):
        txt = self.ui.txtEditErrors.toPlainText()
        new_errors = self.device_thread.read_errors()

        if "No devices found for" in new_errors:
            self.device_thread.stop("Could not establish connection to USRP")
            Errors.usrp_ip_not_found()

            self.on_clear_clicked()

        elif "FATAL: No supported devices found" in new_errors or \
                        "HACKRF_ERROR_NOT_FOUND" in new_errors or \
                        "HACKRF_ERROR_LIBUSB" in new_errors:
            self.device_thread.stop("Could not establish connection to HackRF")
            Errors.hackrf_not_found()
            self.on_clear_clicked()

        elif "No module named gnuradio" in new_errors:
            self.device_thread.stop("Did not find gnuradio.")
            Errors.gnuradio_not_installed()
            self.on_clear_clicked()

        elif "Address already in use" in new_errors:
            self.__restart_device_thread()

        if len(new_errors) > 1:
            self.ui.txtEditErrors.setPlainText(txt + new_errors)

        self.ui.progressBar.setValue(self.device_thread.current_index)

        self.ui.lSamplesCaptured.setText("{0:n}".format(
            self.device_thread.current_index))
        self.ui.lSignalSize.setText("{0:n}".format(
            (8 * self.device_thread.current_index) / (1024**2)))
        self.ui.lTime.setText(
            locale.format_string(
                "%.2f", self.device_thread.current_index /
                self.device_thread.sample_rate))
        if self.device_thread.current_iteration is not None:
            self.ui.lblCurrentRepeatValue.setText(
                str(self.device_thread.current_iteration + 1))
        else:
            self.ui.lblCurrentRepeatValue.setText("Done")

        if self.device_thread.current_index == 0:
            return

        if self.mode == Mode.send or self.mode == Mode.receive:
            self.ui.graphicsView.horizontalScrollBar().blockSignals(True)
            self.scene_creator.end = self.device_thread.current_index
        elif self.mode == Mode.spectrum:
            x, y = self.device_thread.x, self.device_thread.y
            self.scene_creator.scene.frequencies = x
            self.scene_creator.plot_data = y
            if x is None or y is None:
                return

        self.scene_creator.init_scene()
        self.scene_creator.show_full_scene()
        self.ui.graphicsView.update()
Ejemplo n.º 2
0
    def update_view(self):
        self.ui.sliderYscale.setValue(int(
            self.graphics_view.transform().m22()))

        txt = self.ui.txtEditErrors.toPlainText()
        new_errors = self.device.read_errors()

        if "No devices found for" in new_errors:
            self.device.stop_on_error("Could not establish connection to USRP")
            Errors.usrp_ip_not_found()

            self.on_clear_clicked()

        elif "OSError" in new_errors:
            self.device.stop_on_error("OSError")
            self.on_clear_clicked()

        elif "FATAL: No supported devices found" in new_errors or \
                        "HACKRF_ERROR_NOT_FOUND" in new_errors or \
                        "HACKRF_ERROR_LIBUSB" in new_errors:
            self.device.stop_on_error(
                "Could not establish connection to HackRF")
            Errors.hackrf_not_found()
            self.on_clear_clicked()

        elif "No module named gnuradio" in new_errors:
            self.device.stop_on_error("Did not find gnuradio.")
            Errors.gnuradio_not_installed()
            self.on_clear_clicked()

        elif "RTLSDR-open: Error Code: -1" in new_errors:
            self.device.stop_on_error("Could not open a RTL-SDR device.")
            self.on_clear_clicked()

        elif "Address already in use" in new_errors:
            self._restart_device_thread()

        if len(new_errors) > 1:
            self.ui.txtEditErrors.setPlainText(txt + new_errors)

        self.ui.progressBar.setValue(self.device.current_index)

        self.ui.lSamplesCaptured.setText("{0:n}".format(
            self.device.current_index))
        self.ui.lSignalSize.setText(
            locale.format_string("%.2f",
                                 (8 * self.device.current_index) / (1024**2)))
        self.ui.lTime.setText(
            locale.format_string(
                "%.2f", self.device.current_index / self.device.sample_rate))

        if self.device.current_index == 0:
            return False

        return True
Ejemplo n.º 3
0
    def on_rcv_timer_timeout(self):
        new_errors = self.rcv_device.read_errors()
        self.qt_signals.sniff_device_errors_changed.emit(new_errors)
        if "No devices found for" in new_errors:
            self.rcv_device.stop("Could not establish connection to USRP")
            Errors.usrp_ip_not_found()
            self.stop()

        elif "FATAL: No supported devices found" in new_errors or \
                        "HACKRF_ERROR_NOT_FOUND" in new_errors:
            self.rcv_device.stop("Could not establish connection to HackRF")
            Errors.hackrf_not_found()
            self.stop()

        elif "No module named gnuradio" in new_errors:
            self.rcv_device.stop("Did not find gnuradio.")
            Errors.gnuradio_not_installed()
            self.stop()

        elif "Address already in use" in new_errors:
            self.rcv_device.port += 1
            self.stop()
            self.sniff()