sdrangel/swagger/sdrangel/examples
f4exb eef1ce9a64 Web API: implemented instanceDVSerialGet 2018-08-02 23:05:53 +02:00
..
Readme.md Fix spelling errors in documentation 2018-04-21 18:45:09 -07:00
add_channel.py Web API: replaced status code 200 by 202 whenever an asynchronous message is enqueued 2017-12-21 18:10:43 +01:00
devicesets_config.py Web API: implemented instanceDVSerialGet 2018-08-02 23:05:53 +02:00
limesdr_tx.py Web API: LimeSDR Tx example: have device set index as a parameter 2017-12-27 09:19:23 +01:00
nfm_test.py Web API: changed /sdrangel/devicesets POST,DELETE to /sdrangel/deviceset to reflect that it applies to a single device set 2017-12-22 01:07:03 +01:00
ptt.py Commands: corrected edit command dialog focus handling to capture associated key 2018-01-06 05:51:14 +01:00
rtlsdr_settings.py Web API: replaced status code 200 by 202 whenever an asynchronous message is enqueued 2017-12-21 18:10:43 +01:00
rx_test.py Server: added PlutoSDR input plugin 2018-05-29 20:27:36 +02:00
rx_tx_test.py Web API: updated examples 2018-01-07 23:29:55 +01:00
scanner.py Web API: fixes in BFM demod and HackRF input 2018-05-25 02:02:21 +02:00
start_stop.py Web API: replaced status code 200 by 202 whenever an asynchronous message is enqueued 2017-12-21 18:10:43 +01:00
stop_server.py Web API: replaced status code 200 by 202 whenever an asynchronous message is enqueued 2017-12-21 18:10:43 +01:00
tx_test.py Web API: fixed tx_test 2018-05-26 22:39:50 +02:00

Readme.md

Examples of client scripts

These are all Python scripts using python-requests so you have to install this package as a prerequisite either with your package manager or pip. They are designed for Python 2.7 but may work with Python 3 possibly with minimal changes.

add_channel.py

Adds a channel to a device set specifying device set index and channel type.

  • Operation ID: devicesetChannelPost
  • URI: /sdrangel/deviceset/{deviceSetIndex}/channel
  • HTTP method: POST

devicesets_config.py

Example of building an entire configuration with 3 device sets using presets to configure each one of the device sets then start streaming on all of them.

It uses the following APIs:

  • To select a device in a device set:
    • Operation ID: devicesetDevicePut
    • URI: /sdrangel/deviceset/{deviceSetIndex}/device
    • HTTP method: PUT
  • To load a preset in a device set:
    • Operation ID: instancePresetPatch
    • URI: /sdrangel/preset
    • HTTP method: PATCH
  • To create a new device set:
    • OperationID: instanceDeviceSetPost
    • URI: /sdrangel/deviceset
    • HTTP method: POST
  • Activate the DV serial dongle support for digital voice modes
    • OperationID: instanceDVSerialPatch
    • URI: /sdrangel/dvserial
    • HTTP method: PATCH
  • Start a device streaming
    • OperationID: devicesetDeviceRunPost
    • URI: /sdrangel/deviceset/{deviceSetIndex}/device/run
    • HTTP method: POST

limesdr_tx.py

Create a Tx device set with a LimeSDR Tx device and a NFM modulator channel configured to send some beacon Morse code. Then starts the Tx.

It uses the following APIs:

  • To create a new device set:
    • OperationID: instanceDeviceSetPost
    • URI: /sdrangel/deviceset
    • HTTP method: POST
  • To select a device in a device set:
    • Operation ID: devicesetDevicePut
    • URI: /sdrangel/deviceset/{deviceSetIndex}/device
    • HTTP method: PUT
  • To create a new channel:
    • Operation ID: devicesetChannelPost
    • URI: /sdrangel/deviceset/{deviceSetIndex}/channel
    • HTTP method: POST
  • To change the settings of a channel:
    • OperationID: devicesetChannelSettingsPatch
    • URI: /sdrangel/deviceset/{deviceSetIndex}/channel/{channelIndex}/settings
    • HTTP method: PATCH
  • Start a device streaming
    • OperationID: devicesetDeviceRunPost
    • URI: /sdrangel/deviceset/{deviceSetIndex}/device/run
    • HTTP method: POST

