feature/9128_change_radio_endpoints #3
@ -1,5 +1,6 @@
|
||||
#! /usr/bin/env python3
|
||||
|
||||
import routes
|
||||
import os
|
||||
import sys
|
||||
import requests
|
||||
@ -18,7 +19,7 @@ swag = Swagger(app)
|
||||
radios = {}
|
||||
|
||||
|
||||
@app.route("/GetReport")
|
||||
@app.route(routes.endpoint_routes["b"])
|
||||
def report():
|
||||
"""Get streams report from the RTSP relay.
|
||||
---
|
||||
@ -40,7 +41,7 @@ def report():
|
||||
return _error_message_json(e.message), 500
|
||||
|
||||
|
||||
@app.route("/radio/report")
|
||||
@app.route(routes.endpoint_routes["a"])
|
||||
def radio_report():
|
||||
"""List radio devices available to the system.
|
||||
---
|
||||
@ -86,7 +87,7 @@ def connect(radio):
|
||||
return "Radio device not found", 400
|
||||
|
||||
|
||||
# TODO: reset might use this
|
||||
@app.route(routes.endpoint_routes["f"])
|
||||
def disconnect(radio):
|
||||
"""Disconnect from a radio device.
|
||||
---
|
||||
@ -112,7 +113,7 @@ def disconnect(radio):
|
||||
|
||||
|
||||
# TODO: add post parameters...
|
||||
@app.route("ALEModem/Configure")
|
||||
@app.route(routes.endpoint_routes["c"])
|
||||
def configure():
|
||||
"""Tune the radio to a frequency.
|
||||
You must connect to the radio before attempting to configure it.
|
||||
@ -141,7 +142,7 @@ def configure():
|
||||
return _error_message_json("Radio not connected"), 400
|
||||
|
||||
|
||||
@app.route("ALEModem/StartCall")
|
||||
@app.route(routes.endpoint_routes["d"])
|
||||
def start_stream(radio):
|
||||
"""Start the radio stream.
|
||||
Once the stream has been started, connect to the stream at:
|
||||
@ -159,6 +160,9 @@ def start_stream(radio):
|
||||
400:
|
||||
description: JSON with error message.
|
||||
"""
|
||||
if id is not None:
|
||||
_start_tuuube_stream(id)
|
||||
else:
|
||||
try:
|
||||
radios[radio].start_stream()
|
||||
return jsonify("message", "successfully started radio stream"), 200
|
||||
@ -166,7 +170,7 @@ def start_stream(radio):
|
||||
return _error_message_json(e.message), 400
|
||||
|
||||
|
||||
@app.route("ALEModem/EndCall")
|
||||
@app.route(routes.endpoint_routes["e"])
|
||||
def end_stream(radio):
|
||||
"""Terminate the radio stream.
|
||||
---
|
||||
@ -182,6 +186,9 @@ def end_stream(radio):
|
||||
400:
|
||||
description: JSON with error message.
|
||||
"""
|
||||
if id is not None:
|
||||
_end_tuuube_stream(id)
|
||||
else:
|
||||
try:
|
||||
radios[radio].end_stream()
|
||||
return jsonify("message", "successfully ended radio stream"), 200
|
||||
@ -189,7 +196,7 @@ def end_stream(radio):
|
||||
return _error_message_json(e.message), 400
|
||||
|
||||
|
||||
@app.route("/info")
|
||||
@app.route(routes.endpoint_routes["g"])
|
||||
def radio_info(radio):
|
||||
"""Get information about a radio.
|
||||
---
|
||||
@ -214,8 +221,7 @@ def radio_info(radio):
|
||||
tubes = {}
|
||||
|
||||
|
||||
@app.route("/tuuube/<id>/start")
|
||||
def start_tuuube_stream(id):
|
||||
def _start_tuuube_stream(id):
|
||||
"""Start streaming from a youtube source.
|
||||
Once the stream has been started, connect to the stream at:
|
||||
rtsp://[host]:8554/tuuube/[id]
|
||||
@ -248,8 +254,7 @@ def start_tuuube_stream(id):
|
||||
return _error_message_json(e.message), 400
|
||||
|
||||
|
||||
@app.route("/tuuube/<id>/end")
|
||||
def end_tuuube_stream(id):
|
||||
def _end_tuuube_stream(id):
|
||||
"""Terminate the youtube stream.
|
||||
---
|
||||
parameters:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user
Expand this to have default routes so that the program can function without the data being supplied. I think the correct way to do this is:
route_path_ainstead of the empty string<filename>.[json|yml|whatever]exists in the current directory, then:That way we can actually use the microservice outside of the SDE, but if we are inside the SDE with the actual path details (supplied with the config file) then we can interact with the rest of the system.