FaradayRF / Faraday-Software

Faraday node software
https://www.faradayrf.com
Other
48 stars 19 forks source link

Proxy Requires UART Telemetry to Create Queues #60

Closed kb1lqc closed 7 years ago

kb1lqc commented 7 years ago

In most cases this is only an issue if you configure Faraday to update over UART with a long interval ( >5 seconds could get annoying). The symptoms are:

Regardless, this is poor design. Proxy should know what's connected and what to expect prior to any data being sent down over USB.

kb1lqc commented 7 years ago

It seems like this is still an issue https://github.com/FaradayRF/Faraday-Software/blob/master/Proxy/proxy.py#L69

kb1lqc commented 7 years ago

Looking into items related to this. I've programmed a Faraday Radio to send UART packets every 15 seconds and am attempting to view the root page of the proxy flask server. This results in an error:

$ faraday-proxy --start
2017-11-04 17:15:16,178 - Proxy - INFO - Starting proxy server
2017-11-04 17:15:17,203 - Proxy - INFO - Started server on Bryce-PC:10010
2017-11-04 17:15:17,203 - Proxy - INFO - Started server on Bryce-PC:10000
[2017-11-04 17:15:27,101] ERROR in app: Exception on / [GET]
Traceback (most recent call last):
  File "c:\users\bryce\documents\github\kb1lqc-software\venv\lib\site-packages\flask\app.py", line 1982, in wsgi_app
    response = self.full_dispatch_request()
  File "c:\users\bryce\documents\github\kb1lqc-software\venv\lib\site-packages\flask\app.py", line 1614, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "c:\users\bryce\documents\github\kb1lqc-software\venv\lib\site-packages\flask\app.py", line 1517, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "c:\users\bryce\documents\github\kb1lqc-software\venv\lib\site-packages\flask\app.py", line 1612, in full_dispatch_request
    rv = self.dispatch_request()
  File "c:\users\bryce\documents\github\kb1lqc-software\venv\lib\site-packages\flask\app.py", line 1598, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "c:\users\bryce\documents\github\kb1lqc-software\faraday\proxy.py", line 773, in proxy
    callsign = request.args.get("callsign").upper()
AttributeError: 'NoneType' object has no attribute 'upper'
kb1lqc commented 7 years ago

Fixed this in c50fe71 by separating the .upper() conversion from detection of a None type for callsign. Also added default None types to the other parameters.

            data = request.get_json(force=False)  # Requires HTTP JSON header
            port = request.args.get("port")
            callsign = request.args.get("callsign")
            nodeid = request.args.get("nodeid")

            # Convert callsign to uppercase
            if callsign:
                callsign = callsign.upper()
kb1lqc commented 7 years ago

Fixed with PR #283