diff --git a/scriptsapi/Readme.md b/scriptsapi/Readme.md index 36a3a09b9..5073bae39 100644 --- a/scriptsapi/Readme.md +++ b/scriptsapi/Readme.md @@ -58,6 +58,18 @@ In this example we have a Rx device on index 0 and a Tx device on index 1. All s Important: you should initiate switch over by stopping the active device and not by starting the other. +

qo100_datv.py

+ +Quick control of configuration for receiving QO-100 DATV to rapidly follow spotted activity on [BATC web sdr](https://eshail.batc.org.uk/wb/) + +Options are: + - `-h` or `--help` show this help message and exit + - `-a` or `--address` address and port of SDRangel instance API. Default: 127.0.0.1:8091 + - `-d` or `--device` index of device set. Default 0 + - `-c` or `--channel` index of DATV demod channel. Default 0 + - `-f` or `--frequency` device center frequency (kHz). Mandatory. Ex: 491500 + - `-s` or `--symbol-rate` symbol rate (kS/s). Mandatory. Ex: 1500 +

config.py

Sends a sequence of commands recorded in a JSON file which is in the form of a list of commands. @@ -289,4 +301,4 @@ Holds constants related to SDRangel software required by other scripts Run as `python ` in the virtual environment - - `test_superscanner.py` is testing `superscanner.py` \ No newline at end of file + - `test_superscanner.py` is testing `superscanner.py` diff --git a/scriptsapi/qo100_datv.py b/scriptsapi/qo100_datv.py new file mode 100755 index 000000000..92a402334 --- /dev/null +++ b/scriptsapi/qo100_datv.py @@ -0,0 +1,171 @@ +#!/usr/bin/env python3 +""" +Quick control of configuration for receiving QO-100 DATV +""" + +import requests, traceback, sys, json, time +from optparse import OptionParser +import sdrangel + +base_url_pattern = "http://{0}/sdrangel" +base_url = None + +# ====================================================================== +def getInputOptions(): + """ Parse options """ +# ---------------------------------------------------------------------- + parser = OptionParser(usage="usage: %%prog [-t]\n") + parser.add_option("-a", "--address", dest="address", help="Address and port. Default: 127.0.0.1:8091", metavar="ADDRESS", type="string") + parser.add_option("-d", "--device", dest="device_index", help="Index of device set. Default 0", metavar="INT", type="int") + parser.add_option("-c", "--channel", dest="channel_index", help="Index of DATV demod channel. Default 0", metavar="INT", type="int") + parser.add_option("-f", "--frequency", dest="frequency", help="Device center frequency (kHz). Mandatory", metavar="INT", type="int") + parser.add_option("-s", "--symbol-rate", dest="symbol_rate", help="Symbol rate (kS/s). Mandatory", metavar="INT", type="int") + + (options, args) = parser.parse_args() + + if options.address is None: + options.address = "127.0.0.1:8091" + if options.device_index is None: + options.device_index = 0 + if options.channel_index is None: + options.channel_index = 0 + if options.frequency is None: + raise RuntimeError("Frequency (-f or --frequency) is mandatory") + if options.symbol_rate is None: + raise RuntimeError("Symbol rate (-s or --symbol-rate) is mandatory") + + return options + +# ====================================================================== +def change_center_frequency(content, new_frequency): + """ Change center frequency searching recursively """ +# ---------------------------------------------------------------------- + for k in content: + if isinstance(content[k], dict): + change_center_frequency(content[k], new_frequency) + elif k == "centerFrequency": + content[k] = new_frequency + +# ====================================================================== +def change_decim(content, new_decim): + """ Change log2 decimation searching recursively """ +# ---------------------------------------------------------------------- + for k in content: + if isinstance(content[k], dict): + change_decim(content[k], new_decim) + elif k == "log2Decim": + content[k] = new_decim + +# ====================================================================== +def change_rfbw(content, new_rfbw): + """ Change RF bandwidth searching recursively """ +# ---------------------------------------------------------------------- + for k in content: + if isinstance(content[k], dict): + change_rfbw(content[k], new_rfbw) + elif k == "rfBandwidth": + content[k] = new_rfbw + +# ====================================================================== +def change_symbol_rate(content, new_symbol_rate): + """ Change symbol rate searching recursively """ +# ---------------------------------------------------------------------- + for k in content: + if isinstance(content[k], dict): + change_symbol_rate(content[k], new_symbol_rate) + elif k == "symbolRate": + content[k] = new_symbol_rate + +# ====================================================================== +def get_device_sr_and_decim(hwtype, settings): + """ Return device sample rate and decimation """ +# ---------------------------------------------------------------------- + if hwtype == "Airspy" or hwtype == "AirspyHF": + sr_index = settings.get("devSampleRateIndex", 0) + if sr_index == 1: + sr = 3000000 + else: + sr = 6000000 + log2_decim = settings.get("log2Decim", 0) + else: + sr = settings.get("devSampleRate", 0) + log2_decim = settings.get("log2Decim", 0) + return sr, 1<