mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-25 17:28:50 -05:00
Web API: updated examples
This commit is contained in:
parent
1fd5c48d62
commit
44c2c16e18
@ -20,9 +20,12 @@ def getInputOptions():
|
||||
parser.add_option("-a", "--address", dest="address", help="address and port", metavar="ADDRESS", type="string")
|
||||
parser.add_option("-d", "--device-index", dest="device_index", help="device set index", metavar="INDEX", type="int")
|
||||
parser.add_option("-D", "--device-hwid", dest="device_hwid", help="device hardware id", metavar="HWID", type="string")
|
||||
parser.add_option("-F", "--device-freq", dest="device_freq", help="device center frequency (Hz)", metavar="FREQ", type="int")
|
||||
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 <address>[:<port>]", metavar="IP:PORT", type="string")
|
||||
parser.add_option("-A", "--antenna-path", dest="antenna_path", help="antenna path index", metavar="INDEX", type="int")
|
||||
parser.add_option("-s", "--sample-rate", dest="sample_rate", help="device to host sample rate (kS/s)", metavar="RATE", type="int")
|
||||
parser.add_option("-c", "--create", dest="create", help="create a new device set", metavar="CREATE", action="store_true", default=False)
|
||||
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
@ -30,17 +33,23 @@ def getInputOptions():
|
||||
options.address = "127.0.0.1:8091"
|
||||
|
||||
if options.device_index == None:
|
||||
options.device_index = 1
|
||||
options.device_index = 0
|
||||
|
||||
if options.device_hwid == None:
|
||||
options.device_hwid = "FileSource"
|
||||
|
||||
if options.device_freq == None:
|
||||
options.device_freq = 435000000
|
||||
options.device_freq = 435000
|
||||
|
||||
if options.channel_freq == None:
|
||||
options.channel_freq = 0
|
||||
|
||||
if options.antenna_path == None:
|
||||
options.antenna_path = 0
|
||||
|
||||
if options.sample_rate == None:
|
||||
options.sample_rate = 2600
|
||||
|
||||
return options
|
||||
|
||||
# ======================================================================
|
||||
@ -74,6 +83,7 @@ def main():
|
||||
global base_url
|
||||
base_url = "http://%s/sdrangel" % options.address
|
||||
|
||||
if options.create:
|
||||
r = callAPI("/deviceset", "POST", {"tx": 0}, None, "Add Rx device set")
|
||||
if r is None:
|
||||
exit(-1)
|
||||
@ -89,11 +99,11 @@ def main():
|
||||
exit(-1)
|
||||
|
||||
if options.device_hwid == "LimeSDR":
|
||||
settings["limeSdrInputSettings"]["antennaPath"] = 1
|
||||
settings["limeSdrInputSettings"]["devSampleRate"] = 1600000
|
||||
settings["limeSdrInputSettings"]["antennaPath"] = options.antenna_path
|
||||
settings["limeSdrInputSettings"]["devSampleRate"] = options.sample_rate*1000
|
||||
settings["limeSdrInputSettings"]["log2HardDecim"] = 4
|
||||
settings["limeSdrInputSettings"]["log2SoftDecim"] = 3
|
||||
settings["limeSdrInputSettings"]["centerFrequency"] = options.device_freq + 500000
|
||||
settings["limeSdrInputSettings"]["centerFrequency"] = options.device_freq*1000 + 500000
|
||||
settings["limeSdrInputSettings"]["ncoEnable"] = 1
|
||||
settings["limeSdrInputSettings"]["ncoFrequency"] = -500000
|
||||
settings["limeSdrInputSettings"]["lpfBW"] = 1450000
|
||||
@ -101,17 +111,17 @@ def main():
|
||||
settings["limeSdrInputSettings"]["lpfFIREnable"] = 1
|
||||
settings['limeSdrInputSettings']['dcBlock'] = 1
|
||||
elif options.device_hwid == "RTLSDR":
|
||||
settings['rtlSdrSettings']['devSampleRate'] = 1024000
|
||||
settings['rtlSdrSettings']['centerFrequency'] = options.device_freq
|
||||
settings['rtlSdrSettings']['devSampleRate'] = options.sample_rate*1000
|
||||
settings['rtlSdrSettings']['centerFrequency'] = options.device_freq*1000
|
||||
settings['rtlSdrSettings']['gain'] = 496
|
||||
settings['rtlSdrSettings']['log2Decim'] = 4
|
||||
settings['rtlSdrSettings']['dcBlock'] = 1
|
||||
settings['rtlSdrSettings']['agc'] = 1
|
||||
elif options.device_hwid == "HackRF":
|
||||
settings['hackRFInputSettings']['LOppmTenths'] = -51
|
||||
settings['hackRFInputSettings']['centerFrequency'] = options.device_freq
|
||||
settings['hackRFInputSettings']['centerFrequency'] = options.device_freq*1000
|
||||
settings['hackRFInputSettings']['dcBlock'] = 1
|
||||
settings['hackRFInputSettings']['devSampleRate'] = 2600000
|
||||
settings['hackRFInputSettings']['devSampleRate'] = options.sample_rate*1000
|
||||
settings['hackRFInputSettings']['lnaExt'] = 1
|
||||
settings['hackRFInputSettings']['lnaGain'] = 32
|
||||
settings['hackRFInputSettings']['log2Decim'] = 4
|
||||
|
@ -25,6 +25,8 @@ def getInputOptions():
|
||||
parser.add_option("-U", "--copy-to-udp", dest="udp_copy", help="UDP audio copy to <address>[:<port>]", metavar="IP:PORT", type="string")
|
||||
parser.add_option("-s", "--sample-rate-rx", dest="sample_rate_rx", help="device to host (Rx) sample rate (kS/s)", metavar="RATE", type="int")
|
||||
parser.add_option("-S", "--sample-rate-tx", dest="sample_rate_tx", help="host to device (Tx) sample rate (kS/s)", metavar="RATE", type="int")
|
||||
parser.add_option("-n", "--antenna-path-rx", dest="antenna_path_rx", help="antenna path index (Rx)", metavar="INDEX", type="int")
|
||||
parser.add_option("-N", "--antenna-path-tx", dest="antenna_path_tx", help="antenna path index (Tx)", metavar="INDEX", type="int")
|
||||
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
@ -49,6 +51,12 @@ def getInputOptions():
|
||||
if options.sample_rate_tx == None:
|
||||
options.sample_rate_tx = 2600
|
||||
|
||||
if options.antenna_path_rx == None:
|
||||
options.antenna_path_rx = 0
|
||||
|
||||
if options.antenna_path_tx == None:
|
||||
options.antenna_path_tx = 0
|
||||
|
||||
return options
|
||||
|
||||
# ======================================================================
|
||||
@ -107,7 +115,7 @@ def main():
|
||||
exit(-1)
|
||||
|
||||
if options.device_hwid_rx == "LimeSDR":
|
||||
settings["limeSdrInputSettings"]["antennaPath"] = 1
|
||||
settings["limeSdrInputSettings"]["antennaPath"] = options.antenna_path_rx
|
||||
settings["limeSdrInputSettings"]["devSampleRate"] = options.sample_rate_rx*1000
|
||||
settings["limeSdrInputSettings"]["log2HardDecim"] = 4
|
||||
settings["limeSdrInputSettings"]["log2SoftDecim"] = 3
|
||||
@ -188,7 +196,7 @@ def main():
|
||||
exit(-1)
|
||||
|
||||
if options.device_hwid_tx == "LimeSDR":
|
||||
settings["limeSdrOutputSettings"]["antennaPath"] = options.antenna_path
|
||||
settings["limeSdrOutputSettings"]["antennaPath"] = options.antenna_path_tx
|
||||
settings["limeSdrOutputSettings"]["devSampleRate"] = options.sample_rate_tx*1000
|
||||
settings["limeSdrOutputSettings"]["log2HardInterp"] = 4
|
||||
settings["limeSdrOutputSettings"]["log2SoftInterp"] = 4
|
||||
|
@ -20,10 +20,11 @@ def getInputOptions():
|
||||
parser.add_option("-a", "--address", dest="address", help="address and port", metavar="ADDRESS", type="string")
|
||||
parser.add_option("-d", "--device-index", dest="device_index", help="device set index", metavar="INDEX", type="int")
|
||||
parser.add_option("-D", "--device-hwid", dest="device_hwid", help="device hardware id", metavar="HWID", type="string")
|
||||
parser.add_option("-F", "--device-freq", dest="device_freq", help="device center frequency (Hz)", metavar="FREQ", type="int")
|
||||
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("-s", "--sample-rate", dest="sample_rate", help="host to device sample rate (kS/s)", metavar="RATE", type="int")
|
||||
parser.add_option("-A", "--antenna-path", dest="antenna_path", help="antenna path number", metavar="NUMBER", type="int")
|
||||
parser.add_option("-c", "--create", dest="create", help="create a new device set", metavar="CREATE", action="store_true", default=False)
|
||||
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
@ -37,7 +38,7 @@ def getInputOptions():
|
||||
options.device_hwid = "FileSource"
|
||||
|
||||
if options.device_freq == None:
|
||||
options.device_freq = 435000000
|
||||
options.device_freq = 435000
|
||||
|
||||
if options.channel_freq == None:
|
||||
options.channel_freq = 0
|
||||
@ -81,6 +82,7 @@ def main():
|
||||
global base_url
|
||||
base_url = "http://%s/sdrangel" % options.address
|
||||
|
||||
if options.create:
|
||||
r = callAPI("/deviceset", "POST", {"tx": 1}, None, "Add Tx device set")
|
||||
if r is None:
|
||||
exit(-1)
|
||||
@ -99,10 +101,10 @@ def main():
|
||||
|
||||
if options.device_hwid == "LimeSDR":
|
||||
settings["limeSdrOutputSettings"]["antennaPath"] = options.antenna_path
|
||||
settings["limeSdrOutputSettings"]["devSampleRate"] = options.sample_rate * 1000
|
||||
settings["limeSdrOutputSettings"]["devSampleRate"] = options.sample_rate*1000
|
||||
settings["limeSdrOutputSettings"]["log2HardInterp"] = 4
|
||||
settings["limeSdrOutputSettings"]["log2SoftInterp"] = 4
|
||||
settings["limeSdrOutputSettings"]["centerFrequency"] = options.device_freq + 500000
|
||||
settings["limeSdrOutputSettings"]["centerFrequency"] = options.device_freq*1000 + 500000
|
||||
settings["limeSdrOutputSettings"]["ncoEnable"] = 1
|
||||
settings["limeSdrOutputSettings"]["ncoFrequency"] = -500000
|
||||
settings["limeSdrOutputSettings"]["lpfBW"] = 4050000
|
||||
@ -110,8 +112,8 @@ def main():
|
||||
settings["limeSdrOutputSettings"]["lpfFIREnable"] = 1
|
||||
elif options.device_hwid == "HackRF":
|
||||
settings['hackRFOutputSettings']['LOppmTenths'] = -51
|
||||
settings['hackRFOutputSettings']['centerFrequency'] = options.device_freq
|
||||
settings['hackRFOutputSettings']['devSampleRate'] = options.sample_rate * 1000
|
||||
settings['hackRFOutputSettings']['centerFrequency'] = options.device_freq*1000
|
||||
settings['hackRFOutputSettings']['devSampleRate'] = options.sample_rate*1000
|
||||
settings['hackRFOutputSettings']['lnaExt'] = 0
|
||||
settings['hackRFOutputSettings']['log2Interp'] = 4
|
||||
settings['hackRFOutputSettings']['vgaGain'] = 24
|
||||
|
Loading…
Reference in New Issue
Block a user