diff --git a/swagger/sdrangel/examples/add_channel.py b/swagger/sdrangel/examples/add_channel.py index 4de12f9cc..ee35a6b4a 100644 --- a/swagger/sdrangel/examples/add_channel.py +++ b/swagger/sdrangel/examples/add_channel.py @@ -36,7 +36,7 @@ def main(): global base_url base_url = "http://%s/sdrangel" % options.address device_url = base_url + ("/deviceset/%d/channel" % options.device_index) - r = requests.post(url=device_url, json={"tx": 0, "channelType": options.channel_id}) + r = requests.post(url=device_url, json={"direction": 0, "channelType": options.channel_id}) if r.status_code / 100 == 2: print("Success") print json.dumps(r.json(), indent=4, sort_keys=True) diff --git a/swagger/sdrangel/examples/limesdr_tx.py b/swagger/sdrangel/examples/limesdr_tx.py index fa20ab6d1..d6fa7be62 100644 --- a/swagger/sdrangel/examples/limesdr_tx.py +++ b/swagger/sdrangel/examples/limesdr_tx.py @@ -65,13 +65,13 @@ def main(): global base_url base_url = "http://%s/sdrangel" % options.address - r = callAPI("/deviceset", "POST", {"tx": 1}, None, "Add Tx device set") + r = callAPI("/deviceset", "POST", {"direction": 1}, None, "Add Tx device set") if r is None: exit(-1) deviceset_url = "/deviceset/%d" % options.device_index - r = callAPI(deviceset_url + "/device", "PUT", None, {"hwType": "LimeSDR", "tx": 1}, "setup LimeSDR on Tx device set") + r = callAPI(deviceset_url + "/device", "PUT", None, {"hwType": "LimeSDR", "direction": 1}, "setup LimeSDR on Tx device set") if r is None: exit(-1) @@ -91,7 +91,7 @@ def main(): if r is None: exit(-1) - r = callAPI(deviceset_url + "/channel", "POST", None, {"channelType": "NFMMod", "tx": 1}, "Create NFM mod") + r = callAPI(deviceset_url + "/channel", "POST", None, {"channelType": "NFMMod", "direction": 1}, "Create NFM mod") if r is None: exit(-1) diff --git a/swagger/sdrangel/examples/nfm_test.py b/swagger/sdrangel/examples/nfm_test.py index 09ea421d2..aa58d561f 100644 --- a/swagger/sdrangel/examples/nfm_test.py +++ b/swagger/sdrangel/examples/nfm_test.py @@ -61,7 +61,7 @@ def main(): global base_url base_url = "http://%s/sdrangel" % options.address - settings = callAPI("/deviceset/0/channel", "POST", None, {"channelType": "NFMDemod", "tx": 0}, "Create NFM demod") + settings = callAPI("/deviceset/0/channel", "POST", None, {"channelType": "NFMDemod", "direction": 0}, "Create NFM demod") if settings is None: exit(-1) @@ -72,11 +72,11 @@ def main(): if r is None: exit(-1) - r = callAPI("/deviceset", "POST", {"tx": 1}, None, "Add Tx device set") + r = callAPI("/deviceset", "POST", {"direction": 1}, None, "Add Tx device set") if r is None: exit(-1) - settings = callAPI("/deviceset/1/channel", "POST", None, {"channelType": "NFMMod", "tx": 1}, "Create NFM mod") + settings = callAPI("/deviceset/1/channel", "POST", None, {"channelType": "NFMMod", "direction": 1}, "Create NFM mod") if settings is None: exit(-1) diff --git a/swagger/sdrangel/examples/ptt.py b/swagger/sdrangel/examples/ptt.py index 5960f531f..611a23f1f 100755 --- a/swagger/sdrangel/examples/ptt.py +++ b/swagger/sdrangel/examples/ptt.py @@ -1,13 +1,13 @@ #!/usr/bin/env python ''' PTT (Push To Talk) script example. - + Assumes Rx and Tx are contiguous device sets with Rx at index i and Tx at index i+1 - - When going from Rx to Tx (push) the device set index specified must be the Rx one + + When going from Rx to Tx (push) the device set index specified must be the Rx one When going from Tx to Rx (release) the device set index specified must be the Tx one - Defaults are Rx at index 0 and Tx at index 1 - + Defaults are Rx at index 0 and Tx at index 1 + Default web API base address is http://127.0.0.1:8091/sdrangel (default of sdrangel web API) You may change the address and port portion with the -a parameter. Ex: -a 44.168.40.128:8888 ''' @@ -105,7 +105,7 @@ def main(): if deviceSets is not None: if len(deviceSets) > 1: if options.transmit: - if deviceSets[options.deviceset_index]["samplingDevice"]["tx"] == 0 and deviceSets[options.deviceset_index + 1]["samplingDevice"]["tx"] == 1: + if deviceSets[options.deviceset_index]["samplingDevice"]["direction"] == 0 and deviceSets[options.deviceset_index + 1]["samplingDevice"]["direction"] == 1: stopDevice(options.deviceset_index) time.sleep(1) startDevice(options.deviceset_index + 1) @@ -113,7 +113,7 @@ def main(): else: print("Incorrect configuration expecting Rx%d and Tx%d" % (options.deviceset_index, options.deviceset_index + 1)) else: - if deviceSets[options.deviceset_index - 1]["samplingDevice"]["tx"] == 0 and deviceSets[options.deviceset_index]["samplingDevice"]["tx"] == 1: + if deviceSets[options.deviceset_index - 1]["samplingDevice"]["direction"] == 0 and deviceSets[options.deviceset_index]["samplingDevice"]["direction"] == 1: stopDevice(options.deviceset_index) time.sleep(1) startDevice(options.deviceset_index - 1) diff --git a/swagger/sdrangel/examples/ptt_active.py b/swagger/sdrangel/examples/ptt_active.py index 654c01849..310f2dfc5 100644 --- a/swagger/sdrangel/examples/ptt_active.py +++ b/swagger/sdrangel/examples/ptt_active.py @@ -158,12 +158,12 @@ def device_run(deviceset_index): ''' Reply with the expected reply of a working device ''' # ---------------------------------------------------------------------- originator_index = None - tx = None + direction = None content = request.get_json(silent=True) if content: originator_index = content.get('originatorIndex') - tx = content.get('tx') - if originator_index is None or tx is None: + direction = content.get('direction') + if originator_index is None or direction is None: print('device_run: SDRangel reverse API v4.5.2 or higher required. No or invalid originator information') return "" sdrangel_ip = get_sdrangel_ip(request) @@ -174,7 +174,7 @@ def device_run(deviceset_index): global RUNNING print(f'device_run: Device: {originator_index} Other device: {other_device_index} Running: {RUNNING}') if request.method == 'POST': - print(f'device_run: Device {originator_index} (tx={tx}) has started at {sdrangel_ip}:{SDRANGEL_API_PORT}') + print(f'device_run: Device {originator_index} (direction={direction}) has started at {sdrangel_ip}:{SDRANGEL_API_PORT}') if originator_index not in RUNNING: RUNNING.add(originator_index) if other_device_index in RUNNING: @@ -186,7 +186,7 @@ def device_run(deviceset_index): reply = { "state": "idle" } return jsonify(reply) elif request.method == 'DELETE': - print(f'device_run: Device {originator_index} (tx={tx}) has stopped at {sdrangel_ip}:{SDRANGEL_API_PORT}') + print(f'device_run: Device {originator_index} (direction={direction}) has stopped at {sdrangel_ip}:{SDRANGEL_API_PORT}') if originator_index in RUNNING: RUNNING.remove(originator_index) if other_device_index not in RUNNING: diff --git a/swagger/sdrangel/examples/randomize_colors.py b/swagger/sdrangel/examples/randomize_colors.py index ba3d26417..eb3611339 100755 --- a/swagger/sdrangel/examples/randomize_colors.py +++ b/swagger/sdrangel/examples/randomize_colors.py @@ -41,65 +41,65 @@ def getInputOptions(): def get_channel_static_data(channel_info): if channel_info["id"] == "AMDemod": settings_key = "AMDemodSettings" - tx = 0 + direction = 0 elif channel_info["id"] == "AMMod": settings_key = "AMModSettings" - tx = 1 + direction = 1 elif channel_info["id"] == "ATVMod": settings_key = "ATVModSettings" - tx = 1 + direction = 1 elif channel_info["id"] == "BFMDemod": settings_key = "BFMDemodSettings" - tx = 0 + direction = 0 elif channel_info["id"] == "DSDDemod": settings_key = "DSDDemodSettings" - tx = 0 + direction = 0 elif channel_info["id"] == "NFMDemod": settings_key = "NFMDemodSettings" - tx = 0 + direction = 0 elif channel_info["id"] == "NFMMod": settings_key = "NFMModSettings" - tx = 1 + direction = 1 elif channel_info["id"] == "RemoteSink": settings_key = "RemoteSinkSettings" - tx = 0 + direction = 0 elif channel_info["id"] == "RemoteSource": settings_key = "RemoteSourceSettings" - tx = 1 + direction = 1 elif channel_info["id"] == "SSBMod": settings_key = "SSBModSettings" - tx = 1 + direction = 1 elif channel_info["id"] == "SSBDemod": settings_key = "SSBDemodSettings" - tx = 0 + direction = 0 elif channel_info["id"] == "UDPSource": settings_key = "UDPSourceSettings" - tx = 1 + direction = 1 elif channel_info["id"] == "UDPSink": settings_key = "UDPSinkSettings" - tx = 0 + direction = 0 elif channel_info["id"] == "WFMDemod": settings_key = "WFMDemodSettings" - tx = 0 + direction = 0 elif channel_info["id"] == "WFMMod": settings_key = "WFMModSettings" - tx = 1 + direction = 1 else: settings_key = None - tx = None - return settings_key, tx + direction = None + return settings_key, direction # ====================================================================== def randomize_channels_colors(options, channels): for channel_info in channels: - settings_key, tx = get_channel_static_data(channel_info) + settings_key, direction = get_channel_static_data(channel_info) if settings_key is None: continue color = random.randint(0, (1<<24)) rn, gn, bn = color_to_rgb(color) payload_json = { "channelType": channel_info["id"], - "tx": tx, + "direction": direction, settings_key: { "rgbColor": color } @@ -114,7 +114,7 @@ def randomize_channels_colors(options, channels): # ====================================================================== def randomize_channels_hsv(options, channels): for channel_info in channels: - settings_key, tx = get_channel_static_data(channel_info) + settings_key, direction = get_channel_static_data(channel_info) settings_url = base_url + ("/deviceset/{0}/channel/{1}/settings".format(options.device_index, channel_info["index"])) rep = requests.get(url=settings_url) if rep.status_code / 100 == 2: @@ -139,7 +139,7 @@ def randomize_channels_hsv(options, channels): new_color = rgb_to_color(rn, gn, bn) payload_json = { "channelType": channel_info["id"], - "tx": tx, + "direction": direction, settings_key: { "rgbColor": new_color } diff --git a/swagger/sdrangel/examples/rtlsdr_settings.py b/swagger/sdrangel/examples/rtlsdr_settings.py index 069c8a5a9..a07d7ce84 100644 --- a/swagger/sdrangel/examples/rtlsdr_settings.py +++ b/swagger/sdrangel/examples/rtlsdr_settings.py @@ -49,7 +49,7 @@ def getRtlSdrSettings(): def patchRtlSdrSettings(settings): - new_settings = {"deviceHwType": "RTLSDR", "tx": 0, "rtlSdrSettings": settings} + new_settings = {"deviceHwType": "RTLSDR", "direction": 0, "rtlSdrSettings": settings} r = requests.patch(url=base_url + "/deviceset/0/device/settings", json=new_settings) if r.status_code / 100 == 2: print json.dumps(r.json(), indent=4, sort_keys=True) diff --git a/swagger/sdrangel/examples/rx_test.py b/swagger/sdrangel/examples/rx_test.py index aa6026dd1..5a2a34826 100755 --- a/swagger/sdrangel/examples/rx_test.py +++ b/swagger/sdrangel/examples/rx_test.py @@ -53,7 +53,7 @@ def getInputOptions(): parser.add_option("--rmt-address", dest="remote_address", help="RemoteSink: destination data address", metavar="IP_ADDRESS", type="string") parser.add_option("--rmt-port", dest="remote_port", help="RemoteSink: destination data port", metavar="PORT", type="int") parser.add_option("--rmt-fec", dest="remote_fec", help="RemoteSink: number of FEC blocks per frame", metavar="NUMBER", type="int") - parser.add_option("--rmt-tx-delay", dest="remote_tx_delay", help="RemoteSink: inter block UDP Tx delay percentage", metavar="PERCENT", type="int") + parser.add_option("--rmt-txdelay", dest="remote_tx_delay", help="RemoteSink: inter block UDP Tx delay percentage", metavar="PERCENT", type="int") (options, args) = parser.parse_args() @@ -134,7 +134,7 @@ def setup_audio(options): # ====================================================================== def setupDevice(deviceset_url, options): - r = callAPI(deviceset_url + "/device", "PUT", None, {"hwType": "%s" % options.device_hwid, "tx": 0}, "setup device on Rx device set") + r = callAPI(deviceset_url + "/device", "PUT", None, {"hwType": "%s" % options.device_hwid, "direction": 0}, "setup device on Rx device set") if r is None: exit(-1) @@ -245,7 +245,7 @@ def setupDevice(deviceset_url, options): def setupChannel(deviceset_url, options): i = 0 - settings = callAPI(deviceset_url + "/channel", "POST", None, {"channelType": options.channel_id, "tx": 0}, "Create demod") + settings = callAPI(deviceset_url + "/channel", "POST", None, {"channelType": options.channel_id, "direction": 0}, "Create demod") if settings is None: exit(-1) @@ -349,7 +349,7 @@ def main(): deviceset_url = "/deviceset/%d" % options.device_index if options.create: - r = callAPI("/deviceset", "POST", {"tx": 0}, None, "Add Rx device set") + r = callAPI("/deviceset", "POST", {"direction": 0}, None, "Add Rx device set") if r is None: exit(-1) diff --git a/swagger/sdrangel/examples/rx_tx_test.py b/swagger/sdrangel/examples/rx_tx_test.py index bb6516450..e52c2ca7c 100644 --- a/swagger/sdrangel/examples/rx_tx_test.py +++ b/swagger/sdrangel/examples/rx_tx_test.py @@ -19,15 +19,15 @@ def getInputOptions(): parser = OptionParser(usage="usage: %%prog [-t]\n") parser.add_option("-a", "--address", dest="address", help="address and port", metavar="ADDRESS", type="string") - parser.add_option("-R", "--device-hwid-rx", dest="device_hwid_rx", help="device hardware id for Rx", metavar="HWID", type="string") - parser.add_option("-T", "--device-hwid-tx", dest="device_hwid_tx", help="device hardware id for Tx", metavar="HWID", type="string") + parser.add_option("-R", "--device-hwidrx", dest="device_hwid_rx", help="device hardware id for Rx", metavar="HWID", type="string") + parser.add_option("-T", "--device-hwidtx", dest="device_hwid_tx", help="device hardware id for Tx", metavar="HWID", type="string") parser.add_option("-F", "--device-freq", dest="device_freq", help="device center frequency (kHz)", metavar="FREQ", type="int") parser.add_option("-f", "--channel-freq", dest="channel_freq", help="channel center frequency (Hz)", metavar="FREQ", type="int") parser.add_option("-U", "--copy-to-udp", dest="udp_copy", help="UDP audio copy to
[: