1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-26 17:58:43 -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: else:
print "Error HTTP:", r.status_code 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(): def main():
hwType = getHwType() hwType = getHwType()
if hwType and hwType != "RTLSDR": if hwType is not None:
if hwType != "RTLSDR":
if not selectRtlSdr(): if not selectRtlSdr():
return return
else:
return
settings = getRtlSdrSettings() settings = getRtlSdrSettings()
if settings is not None: if settings is not None:
settings["agc"] = 1 settings["agc"] = 1
settings["dcBlock"] = 1
settings["gain"] = 445
settings["centerFrequency"] = 467350000
patchRtlSdrSettings(settings) patchRtlSdrSettings(settings)
deviceRun(True)
if __name__ == "__main__": if __name__ == "__main__":
main() main()