feature/9128_change_radio_endpoints #3

Open
john.sitarski wants to merge 2 commits from feature/9128_change_radio_endpoints into main
Showing only changes of commit 4bde801d6a - Show all commits

View File

@ -18,7 +18,7 @@ swag = Swagger(app)
radios = {} radios = {}
@app.route("/report") @app.route("/GetReport")
def report(): def report():
"""Get streams report from the RTSP relay. """Get streams report from the RTSP relay.
--- ---
@ -53,7 +53,6 @@ def radio_report():
return jsonify(devices) return jsonify(devices)
@app.route("/radio/<radio>/connect")
Review

Don't remove this endpoint until the rest of the code handles connecting automatically to connected USB devices. We can add that feature and then remove this route in the same PR (different from this one).

Don't remove this endpoint until the rest of the code handles connecting automatically to connected USB devices. We can add that feature and then remove this route in the same PR (different from this one).
def connect(radio): def connect(radio):
"""Connect to a radio device, by driver name or serial number. """Connect to a radio device, by driver name or serial number.
--- ---
@ -87,7 +86,7 @@ def connect(radio):
return "Radio device not found", 400 return "Radio device not found", 400
@app.route("/radio/<radio>/disconnect") # TODO: reset might use this
def disconnect(radio): def disconnect(radio):
"""Disconnect from a radio device. """Disconnect from a radio device.
--- ---
@ -112,8 +111,9 @@ def disconnect(radio):
return _error_message_json("Radio not connected"), 400 return _error_message_json("Radio not connected"), 400
@app.route("/radio/<radio>/configure/<frequency>") # TODO: add post parameters...
def configure(radio, frequency): @app.route("ALEModem/Configure")
def configure():
"""Tune the radio to a frequency. """Tune the radio to a frequency.
You must connect to the radio before attempting to configure it. You must connect to the radio before attempting to configure it.
The radio must be configured before streaming can be started. The radio must be configured before streaming can be started.
@ -141,7 +141,7 @@ def configure(radio, frequency):
return _error_message_json("Radio not connected"), 400 return _error_message_json("Radio not connected"), 400
@app.route("/radio/<radio>/start") @app.route("ALEModem/StartCall")
def start_stream(radio): def start_stream(radio):
"""Start the radio stream. """Start the radio stream.
Once the stream has been started, connect to the stream at: Once the stream has been started, connect to the stream at:
@ -166,7 +166,7 @@ def start_stream(radio):
return _error_message_json(e.message), 400 return _error_message_json(e.message), 400
@app.route("/radio/<radio>/end") @app.route("ALEModem/EndCall")
def end_stream(radio): def end_stream(radio):
"""Terminate the radio stream. """Terminate the radio stream.
--- ---
@ -186,11 +186,10 @@ def end_stream(radio):
radios[radio].end_stream() radios[radio].end_stream()
return jsonify("message", "successfully ended radio stream"), 200 return jsonify("message", "successfully ended radio stream"), 200
except Exception as e: except Exception as e:
error_message = {"error_message": e.message}
return _error_message_json(e.message), 400 return _error_message_json(e.message), 400
@app.route("/radio/<radio>/info") @app.route("/info")
def radio_info(radio): def radio_info(radio):
"""Get information about a radio. """Get information about a radio.
--- ---