Skip to content

Commit

Permalink
Major update, now with client/server capabilities
Browse files Browse the repository at this point in the history
  • Loading branch information
Wolfrax committed Jun 3, 2017
1 parent 696bc81 commit 410f7b7
Show file tree
Hide file tree
Showing 26 changed files with 1,063 additions and 402 deletions.
1 change: 1 addition & 0 deletions .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/cssxfire.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions .idea/deployment.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/dictionaries/mm.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions .idea/spots.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/vagrant.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 36 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ The following message will be decoded:
* Comm BDS identity reply (Downlink format: 21)

Messages decoded are displayed either in a serialised format on standard output
or in a tabular format depending on preference.
or in a tabular format depending on preference. An inbuilt server is listening on port 5051 (configurable) and
enables a client to access decoded messages in json format.

Some statistics is collected.
Some statistics is collected, this data is also accessible through the server

## Dependencies

Expand Down Expand Up @@ -98,6 +99,7 @@ Configuration for spots is in `spots_config.json`. Follows json syntax with no e

* verbose logging (true/false): writes messages to spots logfile
* check crc (true/false): whether to check crc (recommended) or not
* check phase (true/false): simple check if there is a phase shift and correction
* use metric (true/false): show values in metric system or not (altitude and velocity)
* apply bit error correction (true/false): whether to try to correct bit errors or not (CPU demanding if true)
* read from file (true/false): if true, read samples from a file rather than from the USB dongle
Expand All @@ -109,14 +111,40 @@ Configuration for spots is in `spots_config.json`. Follows json syntax with no e
* log file (string): The name of the log file
* log max bytes (integer): How many bytes to log before the log file is rotated
* log backup count (integer): How many roted log files to keep
* spots server address (localhost or ip-address): the address for the server
* spots server port (5051): the server port

## Client/Server

Use nginx as proxy server with the following added to the nginx conf file

location /spots {
try_files $uri $uri/ $uri/index.html $uri.html @spots;
}

location @spots {
proxy_pass http:https://rpi2.local:8080;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
}

So, nginx will forward any http requests to spots (e.g. `http:https://www.viltstigen.se/spots`) to
`http:https://rpi2.local:8080` (spots runs on rpi2-node).

Flask is running using Gunicorn, listening on port 8080, see `emitter.py` and `spots_emitter.conf` for details.
Use `supervisor` to control processes running as daemons.
The flask application communicates with the radar application (that listen on port 5051) through a simple text
protocol, see files `emitter.py` and `server.py`

Using some html, bootstrap css and javascripts (jQuery and Highcharts), see files spots.html and spots.js, it is
possible to get this view in a web browser.

![preamble](spots.png)

## What's next?

There is probably inconsistencies, bugs, optimizations, documentation etc etc to make.
If you find something, let me know but be aware that this is a leisure thing for me.

Current directions are:

* decode more information from received messages
* do some more statistical collection
* add web server/client possibilities

0 comments on commit 410f7b7

Please sign in to comment.