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()
def __parse_error_messages(self, messages): messages = messages.lower() if "no devices found for" in messages: self.device.stop_on_error("Could not establish connection to USRP") Errors.usrp_found() self.on_clear_clicked() elif any(e in messages for e in ("hackrf_error_not_found", "hackrf_error_libusb")): 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 messages: self.device.stop_on_error("Did not find gnuradio.") Errors.gnuradio_not_installed() self.on_clear_clicked() elif "rtlsdr-open: error code: -1" in messages: self.device.stop_on_error("Could not open a RTL-SDR device.") self.on_clear_clicked() elif "rtlsdr-open: error code: -12" in messages: self.device.stop_on_error("Could not open a RTL-SDR device") Errors.rtlsdr_sdr_driver() self.on_clear_clicked() elif "Address already in use" in messages: self._restart_device_thread()
def __parse_error_messages(self, messages): messages = messages.lower() if "no devices found for" in messages: self.device.stop_on_error("Could not establish connection to USRP") Errors.usrp_found() self.on_clear_clicked() elif any(e in messages for e in ("hackrf_error_not_found", "hackrf_error_libusb")): 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 messages: self.device.stop_on_error("Did not find gnuradio.") Errors.gnuradio_not_installed() self.on_clear_clicked() elif "rtlsdr-open: error code: -1" in messages: self.device.stop_on_error("Could not open a RTL-SDR device.") self.on_clear_clicked() elif "rtlsdr-open: error code: -12" in messages: self.device.stop_on_error("Could not open a RTL-SDR device") Errors.rtlsdr_sdr_driver() self.on_clear_clicked() elif "Address already in use" in messages: self._restart_device_thread()
def update_view(self): try: self.ui.sliderYscale.setValue( int(self.graphics_view.transform().m22())) except AttributeError: return txt = self.ui.txtEditErrors.toPlainText() new_messages = self.device.read_messages() if "No devices found for" in new_messages: self.device.stop_on_error("Could not establish connection to USRP") Errors.usrp_found() self.on_clear_clicked() elif "FATAL: No supported devices found" in new_messages or \ "HACKRF_ERROR_NOT_FOUND" in new_messages or \ "HACKRF_ERROR_LIBUSB" in new_messages: 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_messages: 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_messages: self.device.stop_on_error("Could not open a RTL-SDR device.") self.on_clear_clicked() elif "Address already in use" in new_messages: self._restart_device_thread() if len(new_messages) > 1: self.ui.txtEditErrors.setPlainText(txt + new_messages) 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.is_rx and self.device.data is not None and len( self.device.data) > 0: self.ui.labelReceiveBufferFull.setText("{0}%".format( int(100 * self.device.current_index / len(self.device.data)))) if self.device.current_index == 0: return False return True
def update_view(self): try: self.ui.sliderYscale.setValue(int(self.graphics_view.transform().m22())) except AttributeError: return txt = self.ui.txtEditErrors.toPlainText() new_messages = self.device.read_messages() if "No devices found for" in new_messages: self.device.stop_on_error("Could not establish connection to USRP") Errors.usrp_found() self.on_clear_clicked() elif any(e in new_messages for e in ("HACKRF_ERROR_NOT_FOUND", "HACKRF_ERROR_LIBUSB")): 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_messages: 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_messages: self.device.stop_on_error("Could not open a RTL-SDR device.") self.on_clear_clicked() elif "Address already in use" in new_messages: self._restart_device_thread() if len(new_messages) > 1: self.ui.txtEditErrors.setPlainText(txt + new_messages) 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.is_rx and self.device.data is not None and len(self.device.data) > 0: self.ui.labelReceiveBufferFull.setText("{0}%".format(int(100 * self.device.current_index / len(self.device.data)))) if self.device.current_index == 0: return False return True
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 "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 "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
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()