nfm_test.py

Example of creating NFM channels (demodulator and modulator) and changing the settings

It uses the following APIs:

  • To create a new channel:
    • Operation ID: devicesetChannelPost
    • URI: /sdrangel/deviceset/{deviceSetIndex}/channel
    • HTTP method: POST
  • To create a new device set:
    • OperationID: instanceDeviceSetsPost
    • URI: /sdrangel/devicesets
    • HTTP method: POST
  • To change the settings of a channel:
    • OperationID: devicesetChannelSettingsPatch
    • URI: /sdrangel/deviceset/{deviceSetIndex}/channel/{channelIndex}/settings
    • HTTP method: PATCH

ptt.py

Implements a basic push to talk (PTT) feature. Verifies that devise set #0 is a Rx and that #1 is a Tx. Stops streaming on one device and start streaming on the other depending on the PTT move (Rx to Tx or Tx to Rx).

It uses the following APIs:

  • Get information on device sets:
    • Operation ID: instanceDeviceSetsGet
    • URI: /sdrangel/devicesets
    • HTTP method: GET
  • Start a device streaming
    • OperationID: devicesetDeviceRunPost
    • URI: /sdrangel/deviceset/{deviceSetIndex}/device/run
    • HTTP method: POST
  • Stop a device streaming
    • OperationID: devicesetDeviceRunDelete
    • URI: /sdrangel/deviceset/{deviceSetIndex}/device/run
    • HTTP method: DELETE

rtlsdr_settings.py

Make sure a RTLSDR device is selected on device set #0. Get and change the settings of this RTLSDR device.

It uses the following APIs:

  • Get information on a device set:
    • Operation ID: devicesetGet
    • URI: /sdrangel/deviceset/{deviceSetIndex}
    • HTTP method: GET
  • To select a device in a device set:
    • Operation ID: devicesetDevicePut
    • URI: /sdrangel/deviceset/{deviceSetIndex}/device
    • HTTP method: PUT
  • To get the settings of a device:
    • OperationID: devicesetDeviceSettingsGet
    • URI: /sdrangel/deviceset/{deviceSetIndex}/device/settings
    • HTTP method: GET
  • To change the settings of a device:
    • OperationID: devicesetDeviceSettingsPatch
    • URI: /sdrangel/deviceset/{deviceSetIndex}/device/settings
    • HTTP method: PATCH

rx_test.py

Sets specified Rx in existing source device set or create a new source device set with this Rx. Adds an NFM demodulator channel.

It uses the following APIs:

  • Create a new device set:
    • Operation ID: devicesetPost
    • URI: /sdrangel/deviceset
    • HTTP method: POST
  • Get information on a device set:
    • Operation ID: devicesetGet
    • URI: /sdrangel/deviceset/{deviceSetIndex}
    • HTTP method: GET
  • To select a device in a device set:
    • Operation ID: devicesetDevicePut
    • URI: /sdrangel/deviceset/{deviceSetIndex}/device
    • HTTP method: PUT
  • To get the settings of a device:
    • OperationID: devicesetDeviceSettingsGet
    • URI: /sdrangel/deviceset/{deviceSetIndex}/device/settings
    • HTTP method: GET
  • To change the settings of a device:
    • OperationID: devicesetDeviceSettingsPatch
    • URI: /sdrangel/deviceset/{deviceSetIndex}/device/settings
    • HTTP method: PATCH
  • To create a new channel:
    • Operation ID: devicesetChannelPost
    • URI: /sdrangel/deviceset/{deviceSetIndex}/channel
    • HTTP method: POST
  • To get the settings of a channel:
    • OperationID: devicesetChannelSettingsGet
    • URI: /sdrangel/deviceset/{deviceSetIndex}/channel/{channelIndex}/settings
    • HTTP method: GET
  • To change the settings of a channel:
    • OperationID: devicesetChannelSettingsPatch
    • URI: /sdrangel/deviceset/{deviceSetIndex}/channel/{channelIndex}/settings
    • HTTP method: PATCH
  • Start a device streaming
    • OperationID: devicesetDeviceRunPost
    • URI: /sdrangel/deviceset/{deviceSetIndex}/device/run
    • HTTP method: POST

