Esempio n. 1
0
    def __process_event(self, queue):
        event = queue.get()
        status = event.data.get_status()
        arg1 = event.data.get_arg1()
        arg2 = event.data.get_arg2()

        if status == Event.STARTING:
            print "Starting"
        elif status == Event.STEPS:
            self.stepsTotal = (arg1 + 1) * 2
            self.steps = self.stepsTotal
        elif status == Event.INFO:
            if arg2 != -1:
                self.settings.devicesRtl[self.settings.indexRtl].tuner = arg2
        elif status == Event.DATA:
            cal = self.settings.devicesRtl[self.settings.indexRtl].calibration
            freq, scan = self.queueScan.get()
            process = ThreadProcess(self.queueNotify,
                                    freq, scan, cal,
                                    self.settings.nfft,
                                    self.settings.overlap,
                                    self.settings.winFunc)
            process.start()
            self.__progress()
        elif status == Event.ERROR:
            print "Error: {}".format(arg2)
            exit(1)
        elif status == Event.PROCESSED:
            offset = self.settings.devicesRtl[self.settings.indexRtl].offset
            Thread(target=update_spectrum, name='Update',
                   args=(self.queueNotify, self.lock,
                         self.settings.start,
                         self.settings.stop,
                         arg1,
                         offset,
                         self.spectrum,
                         not self.settings.retainScans,
                         False)).start()
        elif status == Event.UPDATED:
            self.__progress()
        elif status == Event.LOC:
            if len(self.spectrum) > 0:
                self.locations[max(self.spectrum)] = (arg2[0],
                                                      arg2[1],
                                                      arg2[2])
        elif status == Event.LOC_ERR:
            print '{}'.format(arg2)
            exit(1)

        return status
Esempio n. 2
0
    def __process_event(self, queue):
        event = queue.get()
        status = event.data.get_status()
        arg1 = event.data.get_arg1()
        arg2 = event.data.get_arg2()

        if status == Event.STARTING:
            print "Starting"
        elif status == Event.STEPS:
            self.stepsTotal = (arg1 + 1) * 2
            self.steps = self.stepsTotal
        elif status == Event.INFO:
            if arg2 != -1:
                self.settings.devicesRtl[self.settings.indexRtl].tuner = arg2
        elif status == Event.DATA:
            cal = self.settings.devicesRtl[self.settings.indexRtl].calibration
            freq, scan = self.queueScan.get()
            process = ThreadProcess(self.queueNotify, freq, scan, cal,
                                    self.settings.nfft, self.settings.overlap,
                                    self.settings.winFunc)
            process.start()
            self.__progress()
        elif status == Event.ERROR:
            print "Error: {}".format(arg2)
            exit(1)
        elif status == Event.PROCESSED:
            offset = self.settings.devicesRtl[self.settings.indexRtl].offset
            Thread(target=update_spectrum,
                   name='Update',
                   args=(self.queueNotify, self.lock, self.settings.start,
                         self.settings.stop, arg1, offset, self.spectrum,
                         not self.settings.retainScans, False)).start()
        elif status == Event.UPDATED:
            self.__progress()
        elif status == Event.LOC:
            if len(self.spectrum) > 0:
                self.locations[max(self.spectrum)] = (arg2[0], arg2[1],
                                                      arg2[2])
        elif status == Event.LOC_ERR:
            print '{}'.format(arg2)
            exit(1)

        return status