1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-22 16:08:39 -05:00

Web API: updated example

This commit is contained in:
f4exb 2017-12-08 17:21:25 +01:00
parent 9c581107e8
commit a27ce7ea89

View File

@ -52,18 +52,35 @@ def patchRtlSdrSettings(settings):
else:
print "Error HTTP:", r.status_code
def deviceRun(run):
if run:
r = requests.post(url=base_url+"/deviceset/0/device/run")
else:
r = requests.delete(url=base_url+"/deviceset/0/device/run")
if r.status_code == 200:
print json.dumps(r.json(), indent=4, sort_keys=True)
else:
print "Error HTTP:", r.status_code
def main():
hwType = getHwType()
if hwType and hwType != "RTLSDR":
if hwType is not None:
if hwType != "RTLSDR":
if not selectRtlSdr():
return
else:
return
settings = getRtlSdrSettings()
if settings is not None:
settings["agc"] = 1
settings["dcBlock"] = 1
settings["gain"] = 445
settings["centerFrequency"] = 467350000
patchRtlSdrSettings(settings)
deviceRun(True)
if __name__ == "__main__":
main()