rx_tx_test.py

Combines rx_test and tx_test to create a pair of source and sink device sets. The APIs used are the same as in rx_test or tx_test.

scanner.py

Simple AM and NFM scanner with multiple equally spaced channels. Stops whenever any of the channels squelch opens. At the moment the following sampling devices can be used:

  • AirspyHF
  • HackRF
  • LimeSDR
  • RTLSDR

Check ./scanner.py --help for the options.

Requires numpy

☞ Try to first run with the -m (mock) option to see what the scanner parameters will be. In particular pay attention to the computed sample rate that should be within range for your hardware. For devices with fixed or discrete rates make sure the computed sample rate does not exceed the unique device sample rate or the highest possible sample rate.

In addition to some APIs being used in other script it uses:

  • Get channels reports:
    • Operation ID: devicesetChannelsReportGet
    • URI: /sdrangel/deviceset/{deviceSetIndex}/channels/report
    • HTTP method: GET

start_stop.py

Starts or stops a device in the specified device set

It uses the following APIs:

  • Get information on device sets:
    • Operation ID: instanceDeviceSetsGet
    • URI: /sdrangel/devicesets
    • HTTP method: GET
  • Start a device streaming
    • OperationID: devicesetDeviceRunPost
    • URI: /sdrangel/deviceset/{deviceSetIndex}/device/run
    • HTTP method: POST
  • Stop a device streaming
    • OperationID: devicesetDeviceRunDelete
    • URI: /sdrangel/deviceset/{deviceSetIndex}/device/run
    • HTTP method: DELETE

stop_server.py

This works with a server instance only i.e. sdrangelsrv. It will shutdown the instance nicely as you would do with the exit menu or Ctl-Q in the GUI application.

It uses this API:

  • Stop a server instance
    • OperationID: instanceDelete
    • URI: /sdrangel
    • HTTP method: DELETE

tx_test.py

Sets specified Tx in existing sink device set or create a new sink device set with this Tx. Adds an NFM modulator channel.

It uses the following APIs:

  • Create a new device set:
    • Operation ID: devicesetPost
    • URI: /sdrangel/deviceset
    • HTTP method: POST
  • Get information on a device set:
    • Operation ID: devicesetGet
    • URI: /sdrangel/deviceset/{deviceSetIndex}
    • HTTP method: GET
  • To select a device in a device set:
    • Operation ID: devicesetDevicePut
    • URI: /sdrangel/deviceset/{deviceSetIndex}/device
    • HTTP method: PUT
  • To get the settings of a device:
    • OperationID: devicesetDeviceSettingsGet
    • URI: /sdrangel/deviceset/{deviceSetIndex}/device/settings
    • HTTP method: GET
  • To change the settings of a device:
    • OperationID: devicesetDeviceSettingsPatch
    • URI: /sdrangel/deviceset/{deviceSetIndex}/device/settings
    • HTTP method: PATCH
  • To create a new channel:
    • Operation ID: devicesetChannelPost
    • URI: /sdrangel/deviceset/{deviceSetIndex}/channel
    • HTTP method: POST
  • To get the settings of a channel:
    • OperationID: devicesetChannelSettingsGet
    • URI: /sdrangel/deviceset/{deviceSetIndex}/channel/{channelIndex}/settings
    • HTTP method: GET
  • To change the settings of a channel:
    • OperationID: devicesetChannelSettingsPatch
    • URI: /sdrangel/deviceset/{deviceSetIndex}/channel/{channelIndex}/settings
    • HTTP method: PATCH
  • Start a device streaming
    • OperationID: devicesetDeviceRunPost
    • URI: /sdrangel/deviceset/{deviceSetIndex}/device/run
    • HTTP method: POST