Beispiel #1
0
def start_scanner():
    """Start a scanner thread on the first available SDR"""
    global config, RS_PATH, temporary_block_list

    if "SCAN" in autorx.task_list:
        # Already a scanner running! Return.
        logging.debug(
            "Task Manager - Attempted to start a scanner, but one already running."
        )
        return

    # Attempt to allocate a SDR.
    _device_idx = allocate_sdr(task_description="Scanner")
    if _device_idx is None:
        logging.debug("Task Manager - No SDRs free to run Scanner.")
        return
    else:
        # Create entry in task list.
        autorx.task_list["SCAN"] = {"device_idx": _device_idx, "task": None}

        # Init Scanner using settings from the global config.
        # TODO: Nicer way of passing in the huge list of args.
        autorx.task_list["SCAN"]["task"] = SondeScanner(
            callback=autorx.scan_results.put,
            auto_start=True,
            min_freq=config["min_freq"],
            max_freq=config["max_freq"],
            search_step=config["search_step"],
            only_scan=config["only_scan"],
            always_scan=config["always_scan"],
            never_scan=config["never_scan"],
            snr_threshold=config["snr_threshold"],
            min_distance=config["min_distance"],
            quantization=config["quantization"],
            scan_dwell_time=config["scan_dwell_time"],
            scan_delay=config["scan_delay"],
            detect_dwell_time=config["detect_dwell_time"],
            max_peaks=config["max_peaks"],
            rs_path=RS_PATH,
            sdr_power=config["sdr_power"],
            sdr_fm=config["sdr_fm"],
            device_idx=_device_idx,
            gain=autorx.sdr_list[_device_idx]["gain"],
            ppm=autorx.sdr_list[_device_idx]["ppm"],
            bias=autorx.sdr_list[_device_idx]["bias"],
            save_detection_audio=config["save_detection_audio"],
            temporary_block_list=temporary_block_list,
            temporary_block_time=config["temporary_block_time"],
        )

        # Add a reference into the sdr_list entry
        autorx.sdr_list[_device_idx]["task"] = autorx.task_list["SCAN"]["task"]

    # Indicate to the web client that the task list has been updated.
    flask_emit_event("task_event")
Beispiel #2
0
def start_scanner():
    """ Start a scanner thread on the first available SDR """
    global config, RS_PATH, temporary_block_list

    if 'SCAN' in autorx.task_list:
        # Already a scanner running! Return.
        logging.debug(
            "Task Manager - Attempted to start a scanner, but one already running."
        )
        return

    # Attempt to allocate a SDR.
    _device_idx = allocate_sdr(task_description="Scanner")
    if _device_idx is None:
        logging.debug("Task Manager - No SDRs free to run Scanner.")
        return
    else:
        # Create entry in task list.
        autorx.task_list['SCAN'] = {'device_idx': _device_idx, 'task': None}

        # Init Scanner using settings from the global config.
        # TODO: Nicer way of passing in the huge list of args.
        autorx.task_list['SCAN']['task'] = SondeScanner(
            callback=autorx.scan_results.put,
            auto_start=True,
            min_freq=config['min_freq'],
            max_freq=config['max_freq'],
            search_step=config['search_step'],
            whitelist=config['whitelist'],
            greylist=config['greylist'],
            blacklist=config['blacklist'],
            snr_threshold=config['snr_threshold'],
            min_distance=config['min_distance'],
            quantization=config['quantization'],
            scan_dwell_time=config['scan_dwell_time'],
            detect_dwell_time=config['detect_dwell_time'],
            max_peaks=config['max_peaks'],
            rs_path=RS_PATH,
            sdr_power=config['sdr_power'],
            sdr_fm=config['sdr_fm'],
            device_idx=_device_idx,
            gain=autorx.sdr_list[_device_idx]['gain'],
            ppm=autorx.sdr_list[_device_idx]['ppm'],
            bias=autorx.sdr_list[_device_idx]['bias'],
            save_detection_audio=config['save_detection_audio'],
            temporary_block_list=temporary_block_list,
            temporary_block_time=config['temporary_block_time'])

        # Add a reference into the sdr_list entry
        autorx.sdr_list[_device_idx]['task'] = autorx.task_list['SCAN']['task']

    # Indicate to the web client that the task list has been updated.
    flask_emit_event('task_event')