Compare commits
287 Commits
image-2019
...
image-2020
Author | SHA1 | Date | |
---|---|---|---|
d94914629f | |||
216ede189c | |||
0191ed7ad6 | |||
8036758857 | |||
41bc168a38 | |||
14ea326f43 | |||
fcc907d488 | |||
2869fc3642 | |||
dc1fb3b607 | |||
1258180805 | |||
b35958c6eb | |||
152737e8f6 | |||
840f624b21 | |||
cd1f8a7cb1 | |||
49c333b88a | |||
8fc981c8a0 | |||
4b60b7e046 | |||
92254c8c4d | |||
34312dd402 | |||
b63a991008 | |||
05af69f7b2 | |||
641907893c | |||
7e2c2ad323 | |||
4e3d6527dd | |||
5b9344dee9 | |||
6157aba1ec | |||
f06f1265d8 | |||
1f68ecd9f4 | |||
877f0e4c28 | |||
af7437ab04 | |||
f1e5e9a765 | |||
136b668f8f | |||
24032f4f5a | |||
18a63a6e7b | |||
ae98e6bc56 | |||
b142180f94 | |||
f826002ea8 | |||
12be082523 | |||
470fc43646 | |||
c12a4ecb80 | |||
ea5b5dc8fb | |||
79ab37e6a0 | |||
0f1d219002 | |||
7bf4c48733 | |||
d7aaf0d00e | |||
758b15e887 | |||
c3d89bd4bf | |||
ad5683279e | |||
14198aaa17 | |||
976c15d29a | |||
ba9a9096bf | |||
cbd87abc3d | |||
5a57648eec | |||
b7538dcdd0 | |||
aee1642ef6 | |||
ac92df2149 | |||
44c1edb2dd | |||
2ea8812fda | |||
922a5ed607 | |||
98e227c102 | |||
5a0398ceb5 | |||
ebb7398446 | |||
e0501cff0f | |||
0e528c9267 | |||
0f8c86a26c | |||
f05ac31dc4 | |||
2bb877a84b | |||
887cc3a88a | |||
52199dd800 | |||
94b486cf2e | |||
db508fc4f7 | |||
12e5d2f6f3 | |||
4859cb5db8 | |||
83ad9d616f | |||
2a0ee83c12 | |||
5379d8cc3d | |||
9187bb4371 | |||
c8c5ce8105 | |||
15d351258f | |||
5fdc5489a1 | |||
a30841cdf6 | |||
aad904f1a1 | |||
8eb067b810 | |||
108402a281 | |||
de958ca091 | |||
42828dbf65 | |||
036442aa69 | |||
e60c332c24 | |||
406d06fef2 | |||
9aa6f72152 | |||
70347d1ef9 | |||
42789ed561 | |||
092a2e5ca0 | |||
9c82a80273 | |||
57dab75832 | |||
6297b8f277 | |||
6bcdd4007a | |||
d0d0ba6ba7 | |||
550637ddef | |||
2bb2f65776 | |||
420e21b078 | |||
71b8d72da3 | |||
86ceb7a274 | |||
489d2390c8 | |||
1a3a5b43a0 | |||
e5724620a8 | |||
2c4c88e30d | |||
f92c49cee6 | |||
8371d3b67a | |||
ca4d9771cc | |||
15a2e63866 | |||
eec35f07c3 | |||
11cfca5211 | |||
46b5e9034f | |||
7793609fa4 | |||
6f9ba6c290 | |||
4d0d316fdd | |||
b5c5bcb9f1 | |||
8fe9bf6292 | |||
9923f5b18e | |||
292fe80acf | |||
5b08dae28d | |||
33dd6937b4 | |||
a34cb3db8a | |||
10de50d251 | |||
3bbcaa1329 | |||
e1d2ed8867 | |||
8ee0d7c0e8 | |||
721ac5e2a3 | |||
88a410a9c0 | |||
0e8116b743 | |||
ef1435cef7 | |||
f7ff798238 | |||
f012c1180c | |||
5a2e8d8f80 | |||
364d3473a2 | |||
1a092a1e24 | |||
8248c60aa0 | |||
f4106ee427 | |||
4e99a3ad07 | |||
57a61f0c40 | |||
61988e3297 | |||
5c8da76d9a | |||
3b32dc37c8 | |||
7a6d021e18 | |||
21cb0e8feb | |||
527eccd3c6 | |||
57ec4e09ad | |||
9164a3ed3a | |||
37086bc6c7 | |||
1d1851dc76 | |||
ac841221b6 | |||
c8ddb121d0 | |||
ba5613cf62 | |||
af4acd5623 | |||
19eb5c73e7 | |||
94ff6cc800 | |||
adf4f5a738 | |||
1e6088ca1d | |||
9d01b2306c | |||
fc8d3d8f11 | |||
15b860af36 | |||
90d990bdfb | |||
2cfeb6b6d6 | |||
42f9fb52ed | |||
11c2c8afe3 | |||
fe39c2712d | |||
b774e75f2c | |||
147c108570 | |||
53de54120e | |||
fa097bf57e | |||
917eb4fdf1 | |||
a8df774e50 | |||
0b98ce1ef2 | |||
c6bbdffea0 | |||
481918ab5b | |||
b27caf2405 | |||
d5b7338531 | |||
9246500c95 | |||
91669a7fda | |||
c7eb67129a | |||
98901ac668 | |||
7dde793f9e | |||
07de82ae82 | |||
9f710cb70e | |||
dab62a04df | |||
de51e266f6 | |||
5375580104 | |||
964d9e873d | |||
7e8e644e6c | |||
6bde623698 | |||
5ba89035b4 | |||
a9b99fa0ff | |||
6619a1b4a6 | |||
a36f106c72 | |||
097f8a2b82 | |||
bcbb911b24 | |||
f18efb2344 | |||
497d98363f | |||
367bf666fc | |||
7489a3bb9d | |||
2a6c7863b1 | |||
bf27f51049 | |||
6ba74a0c30 | |||
ada94f69c3 | |||
dc5ac081ce | |||
8a46922e77 | |||
5fdffb5e0c | |||
9f6a4891ed | |||
41d23c66a4 | |||
9163f3d30e | |||
d49fff65e4 | |||
95253e40bd | |||
af1a99c130 | |||
1638fde181 | |||
52ea2e88e9 | |||
d4d8699fc5 | |||
e8d60e2dc0 | |||
944e9df7cc | |||
cd2da582c4 | |||
1e28fc5018 | |||
a24cb3e04a | |||
13f27a76ff | |||
39120d9413 | |||
fe08228204 | |||
c7eb5c430c | |||
70e2a99274 | |||
52b945cd64 | |||
07a8e6bf92 | |||
afa322a83b | |||
d3ac44c526 | |||
5bbee1e1d7 | |||
58da0e8a60 | |||
713b6119d0 | |||
ebf2804d63 | |||
3b77753829 | |||
eb29d0ac99 | |||
6cdec05cde | |||
7ef0ef0d7c | |||
dd7d262bd3 | |||
13d7686258 | |||
91b8c55de9 | |||
00c5467a89 | |||
cc32e28b36 | |||
72329a8a2a | |||
a102ee181a | |||
778591d460 | |||
6bc928b5b6 | |||
0b2c457030 | |||
93d4e629d1 | |||
d53d3b7a51 | |||
72062c8570 | |||
de90219406 | |||
de179d070d | |||
f45857f79b | |||
eda556ef03 | |||
ea67340cab | |||
5b61f8c7a3 | |||
70d8fe82b3 | |||
fce8c294d3 | |||
8541f79ebc | |||
ec4fd401cb | |||
98217b1745 | |||
378c574eed | |||
e5193f3460 | |||
60e90575ac | |||
78ffa6f184 | |||
f9f50e734f | |||
2e75bac90c | |||
8c2f081cb0 | |||
6adbc6c291 | |||
db663fe134 | |||
2e394dc2cb | |||
b80fd9c023 | |||
3e25f1ec42 | |||
351f63f0b8 | |||
9f90d01dc6 | |||
71d815cf08 | |||
a168136102 | |||
e9f9bbb9c0 | |||
3e8e2182a8 | |||
2025ccb366 | |||
6ae934e461 | |||
7431e4d7c0 | |||
eb0f54e79d | |||
08e9520019 | |||
630a542ed6 |
6
.dockerignore
Normal file
6
.dockerignore
Normal file
@ -0,0 +1,6 @@
|
||||
.git
|
||||
.gitignore
|
||||
.idea
|
||||
**/*.pyc
|
||||
**/*.swp
|
||||
black-env
|
6
.gitignore
vendored
6
.gitignore
vendored
@ -1,3 +1,5 @@
|
||||
*.pyc
|
||||
*.swp
|
||||
**/*.pyc
|
||||
**/*.swp
|
||||
tags
|
||||
.idea
|
||||
packages
|
||||
|
115
CHANGELOG.md
Normal file
115
CHANGELOG.md
Normal file
@ -0,0 +1,115 @@
|
||||
**2020-02-08**
|
||||
- Compression, resampling and filtering in the frontend have been rewritten in javascript, sdr.js has been removed
|
||||
- Decoding of Pocsag modulation is now possible
|
||||
- Removed the 3D waterfall since it had no real application and required ~1MB of javascript code to be downloaded
|
||||
- Improved the frontend handling of the "too many users" scenario
|
||||
- PSK63 digimode is now available (same decoding pipeline as PSK31, but with adopted parameters)
|
||||
- The frequency can now be manipulated with the mousewheel, which should allow the user to tune more precise. The tuning
|
||||
step size is determined by the digit the mouse cursor is hovering over.
|
||||
- Clicking on the frequency now opens an input for direct frequency selection
|
||||
- URL hashes have been fixed and improved: They are now updated automatically, so a shared URL will include frequency
|
||||
and demodulator, which allows for improved sharing and linking.
|
||||
- New daylight scheduler for background decoding, allows profiles to be selected by local sunrise / sunset times
|
||||
- New devices supported:
|
||||
- LimeSDR (`"type": "lime_sdr"`)
|
||||
- PlutoSDR (`"type": "pluto_sdr"`)
|
||||
- RTL_SDR via Soapy (`"type": "rtl_sdr_soapy"`) on special request to allow use of the direct sampling mode
|
||||
|
||||
**2020-01-04**
|
||||
- The [owrx_connector](https://github.com/jketterl/owrx_connector) is now the default way of communicating with sdr
|
||||
devices. The old sdr types have been replaced, all `_connector` suffixes on the type must be removed!
|
||||
- The sources have been refactored, making it a lot easier to add support for other devices
|
||||
- SDR device failure handling has been improved, including user feedback
|
||||
- New devices supported:
|
||||
- FiFiSDR (`"type": "fifi_sdr"`)
|
||||
|
||||
**2019-12-15**
|
||||
- wsjt-x updated to 2.1.2
|
||||
- The rtl_tcp compatibility mode of the owrx_connector is now configurable using the `rtltcp_compat` flag
|
||||
|
||||
**2019-12-10**
|
||||
- added support for airspyhf devices (Airspy HF+ / Discovery)
|
||||
|
||||
**2019-12-05**
|
||||
- explicit device filter for soapy devices for multi-device setups
|
||||
|
||||
**2019-12-03**
|
||||
- compatibility fixes for safari browsers (ios and mac)
|
||||
|
||||
**2019-11-24**
|
||||
- There is now a new way to interface with SDR hardware, .
|
||||
They talk directly to the hardware (no rtl_sdr / rx_sdr necessary) and offer I/Q data on a socket, just like nmux
|
||||
did before. They additionally offer a control socket that allows openwebrx to control the SDR parameters directly,
|
||||
without the need for repeated restarts. This allows for quicker profile changes, and also reduces the risk of your
|
||||
SDR hardware from failing during the switchover. See `config_webrx.py` for further information and instructions.
|
||||
- Offset tuning using the `lfo_offset` has been reworked in a way that `center_freq` has to be set to the frequency you
|
||||
actually want to listen to. If you're using an `lfo_offset` already, you will probably need to change its sign.
|
||||
- `initial_squelch_level` can now be set on each profile.
|
||||
- As usual, plenty of fixes and improvements.
|
||||
|
||||
**2019-10-27**
|
||||
- Part of the frontend code has been reworked
|
||||
- Audio buffer minimums have been completely stripped. As a result, you should get better latency. Unfortunately,
|
||||
this also means there will be some skipping when audio starts.
|
||||
- Now also supports AudioWorklets (for those browser that have it). The Raspberry Pi image has been updated to include
|
||||
https due to the SecureContext requirement.
|
||||
- Mousewheel controls for the receiver sliders
|
||||
- Error handling for failed SDR devices
|
||||
|
||||
**2019-09-29**
|
||||
- One of the most-requested features is finally coming to OpenWebRX: Bookmarks (sometimes also referred to as labels).
|
||||
There's two kinds of bookmarks available:
|
||||
- Serverside bookmarks that are set up by the receiver administrator. Check the file `bookmarks.json` for examples!
|
||||
- Clientside bookmarks which every user can store for themselves. They are stored in the browser's localStorage.
|
||||
- Some more bugs in the websocket handling have been fixed.
|
||||
|
||||
**2019-09-25**
|
||||
- Automatic reporting of spots to [pskreporter](https://pskreporter.info/) is now possible. Please have a look at the
|
||||
configuration on how to set it up.
|
||||
- Websocket communication has been overhauled in large parts. It should now be more reliable, and failing connections
|
||||
should now have no impact on other users.
|
||||
- Profile scheduling allows to set up band-hopping if you are running background services.
|
||||
- APRS now has the ability to show symbols on the map, if a corresponding symbol set has been installed. Check the
|
||||
config!
|
||||
- Debug logging has been disabled in a handful of modules, expect vastly reduced output on the shell.
|
||||
|
||||
**2019-09-13**
|
||||
- New set of APRS-related features
|
||||
- Decode Packet transmissions using [direwolf](https://github.com/wb2osz/direwolf) (1k2 only for now)
|
||||
- APRS packets are mostly decoded and shown both in a new panel and on the map
|
||||
- APRS is also available as a background service
|
||||
- direwolfs I-gate functionality can be enabled, which allows your receiver to work as a receive-only I-gate for the
|
||||
APRS network in the background
|
||||
- Demodulation for background services has been optimized to use less total bandwidth, saving CPU
|
||||
- More metrics have been added; they can be used together with collectd and its curl_json plugin for now, with some
|
||||
limitations.
|
||||
|
||||
**2019-07-21**
|
||||
- Latest Features:
|
||||
- More WSJT-X modes have been added, including the new FT4 mode
|
||||
- I started adding a bandplan feature, the first thing visible is the "dial" indicator that brings you right to the
|
||||
dial frequency for digital modes
|
||||
- fixed some bugs in the websocket communication which broke the map
|
||||
|
||||
**2019-07-13**
|
||||
- Latest Features:
|
||||
- FT8 Integration (using wsjt-x demodulators)
|
||||
- New Map Feature that shows both decoded grid squares from FT8 and Locations decoded from YSF digital voice
|
||||
- New Feature report that will show what functionality is available
|
||||
- There's a new Raspbian SD Card image available (see below)
|
||||
|
||||
**2019-06-30**
|
||||
- I have done some major rework on the openwebrx core, and I am planning to continue adding more features in the near
|
||||
future. Please check this place for updates.
|
||||
- My work has not been accepted into the upstream repository, so you will need to chose between my fork and the official
|
||||
version.
|
||||
- I have enabled the issue tracker on this project, so feel free to file bugs or suggest enhancements there!
|
||||
- This version sports the following new and amazing features:
|
||||
- Support of multiple SDR devices simultaneously
|
||||
- Support for multiple profiles per SDR that allow the user to listen to different frequencies
|
||||
- Support for digital voice decoding
|
||||
- Feature detection that will disable functionality when dependencies are not available (if you're missing the digital
|
||||
buttons, this is probably why)
|
||||
- Raspbian SD Card Images and Docker builds available (see below)
|
||||
- I am currently working on the feature set for a stable release, but you are more than welcome to test development
|
||||
versions!
|
@ -1,15 +0,0 @@
|
||||
First of all, thank you for taking the time to contribute to this project!
|
||||
|
||||
Before I can accept your contributions, I need a signed copy of the Individual Contributor License Agreement (ICLA) from you, which is available <a href="ICLA.txt">here</a>.
|
||||
|
||||
The ICLA is needed because it will allow me to dual license the OpenWebRX project under AGPL and a commercial license.
|
||||
I will also apply dual licensing to csdr, but only those parts that are original work (e.g. without the parts enabled by `-DUSE_IMA_ADPCM`; code taken from other projects is clearly separable).
|
||||
|
||||
However, even if there is commercial interest in the projects, I promise to keep them as open as possible, keeping my original intention to provide an open-source web-based SDR receiver software to the amateur radio operators and SDR enthusiasts.
|
||||
|
||||
This contributor agreement is based on the one of Apache Software Foundation, with some modifications. (You can review differences <a href="https://gist.github.com/ha7ilm/9e981006d24659e336c7/revisions">here</a>).
|
||||
When you contribute for the first time, I will send you the ICLA. Replying with only the information requested and the text "I Agree" is sufficient.
|
||||
|
||||
Thanks,
|
||||
|
||||
Andras, HA7ILM
|
@ -1,5 +0,0 @@
|
||||
This is a list of the great people who contributed code to the OpenWebRX repository. (Names are sorted alphabetically.)
|
||||
|
||||
Gnoxter <gnoxter@linuxlounge.net>
|
||||
John Seamons, ZL/KF6VO <jks@jks.com>
|
||||
|
128
ICLA.txt
128
ICLA.txt
@ -1,128 +0,0 @@
|
||||
Individual Contributor License Agreement ("Agreement")
|
||||
|
||||
In order to clarify the intellectual property license granted
|
||||
with Contributions from any person or entity, Retzler András
|
||||
(hereinafter referred to as "Project Owner") must have a
|
||||
Contributor License Agreement ("CLA") on file that has
|
||||
been signed by each Contributor, indicating agreement to the license
|
||||
terms below. This license is for your protection as a Contributor as
|
||||
well as the protection of the Project Owner; it does not change your
|
||||
rights to use your own Contributions for any other purpose.
|
||||
Please read this document carefully before signing and keep a copy
|
||||
for your records.
|
||||
|
||||
Full name: ______________________________________________________
|
||||
|
||||
(optional) Public name: _________________________________________
|
||||
|
||||
Mailing Address: ________________________________________________
|
||||
|
||||
________________________________________________
|
||||
|
||||
Country: ______________________________________________________
|
||||
|
||||
(optional) Telephone: ___________________________________________
|
||||
|
||||
E-Mail: ______________________________________________________
|
||||
|
||||
You accept and agree to the following terms and conditions for Your
|
||||
present and future Contributions submitted to the Project Owner.
|
||||
|
||||
Except for the license granted herein to the Project Owner and recipients
|
||||
of software distributed by the Project Owner, You reserve all right, title,
|
||||
and interest in and to Your Contributions.
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"You" (or "Your") shall mean the copyright owner or legal entity
|
||||
authorized by the copyright owner that is making this Agreement
|
||||
with the Project Owner. For legal entities, the entity making a
|
||||
Contribution and all other entities that control, are controlled
|
||||
by, or are under common control with that entity are considered to
|
||||
be a single Contributor. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"Contribution" shall mean any original work of authorship,
|
||||
including any modifications or additions to an existing work, that
|
||||
is intentionally submitted by You to the Project Owner for inclusion
|
||||
in, or documentation of, any of the products owned or managed by
|
||||
the Project Owner (the "Work"). For the purposes of this definition,
|
||||
"submitted" means any form of electronic, verbal, or written
|
||||
communication sent to the Project Owner or its representatives,
|
||||
including but not limited to communication on electronic mailing
|
||||
lists, source code control systems, and issue tracking systems that
|
||||
are managed by, or on behalf of, the Project Owner for the purpose of
|
||||
discussing and improving the Work, but excluding communication that
|
||||
is conspicuously marked or otherwise designated in writing by You
|
||||
as "Not a Contribution."
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this Agreement, You hereby grant to the Project Owner and to
|
||||
recipients of software distributed by the Project Owner a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare derivative works of,
|
||||
publicly display, publicly perform, sublicense, and distribute Your
|
||||
Contributions and such derivative works.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this Agreement, You hereby grant to the Project Owner and to
|
||||
recipients of software distributed by the Project Owner a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have
|
||||
made, use, offer to sell, sell, import, and otherwise transfer the
|
||||
Work, where such license applies only to those patent claims
|
||||
licensable by You that are necessarily infringed by Your
|
||||
Contribution(s) alone or by combination of Your Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If any
|
||||
entity institutes patent litigation against You or any other entity
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging
|
||||
that your Contribution, or the Work to which you have contributed,
|
||||
constitutes direct or contributory patent infringement, then any
|
||||
patent licenses granted to that entity under this Agreement for
|
||||
that Contribution or Work shall terminate as of the date such
|
||||
litigation is filed.
|
||||
|
||||
4. You represent that you are legally entitled to grant the above
|
||||
license. If your employer(s) has rights to intellectual property
|
||||
that you create that includes your Contributions, you represent
|
||||
that you have received permission to make Contributions on behalf
|
||||
of that employer, that your employer has waived such rights for
|
||||
your Contributions to the Project Owner, or that your employer has
|
||||
executed a separate Corporate CLA with the Project Owner.
|
||||
|
||||
5. You represent that each of Your Contributions is Your original
|
||||
creation (see section 7 for submissions on behalf of others). You
|
||||
represent that Your Contribution submissions include complete
|
||||
details of any third-party license or other restriction (including,
|
||||
but not limited to, related patents and trademarks) of which you
|
||||
are personally aware and which are associated with any part of Your
|
||||
Contributions.
|
||||
|
||||
6. You are not expected to provide support for Your Contributions,
|
||||
except to the extent You desire to provide support. You may provide
|
||||
support for free, for a fee, or not at all. Unless required by
|
||||
applicable law or agreed to in writing, You provide Your
|
||||
Contributions on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
|
||||
OF ANY KIND, either express or implied, including, without
|
||||
limitation, any warranties or conditions of TITLE, NON-
|
||||
INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
7. Should You wish to submit work that is not Your original creation,
|
||||
You may submit it to the Project Owner separately from any
|
||||
Contribution, identifying the complete details of its source and of
|
||||
any license or other restriction (including, but not limited to,
|
||||
related patents, trademarks, and license agreements) of which you
|
||||
are personally aware, and conspicuously marking the work as
|
||||
"Submitted on behalf of a third-party: [named here]".
|
||||
|
||||
8. You agree to notify the Project Owner of any facts or circumstances of
|
||||
which you become aware that would make these representations
|
||||
inaccurate in any respect.
|
||||
|
||||
Please sign: __________________________________ Date: ________________
|
||||
|
||||
Text derived from the Apache Individual Contributor License Agreement
|
||||
("Agreement") V2.0, available at http://apache.org/licenses/icla.txt
|
113
README.md
113
README.md
@ -1,129 +1,76 @@
|
||||
OpenWebRX
|
||||
=========
|
||||
|
||||
[:floppy_disk: Setup guide for Ubuntu](http://blog.sdr.hu/2015/06/30/quick-setup-openwebrx.html) | [:blue_book: Knowledge base on the Wiki](https://github.com/simonyiszk/openwebrx/wiki/) | [:earth_americas: Receivers on SDR.hu](http://sdr.hu/)
|
||||
|
||||
OpenWebRX is a multi-user SDR receiver software with a web interface.
|
||||
|
||||

|
||||
|
||||
It has the following features:
|
||||
|
||||
- [csdr](https://github.com/simonyiszk/csdr) based demodulators (AM/FM/SSB/CW/BPSK31),
|
||||
- filter passband can be set from GUI,
|
||||
- [csdr](https://github.com/jketterl/csdr) based demodulators (AM/FM/SSB/CW/BPSK31/BPSK63)
|
||||
- filter passband can be set from GUI
|
||||
- it extensively uses HTML5 features like WebSocket, Web Audio API, and Canvas
|
||||
- it works in Google Chrome, Chromium and Mozilla Firefox
|
||||
- currently supports RTL-SDR, HackRF, SDRplay, AirSpy
|
||||
- currently supports RTL-SDR, HackRF, SDRplay, AirSpy, LimeSDR, PlutoSDR
|
||||
- Multiple SDR devices can be used simultaneously
|
||||
- [digiham](https://github.com/jketterl/digiham) based demodularors (DMR, YSF)
|
||||
- [digiham](https://github.com/jketterl/digiham) based demodularors (DMR, YSF, Pocsag)
|
||||
- [dsd](https://github.com/f4exb/dsdcc) based demodulators (D-Star, NXDN)
|
||||
- [wsjt-x](https://physics.princeton.edu/pulsar/k1jt/wsjtx.html) based demodulators (FT8, FT4, WSPR, JT65, JT9)
|
||||
|
||||
**News (2019-09-29 by DD5FJK)**
|
||||
- One of the most-requested features is finally coming to OpenWebRX: Bookmarks (sometimes also referred to as labels). There's two kinds of bookmarks available:
|
||||
- Serverside bookmarks that are set up by the receiver administrator. Check the file `bookmarks.json` for examples!
|
||||
- Clientside bookmarks which every user can store for themselves. They are stored in the browser's localStorage.
|
||||
- Some more bugs in the websocket handling have been fixed.
|
||||
|
||||
**News (2019-09-25 by DD5JFK)**
|
||||
- Automatic reporting of spots to [pskreporter](https://pskreporter.info/) is now possible. Please have a look at the configuration on how to set it up.
|
||||
- Websocket communication has been overhauled in large parts. It should now be more reliable, and failing connections should now have no impact on other users.
|
||||
- Profile scheduling allows to set up band-hopping if you are running background services.
|
||||
- APRS now has the ability to show symbols on the map, if a corresponding symbol set has been installed. Check the config!
|
||||
- Debug logging has been disabled in a handful of modules, expect vastly reduced output on the shell.
|
||||
|
||||
**News (2019-09-13 by DD5JFK)**
|
||||
- New set of APRS-related features
|
||||
- Decode Packet transmissions using [direwolf](https://github.com/wb2osz/direwolf) (1k2 only for now)
|
||||
- APRS packets are mostly decoded and shown both in a new panel and on the map
|
||||
- APRS is also available as a background service
|
||||
- direwolfs I-gate functionality can be enabled, which allows your receiver to work as a receive-only I-gate for the APRS network in the background
|
||||
- Demodulation for background services has been optimized to use less total bandwidth, saving CPU
|
||||
- More metrics have been added; they can be used together with collectd and its curl_json plugin for now, with some limitations.
|
||||
|
||||
**News (2019-07-21 by DD5JFK)**
|
||||
- Latest Features:
|
||||
- More WSJT-X modes have been added, including the new FT4 mode
|
||||
- I started adding a bandplan feature, the first thing visible is the "dial" indicator that brings you right to the dial frequency for digital modes
|
||||
- fixed some bugs in the websocket communication which broke the map
|
||||
|
||||
**News (2019-07-13 by DD5JFK)**
|
||||
- Latest Features:
|
||||
- FT8 Integration (using wsjt-x demodulators)
|
||||
- New Map Feature that shows both decoded grid squares from FT8 and Locations decoded from YSF digital voice
|
||||
- New Feature report that will show what functionality is available
|
||||
- There's a new Raspbian SD Card image available (see below)
|
||||
|
||||
**News (2019-06-30 by DD5JFK)**
|
||||
- I have done some major rework on the openwebrx core, and I am planning to continue adding more features in the near future. Please check this place for updates.
|
||||
- My work has not been accepted into the upstream repository, so you will need to chose between my fork and the official version.
|
||||
- I have enabled the issue tracker on this project, so feel free to file bugs or suggest enhancements there!
|
||||
- This version sports the following new and amazing features:
|
||||
- Support of multiple SDR devices simultaneously
|
||||
- Support for multiple profiles per SDR that allow the user to listen to different frequencies
|
||||
- Support for digital voice decoding
|
||||
- Feature detection that will disable functionality when dependencies are not available (if you're missing the digital buttons, this is probably why)
|
||||
- Raspbian SD Card Images and Docker builds available (see below)
|
||||
- I am currently working on the feature set for a stable release, but you are more than welcome to test development versions!
|
||||
|
||||
> When upgrading OpenWebRX, please make sure that you also upgrade *csdr* and *digiham*!
|
||||
|
||||
## OpenWebRX servers on SDR.hu
|
||||
|
||||
[SDR.hu](http://sdr.hu) is a site which lists the active, public OpenWebRX servers. Your receiver [can also be part of it](http://sdr.hu/openwebrx), if you want.
|
||||
|
||||

|
||||
|
||||
## Setup
|
||||
|
||||
### Raspberry Pi SD Card Images
|
||||
|
||||
Probably the quickest way to get started is to download the [latest Raspberry Pi SD Card Image](https://s3.eu-central-1.amazonaws.com/de.dd5jfk.openwebrx/2019-09-29-OpenWebRX-full.zip). It contains all the depencencies out of the box, and should work on all Raspberries up to the 3B+.
|
||||
Probably the quickest way to get started is to download the latest Raspberry Pi SD Card Image. It contains all the
|
||||
depencencies out of the box, and should work on all Raspberry Pis. It is based off the Raspbian Lite distribution,
|
||||
so [their installation instructions](https://www.raspberrypi.org/documentation/installation/installing-images/) apply.
|
||||
|
||||
This is based off the Raspbian Lite distribution, so [their installation instructions](https://www.raspberrypi.org/documentation/installation/installing-images/) apply.
|
||||
You can find the latest images [here](https://s3.eu-central-1.amazonaws.com/de.dd5jfk.openwebrx/index.html). You can
|
||||
also checkout the `nightly` folder, which has the most recent builds, albeit untested.
|
||||
|
||||
Please note: I have not updated this to include the Raspberry Pi 4 yet. (It seems to be impossible to build Rasbpian Buster images on x86 hardware right now. Stay tuned!)
|
||||
Once you have booted a Raspberry with the SD Card, it will appear in your network with the hostname "openwebrx", which
|
||||
should make it available as https://openwebrx/ on most networks. This may vary depending on your specific setup.
|
||||
|
||||
Once you have booted a Raspberry with the SD Card, it will appear in your network with the hostname "openwebrx", which should make it available as http://openwebrx:8073/ on most networks. This may vary depending on your specific setup.
|
||||
|
||||
For Digital voice, the minimum requirement right now seems to be a Rasbperry Pi 3B+. I would like to work on optimizing this for lower specs, but at this point I am not sure how much can be done.
|
||||
For Digital voice, the minimum requirement right now seems to be a Rasbperry Pi 3B+. I would like to work on optimizing
|
||||
this for lower specs, but at this point I am not sure how much can be done.
|
||||
|
||||
### Docker Images
|
||||
|
||||
For those familiar with docker, I am providing [recent builds and Releases for both x86 and arm processors on the Docker hub](https://hub.docker.com/r/jketterl/openwebrx). You can find a short introduction there.
|
||||
For those familiar with docker, I am providing
|
||||
[recent builds and Releases for both x86 and arm processors on the Docker hub](https://hub.docker.com/r/jketterl/openwebrx).
|
||||
You can find a short introduction there.
|
||||
|
||||
### Manual Installation
|
||||
|
||||
OpenWebRX currently requires Linux and python 3 to run.
|
||||
OpenWebRX currently requires Linux and python >= 3.6 to run.
|
||||
|
||||
First you will need to install the dependencies:
|
||||
|
||||
- [csdr](https://github.com/simonyiszk/csdr)
|
||||
- [csdr](https://github.com/jketterl/csdr)
|
||||
- [rtl-sdr](http://sdr.osmocom.org/trac/wiki/rtl-sdr)
|
||||
- [owrx_connector](https://github.com/jketterl/owrx_connector)
|
||||
|
||||
Optional Dependencies if you want to be able to listen do digital voice:
|
||||
Optional dependencies if you want to be able to listen do digital voice:
|
||||
|
||||
- [digiham](https://github.com/jketterl/digiham)
|
||||
- [dsd](https://github.com/f4exb/dsdcc)
|
||||
|
||||
Optional Dependency if you want to decode WSJT-X modes:
|
||||
Optional dependency if you want to decode WSJT-X modes:
|
||||
|
||||
- [wsjt-x](https://physics.princeton.edu/pulsar/k1jt/wsjtx.html)
|
||||
|
||||
[Detailed installation instructions in the Wiki](https://github.com/jketterl/openwebrx/wiki/Manual-Package-installation-(including-digital-voice))
|
||||
|
||||
After cloning this repository and connecting an RTL-SDR dongle to your computer, you can run the server:
|
||||
|
||||
./openwebrx.py
|
||||
|
||||
You can now open the GUI at <a href="http://localhost:8073">http://localhost:8073</a>.
|
||||
|
||||
Please note that the server is also listening on the following ports (on localhost only):
|
||||
|
||||
- ports 4950 to 4960 for the multi-user I/Q servers.
|
||||
|
||||
Now the next step is to customize the parameters of your server in `config_webrx.py`.
|
||||
|
||||
Actually, if you do something cool with OpenWebRX, please drop me a mail:
|
||||
*Andras Retzler, HA7ILM <randras@sdr.hu>*
|
||||
*Jakob Ketterl, DD5JFK <dd5jfk@darc.de>*
|
||||
|
||||
## Usage tips
|
||||
|
||||
@ -133,14 +80,10 @@ The filter envelope can be dragged at its ends and moved around to set the passb
|
||||
|
||||
However, if you hold down the shift key, you can drag the center line (BFO) or the whole passband (PBS).
|
||||
|
||||
## Setup tips
|
||||
|
||||
If you have any problems installing OpenWebRX, you should check out the <a href="https://github.com/simonyiszk/openwebrx/wiki">Wiki</a> about it, which has a page on the <a href="https://github.com/simonyiszk/openwebrx/wiki/Common-problems-and-their-solutions">common problems and their solutions</a>.
|
||||
|
||||
Sometimes the actual error message is not at the end of the terminal output, you may have to look at the whole output to find it.
|
||||
|
||||
## Licensing
|
||||
|
||||
OpenWebRX is available under Affero GPL v3 license (<a href="https://tldrlegal.com/license/gnu-affero-general-public-license-v3-(agpl-3.0)">summary</a>).
|
||||
OpenWebRX is available under Affero GPL v3 license
|
||||
([summary](https://tldrlegal.com/license/gnu-affero-general-public-license-v3-(agpl-3.0)).
|
||||
|
||||
OpenWebRX is also available under a commercial license on request. Please contact me at the address *<randras@sdr.hu>* for licensing options.
|
||||
OpenWebRX is also available under a commercial license on request. Please contact me at the address
|
||||
*<randras@sdr.hu>* for licensing options.
|
||||
|
@ -160,7 +160,10 @@
|
||||
{
|
||||
"name": "70cm",
|
||||
"lower_bound": 430000000,
|
||||
"upper_bound": 440000000
|
||||
"upper_bound": 440000000,
|
||||
"frequencies": {
|
||||
"pocsag": 439987500
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "23cm",
|
||||
|
282
bookmarks.json
282
bookmarks.json
@ -1,65 +1,217 @@
|
||||
[{
|
||||
"name": "DB0ZU",
|
||||
"frequency": 145725000,
|
||||
"modulation": "nfm"
|
||||
},{
|
||||
"name": "DB0ZM",
|
||||
"frequency": 145750000,
|
||||
"modulation": "nfm"
|
||||
},{
|
||||
"name": "DM0ULR",
|
||||
"frequency": 145787500,
|
||||
"modulation": "nfm"
|
||||
},{
|
||||
"name": "DB0EL",
|
||||
"frequency": 439275000,
|
||||
"modulation": "nfm"
|
||||
},{
|
||||
"name": "DB0NJ",
|
||||
"frequency": 438775000,
|
||||
"modulation": "nfm"
|
||||
},{
|
||||
"name": "DB0NJ",
|
||||
"frequency": 439437500,
|
||||
"modulation": "dmr"
|
||||
},{
|
||||
"name": "DB0UFO",
|
||||
"frequency": 438312500,
|
||||
"modulation": "dmr"
|
||||
},{
|
||||
"name": "DB0PV",
|
||||
"frequency": 438525000,
|
||||
"modulation": "ysf"
|
||||
},{
|
||||
"name": "DB0BZA",
|
||||
"frequency": 438412500,
|
||||
"modulation": "ysf"
|
||||
},{
|
||||
"name": "DB0OSH",
|
||||
"frequency": 438250000,
|
||||
"modulation": "ysf"
|
||||
},{
|
||||
"name": "DB0ULR",
|
||||
"frequency": 439325000,
|
||||
"modulation": "nfm"
|
||||
},{
|
||||
"name": "DB0ZU",
|
||||
"frequency": 438850000,
|
||||
"modulation": "nfm"
|
||||
},{
|
||||
"name": "DB0ISW",
|
||||
"frequency": 438650000,
|
||||
"modulation": "nfm"
|
||||
},{
|
||||
"name": "Radio DARC",
|
||||
"frequency": 6070000,
|
||||
"modulation": "am"
|
||||
},{
|
||||
"name": "DB0TVM",
|
||||
"frequency": 439575000,
|
||||
"modulation": "dstar"
|
||||
},{
|
||||
"name": "DB0TVM",
|
||||
"frequency": 439800000,
|
||||
"modulation": "dmr"
|
||||
}]
|
||||
[
|
||||
{
|
||||
"name": "DB0ZU",
|
||||
"frequency": 145725000,
|
||||
"modulation": "nfm"
|
||||
},
|
||||
{
|
||||
"name": "DB0ZM",
|
||||
"frequency": 145750000,
|
||||
"modulation": "nfm"
|
||||
},
|
||||
{
|
||||
"name": "DM0ULR",
|
||||
"frequency": 145787500,
|
||||
"modulation": "nfm"
|
||||
},
|
||||
{
|
||||
"name": "DB0EL",
|
||||
"frequency": 439275000,
|
||||
"modulation": "nfm"
|
||||
},
|
||||
{
|
||||
"name": "DB0NJ",
|
||||
"frequency": 438775000,
|
||||
"modulation": "nfm"
|
||||
},
|
||||
{
|
||||
"name": "DB0NJ",
|
||||
"frequency": 439437500,
|
||||
"modulation": "dmr"
|
||||
},
|
||||
{
|
||||
"name": "DB0UFO",
|
||||
"frequency": 438312500,
|
||||
"modulation": "dmr"
|
||||
},
|
||||
{
|
||||
"name": "DB0PV",
|
||||
"frequency": 438525000,
|
||||
"modulation": "ysf"
|
||||
},
|
||||
{
|
||||
"name": "DB0BZA",
|
||||
"frequency": 438412500,
|
||||
"modulation": "ysf"
|
||||
},
|
||||
{
|
||||
"name": "DB0OSH",
|
||||
"frequency": 438250000,
|
||||
"modulation": "ysf"
|
||||
},
|
||||
{
|
||||
"name": "DB0ULR",
|
||||
"frequency": 439325000,
|
||||
"modulation": "nfm"
|
||||
},
|
||||
{
|
||||
"name": "DB0ZU",
|
||||
"frequency": 438850000,
|
||||
"modulation": "nfm"
|
||||
},
|
||||
{
|
||||
"name": "DB0ISW",
|
||||
"frequency": 438650000,
|
||||
"modulation": "nfm"
|
||||
},
|
||||
{
|
||||
"name": "Radio DARC",
|
||||
"frequency": 6070000,
|
||||
"modulation": "am"
|
||||
},
|
||||
{
|
||||
"name": "DB0TVM",
|
||||
"frequency": 439575000,
|
||||
"modulation": "dstar"
|
||||
},
|
||||
{
|
||||
"name": "DB0TVM",
|
||||
"frequency": 439800000,
|
||||
"modulation": "dmr"
|
||||
},
|
||||
{
|
||||
"name": "DB0TR",
|
||||
"frequency": 438700000,
|
||||
"modulation": "nfm"
|
||||
},
|
||||
{
|
||||
"name": "DB0PME",
|
||||
"frequency": 439825000,
|
||||
"modulation": "dmr"
|
||||
},
|
||||
{
|
||||
"name": "DB0HKN",
|
||||
"frequency": 438300000,
|
||||
"modulation": "dmr"
|
||||
},
|
||||
{
|
||||
"name": "OE2XHM",
|
||||
"frequency": 438825000,
|
||||
"modulation": "nfm"
|
||||
},
|
||||
{
|
||||
"name": "DM0WW",
|
||||
"frequency": 438962500,
|
||||
"modulation": "dmr"
|
||||
},
|
||||
{
|
||||
"name": "OE7XXR",
|
||||
"frequency": 438200000,
|
||||
"modulation": "dstar"
|
||||
},
|
||||
{
|
||||
"name": "OE2XZR",
|
||||
"frequency": 439000000,
|
||||
"modulation": "dstar"
|
||||
},
|
||||
{
|
||||
"name": "DB0OAL",
|
||||
"frequency": 439912500,
|
||||
"modulation": "dmr"
|
||||
},
|
||||
{
|
||||
"name": "DB0AAT",
|
||||
"frequency": 439550000,
|
||||
"modulation": "dmr"
|
||||
},
|
||||
{
|
||||
"name": "DB0FSG",
|
||||
"frequency": 439937500,
|
||||
"modulation": "dmr"
|
||||
},
|
||||
{
|
||||
"name": "DB0ULR",
|
||||
"frequency": 145575000,
|
||||
"modulation": "nfm"
|
||||
},
|
||||
{
|
||||
"name": "DB0RDH",
|
||||
"frequency": 145737500,
|
||||
"modulation": "dstar"
|
||||
},
|
||||
{
|
||||
"name": "DM0GAP",
|
||||
"frequency": 145612500,
|
||||
"modulation": "nfm"
|
||||
},
|
||||
{
|
||||
"name": "DB0XF",
|
||||
"frequency": 145600000,
|
||||
"modulation": "nfm"
|
||||
},
|
||||
{
|
||||
"name": "DB0TOL",
|
||||
"frequency": 145712500,
|
||||
"modulation": "nfm"
|
||||
},
|
||||
{
|
||||
"name": "DB0TTB",
|
||||
"frequency": 439587500,
|
||||
"modulation": "dmr"
|
||||
},
|
||||
{
|
||||
"name": "DB0TRS",
|
||||
"frequency": 439125000,
|
||||
"modulation": "nfm"
|
||||
},
|
||||
{
|
||||
"name": "DB0OAL",
|
||||
"frequency": 438937500,
|
||||
"modulation": "nfm"
|
||||
},
|
||||
{
|
||||
"name": "DM0ULR",
|
||||
"frequency": 439337500,
|
||||
"modulation": "nxdn"
|
||||
},
|
||||
{
|
||||
"name": "DB0MIR",
|
||||
"frequency": 439300000,
|
||||
"modulation": "nfm"
|
||||
},
|
||||
{
|
||||
"name": "DB0PM",
|
||||
"frequency": 439075000,
|
||||
"modulation": "nfm"
|
||||
},
|
||||
{
|
||||
"name": "DB0CP",
|
||||
"frequency": 439025000,
|
||||
"modulation": "nfm"
|
||||
},
|
||||
{
|
||||
"name": "OE7XGR",
|
||||
"frequency": 438925000,
|
||||
"modulation": "dmr"
|
||||
},
|
||||
{
|
||||
"name": "DB0TOL",
|
||||
"frequency": 438725000,
|
||||
"modulation": "nfm"
|
||||
},
|
||||
{
|
||||
"name": "DB0OAL",
|
||||
"frequency": 438325000,
|
||||
"modulation": "dstar"
|
||||
},
|
||||
{
|
||||
"name": "DB0ROL",
|
||||
"frequency": 439237500,
|
||||
"modulation": "nfm"
|
||||
},
|
||||
{
|
||||
"name": "DB0ABX",
|
||||
"frequency": 439137500,
|
||||
"modulation": "nfm"
|
||||
}
|
||||
]
|
||||
|
26
build.sh
26
build.sh
@ -3,20 +3,14 @@ set -euxo pipefail
|
||||
|
||||
ARCH=$(uname -m)
|
||||
|
||||
case $ARCH in
|
||||
x86_64)
|
||||
BASE_IMAGE=alpine
|
||||
;;
|
||||
armv*)
|
||||
BASE_IMAGE=arm32v6/alpine
|
||||
esac
|
||||
TAG="latest"
|
||||
ARCHTAG="$TAG-$ARCH"
|
||||
|
||||
TAGS=$ARCH
|
||||
|
||||
docker build --build-arg BASE_IMAGE=$BASE_IMAGE -t openwebrx-base:$ARCH -f docker/Dockerfiles/Dockerfile-base .
|
||||
docker build --build-arg ARCH=$ARCH -t jketterl/openwebrx-rtlsdr:$ARCH -f docker/Dockerfiles/Dockerfile-rtlsdr .
|
||||
docker build --build-arg ARCH=$ARCH -t openwebrx-soapysdr-base:$ARCH -f docker/Dockerfiles/Dockerfile-soapysdr .
|
||||
docker build --build-arg ARCH=$ARCH -t jketterl/openwebrx-sdrplay:$ARCH -f docker/Dockerfiles/Dockerfile-sdrplay .
|
||||
docker build --build-arg ARCH=$ARCH -t jketterl/openwebrx-hackrf:$ARCH -f docker/Dockerfiles/Dockerfile-hackrf .
|
||||
docker build --build-arg ARCH=$ARCH -t jketterl/openwebrx-airspy:$ARCH -f docker/Dockerfiles/Dockerfile-airspy .
|
||||
docker build --build-arg ARCH=$ARCH -t jketterl/openwebrx-full:$ARCH -t jketterl/openwebrx:$ARCH -f docker/Dockerfiles/Dockerfile-full .
|
||||
docker build --pull -t openwebrx-base:$ARCHTAG -f docker/Dockerfiles/Dockerfile-base .
|
||||
docker build --build-arg ARCHTAG=$ARCHTAG -t jketterl/openwebrx-rtlsdr:$ARCHTAG -f docker/Dockerfiles/Dockerfile-rtlsdr .
|
||||
docker build --build-arg ARCHTAG=$ARCHTAG -t openwebrx-soapysdr-base:$ARCHTAG -f docker/Dockerfiles/Dockerfile-soapysdr .
|
||||
docker build --build-arg ARCHTAG=$ARCHTAG -t jketterl/openwebrx-sdrplay:$ARCHTAG -f docker/Dockerfiles/Dockerfile-sdrplay .
|
||||
docker build --build-arg ARCHTAG=$ARCHTAG -t jketterl/openwebrx-hackrf:$ARCHTAG -f docker/Dockerfiles/Dockerfile-hackrf .
|
||||
docker build --build-arg ARCHTAG=$ARCHTAG -t jketterl/openwebrx-airspy:$ARCHTAG -f docker/Dockerfiles/Dockerfile-airspy .
|
||||
docker build --build-arg ARCHTAG=$ARCHTAG -t jketterl/openwebrx-rtlsdr-soapy:$ARCHTAG -f docker/Dockerfiles/Dockerfile-rtlsdr-soapy .
|
||||
docker build --build-arg ARCHTAG=$ARCHTAG -t jketterl/openwebrx-full:$ARCHTAG -t jketterl/openwebrx:$ARCHTAG -f docker/Dockerfiles/Dockerfile-full .
|
||||
|
@ -6,6 +6,7 @@ config_webrx: configuration options for OpenWebRX
|
||||
This file is part of OpenWebRX,
|
||||
an open-source SDR receiver software with a web UI.
|
||||
Copyright (c) 2013-2015 by Andras Retzler <randras@sdr.hu>
|
||||
Copyright (c) 2019-2020 by Jakob Ketterl <dd5jfk@darc.de>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
@ -41,13 +42,9 @@ max_clients = 20
|
||||
# ==== Web GUI configuration ====
|
||||
receiver_name = "[Callsign]"
|
||||
receiver_location = "Budapest, Hungary"
|
||||
receiver_qra = "JN97ML"
|
||||
receiver_asl = 200
|
||||
receiver_ant = "Longwire"
|
||||
receiver_device = "RTL-SDR"
|
||||
receiver_admin = "example@example.com"
|
||||
receiver_gps = (47.000000, 19.000000)
|
||||
photo_height = 350
|
||||
photo_title = "Panorama of Budapest from Schönherz Zoltán Dormitory"
|
||||
photo_desc = """
|
||||
You can add your own background photo and receiver information.<br />
|
||||
@ -70,8 +67,8 @@ server_hostname = "localhost"
|
||||
fft_fps = 9
|
||||
fft_size = 4096 # Should be power of 2
|
||||
fft_voverlap_factor = (
|
||||
0.3
|
||||
) # If fft_voverlap_factor is above 0, multiple FFTs will be used for creating a line on the diagram.
|
||||
0.3 # If fft_voverlap_factor is above 0, multiple FFTs will be used for creating a line on the diagram.
|
||||
)
|
||||
|
||||
audio_compression = "adpcm" # valid values: "adpcm", "none"
|
||||
fft_compression = "adpcm" # valid values: "adpcm", "none"
|
||||
@ -101,7 +98,17 @@ Note: if you experience audio underruns while CPU usage is 100%, you can:
|
||||
# Check here: https://github.com/simonyiszk/openwebrx/wiki#guides-for-receiver-hardware-support #
|
||||
#################################################################################################
|
||||
|
||||
# Currently supported types of sdr receivers: "rtl_sdr", "sdrplay", "hackrf", "airspy"
|
||||
# Currently supported types of sdr receivers:
|
||||
# "rtl_sdr", "sdrplay", "hackrf", "airspy", "airspyhf", "fifi_sdr"
|
||||
#
|
||||
# In order to use rtl_sdr, you will need to install librtlsdr-dev and the connector.
|
||||
# In order to use sdrplay, airspy or airspyhf, you will need to install soapysdr, the corresponding driver, and the
|
||||
# connector.
|
||||
#
|
||||
# https://github.com/jketterl/owrx_connector
|
||||
#
|
||||
# NOTE: The connector sources have replaced the old piped nmux style of reading input. If you still have any sdrs
|
||||
# configured that have type endin in "_connector", simply remove that suffix.
|
||||
|
||||
sdrs = {
|
||||
"rtlsdr": {
|
||||
@ -109,7 +116,7 @@ sdrs = {
|
||||
"type": "rtl_sdr",
|
||||
"ppm": 0,
|
||||
# you can change this if you use an upconverter. formula is:
|
||||
# shown_center_freq = center_freq + lfo_offset
|
||||
# center_freq + lfo_offset = actual frequency on the sdr
|
||||
# "lfo_offset": 0,
|
||||
"profiles": {
|
||||
"70cm": {
|
||||
@ -130,6 +137,53 @@ sdrs = {
|
||||
},
|
||||
},
|
||||
},
|
||||
"airspy": {
|
||||
"name": "Airspy HF+",
|
||||
"type": "airspyhf",
|
||||
"ppm": 0,
|
||||
"profiles": {
|
||||
"20m": {
|
||||
"name": "20m",
|
||||
"center_freq": 14150000,
|
||||
"rf_gain": 10,
|
||||
"samp_rate": 768000,
|
||||
"start_freq": 14070000,
|
||||
"start_mod": "usb",
|
||||
},
|
||||
"30m": {
|
||||
"name": "30m",
|
||||
"center_freq": 10125000,
|
||||
"rf_gain": 10,
|
||||
"samp_rate": 192000,
|
||||
"start_freq": 10142000,
|
||||
"start_mod": "usb",
|
||||
},
|
||||
"40m": {
|
||||
"name": "40m",
|
||||
"center_freq": 7100000,
|
||||
"rf_gain": 10,
|
||||
"samp_rate": 256000,
|
||||
"start_freq": 7070000,
|
||||
"start_mod": "usb",
|
||||
},
|
||||
"80m": {
|
||||
"name": "80m",
|
||||
"center_freq": 3650000,
|
||||
"rf_gain": 10,
|
||||
"samp_rate": 768000,
|
||||
"start_freq": 3570000,
|
||||
"start_mod": "usb",
|
||||
},
|
||||
"49m": {
|
||||
"name": "49m Broadcast",
|
||||
"center_freq": 6000000,
|
||||
"rf_gain": 10,
|
||||
"samp_rate": 768000,
|
||||
"start_freq": 6070000,
|
||||
"start_mod": "am",
|
||||
},
|
||||
},
|
||||
},
|
||||
"sdrplay": {
|
||||
"name": "SDRPlay RSP2",
|
||||
"type": "sdrplay",
|
||||
@ -181,22 +235,8 @@ sdrs = {
|
||||
},
|
||||
},
|
||||
},
|
||||
# this one is just here to test feature detection
|
||||
"test": {"type": "test"},
|
||||
}
|
||||
|
||||
# ==== Misc settings ====
|
||||
|
||||
client_audio_buffer_size = 5
|
||||
# increasing client_audio_buffer_size will:
|
||||
# - also increase the latency
|
||||
# - decrease the chance of audio underruns
|
||||
|
||||
iq_port_range = [
|
||||
4950,
|
||||
4960,
|
||||
] # TCP port for range ncat to listen on. It will send I/Q data over its connections, for internal use in OpenWebRX. It is only accessible from the localhost by default.
|
||||
|
||||
# ==== Color themes ====
|
||||
|
||||
# A guide is available to help you set these values: https://github.com/simonyiszk/openwebrx/wiki/Calibrating-waterfall-display-levels
|
||||
@ -221,20 +261,6 @@ waterfall_auto_level_margin = (5, 40)
|
||||
# \_waterfall_auto_level_margin[0]_/ |__ current_min_power_level | \_waterfall_auto_level_margin[1]_/
|
||||
# current_max_power_level __|
|
||||
|
||||
# 3D view settings
|
||||
mathbox_waterfall_frequency_resolution = 128 # bins
|
||||
mathbox_waterfall_history_length = 10 # seconds
|
||||
mathbox_waterfall_colors = [
|
||||
0x000000FF,
|
||||
0x2E6893FF,
|
||||
0x69A5D0FF,
|
||||
0x214B69FF,
|
||||
0x9DC4E0FF,
|
||||
0xFFF775FF,
|
||||
0xFF8A8AFF,
|
||||
0xB20000FF,
|
||||
]
|
||||
|
||||
# === Experimental settings ===
|
||||
# Warning! The settings below are very experimental.
|
||||
csdr_dynamic_bufsize = False # This allows you to change the buffering mode of csdr.
|
||||
|
@ -4,6 +4,7 @@ OpenWebRX csdr plugin: do the signal processing with csdr
|
||||
This file is part of OpenWebRX,
|
||||
an open-source SDR receiver software with a web UI.
|
||||
Copyright (c) 2013-2015 by Andras Retzler <randras@sdr.hu>
|
||||
Copyright (c) 2019-2020 by Jakob Ketterl <dd5jfk@darc.de>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
@ -24,6 +25,7 @@ import subprocess
|
||||
import os
|
||||
import signal
|
||||
import threading
|
||||
import math
|
||||
from functools import partial
|
||||
|
||||
from owrx.kiss import KissClient, DirewolfConfig
|
||||
@ -84,7 +86,7 @@ class dsp(object):
|
||||
self.csdr_dynamic_bufsize = False
|
||||
self.csdr_print_bufsizes = False
|
||||
self.csdr_through = False
|
||||
self.squelch_level = 0
|
||||
self.squelch_level = -150
|
||||
self.fft_averages = 50
|
||||
self.iqtee = False
|
||||
self.iqtee2 = False
|
||||
@ -213,35 +215,40 @@ class dsp(object):
|
||||
return chain
|
||||
|
||||
def secondary_chain(self, which):
|
||||
secondary_chain_base = "cat {input_pipe} | "
|
||||
chain = ["cat {input_pipe}"]
|
||||
if which == "fft":
|
||||
return (
|
||||
secondary_chain_base
|
||||
+ "csdr realpart_cf | csdr fft_fc {secondary_fft_input_size} {secondary_fft_block_size} | csdr logpower_cf -70 "
|
||||
+ (" | csdr compress_fft_adpcm_f_u8 {secondary_fft_size}" if self.fft_compression == "adpcm" else "")
|
||||
)
|
||||
elif which == "bpsk31":
|
||||
return (
|
||||
secondary_chain_base
|
||||
+ "csdr shift_addition_cc --fifo {secondary_shift_pipe} | "
|
||||
+ "csdr bandpass_fir_fft_cc -{secondary_bpf_cutoff} {secondary_bpf_cutoff} {secondary_bpf_cutoff} | "
|
||||
+ "csdr simple_agc_cc 0.001 0.5 | "
|
||||
+ "csdr timing_recovery_cc GARDNER {secondary_samples_per_bits} 0.5 2 --add_q | "
|
||||
+ "CSDR_FIXED_BUFSIZE=1 csdr dbpsk_decoder_c_u8 | "
|
||||
+ "CSDR_FIXED_BUFSIZE=1 csdr psk31_varicode_decoder_u8_u8"
|
||||
)
|
||||
chain += [
|
||||
"csdr realpart_cf",
|
||||
"csdr fft_fc {secondary_fft_input_size} {secondary_fft_block_size}",
|
||||
"csdr logpower_cf -70",
|
||||
]
|
||||
if self.fft_compression == "adpcm":
|
||||
chain += ["csdr compress_fft_adpcm_f_u8 {secondary_fft_size}"]
|
||||
return chain
|
||||
elif which == "bpsk31" or which == "bpsk63":
|
||||
return chain + [
|
||||
"csdr shift_addition_cc --fifo {secondary_shift_pipe}",
|
||||
"csdr bandpass_fir_fft_cc -{secondary_bpf_cutoff} {secondary_bpf_cutoff} {secondary_bpf_cutoff}",
|
||||
"csdr simple_agc_cc 0.001 0.5",
|
||||
"csdr timing_recovery_cc GARDNER {secondary_samples_per_bits} 0.5 2 --add_q",
|
||||
"CSDR_FIXED_BUFSIZE=1 csdr dbpsk_decoder_c_u8",
|
||||
"CSDR_FIXED_BUFSIZE=1 csdr psk31_varicode_decoder_u8_u8",
|
||||
]
|
||||
elif self.isWsjtMode(which):
|
||||
chain = secondary_chain_base + "csdr realpart_cf | "
|
||||
chain += ["csdr realpart_cf"]
|
||||
if self.last_decimation != 1.0:
|
||||
chain += "csdr fractional_decimator_ff {last_decimation} | "
|
||||
chain += "csdr agc_ff | csdr limit_ff | csdr convert_f_s16"
|
||||
return chain
|
||||
chain += ["csdr fractional_decimator_ff {last_decimation}"]
|
||||
return chain + ["csdr limit_ff", "csdr convert_f_s16"]
|
||||
elif which == "packet":
|
||||
chain = secondary_chain_base + "csdr fmdemod_quadri_cf | "
|
||||
chain += ["csdr fmdemod_quadri_cf"]
|
||||
if self.last_decimation != 1.0:
|
||||
chain += "csdr fractional_decimator_ff {last_decimation} | "
|
||||
chain += "csdr convert_f_s16 | direwolf -c {direwolf_config} -r {audio_rate} -t 0 -q d -q h - 1>&2"
|
||||
return chain
|
||||
chain += ["csdr fractional_decimator_ff {last_decimation}"]
|
||||
return chain + ["csdr convert_f_s16", "direwolf -c {direwolf_config} -r {audio_rate} -t 0 -q d -q h - 1>&2"]
|
||||
elif which == "pocsag":
|
||||
chain += ["csdr fmdemod_quadri_cf"]
|
||||
if self.last_decimation != 1.0:
|
||||
chain += ["csdr fractional_decimator_ff {last_decimation}"]
|
||||
return chain + ["fsk_demodulator -i", "pocsag_decoder"]
|
||||
|
||||
def set_secondary_demodulator(self, what):
|
||||
if self.get_secondary_demodulator() == what:
|
||||
@ -261,27 +268,35 @@ class dsp(object):
|
||||
def secondary_bpf_cutoff(self):
|
||||
if self.secondary_demodulator == "bpsk31":
|
||||
return 31.25 / self.if_samp_rate()
|
||||
elif self.secondary_demodulator == "bpsk63":
|
||||
return 62.5 / self.if_samp_rate()
|
||||
return 0
|
||||
|
||||
def secondary_bpf_transition_bw(self):
|
||||
if self.secondary_demodulator == "bpsk31":
|
||||
return 31.25 / self.if_samp_rate()
|
||||
elif self.secondary_demodulator == "bpsk63":
|
||||
return 62.5 / self.if_samp_rate()
|
||||
return 0
|
||||
|
||||
def secondary_samples_per_bits(self):
|
||||
if self.secondary_demodulator == "bpsk31":
|
||||
return int(round(self.if_samp_rate() / 31.25)) & ~3
|
||||
elif self.secondary_demodulator == "bpsk63":
|
||||
return int(round(self.if_samp_rate() / 62.5)) & ~3
|
||||
return 0
|
||||
|
||||
def secondary_bw(self):
|
||||
if self.secondary_demodulator == "bpsk31":
|
||||
return 31.25
|
||||
elif self.secondary_demodulator == "bpsk63":
|
||||
return 62.5
|
||||
|
||||
def start_secondary_demodulator(self):
|
||||
if not self.secondary_demodulator:
|
||||
return
|
||||
logger.debug("starting secondary demodulator from IF input sampled at %d" % self.if_samp_rate())
|
||||
secondary_command_demod = self.secondary_chain(self.secondary_demodulator)
|
||||
secondary_command_demod = " | ".join(self.secondary_chain(self.secondary_demodulator))
|
||||
self.try_create_pipes(self.secondary_pipe_names, secondary_command_demod)
|
||||
self.try_create_configs(secondary_command_demod)
|
||||
|
||||
@ -304,7 +319,7 @@ class dsp(object):
|
||||
if self.csdr_print_bufsizes:
|
||||
my_env["CSDR_PRINT_BUFSIZES"] = "1"
|
||||
if self.output.supports_type("secondary_fft"):
|
||||
secondary_command_fft = self.secondary_chain("fft")
|
||||
secondary_command_fft = " | ".join(self.secondary_chain("fft"))
|
||||
secondary_command_fft = secondary_command_fft.format(
|
||||
input_pipe=self.iqtee_pipe,
|
||||
secondary_fft_input_size=self.secondary_fft_size,
|
||||
@ -314,7 +329,7 @@ class dsp(object):
|
||||
logger.debug("secondary command (fft) = %s", secondary_command_fft)
|
||||
|
||||
self.secondary_process_fft = subprocess.Popen(
|
||||
secondary_command_fft, stdout=subprocess.PIPE, shell=True, preexec_fn=os.setpgrp, env=my_env
|
||||
secondary_command_fft, stdout=subprocess.PIPE, shell=True, start_new_session=True, env=my_env
|
||||
)
|
||||
self.output.send_output(
|
||||
"secondary_fft",
|
||||
@ -326,7 +341,7 @@ class dsp(object):
|
||||
# it would block if not read. by piping it to devnull, we avoid a potential pitfall here.
|
||||
secondary_output = subprocess.DEVNULL if self.isPacket() else subprocess.PIPE
|
||||
self.secondary_process_demod = subprocess.Popen(
|
||||
secondary_command_demod, stdout=secondary_output, shell=True, preexec_fn=os.setpgrp, env=my_env
|
||||
secondary_command_demod, stdout=secondary_output, shell=True, start_new_session=True, env=my_env
|
||||
)
|
||||
self.secondary_processes_running = True
|
||||
|
||||
@ -348,6 +363,8 @@ class dsp(object):
|
||||
# we best get the ax25 packets from the kiss socket
|
||||
kiss = KissClient(self.direwolf_port)
|
||||
self.output.send_output("packet_demod", kiss.read)
|
||||
elif self.isPocsag():
|
||||
self.output.send_output("pocsag_demod", self.secondary_process_demod.stdout.readline)
|
||||
else:
|
||||
self.output.send_output("secondary_demod", partial(self.secondary_process_demod.stdout.read, 1))
|
||||
|
||||
@ -391,6 +408,15 @@ class dsp(object):
|
||||
def set_audio_compression(self, what):
|
||||
self.audio_compression = what
|
||||
|
||||
def get_audio_bytes_to_read(self):
|
||||
# desired latency: 5ms
|
||||
# uncompressed audio has 16 bits = 2 bytes per sample
|
||||
base = self.output_rate * 0.005 * 2
|
||||
# adpcm compresses the bitstream by 4
|
||||
if self.audio_compression == "adpcm":
|
||||
base = base / 4
|
||||
return int(base)
|
||||
|
||||
def set_fft_compression(self, what):
|
||||
self.fft_compression = what
|
||||
|
||||
@ -398,7 +424,7 @@ class dsp(object):
|
||||
if self.fft_compression == "none":
|
||||
return self.fft_size * 4
|
||||
if self.fft_compression == "adpcm":
|
||||
return (self.fft_size / 2) + (10 / 2)
|
||||
return int((self.fft_size / 2) + (10 / 2))
|
||||
|
||||
def get_secondary_fft_bytes_to_read(self):
|
||||
if self.fft_compression == "none":
|
||||
@ -433,7 +459,7 @@ class dsp(object):
|
||||
return self.output_rate
|
||||
|
||||
def get_audio_rate(self):
|
||||
if self.isDigitalVoice() or self.isPacket():
|
||||
if self.isDigitalVoice() or self.isPacket() or self.isPocsag():
|
||||
return 48000
|
||||
elif self.isWsjtMode():
|
||||
return 12000
|
||||
@ -454,9 +480,17 @@ class dsp(object):
|
||||
demodulator = self.get_secondary_demodulator()
|
||||
return demodulator == "packet"
|
||||
|
||||
def isPocsag(self, demodulator=None):
|
||||
if demodulator is None:
|
||||
demodulator = self.get_secondary_demodulator()
|
||||
return demodulator == "pocsag"
|
||||
|
||||
def set_output_rate(self, output_rate):
|
||||
if self.output_rate == output_rate:
|
||||
return
|
||||
self.output_rate = output_rate
|
||||
self.calculate_decimation()
|
||||
self.restart()
|
||||
|
||||
def set_demodulator(self, demodulator):
|
||||
if self.demodulator == demodulator:
|
||||
@ -508,13 +542,16 @@ class dsp(object):
|
||||
def get_bpf(self):
|
||||
return [self.low_cut, self.high_cut]
|
||||
|
||||
def convertToLinear(self, db):
|
||||
return float(math.pow(10, db / 10))
|
||||
|
||||
def set_squelch_level(self, squelch_level):
|
||||
self.squelch_level = squelch_level
|
||||
# no squelch required on digital voice modes
|
||||
actual_squelch = 0 if self.isDigitalVoice() or self.isPacket() else self.squelch_level
|
||||
actual_squelch = -150 if self.isDigitalVoice() or self.isPacket() or self.isPocsag() else self.squelch_level
|
||||
if self.running:
|
||||
self.modification_lock.acquire()
|
||||
self.squelch_pipe_file.write("%g\n" % (float(actual_squelch)))
|
||||
self.squelch_pipe_file.write("%g\n" % (self.convertToLinear(actual_squelch)))
|
||||
self.squelch_pipe_file.flush()
|
||||
self.modification_lock.release()
|
||||
|
||||
@ -632,7 +669,7 @@ class dsp(object):
|
||||
my_env["CSDR_PRINT_BUFSIZES"] = "1"
|
||||
|
||||
out = subprocess.PIPE if self.output.supports_type("audio") else subprocess.DEVNULL
|
||||
self.process = subprocess.Popen(command, stdout=out, shell=True, preexec_fn=os.setpgrp, env=my_env)
|
||||
self.process = subprocess.Popen(command, stdout=out, shell=True, start_new_session=True, env=my_env)
|
||||
|
||||
def watch_thread():
|
||||
rc = self.process.wait()
|
||||
@ -647,7 +684,8 @@ class dsp(object):
|
||||
self.output.send_output(
|
||||
"audio",
|
||||
partial(
|
||||
self.process.stdout.read, int(self.get_fft_bytes_to_read()) if self.demodulator == "fft" else 256
|
||||
self.process.stdout.read,
|
||||
self.get_fft_bytes_to_read() if self.demodulator == "fft" else self.get_audio_bytes_to_read(),
|
||||
),
|
||||
)
|
||||
|
5
debian/changelog
vendored
Normal file
5
debian/changelog
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
openwebrx (0.18) UNRELEASED; urgency=low
|
||||
|
||||
* Initial release.
|
||||
|
||||
-- Jakob Ketterl <jakob.ketterl@gmx.de> Sun, 08 Dec 2019 12:35:48 +0000
|
1
debian/compat
vendored
Normal file
1
debian/compat
vendored
Normal file
@ -0,0 +1 @@
|
||||
10
|
13
debian/control
vendored
Normal file
13
debian/control
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
Source: openwebrx
|
||||
Maintainer: Jakob Ketterl <jakob.ketterl@gmx.de>
|
||||
Section: hamradio
|
||||
Priority: optional
|
||||
Standards-Version: 4.2.0
|
||||
Build-Depends: debhelper (>= 10), dh-python, python3 (>= 3.5), dh-systemd (>= 1.5)
|
||||
|
||||
Package: openwebrx
|
||||
Architecture: all
|
||||
Depends: python3 (>= 3.5), python3-pkg-resources, csdr (>= 0.14), netcat, owrx-connector (>= 0.1), ${python3:Depends}
|
||||
Recommends: digiham (>= 0.3), dsd (>= 1.7), sox, direwolf (>= 1.4), wsjtx
|
||||
Description: multi-user web sdr
|
||||
Open source, multi-user SDR receiver with a web interface
|
4
debian/openwebrx.install
vendored
Normal file
4
debian/openwebrx.install
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
config_webrx.py etc/openwebrx/
|
||||
bands.json etc/openwebrx/
|
||||
bookmarks.json etc/openwebrx/
|
||||
systemd/openwebrx.service lib/systemd/system/
|
5
debian/rules
vendored
Executable file
5
debian/rules
vendored
Executable file
@ -0,0 +1,5 @@
|
||||
#!/usr/bin/make -f
|
||||
export PYBUILD_NAME=openwebrx
|
||||
|
||||
%:
|
||||
dh $@ --with python3 --buildsystem=pybuild --with systemd
|
1
debian/source/format
vendored
Normal file
1
debian/source/format
vendored
Normal file
@ -0,0 +1 @@
|
||||
3.0 (native)
|
@ -1,6 +1,10 @@
|
||||
ARG ARCH
|
||||
FROM openwebrx-base:$ARCH
|
||||
ARG ARCHTAG
|
||||
FROM openwebrx-soapysdr-base:$ARCHTAG
|
||||
|
||||
ADD docker/scripts/install-dependencies-airspy.sh /
|
||||
RUN /install-dependencies-airspy.sh
|
||||
RUN rm /install-dependencies-airspy.sh
|
||||
|
||||
ADD docker/scripts/install-connectors.sh /
|
||||
RUN /install-connectors.sh
|
||||
RUN rm /install-connectors.sh
|
||||
|
@ -1,17 +1,19 @@
|
||||
ARG BASE_IMAGE
|
||||
FROM $BASE_IMAGE
|
||||
FROM alpine:3.10
|
||||
|
||||
RUN apk add --no-cache bash
|
||||
|
||||
RUN ln -s /usr/local/lib /usr/local/lib64
|
||||
|
||||
ADD docker/scripts/direwolf-1.5.patch /
|
||||
ADD docker/scripts/install-dependencies.sh /
|
||||
RUN /install-dependencies.sh
|
||||
RUN rm /install-dependencies.sh
|
||||
|
||||
ADD . /openwebrx
|
||||
ADD . /opt/openwebrx
|
||||
|
||||
WORKDIR /openwebrx
|
||||
WORKDIR /opt/openwebrx
|
||||
|
||||
VOLUME /config
|
||||
VOLUME /etc/openwebrx
|
||||
|
||||
ENTRYPOINT [ "/openwebrx/docker/scripts/run.sh" ]
|
||||
ENTRYPOINT [ "/opt/openwebrx/docker/scripts/run.sh" ]
|
||||
EXPOSE 8073
|
||||
|
@ -1,5 +1,5 @@
|
||||
ARG ARCH
|
||||
FROM openwebrx-base:$ARCH
|
||||
ARG ARCHTAG
|
||||
FROM openwebrx-base:$ARCHTAG
|
||||
|
||||
ADD docker/scripts/install-dependencies-*.sh /
|
||||
ADD docker/scripts/install-lib.*.patch /
|
||||
@ -9,3 +9,9 @@ RUN /install-dependencies-hackrf.sh
|
||||
RUN /install-dependencies-soapysdr.sh
|
||||
RUN /install-dependencies-sdrplay.sh
|
||||
RUN /install-dependencies-airspy.sh
|
||||
RUN /install-dependencies-rtlsdr-soapy.sh
|
||||
RUN rm /install-dependencies-*.sh
|
||||
|
||||
ADD docker/scripts/install-connectors.sh /
|
||||
RUN /install-connectors.sh
|
||||
RUN rm /install-connectors.sh
|
||||
|
@ -1,6 +1,7 @@
|
||||
ARG ARCH
|
||||
FROM openwebrx-base:$ARCH
|
||||
ARG ARCHTAG
|
||||
FROM openwebrx-base:$ARCHTAG
|
||||
|
||||
ADD docker/scripts/install-dependencies-hackrf.sh /
|
||||
RUN /install-dependencies-hackrf.sh
|
||||
RUN rm /install-dependencies-hackrf.sh
|
||||
|
||||
|
@ -1,6 +1,10 @@
|
||||
ARG ARCH
|
||||
FROM openwebrx-base:$ARCH
|
||||
ARG ARCHTAG
|
||||
FROM openwebrx-base:$ARCHTAG
|
||||
|
||||
ADD docker/scripts/install-dependencies-rtlsdr.sh /
|
||||
RUN /install-dependencies-rtlsdr.sh
|
||||
RUN rm /install-dependencies-rtlsdr.sh
|
||||
|
||||
ADD docker/scripts/install-connectors.sh /
|
||||
RUN /install-connectors.sh
|
||||
RUN rm /install-connectors.sh
|
||||
|
10
docker/Dockerfiles/Dockerfile-rtlsdr-soapy
Normal file
10
docker/Dockerfiles/Dockerfile-rtlsdr-soapy
Normal file
@ -0,0 +1,10 @@
|
||||
ARG ARCHTAG
|
||||
FROM openwebrx-soapysdr-base:$ARCHTAG
|
||||
|
||||
ADD docker/scripts/install-dependencies-rtlsdr-soapy.sh /
|
||||
RUN /install-dependencies-rtlsdr-soapy.sh
|
||||
RUN rm /install-dependencies-rtlsdr-soapy.sh
|
||||
|
||||
ADD docker/scripts/install-connectors.sh /
|
||||
RUN /install-connectors.sh
|
||||
RUN rm /install-connectors.sh
|
@ -1,7 +1,11 @@
|
||||
ARG ARCH
|
||||
FROM openwebrx-soapysdr-base:$ARCH
|
||||
ARG ARCHTAG
|
||||
FROM openwebrx-soapysdr-base:$ARCHTAG
|
||||
|
||||
ADD docker/scripts/install-dependencies-sdrplay.sh /
|
||||
ADD docker/scripts/install-lib.*.patch /
|
||||
RUN /install-dependencies-sdrplay.sh
|
||||
RUN rm /install-dependencies-sdrplay.sh
|
||||
|
||||
ADD docker/scripts/install-connectors.sh /
|
||||
RUN /install-connectors.sh
|
||||
RUN rm /install-connectors.sh
|
||||
|
@ -1,6 +1,7 @@
|
||||
ARG ARCH
|
||||
FROM openwebrx-base:$ARCH
|
||||
ARG ARCHTAG
|
||||
FROM openwebrx-base:$ARCHTAG
|
||||
|
||||
ADD docker/scripts/install-dependencies-soapysdr.sh /
|
||||
RUN /install-dependencies-soapysdr.sh
|
||||
RUN rm /install-dependencies-soapysdr.sh
|
||||
|
||||
|
28
docker/scripts/install-connectors.sh
Executable file
28
docker/scripts/install-connectors.sh
Executable file
@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euxo pipefail
|
||||
|
||||
function cmakebuild() {
|
||||
cd $1
|
||||
if [[ ! -z "${2:-}" ]]; then
|
||||
git checkout $2
|
||||
fi
|
||||
mkdir build
|
||||
cd build
|
||||
cmake ..
|
||||
make
|
||||
make install
|
||||
cd ../..
|
||||
rm -rf $1
|
||||
}
|
||||
|
||||
cd /tmp
|
||||
|
||||
BUILD_PACKAGES="git cmake make gcc g++ musl-dev"
|
||||
|
||||
apk add --no-cache --virtual .build-deps $BUILD_PACKAGES
|
||||
|
||||
|
||||
git clone https://github.com/jketterl/owrx_connector.git
|
||||
cmakebuild owrx_connector df35e33e42c2e4527853ca18bf04981848860317
|
||||
|
||||
apk del .build-deps
|
@ -3,6 +3,9 @@ set -euxo pipefail
|
||||
|
||||
function cmakebuild() {
|
||||
cd $1
|
||||
if [[ ! -z "${2:-}" ]]; then
|
||||
git checkout $2
|
||||
fi
|
||||
mkdir build
|
||||
cd build
|
||||
cmake ..
|
||||
@ -21,6 +24,15 @@ apk add --no-cache $STATIC_PACKAGES
|
||||
apk add --no-cache --virtual .build-deps $BUILD_PACKAGES
|
||||
|
||||
git clone https://github.com/airspy/airspyone_host.git
|
||||
cmakebuild airspyone_host
|
||||
cmakebuild airspyone_host bceca18f9e3a5f89cff78c4d949c71771d92dfd3
|
||||
|
||||
git clone https://github.com/pothosware/SoapyAirspy.git
|
||||
cmakebuild SoapyAirspy 99756be5c3413a2d447baf70cb5a880662452655
|
||||
|
||||
git clone https://github.com/airspy/airspyhf.git
|
||||
cmakebuild airspyhf 613852a2bb64af42690bf9be2201826af69a9475
|
||||
|
||||
git clone https://github.com/pothosware/SoapyAirspyHF.git
|
||||
cmakebuild SoapyAirspyHF 54f5487dd96207540b2dd562ff9e718e0588770b
|
||||
|
||||
apk del .build-deps
|
||||
|
@ -3,6 +3,9 @@ set -euxo pipefail
|
||||
|
||||
function cmakebuild() {
|
||||
cd $1
|
||||
if [[ ! -z "${2:-}" ]]; then
|
||||
git checkout $2
|
||||
fi
|
||||
mkdir build
|
||||
cd build
|
||||
cmake ..
|
||||
@ -22,6 +25,7 @@ apk add --no-cache --virtual .build-deps $BUILD_PACKAGES
|
||||
|
||||
git clone https://github.com/mossmann/hackrf.git
|
||||
cd hackrf
|
||||
git checkout 06eb9192cd348083f5f7de9c0da9ead276020011
|
||||
cmakebuild host
|
||||
cd ..
|
||||
rm -rf hackrf
|
||||
|
32
docker/scripts/install-dependencies-rtlsdr-soapy.sh
Executable file
32
docker/scripts/install-dependencies-rtlsdr-soapy.sh
Executable file
@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
function cmakebuild() {
|
||||
cd $1
|
||||
if [[ ! -z "${2:-}" ]]; then
|
||||
git checkout $2
|
||||
fi
|
||||
mkdir build
|
||||
cd build
|
||||
cmake ..
|
||||
make
|
||||
make install
|
||||
cd ../..
|
||||
rm -rf $1
|
||||
}
|
||||
|
||||
cd /tmp
|
||||
|
||||
STATIC_PACKAGES="libusb"
|
||||
BUILD_PACKAGES="git libusb-dev cmake make gcc musl-dev g++ linux-headers"
|
||||
|
||||
apk add --no-cache $STATIC_PACKAGES
|
||||
apk add --no-cache --virtual .build-deps $BUILD_PACKAGES
|
||||
|
||||
git clone https://github.com/osmocom/rtl-sdr.git
|
||||
cmakebuild rtl-sdr b5af355b1d833b3c898a61cf1e072b59b0ea3440
|
||||
|
||||
git clone https://github.com/pothosware/SoapyRTLSDR.git
|
||||
cmakebuild SoapyRTLSDR 5c5d9503337c6d1c34b496dec6f908aab9478b0f
|
||||
|
||||
apk del .build-deps
|
@ -3,6 +3,9 @@ set -euxo pipefail
|
||||
|
||||
function cmakebuild() {
|
||||
cd $1
|
||||
if [[ ! -z "${2:-}" ]]; then
|
||||
git checkout $2
|
||||
fi
|
||||
mkdir build
|
||||
cd build
|
||||
cmake ..
|
||||
@ -21,6 +24,6 @@ apk add --no-cache $STATIC_PACKAGES
|
||||
apk add --no-cache --virtual .build-deps $BUILD_PACKAGES
|
||||
|
||||
git clone https://github.com/osmocom/rtl-sdr.git
|
||||
cmakebuild rtl-sdr
|
||||
cmakebuild rtl-sdr b5af355b1d833b3c898a61cf1e072b59b0ea3440
|
||||
|
||||
apk del .build-deps
|
||||
|
@ -3,6 +3,9 @@ set -euxo pipefail
|
||||
|
||||
function cmakebuild() {
|
||||
cd $1
|
||||
if [[ ! -z "${2:-}" ]]; then
|
||||
git checkout $2
|
||||
fi
|
||||
mkdir build
|
||||
cd build
|
||||
cmake ..
|
||||
@ -29,9 +32,12 @@ case $ARCH in
|
||||
armv*)
|
||||
BINARY=SDRplay_RSP_API-RPi-2.13.1.run
|
||||
;;
|
||||
aarch64)
|
||||
BINARY=SDRplay_RSP_API-ARM64-2.13.1.run
|
||||
;;
|
||||
esac
|
||||
|
||||
wget http://www.sdrplay.com/software/$BINARY
|
||||
wget https://www.sdrplay.com/software/$BINARY
|
||||
sh $BINARY --noexec --target sdrplay
|
||||
patch --verbose -Np0 < /install-lib.$ARCH.patch
|
||||
|
||||
@ -42,6 +48,6 @@ rm -rf sdrplay
|
||||
rm $BINARY
|
||||
|
||||
git clone https://github.com/pothosware/SoapySDRPlay.git
|
||||
cmakebuild SoapySDRPlay
|
||||
cmakebuild SoapySDRPlay 14ec39e4ff0dab7ae7fdf1afbbd2d28b49b0ffae
|
||||
|
||||
apk del .build-deps
|
||||
|
@ -3,6 +3,9 @@ set -euxo pipefail
|
||||
|
||||
function cmakebuild() {
|
||||
cd $1
|
||||
if [[ ! -z "${2:-}" ]]; then
|
||||
git checkout $2
|
||||
fi
|
||||
mkdir build
|
||||
cd build
|
||||
cmake ..
|
||||
@ -21,9 +24,6 @@ apk add --no-cache $STATIC_PACKAGES
|
||||
apk add --no-cache --virtual .build-deps $BUILD_PACKAGES
|
||||
|
||||
git clone https://github.com/pothosware/SoapySDR
|
||||
cmakebuild SoapySDR
|
||||
|
||||
git clone https://github.com/rxseger/rx_tools
|
||||
cmakebuild rx_tools
|
||||
cmakebuild SoapySDR f722f9ce5b629c3c44401a9bf628b3f8e67a9695
|
||||
|
||||
apk del .build-deps
|
||||
|
@ -3,6 +3,9 @@ set -euxo pipefail
|
||||
|
||||
function cmakebuild() {
|
||||
cd $1
|
||||
if [[ ! -z "${2:-}" ]]; then
|
||||
git checkout $2
|
||||
fi
|
||||
mkdir build
|
||||
cd build
|
||||
cmake ..
|
||||
@ -21,37 +24,33 @@ apk add --no-cache $STATIC_PACKAGES
|
||||
apk add --no-cache --virtual .build-deps $BUILD_PACKAGES
|
||||
|
||||
git clone https://git.code.sf.net/p/itpp/git itpp
|
||||
cmakebuild itpp
|
||||
cmakebuild itpp bb5c7e95f40e8fdb5c3f3d01a84bcbaf76f3676d
|
||||
|
||||
git clone https://github.com/jketterl/csdr.git -b 48khz_filter
|
||||
git clone https://github.com/jketterl/csdr.git
|
||||
cd csdr
|
||||
git checkout 43c36df5dcd92d3bdb322f9d53f99ca0c7c816a4
|
||||
make
|
||||
make install
|
||||
cd ..
|
||||
rm -rf csdr
|
||||
|
||||
git clone https://github.com/szechyjs/mbelib.git
|
||||
cmakebuild mbelib
|
||||
if [ -d "/usr/local/lib64" ]; then
|
||||
# no idea why it's put into there now. alpine does not handle it correctly, so move it.
|
||||
mv /usr/local/lib64/libmbe* /usr/local/lib
|
||||
fi
|
||||
cmakebuild mbelib 9a04ed5c78176a9965f3d43f7aa1b1f5330e771f
|
||||
|
||||
git clone https://github.com/jketterl/digiham.git
|
||||
cmakebuild digiham
|
||||
cmakebuild digiham e5e11ce9611e3d8f5f9dce7dee97f86a31af107c
|
||||
|
||||
git clone https://github.com/f4exb/dsd.git
|
||||
cmakebuild dsd
|
||||
cmakebuild dsd f6939f9edbbc6f66261833616391a4e59cb2b3d7
|
||||
|
||||
WSJT_DIR=wsjtx-2.1.0
|
||||
WSJT_DIR=wsjtx-2.1.2
|
||||
WSJT_TGZ=${WSJT_DIR}.tgz
|
||||
wget http://physics.princeton.edu/pulsar/k1jt/$WSJT_TGZ
|
||||
tar xvfz $WSJT_TGZ
|
||||
cmakebuild $WSJT_DIR
|
||||
|
||||
git clone https://github.com/wb2osz/direwolf.git
|
||||
git clone --depth 1 -b 1.5 https://github.com/wb2osz/direwolf.git
|
||||
cd direwolf
|
||||
git checkout 1.5
|
||||
patch -Np1 < /direwolf-1.5.patch
|
||||
make
|
||||
make install
|
||||
@ -59,5 +58,8 @@ cd ..
|
||||
rm -rf direwolf
|
||||
|
||||
git clone https://github.com/hessu/aprs-symbols /opt/aprs-symbols
|
||||
pushd /opt/aprs-symbols
|
||||
git checkout 5c2abe2658ee4d2563f3c73b90c6f59124839802
|
||||
popd
|
||||
|
||||
apk del .build-deps
|
||||
|
40
docker/scripts/install-lib.aarch64.patch
Normal file
40
docker/scripts/install-lib.aarch64.patch
Normal file
@ -0,0 +1,40 @@
|
||||
--- sdrplay/install_lib.sh 2018-06-21 18:47:08.000000000 +0000
|
||||
+++ sdrplay/install_lib_patched.sh 2019-12-15 01:49:49.477386963 +0000
|
||||
@@ -3,19 +3,7 @@
|
||||
|
||||
echo "Installing SDRplay RSP API library 2.13..."
|
||||
|
||||
-more sdrplay_license.txt
|
||||
-
|
||||
-while true; do
|
||||
- echo "Press y and RETURN to accept the license agreement and continue with"
|
||||
- read -p "the installation, or press n and RETURN to exit the installer [y/n] " yn
|
||||
- case $yn in
|
||||
- [Yy]* ) break;;
|
||||
- [Nn]* ) exit;;
|
||||
- * ) echo "Please answer y or n";;
|
||||
- esac
|
||||
-done
|
||||
-
|
||||
-export ARCH=`arch`
|
||||
+export ARCH=`uname -m`
|
||||
export VERS="2.13"
|
||||
|
||||
echo "Architecture: ${ARCH}"
|
||||
@@ -63,16 +51,6 @@
|
||||
echo " "
|
||||
exit 1
|
||||
fi
|
||||
-
|
||||
-if /sbin/ldconfig -p | /bin/fgrep -q libusb-1.0; then
|
||||
- echo "Libusb found, continuing..."
|
||||
-else
|
||||
- echo " "
|
||||
- echo "ERROR: Libusb cannot be found. Please install libusb and then run"
|
||||
- echo "the installer again. Libusb can be installed from http://libusb.info"
|
||||
- echo " "
|
||||
- exit 1
|
||||
-fi
|
||||
|
||||
sudo ldconfig
|
||||
|
@ -1,12 +1,17 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
if [[ ! -f /config/config_webrx.py ]] ; then
|
||||
cp config_webrx.py /config
|
||||
mkdir -p /etc/openwebrx/
|
||||
mkdir -p /tmp/openwebrx/
|
||||
if [[ ! -f /etc/openwebrx/config_webrx.py ]] ; then
|
||||
sed 's/temporary_directory = "\/tmp"/temporary_directory = "\/tmp\/openwebrx"/' < "/opt/openwebrx/config_webrx.py" > "/etc/openwebrx/config_webrx.py"
|
||||
fi
|
||||
if [[ ! -f /etc/openwebrx/bands.json ]] ; then
|
||||
cp bands.json /etc/openwebrx/
|
||||
fi
|
||||
if [[ ! -f /etc/openwebrx/bookmarks.json ]] ; then
|
||||
cp bookmarks.json /etc/openwebrx/
|
||||
fi
|
||||
|
||||
rm config_webrx.py
|
||||
ln -s /config/config_webrx.py .
|
||||
|
||||
|
||||
_term() {
|
||||
|
0
htdocs/__init__.py
Normal file
0
htdocs/__init__.py
Normal file
@ -53,21 +53,13 @@
|
||||
padding: 15px;
|
||||
}
|
||||
|
||||
#webrx-rx-avatar-background
|
||||
{
|
||||
cursor:pointer;
|
||||
background-image: url(../gfx/openwebrx-avatar-background.png);
|
||||
background-origin: content-box;
|
||||
background-repeat: no-repeat;
|
||||
float: left;
|
||||
width: 54px;
|
||||
height: 54px;
|
||||
padding: 7px;
|
||||
box-sizing: content-box;
|
||||
}
|
||||
|
||||
#webrx-rx-avatar
|
||||
{
|
||||
background-color: rgba(154, 154, 154, .5);
|
||||
border-radius: 7px;
|
||||
float: left;
|
||||
margin: 7px;
|
||||
|
||||
cursor:pointer;
|
||||
width: 46px;
|
||||
height: 46px;
|
||||
|
@ -3,6 +3,7 @@
|
||||
This file is part of OpenWebRX,
|
||||
an open-source SDR receiver software with a web UI.
|
||||
Copyright (c) 2013-2015 by Andras Retzler <randras@sdr.hu>
|
||||
Copyright (c) 2019-2020 by Jakob Ketterl <dd5jfk@darc.de>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
@ -39,6 +40,8 @@ input[type=range]
|
||||
{
|
||||
-webkit-appearance: none;
|
||||
margin: 0 0;
|
||||
background: transparent;
|
||||
--track-background: #B6B6B6;
|
||||
}
|
||||
input[type=range]:focus
|
||||
{
|
||||
@ -54,6 +57,7 @@ input[type=range]::-webkit-slider-runnable-track
|
||||
background: #B6B6B6;
|
||||
/*border-radius: 11px;*/
|
||||
border: 1px solid #8A8A8A;
|
||||
background: var(--track-background);
|
||||
}
|
||||
|
||||
input[type=range]::-webkit-slider-thumb
|
||||
@ -72,6 +76,7 @@ input[type=range]::-webkit-slider-thumb
|
||||
input[type=range]:focus::-webkit-slider-runnable-track
|
||||
{
|
||||
background: #B6B6B6;
|
||||
background: var(--track-background);
|
||||
}
|
||||
|
||||
input[type=range]::-moz-range-track
|
||||
@ -81,6 +86,7 @@ input[type=range]::-moz-range-track
|
||||
animate: 0.2s;
|
||||
box-shadow: 0px 0px 0px #000000;
|
||||
background: #B6B6B6;
|
||||
background: var(--track-background);
|
||||
border-radius: 11px;
|
||||
border: 1px solid #8A8A8A;
|
||||
}
|
||||
@ -146,8 +152,10 @@ input[type=range]:focus::-ms-fill-upper
|
||||
|
||||
#webrx-page-container
|
||||
{
|
||||
min-height:100%;
|
||||
position:relative;
|
||||
height: 100%;
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
#openwebrx-scale-container
|
||||
@ -163,6 +171,7 @@ input[type=range]:focus::-ms-fill-upper
|
||||
background-repeat: repeat-x;
|
||||
background-size: cover;
|
||||
background-color: #444;
|
||||
z-index: 1001;
|
||||
}
|
||||
|
||||
#openwebrx-bookmarks-container
|
||||
@ -243,19 +252,30 @@ input[type=range]:focus::-ms-fill-upper
|
||||
border-top-color: #0FF;
|
||||
}
|
||||
|
||||
#webrx-canvas-container
|
||||
{
|
||||
/*background-image:url('../gfx/openwebrx-blank-background-1.jpg');*/
|
||||
position: relative;
|
||||
height: 2000px;
|
||||
overflow-y: scroll;
|
||||
overflow-x: hidden;
|
||||
/*background-color: #646464;*/
|
||||
/*background-image: -webkit-linear-gradient(top, rgba(247,247,247,1) 0%, rgba(0,0,0,1) 100%);*/
|
||||
#openwebrx-bookmarks-container .bookmark[data-source=dial_frequencies] {
|
||||
background-color: #0F0;
|
||||
}
|
||||
|
||||
#openwebrx-bookmarks-container .bookmark[data-source=dial_frequencies]:after {
|
||||
border-top-color: #0F0;
|
||||
}
|
||||
|
||||
#webrx-canvas-background {
|
||||
flex-grow: 1;
|
||||
background-image: url('../gfx/openwebrx-background-cool-blue.png');
|
||||
background-repeat: no-repeat;
|
||||
background-color: #1e5f7f;
|
||||
background-size: cover;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
#webrx-canvas-container
|
||||
{
|
||||
position: relative;
|
||||
overflow: visible;
|
||||
cursor: crosshair;
|
||||
flex-grow: 1;
|
||||
}
|
||||
|
||||
#webrx-canvas-container canvas
|
||||
@ -264,29 +284,10 @@ input[type=range]:focus::-ms-fill-upper
|
||||
border-style: none;
|
||||
image-rendering: crisp-edges;
|
||||
image-rendering: -webkit-optimize-contrast;
|
||||
/*transition: left 200ms, width 200ms;*/
|
||||
width: 100%;
|
||||
height: 200px;
|
||||
}
|
||||
|
||||
#openwebrx-mathbox-container
|
||||
{
|
||||
overflow: none;
|
||||
display: none;
|
||||
}
|
||||
|
||||
#openwebrx-phantom-canvas
|
||||
{
|
||||
position: absolute;
|
||||
width: 0px;
|
||||
height: 0px;
|
||||
}
|
||||
|
||||
/*#openwebrx-canvas-gradient-background
|
||||
{
|
||||
overflow: hidden;
|
||||
width: 100%;
|
||||
height: 396px;
|
||||
}*/
|
||||
|
||||
#openwebrx-log-scroll
|
||||
{
|
||||
/*overflow-y:auto;*/
|
||||
@ -297,74 +298,46 @@ input[type=range]:focus::-ms-fill-upper
|
||||
.nano .nano-pane { background: #444; }
|
||||
.nano .nano-slider { background: #eee !important; }
|
||||
|
||||
#webrx-main-container
|
||||
{
|
||||
position: relative;
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.webrx-error
|
||||
{
|
||||
font-weight: bold;
|
||||
color: #ff6262;
|
||||
}
|
||||
|
||||
#openwebrx-problems span
|
||||
{
|
||||
background: #ff6262;
|
||||
padding: 3px;
|
||||
font-size: 8pt;
|
||||
color: white;
|
||||
font-weight: bold;
|
||||
border-radius: 4px;
|
||||
-moz-border-radius: 4px;
|
||||
margin: 0px 2px 0px 2px;
|
||||
}
|
||||
|
||||
/*#webrx-freq-show
|
||||
{
|
||||
visibility: hidden;
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
padding: 5px;
|
||||
font-weight: bold;
|
||||
border-radius: 10px;
|
||||
-moz-border-radius: 10px;
|
||||
background-color: #999999;
|
||||
color: White;
|
||||
z-index:9999; /*should be higher?
|
||||
|
||||
}*/
|
||||
|
||||
/* removed non-free fonts like that: */
|
||||
/*@font-face {
|
||||
font-family: 'unibody_8_pro_regregular';
|
||||
src: url('../gfx/unibody8pro-regular-webfont.eot');
|
||||
src: url('../gfx/unibody8pro-regular-webfont.ttf');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}*/
|
||||
|
||||
@font-face {
|
||||
font-family: 'expletus-sans-medium';
|
||||
src: url('../gfx/font-expletus-sans/ExpletusSans-Medium.ttf');
|
||||
font-family: 'roboto-mono';
|
||||
src: url('../fonts/RobotoMono-Regular.ttf');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
#webrx-actual-freq
|
||||
{
|
||||
#webrx-actual-freq {
|
||||
width: 100%;
|
||||
text-align: left;
|
||||
font-size: 16pt;
|
||||
font-family: 'expletus-sans-medium';
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
line-height:22px;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
#webrx-actual-freq > * {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
#webrx-actual-freq input {
|
||||
font-family: 'roboto-mono';
|
||||
width: 0;
|
||||
box-sizing: border-box;
|
||||
border: 0;
|
||||
padding: 0;
|
||||
background-color: inherit;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
#webrx-actual-freq, #webrx-actual-freq input {
|
||||
font-size: 16pt;
|
||||
font-family: 'roboto-mono';
|
||||
line-height: 22px;
|
||||
}
|
||||
|
||||
#webrx-mouse-freq
|
||||
@ -373,22 +346,41 @@ input[type=range]:focus::-ms-fill-upper
|
||||
text-align: left;
|
||||
font-size: 10pt;
|
||||
color: #AAA;
|
||||
font-family: 'expletus-sans-medium';
|
||||
font-family: 'roboto-mono';
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
#openwebrx-panels-container-left,
|
||||
#openwebrx-panels-container-right {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: flex-end;
|
||||
height: 0;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
#openwebrx-panels-container-left {
|
||||
left: 0;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
#openwebrx-panels-container-right {
|
||||
right: 0;
|
||||
align-items: flex-end;
|
||||
}
|
||||
|
||||
.openwebrx-panel
|
||||
{
|
||||
transform: perspective( 600px ) rotateX( 90deg );
|
||||
visibility: hidden;
|
||||
background-color: #575757;
|
||||
padding: 10px;
|
||||
color: white;
|
||||
position: fixed;
|
||||
font-size: 10pt;
|
||||
border-radius: 15px;
|
||||
-moz-border-radius: 15px;
|
||||
margin: 5.9px;
|
||||
}
|
||||
|
||||
.openwebrx-panel a
|
||||
@ -439,26 +431,18 @@ input[type=range]:focus::-ms-fill-upper
|
||||
color: #FFFF50;
|
||||
}
|
||||
|
||||
.openwebrx-button:last-child {
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
.openwebrx-demodulator-button
|
||||
{
|
||||
width: 38px;
|
||||
height: 19px;
|
||||
font-size: 12pt;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.openwebrx-dial-button svg {
|
||||
width: 19px;
|
||||
height: 19px;
|
||||
vertical-align: bottom;
|
||||
}
|
||||
|
||||
.openwebrx-dial-button #ph_dial {
|
||||
fill: #888;
|
||||
}
|
||||
|
||||
.openwebrx-dial-button.available #ph_dial {
|
||||
fill: #FFF;
|
||||
flex: 1;
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
.openwebrx-square-button img
|
||||
@ -554,7 +538,7 @@ img.openwebrx-mirror-img
|
||||
|
||||
#openwebrx-panel-status
|
||||
{
|
||||
margin: 0px;
|
||||
margin: 0 0 0 5.9px;
|
||||
padding: 0px;
|
||||
background-color:rgba(0, 0, 0, 0);
|
||||
}
|
||||
@ -615,6 +599,11 @@ img.openwebrx-mirror-img
|
||||
padding-top: 5px;
|
||||
}
|
||||
|
||||
.openwebrx-panel-flex-line {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
.openwebrx-panel-line:first-child {
|
||||
padding-top: 0;
|
||||
}
|
||||
@ -649,11 +638,10 @@ img.openwebrx-mirror-img
|
||||
float: right;
|
||||
margin-right: 5px;
|
||||
margin-top: 24px;
|
||||
font-family: 'expletus-sans-medium';
|
||||
font-family: 'roboto-mono';
|
||||
}
|
||||
|
||||
#openwebrx-big-grey
|
||||
{
|
||||
.openwebrx-overlay {
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
@ -664,21 +652,36 @@ img.openwebrx-mirror-img
|
||||
left: 0;
|
||||
top: 0;
|
||||
z-index: 1001;
|
||||
display: none;
|
||||
vertical-align: middle;
|
||||
text-align: center;
|
||||
color: white;
|
||||
font-weight: bold;
|
||||
font-size: 20pt;
|
||||
}
|
||||
|
||||
#openwebrx-autoplay-overlay
|
||||
{
|
||||
cursor: pointer;
|
||||
transition: opacity 0.3s linear;
|
||||
}
|
||||
|
||||
#openwebrx-big-grey img
|
||||
#openwebrx-autoplay-overlay img
|
||||
{
|
||||
width: 150px;
|
||||
}
|
||||
|
||||
.openwebrx-overlay .overlay-content {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#openwebrx-error-overlay .overlay-content {
|
||||
background-color: #000;
|
||||
padding: 50px;
|
||||
border-radius: 20px;
|
||||
}
|
||||
|
||||
#openwebrx-digimode-canvas-container
|
||||
{
|
||||
/*margin: -10px -10px 10px -10px;*/
|
||||
@ -725,6 +728,7 @@ img.openwebrx-mirror-img
|
||||
width: 173px;
|
||||
height: 27px;
|
||||
padding-left:3px;
|
||||
flex: 4;
|
||||
}
|
||||
|
||||
#openwebrx-sdr-profiles-listbox {
|
||||
@ -920,13 +924,15 @@ img.openwebrx-mirror-img
|
||||
}
|
||||
|
||||
#openwebrx-panel-wsjt-message,
|
||||
#openwebrx-panel-packet-message
|
||||
#openwebrx-panel-packet-message,
|
||||
#openwebrx-panel-pocsag-message
|
||||
{
|
||||
height: 180px;
|
||||
}
|
||||
|
||||
#openwebrx-panel-wsjt-message tbody,
|
||||
#openwebrx-panel-packet-message tbody
|
||||
#openwebrx-panel-packet-message tbody,
|
||||
#openwebrx-panel-pocsag-message tbody
|
||||
{
|
||||
display: block;
|
||||
overflow: auto;
|
||||
@ -935,7 +941,8 @@ img.openwebrx-mirror-img
|
||||
}
|
||||
|
||||
#openwebrx-panel-wsjt-message thead tr,
|
||||
#openwebrx-panel-packet-message thead tr
|
||||
#openwebrx-panel-packet-message thead tr,
|
||||
#openwebrx-panel-pocsag-message thead tr
|
||||
{
|
||||
display: block;
|
||||
}
|
||||
@ -943,7 +950,9 @@ img.openwebrx-mirror-img
|
||||
#openwebrx-panel-wsjt-message th,
|
||||
#openwebrx-panel-wsjt-message td,
|
||||
#openwebrx-panel-packet-message th,
|
||||
#openwebrx-panel-packet-message td
|
||||
#openwebrx-panel-packet-message td,
|
||||
#openwebrx-panel-pocsag-message th,
|
||||
#openwebrx-panel-pocsag-message td
|
||||
{
|
||||
width: 50px;
|
||||
text-align: left;
|
||||
@ -965,6 +974,7 @@ img.openwebrx-mirror-img
|
||||
|
||||
#openwebrx-panel-packet-message .message {
|
||||
width: 410px;
|
||||
max-width: 410px;
|
||||
}
|
||||
|
||||
#openwebrx-panel-packet-message .callsign {
|
||||
@ -976,6 +986,16 @@ img.openwebrx-mirror-img
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#openwebrx-panel-pocsag-message .address {
|
||||
width: 100px;
|
||||
}
|
||||
|
||||
#openwebrx-panel-pocsag-message .message {
|
||||
width: 486px;
|
||||
max-width: 486px;
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
.aprs-symbol {
|
||||
display: inline-block;
|
||||
width: 15px;
|
||||
@ -1021,7 +1041,8 @@ img.openwebrx-mirror-img
|
||||
|
||||
.openwebrx-dialog label {
|
||||
display: inline-block;
|
||||
flex: 1 0 20px;
|
||||
flex-grow: 0;
|
||||
width: 70px;
|
||||
padding-right: 20px;
|
||||
margin-top: auto;
|
||||
margin-bottom: auto;
|
||||
@ -1029,7 +1050,7 @@ img.openwebrx-mirror-img
|
||||
|
||||
.openwebrx-dialog .form-field input,
|
||||
.openwebrx-dialog .form-field select {
|
||||
flex: 2 0 20px;
|
||||
flex-grow: 1;
|
||||
height: 27px;
|
||||
}
|
||||
|
||||
@ -1056,12 +1077,14 @@ img.openwebrx-mirror-img
|
||||
#openwebrx-panel-digimodes[data-mode="jt9"] #openwebrx-digimode-content-container,
|
||||
#openwebrx-panel-digimodes[data-mode="ft4"] #openwebrx-digimode-content-container,
|
||||
#openwebrx-panel-digimodes[data-mode="packet"] #openwebrx-digimode-content-container,
|
||||
#openwebrx-panel-digimodes[data-mode="pocsag"] #openwebrx-digimode-content-container,
|
||||
#openwebrx-panel-digimodes[data-mode="ft8"] #openwebrx-digimode-select-channel,
|
||||
#openwebrx-panel-digimodes[data-mode="wspr"] #openwebrx-digimode-select-channel,
|
||||
#openwebrx-panel-digimodes[data-mode="jt65"] #openwebrx-digimode-select-channel,
|
||||
#openwebrx-panel-digimodes[data-mode="jt9"] #openwebrx-digimode-select-channel,
|
||||
#openwebrx-panel-digimodes[data-mode="ft4"] #openwebrx-digimode-select-channel,
|
||||
#openwebrx-panel-digimodes[data-mode="packet"] #openwebrx-digimode-select-channel
|
||||
#openwebrx-panel-digimodes[data-mode="packet"] #openwebrx-digimode-select-channel,
|
||||
#openwebrx-panel-digimodes[data-mode="pocsag"] #openwebrx-digimode-select-channel
|
||||
{
|
||||
display: none;
|
||||
}
|
||||
@ -1071,8 +1094,10 @@ img.openwebrx-mirror-img
|
||||
#openwebrx-panel-digimodes[data-mode="jt65"] #openwebrx-digimode-canvas-container,
|
||||
#openwebrx-panel-digimodes[data-mode="jt9"] #openwebrx-digimode-canvas-container,
|
||||
#openwebrx-panel-digimodes[data-mode="ft4"] #openwebrx-digimode-canvas-container,
|
||||
#openwebrx-panel-digimodes[data-mode="packet"] #openwebrx-digimode-canvas-container
|
||||
#openwebrx-panel-digimodes[data-mode="packet"] #openwebrx-digimode-canvas-container,
|
||||
#openwebrx-panel-digimodes[data-mode="pocsag"] #openwebrx-digimode-canvas-container
|
||||
{
|
||||
height: 200px;
|
||||
margin: -10px;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
<HTML><HEAD>
|
||||
<TITLE>OpenWebRX Feature report</TITLE>
|
||||
<link rel="shortcut icon" type="image/x-icon" href="static/favicon.ico" />
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
|
||||
<link rel="stylesheet" href="static/css/features.css">
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/showdown/1.9.0/showdown.min.js"></script>
|
||||
|
@ -1,6 +1,6 @@
|
||||
$(function(){
|
||||
var converter = new showdown.Converter();
|
||||
$.ajax('/api/features').done(function(data){
|
||||
$.ajax('api/features').done(function(data){
|
||||
var $table = $('table.features');
|
||||
$.each(data, function(name, details) {
|
||||
var requirements = $.map(details.requirements, function(r, name){
|
||||
@ -21,4 +21,4 @@ $(function(){
|
||||
);
|
||||
})
|
||||
});
|
||||
});
|
||||
});
|
||||
|
BIN
htdocs/fonts/RobotoMono-Regular.ttf
Normal file
BIN
htdocs/fonts/RobotoMono-Regular.ttf
Normal file
Binary file not shown.
Binary file not shown.
@ -1,93 +0,0 @@
|
||||
Copyright (c) 2011, Jasper de Waard (jasper@designtown.nl),
|
||||
with Reserved Font Name "Expletus Sans".
|
||||
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||
This license is copied below, and is also available with a FAQ at:
|
||||
http://scripts.sil.org/OFL
|
||||
|
||||
|
||||
-----------------------------------------------------------
|
||||
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||
-----------------------------------------------------------
|
||||
|
||||
PREAMBLE
|
||||
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||
development of collaborative font projects, to support the font creation
|
||||
efforts of academic and linguistic communities, and to provide a free and
|
||||
open framework in which fonts may be shared and improved in partnership
|
||||
with others.
|
||||
|
||||
The OFL allows the licensed fonts to be used, studied, modified and
|
||||
redistributed freely as long as they are not sold by themselves. The
|
||||
fonts, including any derivative works, can be bundled, embedded,
|
||||
redistributed and/or sold with any software provided that any reserved
|
||||
names are not used by derivative works. The fonts and derivatives,
|
||||
however, cannot be released under any other type of license. The
|
||||
requirement for fonts to remain under this license does not apply
|
||||
to any document created using the fonts or their derivatives.
|
||||
|
||||
DEFINITIONS
|
||||
"Font Software" refers to the set of files released by the Copyright
|
||||
Holder(s) under this license and clearly marked as such. This may
|
||||
include source files, build scripts and documentation.
|
||||
|
||||
"Reserved Font Name" refers to any names specified as such after the
|
||||
copyright statement(s).
|
||||
|
||||
"Original Version" refers to the collection of Font Software components as
|
||||
distributed by the Copyright Holder(s).
|
||||
|
||||
"Modified Version" refers to any derivative made by adding to, deleting,
|
||||
or substituting -- in part or in whole -- any of the components of the
|
||||
Original Version, by changing formats or by porting the Font Software to a
|
||||
new environment.
|
||||
|
||||
"Author" refers to any designer, engineer, programmer, technical
|
||||
writer or other person who contributed to the Font Software.
|
||||
|
||||
PERMISSION & CONDITIONS
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
||||
redistribute, and sell modified and unmodified copies of the Font
|
||||
Software, subject to the following conditions:
|
||||
|
||||
1) Neither the Font Software nor any of its individual components,
|
||||
in Original or Modified Versions, may be sold by itself.
|
||||
|
||||
2) Original or Modified Versions of the Font Software may be bundled,
|
||||
redistributed and/or sold with any software, provided that each copy
|
||||
contains the above copyright notice and this license. These can be
|
||||
included either as stand-alone text files, human-readable headers or
|
||||
in the appropriate machine-readable metadata fields within text or
|
||||
binary files as long as those fields can be easily viewed by the user.
|
||||
|
||||
3) No Modified Version of the Font Software may use the Reserved Font
|
||||
Name(s) unless explicit written permission is granted by the corresponding
|
||||
Copyright Holder. This restriction only applies to the primary font name as
|
||||
presented to the users.
|
||||
|
||||
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||
Software shall not be used to promote, endorse or advertise any
|
||||
Modified Version, except to acknowledge the contribution(s) of the
|
||||
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||
permission.
|
||||
|
||||
5) The Font Software, modified or unmodified, in part or in whole,
|
||||
must be distributed entirely under this license, and must not be
|
||||
distributed under any other license. The requirement for fonts to
|
||||
remain under this license does not apply to any document created
|
||||
using the Font Software.
|
||||
|
||||
TERMINATION
|
||||
This license becomes null and void if any of the above conditions are
|
||||
not met.
|
||||
|
||||
DISCLAIMER
|
||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||
OTHER DEALINGS IN THE FONT SOFTWARE.
|
Binary file not shown.
Before Width: | Height: | Size: 459 B |
Binary file not shown.
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 2.7 KiB |
@ -4,9 +4,7 @@
|
||||
<div id="webrx-top-bar" class="webrx-top-bar-parts">
|
||||
<a href="https://sdr.hu/openwebrx" target="_blank"><img src="static/gfx/openwebrx-top-logo.png" id="webrx-top-logo" /></a>
|
||||
<a href="http://ha5kfu.sch.bme.hu/" target="_blank"><img src="static/gfx/openwebrx-ha5kfu-top-logo.png" id="webrx-ha5kfu-top-logo" /></a>
|
||||
<div id="webrx-rx-avatar-background">
|
||||
<img id="webrx-rx-avatar" class="openwebrx-photo-trigger" src="static/gfx/openwebrx-avatar.png"/>
|
||||
</div>
|
||||
<img id="webrx-rx-avatar" class="openwebrx-photo-trigger" src="static/gfx/openwebrx-avatar.png"/>
|
||||
<div id="webrx-rx-texts">
|
||||
<div id="webrx-rx-title" class="openwebrx-photo-trigger"></div>
|
||||
<div id="webrx-rx-desc" class="openwebrx-photo-trigger"></div>
|
||||
@ -20,7 +18,7 @@
|
||||
<li data-toggle-panel="openwebrx-panel-status"><img src="static/gfx/openwebrx-panel-status.png" /><br/>Status</li>
|
||||
<li data-toggle-panel="openwebrx-panel-log"><img src="static/gfx/openwebrx-panel-log.png" /><br/>Log</li>
|
||||
<li data-toggle-panel="openwebrx-panel-receiver"><img src="static/gfx/openwebrx-panel-receiver.png" /><br/>Receiver</li>
|
||||
<li><a href="/map" target="_blank"><img src="static/gfx/openwebrx-panel-map.png" /><br/>Map</a></li>
|
||||
<li><a href="map" target="_blank"><img src="static/gfx/openwebrx-panel-map.png" /><br/>Map</a></li>
|
||||
</ul>
|
||||
</section>
|
||||
</div>
|
||||
|
@ -4,6 +4,7 @@
|
||||
This file is part of OpenWebRX,
|
||||
an open-source SDR receiver software with a web UI.
|
||||
Copyright (c) 2013-2015 by Andras Retzler <randras@sdr.hu>
|
||||
Copyright (c) 2019-2020 by Jakob Ketterl <dd5jfk@darc.de>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
@ -22,11 +23,15 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>OpenWebRX | Open Source SDR Web App for Everyone!</title>
|
||||
<script src="static/sdr.js"></script>
|
||||
<script src="static/mathbox-bundle.min.js"></script>
|
||||
<link rel="shortcut icon" type="image/x-icon" href="static/favicon.ico" />
|
||||
<script src="static/openwebrx.js"></script>
|
||||
<script src="static/lib/jquery-3.2.1.min.js"></script>
|
||||
<script src="static/lib/jquery.nanoscroller.js"></script>
|
||||
<script src="static/lib/BookmarkBar.js"></script>
|
||||
<script src="static/lib/AudioEngine.js"></script>
|
||||
<script src="static/lib/ProgressBar.js"></script>
|
||||
<script src="static/lib/Measurement.js"></script>
|
||||
<script src="static/lib/FrequencyDisplay.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="static/lib/nanoscroller.css" />
|
||||
<link rel="stylesheet" type="text/css" href="static/css/openwebrx.css" />
|
||||
<meta charset="utf-8">
|
||||
@ -34,26 +39,115 @@
|
||||
<body onload="openwebrx_init();">
|
||||
<div id="webrx-page-container">
|
||||
${header}
|
||||
<div id="webrx-main-container">
|
||||
<div id="openwebrx-frequency-container">
|
||||
<div id="openwebrx-bookmarks-container"></div>
|
||||
<div id="openwebrx-scale-container">
|
||||
<canvas id="openwebrx-scale-canvas" width="0" height="0"></canvas>
|
||||
</div>
|
||||
<div id="openwebrx-frequency-container">
|
||||
<div id="openwebrx-bookmarks-container"></div>
|
||||
<div id="openwebrx-scale-container">
|
||||
<canvas id="openwebrx-scale-canvas" width="0" height="0"></canvas>
|
||||
</div>
|
||||
<div id="openwebrx-mathbox-container"> </div>
|
||||
</div>
|
||||
<div id="webrx-canvas-background">
|
||||
<div id="webrx-canvas-container">
|
||||
<div id="openwebrx-phantom-canvas"></div>
|
||||
<!-- add canvas here by javascript -->
|
||||
</div>
|
||||
<div id="openwebrx-panels-container">
|
||||
<div class="openwebrx-panel" id="openwebrx-panel-receiver" data-panel-name="client-params" data-panel-pos="right" data-panel-order="0" data-panel-size="259,115">
|
||||
</div>
|
||||
<div id="openwebrx-panels-container">
|
||||
<div id="openwebrx-panels-container-left">
|
||||
<div class="openwebrx-panel" data-panel-name="client-under-devel" style="width: 245px; background-color: Red;">
|
||||
<span style="font-size: 15pt; font-weight: bold;">Under construction</span>
|
||||
<br />We're working on the code right now, so the application might fail.
|
||||
</div>
|
||||
<div class="openwebrx-panel" id="openwebrx-panel-digimodes" style="display: none; width: 619px;" data-panel-name="digimodes">
|
||||
<div id="openwebrx-digimode-canvas-container">
|
||||
<div id="openwebrx-digimode-select-channel"></div>
|
||||
</div>
|
||||
<div id="openwebrx-digimode-content-container">
|
||||
<div class="gradient"></div>
|
||||
<div id="openwebrx-digimode-content">
|
||||
<span id="openwebrx-cursor-blink"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table class="openwebrx-panel" id="openwebrx-panel-wsjt-message" style="display: none; width: 619px;" data-panel-name="wsjt-message">
|
||||
<thead><tr>
|
||||
<th>UTC</th>
|
||||
<th class="decimal">dB</th>
|
||||
<th class="decimal">DT</th>
|
||||
<th class="decimal freq">Freq</th>
|
||||
<th class="message">Message</th>
|
||||
</tr></thead>
|
||||
<tbody></tbody>
|
||||
</table>
|
||||
<table class="openwebrx-panel" id="openwebrx-panel-packet-message" style="display: none; width: 619px;" data-panel-name="aprs-message">
|
||||
<thead><tr>
|
||||
<th>UTC</th>
|
||||
<th class="callsign">Callsign</th>
|
||||
<th class="coord">Coord</th>
|
||||
<th class="message">Comment</th>
|
||||
</tr></thead>
|
||||
<tbody></tbody>
|
||||
</table>
|
||||
<table class="openwebrx-panel" id="openwebrx-panel-pocsag-message" style="display: none; width: 619px;" data-panel-name="pocsag-message">
|
||||
<thead><tr>
|
||||
<th class="address">Address</th>
|
||||
<th class="message">Message</th>
|
||||
</tr></thead>
|
||||
<tbody></tbody>
|
||||
</table>
|
||||
<div class="openwebrx-panel openwebrx-meta-panel" id="openwebrx-panel-metadata-ysf" style="display: none;" data-panel-name="metadata-ysf">
|
||||
<div class="openwebrx-meta-frame">
|
||||
<div class="openwebrx-meta-slot">
|
||||
<div class="openwebrx-ysf-mode openwebrx-meta-autoclear"></div>
|
||||
<div class="openwebrx-meta-user-image"></div>
|
||||
<div class="openwebrx-ysf-source openwebrx-meta-autoclear"></div>
|
||||
<div class="openwebrx-ysf-up openwebrx-meta-autoclear"></div>
|
||||
<div class="openwebrx-ysf-down openwebrx-meta-autoclear"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="openwebrx-panel openwebrx-meta-panel" id="openwebrx-panel-metadata-dmr" style="display: none;" data-panel-name="metadata-dmr">
|
||||
<div class="openwebrx-meta-frame">
|
||||
<div class="openwebrx-meta-slot openwebrx-dmr-timeslot-panel">
|
||||
<div class="openwebrx-dmr-slot">Timeslot 1</div>
|
||||
<div class="openwebrx-meta-user-image"></div>
|
||||
<div class="openwebrx-dmr-id openwebrx-meta-autoclear"></div>
|
||||
<div class="openwebrx-dmr-name openwebrx-meta-autoclear"></div>
|
||||
<div class="openwebrx-dmr-target openwebrx-meta-autoclear"></div>
|
||||
</div>
|
||||
<div class="openwebrx-meta-slot openwebrx-dmr-timeslot-panel">
|
||||
<div class="openwebrx-dmr-slot">Timeslot 2</div>
|
||||
<div class="openwebrx-meta-user-image"></div>
|
||||
<div class="openwebrx-dmr-id openwebrx-meta-autoclear"></div>
|
||||
<div class="openwebrx-dmr-name openwebrx-meta-autoclear"></div>
|
||||
<div class="openwebrx-dmr-target openwebrx-meta-autoclear"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="openwebrx-panel" id="openwebrx-panel-log" data-panel-name="debug" style="width: 619px;">
|
||||
<div class="openwebrx-panel-inner nano" id="openwebrx-log-scroll">
|
||||
<div class="nano-content">
|
||||
<div id="openwebrx-client-log-title">OpenWebRX client log</div>
|
||||
<div>Author contact: <a href="http://www.justjakob.de/" target="_blank">Jakob Ketterl, DD5JFK</a></div>
|
||||
<div id="openwebrx-debugdiv"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="openwebrx-panel" id="openwebrx-panel-status" data-panel-name="status" style="width: 615px;" data-panel-transparent="true">
|
||||
<div class="openwebrx-progressbar" id="openwebrx-bar-audio-buffer"> <span class="openwebrx-progressbar-text">Audio buffer [0 ms]</span><div class="openwebrx-progressbar-bar"></div></div>
|
||||
<div class="openwebrx-progressbar" id="openwebrx-bar-audio-output"> <span class="openwebrx-progressbar-text">Audio output [0 sps]</span><div class="openwebrx-progressbar-bar"></div></div>
|
||||
<div class="openwebrx-progressbar" id="openwebrx-bar-audio-speed"> <span class="openwebrx-progressbar-text">Audio stream [0 kbps]</span><div class="openwebrx-progressbar-bar"></div></div>
|
||||
<div class="openwebrx-progressbar" id="openwebrx-bar-network-speed"> <span class="openwebrx-progressbar-text">Network usage [0 kbps]</span><div class="openwebrx-progressbar-bar"></div></div>
|
||||
<div class="openwebrx-progressbar" id="openwebrx-bar-server-cpu"> <span class="openwebrx-progressbar-text">Server CPU [0%]</span><div class="openwebrx-progressbar-bar"></div></div>
|
||||
<div class="openwebrx-progressbar" id="openwebrx-bar-clients"> <span class="openwebrx-progressbar-text">Clients [1]</span><div class="openwebrx-progressbar-bar"></div></div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="openwebrx-panels-container-right">
|
||||
<div class="openwebrx-panel" id="openwebrx-panel-receiver" data-panel-name="client-params" style="width: 259px;">
|
||||
<div class="openwebrx-panel-line frequencies-container">
|
||||
<div class="frequencies">
|
||||
<div id="webrx-actual-freq">---.--- MHz</div>
|
||||
<div id="webrx-mouse-freq">---.--- MHz</div>
|
||||
<div id="webrx-actual-freq"></div>
|
||||
<div id="webrx-mouse-freq"></div>
|
||||
</div>
|
||||
<div class="openwebrx-button openwebrx-square-button openwebrx-bookmark-button" style="display:none;">
|
||||
<div class="openwebrx-button openwebrx-square-button openwebrx-bookmark-button" style="display:none;" title="Add bookmark...">
|
||||
<img src="static/gfx/openwebrx-bookmark.png">
|
||||
</div>
|
||||
</div>
|
||||
@ -61,49 +155,46 @@
|
||||
<select id="openwebrx-sdr-profiles-listbox" onchange="sdr_profile_changed();">
|
||||
</select>
|
||||
</div>
|
||||
<div class="openwebrx-panel-line">
|
||||
<div class="openwebrx-panel-line openwebrx-panel-flex-line">
|
||||
<div class="openwebrx-button openwebrx-demodulator-button" id="openwebrx-button-nfm"
|
||||
onclick="demodulator_analog_replace('nfm');">FM</div>
|
||||
onclick="demodulator_analog_replace('nfm');">FM</div>
|
||||
<div class="openwebrx-button openwebrx-demodulator-button" id="openwebrx-button-am"
|
||||
onclick="demodulator_analog_replace('am');">AM</div>
|
||||
onclick="demodulator_analog_replace('am');">AM</div>
|
||||
<div class="openwebrx-button openwebrx-demodulator-button" id="openwebrx-button-lsb"
|
||||
onclick="demodulator_analog_replace('lsb');">LSB</div>
|
||||
onclick="demodulator_analog_replace('lsb');">LSB</div>
|
||||
<div class="openwebrx-button openwebrx-demodulator-button" id="openwebrx-button-usb"
|
||||
onclick="demodulator_analog_replace('usb');">USB</div>
|
||||
onclick="demodulator_analog_replace('usb');">USB</div>
|
||||
<div class="openwebrx-button openwebrx-demodulator-button" id="openwebrx-button-cw"
|
||||
onclick="demodulator_analog_replace('cw');">CW</div>
|
||||
onclick="demodulator_analog_replace('cw');">CW</div>
|
||||
</div>
|
||||
<div class="openwebrx-panel-line openwebrx-panel-flex-line">
|
||||
<div class="openwebrx-button openwebrx-demodulator-button" id="openwebrx-button-dmr"
|
||||
style="display:none;" data-feature="digital_voice_digiham"
|
||||
onclick="demodulator_analog_replace('dmr');">DMR</div>
|
||||
onclick="demodulator_analog_replace('dmr');">DMR</div>
|
||||
<div class="openwebrx-button openwebrx-demodulator-button" id="openwebrx-button-dstar"
|
||||
style="display:none;" data-feature="digital_voice_dsd"
|
||||
onclick="demodulator_analog_replace('dstar');">DStar</div>
|
||||
onclick="demodulator_analog_replace('dstar');">DStar</div>
|
||||
<div class="openwebrx-button openwebrx-demodulator-button" id="openwebrx-button-nxdn"
|
||||
style="display:none;" data-feature="digital_voice_dsd"
|
||||
onclick="demodulator_analog_replace('nxdn');">NXDN</div>
|
||||
onclick="demodulator_analog_replace('nxdn');">NXDN</div>
|
||||
<div class="openwebrx-button openwebrx-demodulator-button" id="openwebrx-button-ysf"
|
||||
style="display:none;" data-feature="digital_voice_digiham"
|
||||
onclick="demodulator_analog_replace('ysf');">YSF</div>
|
||||
onclick="demodulator_analog_replace('ysf');">YSF</div>
|
||||
</div>
|
||||
<div class="openwebrx-panel-line">
|
||||
<div class="openwebrx-panel-line openwebrx-panel-flex-line">
|
||||
<div class="openwebrx-button openwebrx-demodulator-button" id="openwebrx-button-dig" onclick="demodulator_digital_replace_last();">DIG</div>
|
||||
<select id="openwebrx-secondary-demod-listbox" onchange="secondary_demod_listbox_changed();">
|
||||
<option value="none"></option>
|
||||
<option value="bpsk31">BPSK31</option>
|
||||
<option value="bpsk63">BPSK63</option>
|
||||
<option value="ft8" data-feature="wsjt-x">FT8</option>
|
||||
<option value="wspr" data-feature="wsjt-x">WSPR</option>
|
||||
<option value="jt65" data-feature="wsjt-x">JT65</option>
|
||||
<option value="jt9" data-feature="wsjt-x">JT9</option>
|
||||
<option value="ft4" data-feature="wsjt-x">FT4</option>
|
||||
<option value="packet" data-feature="packet">Packet</option>
|
||||
<option value="pocsag" data-feature="pocsag">Pocsag</option>
|
||||
</select>
|
||||
<div id="openwebrx-secondary-demod-dial-button" class="openwebrx-button openwebrx-dial-button" onclick="dial_button_click();">
|
||||
<svg version="1.1" id="Layer_1" x="0px" y="0px" width="246px" height="246px" viewBox="0 0 246 246" xmlns="http://www.w3.org/2000/svg">
|
||||
<g id="ph_dial_1_" transform="matrix(1, 0, 0, 1, -45.398312, -50.931698)">
|
||||
<path id="ph_dial" d="M238.875,190.125c3.853,7.148,34.267,4.219,50.242,2.145c0.891-5.977,1.508-12.043,1.508-18.27 c0-67.723-54.901-122.625-122.625-122.625c-67.723,0-122.625,54.902-122.625,122.625c0,67.723,54.902,122.625,122.625,122.625 c51.06,0,94.797-31.227,113.25-75.609c-13.969-9.668-41.625-18.891-41.625-18.891c-5.25,0-10.5-3-12.75-8.25 S233.625,180.375,238.875,190.125z M220.465,175.313c0,28.478-23.086,51.563-51.563,51.563c-28.478,0-51.563-23.086-51.563-51.563 c0-28.477,23.086-51.563,51.563-51.563C197.379,123.75,220.465,146.836,220.465,175.313z M185.25,64.125 c10.563,0,19.125,8.563,19.125,19.125s-8.563,19.125-19.125,19.125c-10.562,0-19.125-8.563-19.125-19.125 S174.688,64.125,185.25,64.125z M142.875,69C153.438,69,162,77.563,162,88.125s-8.563,19.125-19.125,19.125 c-10.562,0-19.125-8.563-19.125-19.125S132.313,69,142.875,69z M106.5,91.875c10.563,0,19.125,8.563,19.125,19.125 s-8.563,19.125-19.125,19.125c-10.562,0-19.125-8.562-19.125-19.125S95.938,91.875,106.5,91.875z M81.375,126.75 c10.563,0,19.125,8.563,19.125,19.125S91.938,165,81.375,165c-10.563,0-19.125-8.563-19.125-19.125S70.813,126.75,81.375,126.75z M58.125,188.625c0-10.559,8.563-19.125,19.125-19.125c10.563,0,19.125,8.566,19.125,19.125S87.813,207.75,77.25,207.75 C66.687,207.75,58.125,199.184,58.125,188.625z M75.75,229.875c0-10.559,8.563-19.125,19.125-19.125 c10.563,0,19.125,8.566,19.125,19.125S105.438,249,94.875,249C84.312,249,75.75,240.434,75.75,229.875z M126.375,276 c-10.563,0-19.125-8.566-19.125-19.125s8.563-19.125,19.125-19.125c10.563,0,19.125,8.566,19.125,19.125S136.938,276,126.375,276z M168,288c-10.563,0-19.125-8.566-19.125-19.125S157.438,249.75,168,249.75c10.563,0,19.125,8.566,19.125,19.125 S178.563,288,168,288z M210.375,276c-10.563,0-19.125-8.566-19.125-19.125s8.563-19.125,19.125-19.125 c10.563,0,19.125,8.566,19.125,19.125S220.938,276,210.375,276z M243.375,210.75c10.563,0,19.125,8.566,19.125,19.125 S253.938,249,243.375,249c-10.563,0-19.125-8.566-19.125-19.125S232.813,210.75,243.375,210.75z"/>
|
||||
</g>
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
<div class="openwebrx-panel-line">
|
||||
<div title="Mute on/off" id="openwebrx-mute-off" class="openwebrx-button" onclick="toggleMute();"><img src="static/gfx/openwebrx-speaker.png" class="openwebrx-sliderbtn-img" id="openwebrx-mute-img"></div>
|
||||
@ -122,7 +213,6 @@
|
||||
<div class="openwebrx-button openwebrx-square-button" onclick="zoomOutOneStep();" title="Zoom out one step"> <img src="static/gfx/openwebrx-zoom-out.png" /></div>
|
||||
<div class="openwebrx-button openwebrx-square-button" onclick="zoomInTotal();" title="Zoom in totally"><img src="static/gfx/openwebrx-zoom-in-total.png" /></div>
|
||||
<div class="openwebrx-button openwebrx-square-button" onclick="zoomOutTotal();" title="Zoom out totally"><img src="static/gfx/openwebrx-zoom-out-total.png" /></div>
|
||||
<div class="openwebrx-button openwebrx-square-button" onclick="mathbox_toggle();" title="Toggle 3D view"><img src="static/gfx/openwebrx-3d-spectrum.png" /></div>
|
||||
<div id="openwebrx-smeter-db">0 dB</div>
|
||||
</div>
|
||||
<div class="openwebrx-panel-line">
|
||||
@ -131,93 +221,20 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="openwebrx-panel" id="openwebrx-panel-log" data-panel-name="debug" data-panel-pos="left" data-panel-order="1" data-panel-size="619,137">
|
||||
<div class="openwebrx-panel-inner nano" id="openwebrx-log-scroll">
|
||||
<div class="nano-content">
|
||||
<div id="openwebrx-client-log-title">OpenWebRX client log</strong><span id="openwebrx-problems"></span></div>
|
||||
<span id="openwebrx-client-1">Author: </span><a href="http://blog.sdr.hu/about" target="_blank">András Retzler, HA7ILM</a><br />You can support OpenWebRX development via <a href="http://blog.sdr.hu/support" target="_blank">PayPal!</a><br/>
|
||||
<div id="openwebrx-debugdiv"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="openwebrx-panel" id="openwebrx-panel-status" data-panel-name="status" data-panel-pos="left" data-panel-order="0" data-panel-size="615,50" data-panel-transparent="true">
|
||||
<div class="openwebrx-progressbar" id="openwebrx-bar-audio-buffer"> <span class="openwebrx-progressbar-text">Audio buffer [0 ms]</span><div class="openwebrx-progressbar-bar"></div></div>
|
||||
<div class="openwebrx-progressbar" id="openwebrx-bar-audio-output"> <span class="openwebrx-progressbar-text">Audio output [0 sps]</span><div class="openwebrx-progressbar-bar"></div></div>
|
||||
<div class="openwebrx-progressbar" id="openwebrx-bar-audio-speed"> <span class="openwebrx-progressbar-text">Audio stream [0 kbps]</span><div class="openwebrx-progressbar-bar"></div></div>
|
||||
<div class="openwebrx-progressbar" id="openwebrx-bar-network-speed"> <span class="openwebrx-progressbar-text">Network usage [0 kbps]</span><div class="openwebrx-progressbar-bar"></div></div>
|
||||
<div class="openwebrx-progressbar" id="openwebrx-bar-server-cpu"> <span class="openwebrx-progressbar-text">Server CPU [0%]</span><div class="openwebrx-progressbar-bar"></div></div>
|
||||
<div class="openwebrx-progressbar" id="openwebrx-bar-clients"> <span class="openwebrx-progressbar-text">Clients [1]</span><div class="openwebrx-progressbar-bar"></div></div>
|
||||
</div>
|
||||
<div class="openwebrx-panel" data-panel-name="client-under-devel" data-panel-pos="left" data-panel-order="9" data-panel-size="245,55" style="background-color: Red;">
|
||||
<span style="font-size: 15pt; font-weight: bold;">Under construction</span>
|
||||
<br />We're working on the code right now, so the application might fail.
|
||||
</div>
|
||||
<div class="openwebrx-panel" id="openwebrx-panel-digimodes" data-panel-name="digimodes" data-panel-pos="left" data-panel-order="3" data-panel-size="619,210">
|
||||
<div id="openwebrx-digimode-canvas-container">
|
||||
<div id="openwebrx-digimode-select-channel"></div>
|
||||
</div>
|
||||
<div id="openwebrx-digimode-content-container">
|
||||
<div class="gradient"></div>
|
||||
<div id="openwebrx-digimode-content">
|
||||
<span id="openwebrx-cursor-blink"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table class="openwebrx-panel" id="openwebrx-panel-wsjt-message" data-panel-name="wsjt-message" data-panel-pos="left" data-panel-order="2" data-panel-size="619,200">
|
||||
<thead><tr>
|
||||
<th>UTC</th>
|
||||
<th class="decimal">dB</th>
|
||||
<th class="decimal">DT</th>
|
||||
<th class="decimal freq">Freq</th>
|
||||
<th class="message">Message</th>
|
||||
</tr></thead>
|
||||
<tbody></tbody>
|
||||
</table>
|
||||
<table class="openwebrx-panel" id="openwebrx-panel-packet-message" data-panel-name="aprs-message" data-panel-pos="left" data-panel-order="2" data-panel-size="619,200">
|
||||
<thead><tr>
|
||||
<th>UTC</th>
|
||||
<th class="callsign">Callsign</th>
|
||||
<th class="coord">Coord</th>
|
||||
<th class="message">Comment</th>
|
||||
</tr></thead>
|
||||
<tbody></tbody>
|
||||
</table>
|
||||
<div class="openwebrx-panel openwebrx-meta-panel" id="openwebrx-panel-metadata-ysf" data-panel-name="metadata-ysf" data-panel-pos="left" data-panel-order="2" data-panel-size="145,220">
|
||||
<div class="openwebrx-meta-frame">
|
||||
<div class="openwebrx-meta-slot">
|
||||
<div class="openwebrx-ysf-mode openwebrx-meta-autoclear"></div>
|
||||
<div class="openwebrx-meta-user-image"></div>
|
||||
<div class="openwebrx-ysf-source openwebrx-meta-autoclear"></div>
|
||||
<div class="openwebrx-ysf-up openwebrx-meta-autoclear"></div>
|
||||
<div class="openwebrx-ysf-down openwebrx-meta-autoclear"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="openwebrx-panel openwebrx-meta-panel" id="openwebrx-panel-metadata-dmr" data-panel-name="metadata-dmr" data-panel-pos="left" data-panel-order="2" data-panel-size="300,220">
|
||||
<div class="openwebrx-meta-frame">
|
||||
<div class="openwebrx-meta-slot openwebrx-dmr-timeslot-panel">
|
||||
<div class="openwebrx-dmr-slot">Timeslot 1</div>
|
||||
<div class="openwebrx-meta-user-image"></div>
|
||||
<div class="openwebrx-dmr-id openwebrx-meta-autoclear"></div>
|
||||
<div class="openwebrx-dmr-name openwebrx-meta-autoclear"></div>
|
||||
<div class="openwebrx-dmr-target openwebrx-meta-autoclear"></div>
|
||||
</div>
|
||||
<div class="openwebrx-meta-slot openwebrx-dmr-timeslot-panel">
|
||||
<div class="openwebrx-dmr-slot">Timeslot 2</div>
|
||||
<div class="openwebrx-meta-user-image"></div>
|
||||
<div class="openwebrx-dmr-id openwebrx-meta-autoclear"></div>
|
||||
<div class="openwebrx-dmr-name openwebrx-meta-autoclear"></div>
|
||||
<div class="openwebrx-dmr-target openwebrx-meta-autoclear"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="openwebrx-big-grey" onclick="iosPlayButtonClick();">
|
||||
<div id="openwebrx-play-button-text">
|
||||
<img id="openwebrx-play-button" src="static/gfx/openwebrx-play-button.png" />
|
||||
<br /><br />Start OpenWebRX
|
||||
<div id="openwebrx-autoplay-overlay" class="openwebrx-overlay" style="display:none;">
|
||||
<div class="overlay-content">
|
||||
<img id="openwebrx-play-button" src="static/gfx/openwebrx-play-button.png" />
|
||||
<div>Start OpenWebRX</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="openwebrx-error-overlay" class="openwebrx-overlay" style="display:none;">
|
||||
<div class="overlay-content">
|
||||
<div>This receiver is currently unavailable due to technical issues.</div>
|
||||
<div>Error Message:</div>
|
||||
<div class="errormessage"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="openwebrx-dialog-bookmark" class="openwebrx-dialog" style="display:none;">
|
||||
|
@ -8,8 +8,8 @@ AprsMarker.prototype.draw = function() {
|
||||
if (!div || !overlay) return;
|
||||
|
||||
if (this.symbol) {
|
||||
var tableId = this.symbol.table == '/' ? 0 : 1;
|
||||
div.style.background = 'url(/aprs-symbols/aprs-symbols-24-' + tableId + '@2x.png)';
|
||||
var tableId = this.symbol.table === '/' ? 0 : 1;
|
||||
div.style.background = 'url(aprs-symbols/aprs-symbols-24-' + tableId + '@2x.png)';
|
||||
div.style['background-size'] = '384px 144px';
|
||||
div.style['background-position-x'] = -(this.symbol.index % 16) * 24 + 'px';
|
||||
div.style['background-position-y'] = -Math.floor(this.symbol.index / 16) * 24 + 'px';
|
||||
@ -25,7 +25,7 @@ AprsMarker.prototype.draw = function() {
|
||||
div.style.transform = null;
|
||||
}
|
||||
|
||||
if (this.symbol.table != '/' && this.symbol.table != '\\') {
|
||||
if (this.symbol.table !== '/' && this.symbol.table !== '\\') {
|
||||
overlay.style.display = 'block';
|
||||
overlay.style['background-position-x'] = -(this.symbol.tableindex % 16) * 24 + 'px';
|
||||
overlay.style['background-position-y'] = -Math.floor(this.symbol.tableindex / 16) * 24 + 'px';
|
||||
@ -63,7 +63,7 @@ AprsMarker.prototype.onAdd = function() {
|
||||
var overlay = this.overlay = document.createElement('div');
|
||||
overlay.style.width = '24px';
|
||||
overlay.style.height = '24px';
|
||||
overlay.style.background = 'url(/aprs-symbols/aprs-symbols-24-2@2x.png)';
|
||||
overlay.style.background = 'url(aprs-symbols/aprs-symbols-24-2@2x.png)';
|
||||
overlay.style['background-size'] = '384px 144px';
|
||||
overlay.style.display = 'none';
|
||||
|
||||
|
356
htdocs/lib/AudioEngine.js
Normal file
356
htdocs/lib/AudioEngine.js
Normal file
@ -0,0 +1,356 @@
|
||||
// this controls if the new AudioWorklet API should be used if available.
|
||||
// the engine will still fall back to the ScriptProcessorNode if this is set to true but not available in the browser.
|
||||
var useAudioWorklets = true;
|
||||
|
||||
function AudioEngine(maxBufferLength, audioReporter) {
|
||||
this.audioReporter = audioReporter;
|
||||
this.initStats();
|
||||
this.resetStats();
|
||||
var ctx = window.AudioContext || window.webkitAudioContext;
|
||||
if (!ctx) {
|
||||
return;
|
||||
}
|
||||
this.audioContext = new ctx();
|
||||
this.allowed = this.audioContext.state === 'running';
|
||||
this.started = false;
|
||||
|
||||
this.audioCodec = new ImaAdpcmCodec();
|
||||
this.compression = 'none';
|
||||
|
||||
this.setupResampling();
|
||||
this.resampler = new Interpolator(this.resamplingFactor);
|
||||
|
||||
this.maxBufferSize = maxBufferLength * this.getSampleRate();
|
||||
}
|
||||
|
||||
AudioEngine.prototype.start = function(callback) {
|
||||
var me = this;
|
||||
if (me.resamplingFactor === 0) return; //if failed to find a valid resampling factor...
|
||||
if (me.started) {
|
||||
if (callback) callback(false);
|
||||
return;
|
||||
}
|
||||
|
||||
me.audioContext.resume().then(function(){
|
||||
me.allowed = me.audioContext.state === 'running';
|
||||
if (!me.allowed) {
|
||||
if (callback) callback(false);
|
||||
return;
|
||||
}
|
||||
me.started = true;
|
||||
|
||||
me.gainNode = me.audioContext.createGain();
|
||||
me.gainNode.connect(me.audioContext.destination);
|
||||
|
||||
if (useAudioWorklets && me.audioContext.audioWorklet) {
|
||||
me.audioContext.audioWorklet.addModule('static/lib/AudioProcessor.js').then(function(){
|
||||
me.audioNode = new AudioWorkletNode(me.audioContext, 'openwebrx-audio-processor', {
|
||||
numberOfInputs: 0,
|
||||
numberOfOutputs: 1,
|
||||
outputChannelCount: [1],
|
||||
processorOptions: {
|
||||
maxBufferSize: me.maxBufferSize
|
||||
}
|
||||
});
|
||||
me.audioNode.connect(me.gainNode);
|
||||
me.audioNode.port.addEventListener('message', function(m){
|
||||
var json = JSON.parse(m.data);
|
||||
if (typeof(json.buffersize) !== 'undefined') {
|
||||
me.audioReporter({
|
||||
buffersize: json.buffersize
|
||||
});
|
||||
}
|
||||
if (typeof(json.samplesProcessed) !== 'undefined') {
|
||||
me.audioSamples.add(json.samplesProcessed);
|
||||
}
|
||||
});
|
||||
me.audioNode.port.start();
|
||||
if (callback) callback(true, 'AudioWorklet');
|
||||
});
|
||||
} else {
|
||||
me.audioBuffers = [];
|
||||
|
||||
if (!AudioBuffer.prototype.copyToChannel) { //Chrome 36 does not have it, Firefox does
|
||||
AudioBuffer.prototype.copyToChannel = function (input, channel) //input is Float32Array
|
||||
{
|
||||
var cd = this.getChannelData(channel);
|
||||
for (var i = 0; i < input.length; i++) cd[i] = input[i];
|
||||
}
|
||||
}
|
||||
|
||||
var bufferSize;
|
||||
if (me.audioContext.sampleRate < 44100 * 2)
|
||||
bufferSize = 4096;
|
||||
else if (me.audioContext.sampleRate >= 44100 * 2 && me.audioContext.sampleRate < 44100 * 4)
|
||||
bufferSize = 4096 * 2;
|
||||
else if (me.audioContext.sampleRate > 44100 * 4)
|
||||
bufferSize = 4096 * 4;
|
||||
|
||||
|
||||
function audio_onprocess(e) {
|
||||
var total = 0;
|
||||
var out = new Float32Array(bufferSize);
|
||||
while (me.audioBuffers.length) {
|
||||
var b = me.audioBuffers.shift();
|
||||
// not enough space to fit all data, so splice and put back in the queue
|
||||
if (total + b.length > bufferSize) {
|
||||
var spaceLeft = bufferSize - total;
|
||||
var tokeep = b.subarray(0, spaceLeft);
|
||||
out.set(tokeep, total);
|
||||
var tobuffer = b.subarray(spaceLeft, b.length);
|
||||
me.audioBuffers.unshift(tobuffer);
|
||||
total += spaceLeft;
|
||||
break;
|
||||
} else {
|
||||
out.set(b, total);
|
||||
total += b.length;
|
||||
}
|
||||
}
|
||||
|
||||
e.outputBuffer.copyToChannel(out, 0);
|
||||
me.audioSamples.add(total);
|
||||
|
||||
}
|
||||
|
||||
//on Chrome v36, createJavaScriptNode has been replaced by createScriptProcessor
|
||||
var method = 'createScriptProcessor';
|
||||
if (me.audioContext.createJavaScriptNode) {
|
||||
method = 'createJavaScriptNode';
|
||||
}
|
||||
me.audioNode = me.audioContext[method](bufferSize, 0, 1);
|
||||
me.audioNode.onaudioprocess = audio_onprocess;
|
||||
me.audioNode.connect(me.gainNode);
|
||||
if (callback) callback(true, 'ScriptProcessorNode');
|
||||
}
|
||||
|
||||
setInterval(me.reportStats.bind(me), 1000);
|
||||
});
|
||||
};
|
||||
|
||||
AudioEngine.prototype.isAllowed = function() {
|
||||
return this.allowed;
|
||||
};
|
||||
|
||||
AudioEngine.prototype.reportStats = function() {
|
||||
if (this.audioNode.port) {
|
||||
this.audioNode.port.postMessage(JSON.stringify({cmd:'getStats'}));
|
||||
} else {
|
||||
this.audioReporter({
|
||||
buffersize: this.getBuffersize()
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
AudioEngine.prototype.initStats = function() {
|
||||
var me = this;
|
||||
var buildReporter = function(key) {
|
||||
return function(v){
|
||||
var report = {};
|
||||
report[key] = v;
|
||||
me.audioReporter(report);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
this.audioBytes = new Measurement();
|
||||
this.audioBytes.report(10000, 1000, buildReporter('audioByteRate'));
|
||||
|
||||
this.audioSamples = new Measurement();
|
||||
this.audioSamples.report(10000, 1000, buildReporter('audioRate'));
|
||||
};
|
||||
|
||||
AudioEngine.prototype.resetStats = function() {
|
||||
this.audioBytes.reset();
|
||||
this.audioSamples.reset();
|
||||
};
|
||||
|
||||
AudioEngine.prototype.setupResampling = function() { //both at the server and the client
|
||||
var output_range_max = 12000;
|
||||
var output_range_min = 8000;
|
||||
var targetRate = this.audioContext.sampleRate;
|
||||
var i = 1;
|
||||
while (true) {
|
||||
var audio_server_output_rate = Math.floor(targetRate / i);
|
||||
if (audio_server_output_rate < output_range_min) {
|
||||
this.resamplingFactor = 0;
|
||||
this.outputRate = 0;
|
||||
divlog('Your audio card sampling rate (' + targetRate + ') is not supported.<br />Please change your operating system default settings in order to fix this.', 1);
|
||||
break;
|
||||
} else if (audio_server_output_rate >= output_range_min && audio_server_output_rate <= output_range_max) {
|
||||
this.resamplingFactor = i;
|
||||
this.outputRate = audio_server_output_rate;
|
||||
break; //okay, we're done
|
||||
}
|
||||
i++;
|
||||
}
|
||||
};
|
||||
|
||||
AudioEngine.prototype.getOutputRate = function() {
|
||||
return this.outputRate;
|
||||
};
|
||||
|
||||
AudioEngine.prototype.getSampleRate = function() {
|
||||
return this.audioContext.sampleRate;
|
||||
};
|
||||
|
||||
AudioEngine.prototype.pushAudio = function(data) {
|
||||
if (!this.audioNode) return;
|
||||
this.audioBytes.add(data.byteLength);
|
||||
var buffer;
|
||||
if (this.compression === "adpcm") {
|
||||
//resampling & ADPCM
|
||||
buffer = this.audioCodec.decode(new Uint8Array(data));
|
||||
} else {
|
||||
buffer = new Int16Array(data);
|
||||
}
|
||||
buffer = this.resampler.process(buffer);
|
||||
if (this.audioNode.port) {
|
||||
// AudioWorklets supported
|
||||
this.audioNode.port.postMessage(buffer);
|
||||
} else {
|
||||
// silently drop excess samples
|
||||
if (this.getBuffersize() + buffer.length <= this.maxBufferSize) {
|
||||
this.audioBuffers.push(buffer);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
AudioEngine.prototype.setCompression = function(compression) {
|
||||
this.compression = compression;
|
||||
};
|
||||
|
||||
AudioEngine.prototype.setVolume = function(volume) {
|
||||
this.gainNode.gain.value = volume;
|
||||
};
|
||||
|
||||
AudioEngine.prototype.getBuffersize = function() {
|
||||
// only available when using ScriptProcessorNode
|
||||
if (!this.audioBuffers) return 0;
|
||||
return this.audioBuffers.map(function(b){ return b.length; }).reduce(function(a, b){ return a + b; }, 0);
|
||||
};
|
||||
|
||||
function ImaAdpcmCodec() {
|
||||
this.reset();
|
||||
}
|
||||
|
||||
ImaAdpcmCodec.prototype.reset = function() {
|
||||
this.stepIndex = 0;
|
||||
this.predictor = 0;
|
||||
this.step = 0;
|
||||
};
|
||||
|
||||
ImaAdpcmCodec.imaIndexTable = [ -1, -1, -1, -1, 2, 4, 6, 8, -1, -1, -1, -1, 2, 4, 6, 8 ];
|
||||
|
||||
ImaAdpcmCodec.imaStepTable = [
|
||||
7, 8, 9, 10, 11, 12, 13, 14, 16, 17,
|
||||
19, 21, 23, 25, 28, 31, 34, 37, 41, 45,
|
||||
50, 55, 60, 66, 73, 80, 88, 97, 107, 118,
|
||||
130, 143, 157, 173, 190, 209, 230, 253, 279, 307,
|
||||
337, 371, 408, 449, 494, 544, 598, 658, 724, 796,
|
||||
876, 963, 1060, 1166, 1282, 1411, 1552, 1707, 1878, 2066,
|
||||
2272, 2499, 2749, 3024, 3327, 3660, 4026, 4428, 4871, 5358,
|
||||
5894, 6484, 7132, 7845, 8630, 9493, 10442, 11487, 12635, 13899,
|
||||
15289, 16818, 18500, 20350, 22385, 24623, 27086, 29794, 32767
|
||||
];
|
||||
|
||||
ImaAdpcmCodec.prototype.decode = function(data) {
|
||||
var output = new Int16Array(data.length * 2);
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
output[i * 2] = this.decodeNibble(data[i] & 0x0F);
|
||||
output[i * 2 + 1] = this.decodeNibble((data[i] >> 4) & 0x0F);
|
||||
}
|
||||
return output;
|
||||
};
|
||||
|
||||
ImaAdpcmCodec.prototype.decodeNibble = function(nibble) {
|
||||
this.stepIndex += ImaAdpcmCodec.imaIndexTable[nibble];
|
||||
this.stepIndex = Math.min(Math.max(this.stepIndex, 0), 88);
|
||||
|
||||
var diff = this.step >> 3;
|
||||
if (nibble & 1) diff += this.step >> 2;
|
||||
if (nibble & 2) diff += this.step >> 1;
|
||||
if (nibble & 4) diff += this.step;
|
||||
if (nibble & 8) diff = -diff;
|
||||
|
||||
this.predictor += diff;
|
||||
this.predictor = Math.min(Math.max(this.predictor, -32768), 32767);
|
||||
|
||||
this.step = ImaAdpcmCodec.imaStepTable[this.stepIndex];
|
||||
|
||||
return this.predictor;
|
||||
};
|
||||
|
||||
function Interpolator(factor) {
|
||||
this.factor = factor;
|
||||
this.lowpass = new Lowpass(factor)
|
||||
}
|
||||
|
||||
Interpolator.prototype.process = function(data) {
|
||||
var output = new Float32Array(data.length * this.factor);
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
output[i * this.factor] = (data[i] + 0.5) / 32768;
|
||||
}
|
||||
return this.lowpass.process(output);
|
||||
};
|
||||
|
||||
function Lowpass(interpolation) {
|
||||
this.interpolation = interpolation;
|
||||
var transitionBandwidth = 0.05;
|
||||
this.numtaps = Math.round(4 / transitionBandwidth);
|
||||
if (this.numtaps % 2 == 0) this.numtaps += 1;
|
||||
|
||||
var cutoff = 1 / interpolation;
|
||||
this.coefficients = this.getCoefficients(cutoff / 2);
|
||||
|
||||
this.delay = new Float32Array(this.numtaps);
|
||||
for (var i = 0; i < this.numtaps; i++){
|
||||
this.delay[i] = 0;
|
||||
}
|
||||
this.delayIndex = 0;
|
||||
}
|
||||
|
||||
Lowpass.prototype.getCoefficients = function(cutoffRate) {
|
||||
var middle = Math.floor(this.numtaps / 2);
|
||||
// hamming window
|
||||
var window_function = function(r){
|
||||
var rate = 0.5 + r / 2;
|
||||
return 0.54 - 0.46 * Math.cos(2 * Math.PI * rate);
|
||||
}
|
||||
var output = [];
|
||||
output[middle] = 2 * Math.PI * cutoffRate * window_function(0);
|
||||
for (var i = 1; i <= middle; i++) {
|
||||
output[middle - i] = output[middle + i] = (Math.sin(2 * Math.PI * cutoffRate * i) / i) * window_function(i / middle);
|
||||
}
|
||||
return this.normalizeCoefficients(output);
|
||||
};
|
||||
|
||||
Lowpass.prototype.normalizeCoefficients = function(input) {
|
||||
var sum = 0;
|
||||
var output = [];
|
||||
for (var i = 0; i < input.length; i++) {
|
||||
sum += input[i];
|
||||
}
|
||||
for (var i = 0; i < input.length; i++) {
|
||||
output[i] = input[i] / sum;
|
||||
}
|
||||
return output;
|
||||
};
|
||||
|
||||
Lowpass.prototype.process = function(input) {
|
||||
output = new Float32Array(input.length);
|
||||
for (var oi = 0; oi < input.length; oi++) {
|
||||
this.delay[this.delayIndex] = input[oi];
|
||||
this.delayIndex = (this.delayIndex + 1) % this.numtaps;
|
||||
|
||||
var acc = 0;
|
||||
var index = this.delayIndex;
|
||||
for (var i = 0; i < this.numtaps; ++i) {
|
||||
var index = index != 0 ? index - 1 : this.numtaps - 1;
|
||||
acc += this.delay[index] * this.coefficients[i];
|
||||
if (isNaN(acc)) debugger;
|
||||
}
|
||||
// gain by interpolation
|
||||
output[oi] = this.interpolation * acc;
|
||||
}
|
||||
return output;
|
||||
};
|
58
htdocs/lib/AudioProcessor.js
Normal file
58
htdocs/lib/AudioProcessor.js
Normal file
@ -0,0 +1,58 @@
|
||||
class OwrxAudioProcessor extends AudioWorkletProcessor {
|
||||
constructor(options){
|
||||
super(options);
|
||||
// initialize ringbuffer, make sure it aligns with the expected buffer size of 128
|
||||
this.bufferSize = Math.round(options.processorOptions.maxBufferSize / 128) * 128;
|
||||
this.audioBuffer = new Float32Array(this.bufferSize);
|
||||
this.inPos = 0;
|
||||
this.outPos = 0;
|
||||
this.samplesProcessed = 0;
|
||||
this.port.addEventListener('message', (m) => {
|
||||
if (typeof(m.data) === 'string') {
|
||||
const json = JSON.parse(m.data);
|
||||
if (json.cmd && json.cmd === 'getStats') {
|
||||
this.reportStats();
|
||||
}
|
||||
} else {
|
||||
// the ringbuffer size is aligned to the output buffer size, which means that the input buffers might
|
||||
// need to wrap around the end of the ringbuffer, back to the start.
|
||||
// it is better to have this processing here instead of in the time-critical process function.
|
||||
if (this.inPos + m.data.length <= this.bufferSize) {
|
||||
// we have enough space, so just copy data over.
|
||||
this.audioBuffer.set(m.data, this.inPos);
|
||||
} else {
|
||||
// we don't have enough space, so we need to split the data.
|
||||
const remaining = this.bufferSize - this.inPos;
|
||||
this.audioBuffer.set(m.data.subarray(0, remaining), this.inPos);
|
||||
this.audioBuffer.set(m.data.subarray(remaining));
|
||||
}
|
||||
this.inPos = (this.inPos + m.data.length) % this.bufferSize;
|
||||
}
|
||||
});
|
||||
this.port.addEventListener('messageerror', console.error);
|
||||
this.port.start();
|
||||
}
|
||||
process(inputs, outputs) {
|
||||
if (this.remaining() < 128) return true;
|
||||
outputs[0].forEach((output) => {
|
||||
output.set(this.audioBuffer.subarray(this.outPos, this.outPos + 128));
|
||||
});
|
||||
this.outPos = (this.outPos + 128) % this.bufferSize;
|
||||
this.samplesProcessed += 128;
|
||||
return true;
|
||||
}
|
||||
remaining() {
|
||||
const mod = (this.inPos - this.outPos) % this.bufferSize;
|
||||
if (mod >= 0) return mod;
|
||||
return mod + this.bufferSize;
|
||||
}
|
||||
reportStats() {
|
||||
this.port.postMessage(JSON.stringify({
|
||||
buffersize: this.remaining(),
|
||||
samplesProcessed: this.samplesProcessed
|
||||
}));
|
||||
this.samplesProcessed = 0;
|
||||
}
|
||||
}
|
||||
|
||||
registerProcessor('openwebrx-audio-processor', OwrxAudioProcessor);
|
177
htdocs/lib/BookmarkBar.js
Normal file
177
htdocs/lib/BookmarkBar.js
Normal file
@ -0,0 +1,177 @@
|
||||
function BookmarkBar() {
|
||||
var me = this;
|
||||
me.localBookmarks = new BookmarkLocalStorage();
|
||||
me.$container = $("#openwebrx-bookmarks-container");
|
||||
me.bookmarks = {};
|
||||
|
||||
me.$container.on('click', '.bookmark', function(e){
|
||||
var $bookmark = $(e.target).closest('.bookmark');
|
||||
me.$container.find('.bookmark').removeClass('selected');
|
||||
var b = $bookmark.data();
|
||||
if (!b || !b.frequency || (!b.modulation && !b.digital_modulation)) return;
|
||||
demodulators[0].set_offset_frequency(b.frequency - center_freq);
|
||||
if (b.modulation) {
|
||||
demodulator_analog_replace(b.modulation);
|
||||
} else if (b.digital_modulation) {
|
||||
demodulator_digital_replace(b.digital_modulation);
|
||||
}
|
||||
$bookmark.addClass('selected');
|
||||
});
|
||||
|
||||
me.$container.on('click', '.action[data-action=edit]', function(e){
|
||||
e.stopPropagation();
|
||||
var $bookmark = $(e.target).closest('.bookmark');
|
||||
me.showEditDialog($bookmark.data());
|
||||
});
|
||||
|
||||
me.$container.on('click', '.action[data-action=delete]', function(e){
|
||||
e.stopPropagation();
|
||||
var $bookmark = $(e.target).closest('.bookmark');
|
||||
me.localBookmarks.deleteBookmark($bookmark.data());
|
||||
me.loadLocalBookmarks();
|
||||
});
|
||||
|
||||
var $bookmarkButton = $('#openwebrx-panel-receiver').find('.openwebrx-bookmark-button');
|
||||
if (typeof(Storage) !== 'undefined') {
|
||||
$bookmarkButton.show();
|
||||
} else {
|
||||
$bookmarkButton.hide();
|
||||
}
|
||||
$bookmarkButton.click(function(){
|
||||
me.showEditDialog();
|
||||
});
|
||||
|
||||
me.$dialog = $("#openwebrx-dialog-bookmark");
|
||||
me.$dialog.find('.openwebrx-button[data-action=cancel]').click(function(){
|
||||
me.$dialog.hide();
|
||||
});
|
||||
me.$dialog.find('.openwebrx-button[data-action=submit]').click(function(){
|
||||
me.storeBookmark();
|
||||
});
|
||||
me.$dialog.find('form').on('submit', function(e){
|
||||
e.preventDefault();
|
||||
me.storeBookmark();
|
||||
});
|
||||
}
|
||||
|
||||
BookmarkBar.prototype.position = function(){
|
||||
var range = get_visible_freq_range();
|
||||
$('#openwebrx-bookmarks-container').find('.bookmark').each(function(){
|
||||
$(this).css('left', scale_px_from_freq($(this).data('frequency'), range));
|
||||
});
|
||||
};
|
||||
|
||||
BookmarkBar.prototype.loadLocalBookmarks = function(){
|
||||
var bwh = bandwidth / 2;
|
||||
var start = center_freq - bwh;
|
||||
var end = center_freq + bwh;
|
||||
var bookmarks = this.localBookmarks.getBookmarks().filter(function(b){
|
||||
return b.frequency >= start && b.frequency <= end;
|
||||
});
|
||||
this.replace_bookmarks(bookmarks, 'local', true);
|
||||
};
|
||||
|
||||
BookmarkBar.prototype.replace_bookmarks = function(bookmarks, source, editable) {
|
||||
editable = !!editable;
|
||||
bookmarks = bookmarks.map(function(b){
|
||||
b.source = source;
|
||||
b.editable = editable;
|
||||
return b;
|
||||
});
|
||||
this.bookmarks[source] = bookmarks;
|
||||
this.render();
|
||||
};
|
||||
|
||||
BookmarkBar.prototype.render = function(){
|
||||
var bookmarks = Object.values(this.bookmarks).reduce(function(l, v){ return l.concat(v); });
|
||||
bookmarks = bookmarks.sort(function(a, b){ return a.frequency - b.frequency; });
|
||||
var elements = bookmarks.map(function(b){
|
||||
var $bookmark = $(
|
||||
'<div class="bookmark" data-source="' + b.source + '"' + (b.editable?' editable="editable"':'') + '>' +
|
||||
'<div class="bookmark-actions">' +
|
||||
'<div class="openwebrx-button action" data-action="edit"><img src="static/gfx/openwebrx-edit.png"></div>' +
|
||||
'<div class="openwebrx-button action" data-action="delete"><img src="static/gfx/openwebrx-trashcan.png"></div>' +
|
||||
'</div>' +
|
||||
'<div class="bookmark-content">' + b.name + '</div>' +
|
||||
'</div>'
|
||||
);
|
||||
$bookmark.data(b);
|
||||
return $bookmark;
|
||||
});
|
||||
this.$container.find('.bookmark').remove();
|
||||
this.$container.append(elements);
|
||||
this.position();
|
||||
};
|
||||
|
||||
BookmarkBar.prototype.showEditDialog = function(bookmark) {
|
||||
var $form = this.$dialog.find("form");
|
||||
if (!bookmark) {
|
||||
bookmark = {
|
||||
name: "",
|
||||
frequency: center_freq + demodulators[0].offset_frequency,
|
||||
modulation: demodulators[0].subtype
|
||||
}
|
||||
}
|
||||
['name', 'frequency', 'modulation'].forEach(function(key){
|
||||
$form.find('#' + key).val(bookmark[key]);
|
||||
});
|
||||
this.$dialog.data('id', bookmark.id);
|
||||
this.$dialog.show();
|
||||
this.$dialog.find('#name').focus();
|
||||
};
|
||||
|
||||
BookmarkBar.prototype.storeBookmark = function() {
|
||||
var me = this;
|
||||
var bookmark = {};
|
||||
var valid = true;
|
||||
['name', 'frequency', 'modulation'].forEach(function(key){
|
||||
var $input = me.$dialog.find('#' + key);
|
||||
valid = valid && $input[0].checkValidity();
|
||||
bookmark[key] = $input.val();
|
||||
});
|
||||
if (!valid) {
|
||||
me.$dialog.find("form :submit").click();
|
||||
return;
|
||||
}
|
||||
bookmark.frequency = Number(bookmark.frequency);
|
||||
|
||||
var bookmarks = me.localBookmarks.getBookmarks();
|
||||
|
||||
bookmark.id = me.$dialog.data('id');
|
||||
if (!bookmark.id) {
|
||||
if (bookmarks.length) {
|
||||
bookmark.id = 1 + Math.max.apply(Math, bookmarks.map(function(b){ return b.id || 0; }));
|
||||
} else {
|
||||
bookmark.id = 1;
|
||||
}
|
||||
}
|
||||
|
||||
bookmarks = bookmarks.filter(function(b) { return b.id !== bookmark.id; });
|
||||
bookmarks.push(bookmark);
|
||||
|
||||
me.localBookmarks.setBookmarks(bookmarks);
|
||||
me.loadLocalBookmarks();
|
||||
me.$dialog.hide();
|
||||
};
|
||||
|
||||
BookmarkLocalStorage = function(){
|
||||
};
|
||||
|
||||
BookmarkLocalStorage.prototype.getBookmarks = function(){
|
||||
return JSON.parse(window.localStorage.getItem("bookmarks")) || [];
|
||||
};
|
||||
|
||||
BookmarkLocalStorage.prototype.setBookmarks = function(bookmarks){
|
||||
window.localStorage.setItem("bookmarks", JSON.stringify(bookmarks));
|
||||
};
|
||||
|
||||
BookmarkLocalStorage.prototype.deleteBookmark = function(data) {
|
||||
if (data.id) data = data.id;
|
||||
var bookmarks = this.getBookmarks();
|
||||
bookmarks = bookmarks.filter(function(b) { return b.id !== data; });
|
||||
this.setBookmarks(bookmarks);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
101
htdocs/lib/FrequencyDisplay.js
Normal file
101
htdocs/lib/FrequencyDisplay.js
Normal file
@ -0,0 +1,101 @@
|
||||
function FrequencyDisplay(element) {
|
||||
this.element = $(element);
|
||||
this.digits = [];
|
||||
this.setupElements();
|
||||
this.setFrequency(0);
|
||||
}
|
||||
|
||||
FrequencyDisplay.prototype.setupElements = function() {
|
||||
this.displayContainer = $('<div>');
|
||||
this.digitContainer = $('<span>');
|
||||
this.displayContainer.html([this.digitContainer, $('<span> MHz</span>')]);
|
||||
this.element.html(this.displayContainer);
|
||||
};
|
||||
|
||||
FrequencyDisplay.prototype.setFrequency = function(freq) {
|
||||
this.frequency = freq;
|
||||
var formatted = (freq / 1e6).toLocaleString(undefined, {maximumFractionDigits: 4, minimumFractionDigits: 4});
|
||||
var children = this.digitContainer.children();
|
||||
for (var i = 0; i < formatted.length; i++) {
|
||||
if (!this.digits[i]) {
|
||||
this.digits[i] = $('<span>');
|
||||
var before = children[i];
|
||||
if (before) {
|
||||
$(before).after(this.digits[i]);
|
||||
} else {
|
||||
this.digitContainer.append(this.digits[i]);
|
||||
}
|
||||
}
|
||||
this.digits[i][(isNaN(formatted[i]) ? 'remove' : 'add') + 'Class']('digit');
|
||||
this.digits[i].html(formatted[i]);
|
||||
}
|
||||
while (this.digits.length > formatted.length) {
|
||||
this.digits.pop().remove();
|
||||
}
|
||||
};
|
||||
|
||||
function TuneableFrequencyDisplay(element) {
|
||||
FrequencyDisplay.call(this, element);
|
||||
this.setupEvents();
|
||||
}
|
||||
|
||||
TuneableFrequencyDisplay.prototype = new FrequencyDisplay();
|
||||
|
||||
TuneableFrequencyDisplay.prototype.setupElements = function() {
|
||||
FrequencyDisplay.prototype.setupElements.call(this);
|
||||
this.input = $('<input>');
|
||||
this.input.hide();
|
||||
this.element.append(this.input);
|
||||
};
|
||||
|
||||
TuneableFrequencyDisplay.prototype.setupEvents = function() {
|
||||
var me = this;
|
||||
me.listeners = [];
|
||||
|
||||
me.element.on('wheel', function(e){
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
var index = me.digitContainer.find('.digit').index(e.target);
|
||||
if (index < 0) return;
|
||||
|
||||
var delta = 10 ** (Math.floor(Math.log10(me.frequency)) - index);
|
||||
if (e.originalEvent.deltaY > 0) delta *= -1;
|
||||
var newFrequency = me.frequency + delta;
|
||||
|
||||
me.listeners.forEach(function(l) {
|
||||
l(newFrequency);
|
||||
});
|
||||
});
|
||||
|
||||
var submit = function(){
|
||||
var freq = parseInt(me.input.val());
|
||||
if (!isNaN(freq)) {
|
||||
me.listeners.forEach(function(l) {
|
||||
l(freq);
|
||||
});
|
||||
}
|
||||
me.input.hide();
|
||||
me.displayContainer.show();
|
||||
};
|
||||
me.input.on('blur', submit).on('keyup', function(e){
|
||||
if (e.keyCode == 13) return submit();
|
||||
if (e.keyCode == 27) {
|
||||
me.input.hide();
|
||||
me.displayContainer.show();
|
||||
}
|
||||
});
|
||||
me.input.on('click', function(e){
|
||||
e.stopPropagation();
|
||||
});
|
||||
me.element.on('click', function(){
|
||||
me.input.val(me.frequency);
|
||||
me.input.show();
|
||||
me.displayContainer.hide();
|
||||
me.input.focus();
|
||||
});
|
||||
};
|
||||
|
||||
TuneableFrequencyDisplay.prototype.onFrequencyChange = function(listener){
|
||||
this.listeners.push(listener);
|
||||
};
|
62
htdocs/lib/Measurement.js
Normal file
62
htdocs/lib/Measurement.js
Normal file
@ -0,0 +1,62 @@
|
||||
function Measurement() {
|
||||
this.reset();
|
||||
}
|
||||
|
||||
Measurement.prototype.add = function(v) {
|
||||
this.value += v;
|
||||
};
|
||||
|
||||
Measurement.prototype.getValue = function() {
|
||||
return this.value;
|
||||
};
|
||||
|
||||
Measurement.prototype.getElapsed = function() {
|
||||
return new Date() - this.start;
|
||||
};
|
||||
|
||||
Measurement.prototype.getRate = function() {
|
||||
return this.getValue() / this.getElapsed();
|
||||
};
|
||||
|
||||
Measurement.prototype.reset = function() {
|
||||
this.value = 0;
|
||||
this.start = new Date();
|
||||
};
|
||||
|
||||
Measurement.prototype.report = function(range, interval, callback) {
|
||||
return new Reporter(this, range, interval, callback);
|
||||
};
|
||||
|
||||
function Reporter(measurement, range, interval, callback) {
|
||||
this.measurement = measurement;
|
||||
this.range = range;
|
||||
this.samples = [];
|
||||
this.callback = callback;
|
||||
this.interval = setInterval(this.report.bind(this), interval);
|
||||
}
|
||||
|
||||
Reporter.prototype.sample = function(){
|
||||
this.samples.push({
|
||||
timestamp: new Date(),
|
||||
value: this.measurement.getValue()
|
||||
});
|
||||
};
|
||||
|
||||
Reporter.prototype.report = function(){
|
||||
this.sample();
|
||||
var now = new Date();
|
||||
var minDate = now.getTime() - this.range;
|
||||
this.samples = this.samples.filter(function(s) {
|
||||
return s.timestamp.getTime() > minDate;
|
||||
});
|
||||
this.samples.sort(function(a, b) {
|
||||
return a.timestamp - b.timestamp;
|
||||
});
|
||||
var oldest = this.samples[0];
|
||||
var newest = this.samples[this.samples.length -1];
|
||||
var elapsed = newest.timestamp - oldest.timestamp;
|
||||
if (elapsed <= 0) return;
|
||||
var accumulated = newest.value - oldest.value;
|
||||
// we want rate per second, but our time is in milliseconds... compensate by 1000
|
||||
this.callback(accumulated * 1000 / elapsed);
|
||||
};
|
113
htdocs/lib/ProgressBar.js
Normal file
113
htdocs/lib/ProgressBar.js
Normal file
@ -0,0 +1,113 @@
|
||||
ProgressBar = function(el) {
|
||||
this.$el = $(el);
|
||||
this.$innerText = this.$el.find('.openwebrx-progressbar-text');
|
||||
this.$innerBar = this.$el.find('.openwebrx-progressbar-bar');
|
||||
this.$innerBar.css('width', '0%');
|
||||
};
|
||||
|
||||
ProgressBar.prototype.set = function(val, text, over) {
|
||||
this.setValue(val);
|
||||
this.setText(text);
|
||||
this.setOver(over);
|
||||
};
|
||||
|
||||
ProgressBar.prototype.setValue = function(val) {
|
||||
if (val < 0) val = 0;
|
||||
if (val > 1) val = 1;
|
||||
this.$innerBar.stop().animate({width: val * 100 + '%'}, 700);
|
||||
};
|
||||
|
||||
ProgressBar.prototype.setText = function(text) {
|
||||
this.$innerText.html(text);
|
||||
};
|
||||
|
||||
ProgressBar.prototype.setOver = function(over) {
|
||||
this.$innerBar.css('backgroundColor', (over) ? "#ff6262" : "#00aba6");
|
||||
};
|
||||
|
||||
AudioBufferProgressBar = function(el, sampleRate) {
|
||||
ProgressBar.call(this, el);
|
||||
this.sampleRate = sampleRate;
|
||||
};
|
||||
|
||||
AudioBufferProgressBar.prototype = new ProgressBar();
|
||||
|
||||
AudioBufferProgressBar.prototype.setBuffersize = function(buffersize) {
|
||||
var audio_buffer_value = buffersize / this.sampleRate;
|
||||
var overrun = audio_buffer_value > audio_buffer_maximal_length_sec;
|
||||
var underrun = audio_buffer_value === 0;
|
||||
var text = "buffer";
|
||||
if (overrun) {
|
||||
text = "overrun";
|
||||
}
|
||||
if (underrun) {
|
||||
text = "underrun";
|
||||
}
|
||||
this.set(audio_buffer_value, "Audio " + text + " [" + (audio_buffer_value).toFixed(1) + " s]", overrun || underrun);
|
||||
};
|
||||
|
||||
|
||||
NetworkSpeedProgressBar = function(el) {
|
||||
ProgressBar.call(this, el);
|
||||
};
|
||||
|
||||
NetworkSpeedProgressBar.prototype = new ProgressBar();
|
||||
|
||||
NetworkSpeedProgressBar.prototype.setSpeed = function(speed) {
|
||||
var speedInKilobits = speed * 8 / 1000;
|
||||
this.set(speedInKilobits / 2000, "Network usage [" + speedInKilobits.toFixed(1) + " kbps]", false);
|
||||
};
|
||||
|
||||
AudioSpeedProgressBar = function(el) {
|
||||
ProgressBar.call(this, el);
|
||||
};
|
||||
|
||||
AudioSpeedProgressBar.prototype = new ProgressBar();
|
||||
|
||||
AudioSpeedProgressBar.prototype.setSpeed = function(speed) {
|
||||
this.set(speed / 500000, "Audio stream [" + (speed / 1000).toFixed(0) + " kbps]", false);
|
||||
};
|
||||
|
||||
AudioOutputProgressBar = function(el, sampleRate) {
|
||||
ProgressBar.call(this, el);
|
||||
this.maxRate = sampleRate * 1.25;
|
||||
this.minRate = sampleRate * .25;
|
||||
};
|
||||
|
||||
AudioOutputProgressBar.prototype = new ProgressBar();
|
||||
|
||||
AudioOutputProgressBar.prototype.setAudioRate = function(audioRate) {
|
||||
this.set(audioRate / this.maxRate, "Audio output [" + (audioRate / 1000).toFixed(1) + " ksps]", audioRate > this.maxRate || audioRate < this.minRate);
|
||||
};
|
||||
|
||||
ClientsProgressBar = function(el) {
|
||||
ProgressBar.call(this, el);
|
||||
this.clients = 0;
|
||||
this.maxClients = 0;
|
||||
};
|
||||
|
||||
ClientsProgressBar.prototype = new ProgressBar();
|
||||
|
||||
ClientsProgressBar.prototype.setClients = function(clients) {
|
||||
this.clients = clients;
|
||||
this.render();
|
||||
};
|
||||
|
||||
ClientsProgressBar.prototype.setMaxClients = function(maxClients) {
|
||||
this.maxClients = maxClients;
|
||||
this.render();
|
||||
};
|
||||
|
||||
ClientsProgressBar.prototype.render = function() {
|
||||
this.set(this.clients / this.maxClients, "Clients [" + this.clients + "]", this.clients > this.maxClients * 0.85);
|
||||
};
|
||||
|
||||
CpuProgressBar = function(el) {
|
||||
ProgressBar.call(this, el);
|
||||
};
|
||||
|
||||
CpuProgressBar.prototype = new ProgressBar();
|
||||
|
||||
CpuProgressBar.prototype.setUsage = function(usage) {
|
||||
this.set(usage, "Server CPU [" + Math.round(usage * 100) + "%]", usage > .85);
|
||||
};
|
@ -2,6 +2,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>OpenWebRX Map</title>
|
||||
<link rel="shortcut icon" type="image/x-icon" href="static/favicon.ico" />
|
||||
<script src="static/lib/jquery-3.2.1.min.js"></script>
|
||||
<script src="static/lib/chroma.min.js"></script>
|
||||
<script src="static/map.js"></script>
|
||||
|
@ -1,9 +1,4 @@
|
||||
(function(){
|
||||
var protocol = 'ws';
|
||||
if (window.location.toString().startsWith('https://')) {
|
||||
protocol = 'wss';
|
||||
}
|
||||
|
||||
var query = window.location.search.replace(/^\?/, '').split('&').map(function(v){
|
||||
var s = v.split('=');
|
||||
var r = {};
|
||||
@ -18,8 +13,19 @@
|
||||
var expectedLocator;
|
||||
if (query.locator) expectedLocator = query.locator;
|
||||
|
||||
var ws_url = protocol + "://" + (window.location.origin.split("://")[1]) + "/ws/";
|
||||
if (!("WebSocket" in window)) return;
|
||||
var protocol = window.location.protocol.match(/https/) ? 'wss' : 'ws';
|
||||
|
||||
var href = window.location.href;
|
||||
var index = href.lastIndexOf('/');
|
||||
if (index > 0) {
|
||||
href = href.substr(0, index + 1);
|
||||
}
|
||||
href = href.split("://")[1];
|
||||
href = protocol + "://" + href;
|
||||
if (!href.endsWith('/')) {
|
||||
href += '/';
|
||||
}
|
||||
var ws_url = href + "ws/";
|
||||
|
||||
var map;
|
||||
var markers = {};
|
||||
@ -216,11 +222,11 @@
|
||||
},
|
||||
zoom: 5
|
||||
});
|
||||
$.getScript("/static/lib/nite-overlay.js").done(function(){
|
||||
$.getScript("static/lib/nite-overlay.js").done(function(){
|
||||
nite.init(map);
|
||||
setInterval(function() { nite.refresh() }, 10000); // every 10s
|
||||
});
|
||||
$.getScript('/static/lib/AprsMarker.js').done(function(){
|
||||
$.getScript('static/lib/AprsMarker.js').done(function(){
|
||||
processUpdates(updateQueue);
|
||||
updateQueue = [];
|
||||
});
|
||||
@ -353,4 +359,4 @@
|
||||
});
|
||||
}, 1000);
|
||||
|
||||
})();
|
||||
})();
|
||||
|
33
htdocs/mathbox-bundle.min.js
vendored
33
htdocs/mathbox-bundle.min.js
vendored
File diff suppressed because one or more lines are too long
@ -1,461 +0,0 @@
|
||||
.shadergraph-graph {
|
||||
font: 12px sans-serif;
|
||||
line-height: 25px;
|
||||
position: relative;
|
||||
}
|
||||
.shadergraph-graph:after {
|
||||
content: ' ';
|
||||
display: block;
|
||||
height: 0;
|
||||
font-size: 0;
|
||||
clear: both;
|
||||
}
|
||||
.shadergraph-graph svg {
|
||||
pointer-events: none;
|
||||
}
|
||||
.shadergraph-clear {
|
||||
clear: both;
|
||||
}
|
||||
.shadergraph-graph svg {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: auto;
|
||||
height: auto;
|
||||
}
|
||||
.shadergraph-column {
|
||||
float: left;
|
||||
}
|
||||
.shadergraph-node .shadergraph-graph {
|
||||
float: left;
|
||||
clear: both;
|
||||
overflow: visible;
|
||||
}
|
||||
.shadergraph-node .shadergraph-graph .shadergraph-node {
|
||||
margin: 5px 15px 15px;
|
||||
}
|
||||
.shadergraph-node {
|
||||
margin: 5px 15px 25px;
|
||||
background: rgba(0, 0, 0, .1);
|
||||
border-radius: 5px;
|
||||
box-shadow: 0 1px 2px rgba(0, 0, 0, .2),
|
||||
0 1px 10px rgba(0, 0, 0, .2);
|
||||
min-height: 35px;
|
||||
float: left;
|
||||
clear: left;
|
||||
position: relative;
|
||||
}
|
||||
.shadergraph-type {
|
||||
font-weight: bold;
|
||||
}
|
||||
.shadergraph-header {
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
height: 25px;
|
||||
background: rgba(0, 0, 0, .3);
|
||||
text-shadow: 0 1px 2px rgba(0, 0, 0, .25);
|
||||
color: #fff;
|
||||
border-top-left-radius: 5px;
|
||||
border-top-right-radius: 5px;
|
||||
margin-bottom: 5px;
|
||||
padding: 0 10px;
|
||||
}
|
||||
.shadergraph-outlet div {
|
||||
}
|
||||
.shadergraph-outlet-in .shadergraph-name {
|
||||
margin-right: 7px;
|
||||
}
|
||||
.shadergraph-outlet-out .shadergraph-name {
|
||||
margin-left: 7px;
|
||||
}
|
||||
|
||||
.shadergraph-name {
|
||||
margin: 0 4px;
|
||||
}
|
||||
.shadergraph-point {
|
||||
margin: 6px;
|
||||
width: 11px;
|
||||
height: 11px;
|
||||
border-radius: 7.5px;
|
||||
background: rgba(255, 255, 255, 1);
|
||||
}
|
||||
.shadergraph-outlet-in {
|
||||
float: left;
|
||||
clear: left;
|
||||
}
|
||||
.shadergraph-outlet-in div {
|
||||
float: left;
|
||||
}
|
||||
.shadergraph-outlet-out {
|
||||
float: right;
|
||||
clear: right;
|
||||
}
|
||||
.shadergraph-outlet-out div {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.shadergraph-node-callback {
|
||||
background: rgba(205, 209, 221, .5);
|
||||
box-shadow: 0 1px 2px rgba(0, 10, 40, .2),
|
||||
0 1px 10px rgba(0, 10, 40, .2);
|
||||
}
|
||||
.shadergraph-node-callback > .shadergraph-header {
|
||||
background: rgba(0, 20, 80, .3);
|
||||
}
|
||||
.shadergraph-graph .shadergraph-graph .shadergraph-node-callback {
|
||||
background: rgba(0, 20, 80, .1);
|
||||
}
|
||||
|
||||
.shadergraph-node-call {
|
||||
background: rgba(209, 221, 205, .5);
|
||||
box-shadow: 0 1px 2px rgba(10, 40, 0, .2),
|
||||
0 1px 10px rgba(10, 40, 0, .2);
|
||||
}
|
||||
.shadergraph-node-call > .shadergraph-header {
|
||||
background: rgba(20, 80, 0, .3);
|
||||
}
|
||||
.shadergraph-graph .shadergraph-graph .shadergraph-node-call {
|
||||
background: rgba(20, 80, 0, .1);
|
||||
}
|
||||
|
||||
.shadergraph-node-isolate {
|
||||
background: rgba(221, 205, 209, .5);
|
||||
box-shadow: 0 1px 2px rgba(40, 0, 10, .2),
|
||||
0 1px 10px rgba(40, 0, 10, .2);
|
||||
}
|
||||
.shadergraph-node-isolate > .shadergraph-header {
|
||||
background: rgba(80, 0, 20, .3);
|
||||
}
|
||||
.shadergraph-graph .shadergraph-graph .shadergraph-node-isolate {
|
||||
background: rgba(80, 0, 20, .1);
|
||||
}
|
||||
|
||||
.shadergraph-node.shadergraph-has-code {
|
||||
cursor: pointer;
|
||||
}
|
||||
.shadergraph-node.shadergraph-has-code::before {
|
||||
position: absolute;
|
||||
content: ' ';
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
display: none;
|
||||
border: 2px solid rgba(0, 0, 0, .25);
|
||||
border-radius: 5px;
|
||||
}
|
||||
.shadergraph-node.shadergraph-has-code:hover::before {
|
||||
display: block;
|
||||
}
|
||||
.shadergraph-code {
|
||||
z-index: 10000;
|
||||
display: none;
|
||||
position: absolute;
|
||||
background: #fff;
|
||||
color: #000;
|
||||
white-space: pre;
|
||||
padding: 10px;
|
||||
border-radius: 5px;
|
||||
box-shadow: 0 1px 2px rgba(0, 0, 0, .2),
|
||||
0 1px 10px rgba(0, 0, 0, .2);
|
||||
font-family: monospace;
|
||||
font-size: 10px;
|
||||
line-height: 12px;
|
||||
}
|
||||
|
||||
.shadergraph-overlay {
|
||||
position: fixed;
|
||||
top: 50%;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: #fff;
|
||||
border-top: 1px solid #CCC;
|
||||
}
|
||||
.shadergraph-overlay .shadergraph-view {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
overflow: auto;
|
||||
}
|
||||
.shadergraph-overlay .shadergraph-inside {
|
||||
width: 4000px;
|
||||
min-height: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.shadergraph-overlay .shadergraph-close {
|
||||
position: absolute;
|
||||
top: 5px;
|
||||
right: 5px;
|
||||
padding: 4px;
|
||||
border-radius: 16px;
|
||||
background: rgba(255,255,255,.3);
|
||||
color: rgba(0, 0, 0, .3);
|
||||
cursor: pointer;
|
||||
font-size: 24px;
|
||||
line-height: 24px;
|
||||
width: 24px;
|
||||
text-align: center;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.shadergraph-overlay .shadergraph-close:hover {
|
||||
background: rgba(255,255,255,1);
|
||||
color: rgba(0, 0, 0, 1);
|
||||
}
|
||||
.shadergraph-overlay .shadergraph-graph {
|
||||
padding-top: 10px;
|
||||
overflow: visible;
|
||||
min-height: 100%;
|
||||
}
|
||||
.shadergraph-overlay span {
|
||||
display: block;
|
||||
padding: 5px 15px;
|
||||
margin: 0;
|
||||
background: rgba(0, 0, 0, .1);
|
||||
font-weight: bold;
|
||||
font-family: sans-serif;
|
||||
}
|
||||
.mathbox-loader {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
-webkit-transform: translate(-50%, -50%);
|
||||
transform: translate(-50%, -50%);
|
||||
padding: 10px;
|
||||
border-radius: 50%;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.mathbox-loader.mathbox-exit {
|
||||
opacity: 0;
|
||||
-webkit-transition:
|
||||
opacity .15s ease-in-out;
|
||||
transition:
|
||||
opacity .15s ease-in-out;
|
||||
}
|
||||
|
||||
.mathbox-progress {
|
||||
height: 10px;
|
||||
border-radius: 5px;
|
||||
width: 80px;
|
||||
margin: 0 auto 20px;
|
||||
box-shadow:
|
||||
1px 1px 1px rgba(255, 255, 255, .2),
|
||||
1px -1px 1px rgba(255, 255, 255, .2),
|
||||
-1px 1px 1px rgba(255, 255, 255, .2),
|
||||
-1px -1px 1px rgba(255, 255, 255, .2);
|
||||
background: #ccc;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.mathbox-progress > div {
|
||||
display: block;
|
||||
width: 0px;
|
||||
height: 10px;
|
||||
background: #888;
|
||||
}
|
||||
|
||||
.mathbox-logo {
|
||||
position: relative;
|
||||
width: 140px;
|
||||
height: 100px;
|
||||
margin: 0 auto 10px;
|
||||
-webkit-perspective: 200px;
|
||||
perspective: 200px;
|
||||
}
|
||||
|
||||
.mathbox-logo > div {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
-webkit-transform-style: preserve-3d;
|
||||
transform-style: preserve-3d;
|
||||
}
|
||||
|
||||
.mathbox-logo > :nth-child(1) {
|
||||
-webkit-transform: rotateZ(22deg) rotateX(24deg) rotateY(30deg);
|
||||
transform: rotateZ(22deg) rotateX(24deg) rotateY(30deg);
|
||||
}
|
||||
|
||||
.mathbox-logo > :nth-child(2) {
|
||||
-webkit-transform: rotateZ(11deg) rotateX(12deg) rotateY(15deg) scale3d(.6, .6, .6);
|
||||
transform: rotateZ(11deg) rotateX(12deg) rotateY(15deg) scale3d(.6, .6, .6);
|
||||
}
|
||||
|
||||
.mathbox-logo > div > div {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
margin-left: -100px;
|
||||
margin-top: -100px;
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
box-sizing: border-box;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.mathbox-logo > div > :nth-child(1) {
|
||||
-webkit-transform: scale(0.5, 0.5);
|
||||
transform: rotateX(30deg) scale(0.5, 0.5);
|
||||
}
|
||||
|
||||
.mathbox-logo > div > :nth-child(2) {
|
||||
-webkit-transform: rotateX(90deg) scale(0.42, 0.42);
|
||||
transform: rotateX(90deg) scale(0.42, 0.42);
|
||||
}
|
||||
|
||||
.mathbox-logo > div > :nth-child(3) {
|
||||
-webkit-transform: rotateY(90deg) scale(0.35, 0.35);
|
||||
transform: rotateY(90deg) scale(0.35, 0.35);
|
||||
}
|
||||
|
||||
.mathbox-logo > :nth-child(1) > :nth-child(1) {
|
||||
border: 16px solid #808080;
|
||||
}
|
||||
.mathbox-logo > :nth-child(1) > :nth-child(2) {
|
||||
border: 19px solid #A0A0A0;
|
||||
}
|
||||
.mathbox-logo > :nth-child(1) > :nth-child(3) {
|
||||
border: 23px solid #C0C0C0;
|
||||
}
|
||||
.mathbox-logo > :nth-child(2) > :nth-child(1) {
|
||||
border: 27px solid #808080;
|
||||
}
|
||||
.mathbox-logo > :nth-child(2) > :nth-child(2) {
|
||||
border: 32px solid #A0A0A0;
|
||||
}
|
||||
.mathbox-logo > :nth-child(2) > :nth-child(3) {
|
||||
border: 38px solid #C0C0C0;
|
||||
}
|
||||
|
||||
.mathbox-splash-blue .mathbox-progress {
|
||||
background: #def;
|
||||
}
|
||||
.mathbox-splash-blue .mathbox-progress > div {
|
||||
background: #1979e7;
|
||||
}
|
||||
.mathbox-splash-blue .mathbox-logo > :nth-child(1) > :nth-child(1) {
|
||||
border-color: #1979e7;
|
||||
}
|
||||
.mathbox-splash-blue .mathbox-logo > :nth-child(1) > :nth-child(2) {
|
||||
border-color: #33b0ff;
|
||||
}
|
||||
.mathbox-splash-blue .mathbox-logo > :nth-child(1) > :nth-child(3) {
|
||||
border-color: #75eaff;
|
||||
}
|
||||
.mathbox-splash-blue .mathbox-logo > :nth-child(2) > :nth-child(1) {
|
||||
border-color: #18487F;
|
||||
}
|
||||
.mathbox-splash-blue .mathbox-logo > :nth-child(2) > :nth-child(2) {
|
||||
border-color: #33b0ff;
|
||||
}
|
||||
.mathbox-splash-blue .mathbox-logo > :nth-child(2) > :nth-child(3) {
|
||||
border-color: #75eaff;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
.mathbox-overlays {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
pointer-events: none;
|
||||
transform-style: preserve-3d;
|
||||
overflow: hidden;
|
||||
}
|
||||
.mathbox-overlays > div {
|
||||
transform-style: preserve-3d;
|
||||
}
|
||||
.mathbox-overlay > div {
|
||||
position: absolute;
|
||||
will-change: transform, opacity;
|
||||
}
|
||||
.mathbox-label {
|
||||
font-family: sans-serif;
|
||||
}
|
||||
.mathbox-outline-1 {
|
||||
text-shadow:
|
||||
-1px -1px 0px rgb(255, 255, 255),
|
||||
1px 1px 0px rgb(255, 255, 255),
|
||||
-1px 1px 0px rgb(255, 255, 255),
|
||||
1px -1px 0px rgb(255, 255, 255),
|
||||
1px 0px 1px rgb(255, 255, 255),
|
||||
-1px 0px 1px rgb(255, 255, 255),
|
||||
0px -1px 1px rgb(255, 255, 255),
|
||||
0px 1px 1px rgb(255, 255, 255);
|
||||
}
|
||||
.mathbox-outline-2 {
|
||||
text-shadow:
|
||||
0px -2px 0px rgb(255, 255, 255),
|
||||
0px 2px 0px rgb(255, 255, 255),
|
||||
-2px 0px 0px rgb(255, 255, 255),
|
||||
2px 0px 0px rgb(255, 255, 255),
|
||||
-1px -2px 0px rgb(255, 255, 255),
|
||||
-2px -1px 0px rgb(255, 255, 255),
|
||||
-1px 2px 0px rgb(255, 255, 255),
|
||||
-2px 1px 0px rgb(255, 255, 255),
|
||||
1px 2px 0px rgb(255, 255, 255),
|
||||
2px 1px 0px rgb(255, 255, 255),
|
||||
1px -2px 0px rgb(255, 255, 255),
|
||||
2px -1px 0px rgb(255, 255, 255);
|
||||
}
|
||||
.mathbox-outline-3 {
|
||||
text-shadow:
|
||||
3px 0px 0px rgb(255, 255, 255),
|
||||
-3px 0px 0px rgb(255, 255, 255),
|
||||
0px 3px 0px rgb(255, 255, 255),
|
||||
0px -3px 0px rgb(255, 255, 255),
|
||||
|
||||
-2px -2px 0px rgb(255, 255, 255),
|
||||
-2px 2px 0px rgb(255, 255, 255),
|
||||
2px 2px 0px rgb(255, 255, 255),
|
||||
2px -2px 0px rgb(255, 255, 255),
|
||||
|
||||
-1px -2px 1px rgb(255, 255, 255),
|
||||
-2px -1px 1px rgb(255, 255, 255),
|
||||
-1px 2px 1px rgb(255, 255, 255),
|
||||
-2px 1px 1px rgb(255, 255, 255),
|
||||
1px 2px 1px rgb(255, 255, 255),
|
||||
2px 1px 1px rgb(255, 255, 255),
|
||||
1px -2px 1px rgb(255, 255, 255),
|
||||
2px -1px 1px rgb(255, 255, 255);
|
||||
}
|
||||
.mathbox-outline-4 {
|
||||
text-shadow:
|
||||
4px 0px 0px rgb(255, 255, 255),
|
||||
-4px 0px 0px rgb(255, 255, 255),
|
||||
0px 4px 0px rgb(255, 255, 255),
|
||||
0px -4px 0px rgb(255, 255, 255),
|
||||
|
||||
-3px -2px 0px rgb(255, 255, 255),
|
||||
-3px 2px 0px rgb(255, 255, 255),
|
||||
3px 2px 0px rgb(255, 255, 255),
|
||||
3px -2px 0px rgb(255, 255, 255),
|
||||
|
||||
-2px -3px 0px rgb(255, 255, 255),
|
||||
-2px 3px 0px rgb(255, 255, 255),
|
||||
2px 3px 0px rgb(255, 255, 255),
|
||||
2px -3px 0px rgb(255, 255, 255),
|
||||
|
||||
-1px -2px 1px rgb(255, 255, 255),
|
||||
-2px -1px 1px rgb(255, 255, 255),
|
||||
-1px 2px 1px rgb(255, 255, 255),
|
||||
-2px 1px 1px rgb(255, 255, 255),
|
||||
1px 2px 1px rgb(255, 255, 255),
|
||||
2px 1px 1px rgb(255, 255, 255),
|
||||
1px -2px 1px rgb(255, 255, 255),
|
||||
2px -1px 1px rgb(255, 255, 255);
|
||||
|
||||
}
|
||||
.mathbox-outline-fill, .mathbox-outline-fill * {
|
||||
color: #fff !important;
|
||||
}
|
4373
htdocs/openwebrx.js
4373
htdocs/openwebrx.js
File diff suppressed because it is too large
Load Diff
11679
htdocs/sdr.js
11679
htdocs/sdr.js
File diff suppressed because one or more lines are too long
60
openwebrx.py
60
openwebrx.py
@ -1,62 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from http.server import HTTPServer
|
||||
from owrx.http import RequestHandler
|
||||
from owrx.config import PropertyManager
|
||||
from owrx.feature import FeatureDetector
|
||||
from owrx.source import SdrService
|
||||
from socketserver import ThreadingMixIn
|
||||
from owrx.sdrhu import SdrHuUpdater
|
||||
from owrx.service import Services
|
||||
from owrx.websocket import WebSocketConnection
|
||||
|
||||
import logging
|
||||
|
||||
logging.basicConfig(level=logging.DEBUG, format="%(asctime)s - %(name)s - %(levelname)s - %(message)s")
|
||||
|
||||
|
||||
class ThreadedHttpServer(ThreadingMixIn, HTTPServer):
|
||||
pass
|
||||
|
||||
|
||||
def main():
|
||||
print(
|
||||
"""
|
||||
|
||||
OpenWebRX - Open Source SDR Web App for Everyone! | for license see LICENSE file in the package
|
||||
_________________________________________________________________________________________________
|
||||
|
||||
Author contact info: Andras Retzler, HA7ILM <randras@sdr.hu>
|
||||
|
||||
"""
|
||||
)
|
||||
|
||||
pm = PropertyManager.getSharedInstance().loadConfig("config_webrx")
|
||||
|
||||
featureDetector = FeatureDetector()
|
||||
if not featureDetector.is_available("core"):
|
||||
print(
|
||||
"you are missing required dependencies to run openwebrx. "
|
||||
"please check that the following core requirements are installed:"
|
||||
)
|
||||
print(", ".join(featureDetector.get_requirements("core")))
|
||||
return
|
||||
|
||||
# Get error messages about unknown / unavailable features as soon as possible
|
||||
SdrService.loadProps()
|
||||
|
||||
if "sdrhu_key" in pm and pm["sdrhu_public_listing"]:
|
||||
updater = SdrHuUpdater()
|
||||
updater.start()
|
||||
|
||||
Services.start()
|
||||
|
||||
server = ThreadedHttpServer(("0.0.0.0", pm.getPropertyValue("web_port")), RequestHandler)
|
||||
server.serve_forever()
|
||||
|
||||
from owrx.__main__ import main
|
||||
|
||||
if __name__ == "__main__":
|
||||
try:
|
||||
main()
|
||||
except KeyboardInterrupt:
|
||||
WebSocketConnection.closeAll()
|
||||
main()
|
||||
|
59
owrx/__main__.py
Normal file
59
owrx/__main__.py
Normal file
@ -0,0 +1,59 @@
|
||||
from http.server import HTTPServer
|
||||
from owrx.http import RequestHandler
|
||||
from owrx.config import PropertyManager
|
||||
from owrx.feature import FeatureDetector
|
||||
from owrx.sdr import SdrService
|
||||
from socketserver import ThreadingMixIn
|
||||
from owrx.sdrhu import SdrHuUpdater
|
||||
from owrx.service import Services
|
||||
from owrx.websocket import WebSocketConnection
|
||||
from owrx.pskreporter import PskReporter
|
||||
|
||||
import logging
|
||||
|
||||
logging.basicConfig(level=logging.DEBUG, format="%(asctime)s - %(name)s - %(levelname)s - %(message)s")
|
||||
|
||||
|
||||
class ThreadedHttpServer(ThreadingMixIn, HTTPServer):
|
||||
pass
|
||||
|
||||
|
||||
def main():
|
||||
print(
|
||||
"""
|
||||
|
||||
OpenWebRX - Open Source SDR Web App for Everyone! | for license see LICENSE file in the package
|
||||
_________________________________________________________________________________________________
|
||||
|
||||
Author contact info: Jakob Ketterl, DD5JFK <dd5jfk@darc.de>
|
||||
|
||||
"""
|
||||
)
|
||||
|
||||
pm = PropertyManager.getSharedInstance().loadConfig()
|
||||
|
||||
featureDetector = FeatureDetector()
|
||||
if not featureDetector.is_available("core"):
|
||||
print(
|
||||
"you are missing required dependencies to run openwebrx. "
|
||||
"please check that the following core requirements are installed:"
|
||||
)
|
||||
print(", ".join(featureDetector.get_requirements("core")))
|
||||
return
|
||||
|
||||
# Get error messages about unknown / unavailable features as soon as possible
|
||||
SdrService.loadProps()
|
||||
|
||||
if "sdrhu_key" in pm and pm["sdrhu_public_listing"]:
|
||||
updater = SdrHuUpdater()
|
||||
updater.start()
|
||||
|
||||
Services.start()
|
||||
|
||||
try:
|
||||
server = ThreadedHttpServer(("0.0.0.0", pm.getPropertyValue("web_port")), RequestHandler)
|
||||
server.serve_forever()
|
||||
except KeyboardInterrupt:
|
||||
WebSocketConnection.closeAll()
|
||||
Services.stop()
|
||||
PskReporter.stop()
|
10
owrx/aprs.py
10
owrx/aprs.py
@ -2,6 +2,7 @@ from owrx.kiss import KissDeframer
|
||||
from owrx.map import Map, LatLngLocation
|
||||
from owrx.bands import Bandplan
|
||||
from owrx.metrics import Metrics, CounterMetric
|
||||
from owrx.parser import Parser
|
||||
from datetime import datetime, timezone
|
||||
import re
|
||||
import logging
|
||||
@ -148,18 +149,15 @@ class AprsLocation(LatLngLocation):
|
||||
return res
|
||||
|
||||
|
||||
class AprsParser(object):
|
||||
class AprsParser(Parser):
|
||||
def __init__(self, handler):
|
||||
super().__init__(handler)
|
||||
self.ax25parser = Ax25Parser()
|
||||
self.deframer = KissDeframer()
|
||||
self.dial_freq = None
|
||||
self.band = None
|
||||
self.handler = handler
|
||||
self.metric = self.getMetric()
|
||||
|
||||
def setDialFrequency(self, freq):
|
||||
self.dial_freq = freq
|
||||
self.band = Bandplan.getSharedInstance().findBand(freq)
|
||||
super().setDialFrequency(freq)
|
||||
self.metric = self.getMetric()
|
||||
|
||||
def getMetric(self):
|
||||
|
@ -46,10 +46,24 @@ class Bandplan(object):
|
||||
return Bandplan.sharedInstance
|
||||
|
||||
def __init__(self):
|
||||
f = open("bands.json", "r")
|
||||
bands_json = json.load(f)
|
||||
f.close()
|
||||
self.bands = [Band(d) for d in bands_json]
|
||||
self.bands = self.loadBands()
|
||||
|
||||
def loadBands(self):
|
||||
for file in ["/etc/openwebrx/bands.json", "bands.json"]:
|
||||
try:
|
||||
f = open(file, "r")
|
||||
bands_json = json.load(f)
|
||||
f.close()
|
||||
return [Band(d) for d in bands_json]
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
except json.JSONDecodeError:
|
||||
logger.exception("error while parsing bandplan file %s", file)
|
||||
return []
|
||||
except Exception:
|
||||
logger.exception("error while processing bandplan from %s", file)
|
||||
return []
|
||||
return []
|
||||
|
||||
def findBands(self, freq):
|
||||
return [band for band in self.bands if band.inBand(freq)]
|
||||
|
@ -1,5 +1,9 @@
|
||||
import json
|
||||
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Bookmark(object):
|
||||
def __init__(self, j):
|
||||
@ -26,6 +30,7 @@ class Bookmark(object):
|
||||
|
||||
class Bookmarks(object):
|
||||
sharedInstance = None
|
||||
|
||||
@staticmethod
|
||||
def getSharedInstance():
|
||||
if Bookmarks.sharedInstance is None:
|
||||
@ -33,10 +38,24 @@ class Bookmarks(object):
|
||||
return Bookmarks.sharedInstance
|
||||
|
||||
def __init__(self):
|
||||
f = open("bookmarks.json", "r")
|
||||
bookmarks_json = json.load(f)
|
||||
f.close()
|
||||
self.bookmarks = [Bookmark(d) for d in bookmarks_json]
|
||||
self.bookmarks = self.loadBookmarks()
|
||||
|
||||
def loadBookmarks(self):
|
||||
for file in ["/etc/openwebrx/bookmarks.json", "bookmarks.json"]:
|
||||
try:
|
||||
f = open(file, "r")
|
||||
bookmarks_json = json.load(f)
|
||||
f.close()
|
||||
return [Bookmark(d) for d in bookmarks_json]
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
except json.JSONDecodeError:
|
||||
logger.exception("error while parsing bookmarks file %s", file)
|
||||
return []
|
||||
except Exception:
|
||||
logger.exception("error while processing bookmarks from %s", file)
|
||||
return []
|
||||
return []
|
||||
|
||||
def getBookmarks(self, range):
|
||||
(lo, hi) = range
|
||||
|
50
owrx/client.py
Normal file
50
owrx/client.py
Normal file
@ -0,0 +1,50 @@
|
||||
from owrx.config import PropertyManager
|
||||
from owrx.metrics import Metrics, DirectMetric
|
||||
import threading
|
||||
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class TooManyClientsException(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class ClientRegistry(object):
|
||||
sharedInstance = None
|
||||
creationLock = threading.Lock()
|
||||
|
||||
@staticmethod
|
||||
def getSharedInstance():
|
||||
with ClientRegistry.creationLock:
|
||||
if ClientRegistry.sharedInstance is None:
|
||||
ClientRegistry.sharedInstance = ClientRegistry()
|
||||
return ClientRegistry.sharedInstance
|
||||
|
||||
def __init__(self):
|
||||
self.clients = []
|
||||
Metrics.getSharedInstance().addMetric("openwebrx.users", DirectMetric(self.clientCount))
|
||||
super().__init__()
|
||||
|
||||
def broadcast(self):
|
||||
n = self.clientCount()
|
||||
for c in self.clients:
|
||||
c.write_clients(n)
|
||||
|
||||
def addClient(self, client):
|
||||
pm = PropertyManager.getSharedInstance()
|
||||
if len(self.clients) >= pm["max_clients"]:
|
||||
raise TooManyClientsException()
|
||||
self.clients.append(client)
|
||||
self.broadcast()
|
||||
|
||||
def clientCount(self):
|
||||
return len(self.clients)
|
||||
|
||||
def removeClient(self, client):
|
||||
try:
|
||||
self.clients.remove(client)
|
||||
except ValueError:
|
||||
pass
|
||||
self.broadcast()
|
71
owrx/command.py
Normal file
71
owrx/command.py
Normal file
@ -0,0 +1,71 @@
|
||||
from abc import ABC, abstractmethod
|
||||
|
||||
|
||||
class CommandMapper(object):
|
||||
def __init__(self, base=None, mappings=None, static=None):
|
||||
self.base = base
|
||||
self.mappings = {} if mappings is None else mappings
|
||||
self.static = static
|
||||
|
||||
def map(self, values):
|
||||
args = [self.mappings[k].map(v) for k, v in values.items() if k in self.mappings]
|
||||
args = [a for a in args if a != ""]
|
||||
options = " ".join(args)
|
||||
command = "{0} {1}".format(self.base, options)
|
||||
if self.static is not None:
|
||||
command += " " + self.static
|
||||
return command
|
||||
|
||||
def setMapping(self, key, mapping):
|
||||
self.mappings[key] = mapping
|
||||
return self
|
||||
|
||||
def setMappings(self, mappings):
|
||||
for k, v in mappings.items():
|
||||
self.setMapping(k, v)
|
||||
return self
|
||||
|
||||
def setBase(self, base):
|
||||
self.base = base
|
||||
return self
|
||||
|
||||
def setStatic(self, static):
|
||||
self.static = static
|
||||
return self
|
||||
|
||||
|
||||
class CommandMapping(ABC):
|
||||
@abstractmethod
|
||||
def map(self, value):
|
||||
pass
|
||||
|
||||
|
||||
class Flag(CommandMapping):
|
||||
def __init__(self, flag):
|
||||
self.flag = flag
|
||||
|
||||
def map(self, value):
|
||||
if value is not None and value:
|
||||
return self.flag
|
||||
else:
|
||||
return ""
|
||||
|
||||
|
||||
class Option(CommandMapping):
|
||||
def __init__(self, option):
|
||||
self.option = option
|
||||
self.spacer = " "
|
||||
|
||||
def map(self, value):
|
||||
if value is not None:
|
||||
if isinstance(value, str) and " " in value:
|
||||
template = '{option}{spacer}"{value}"'
|
||||
else:
|
||||
template = "{option}{spacer}{value}"
|
||||
return template.format(option=self.option, spacer=self.spacer, value=value)
|
||||
else:
|
||||
return ""
|
||||
|
||||
def setSpacer(self, spacer):
|
||||
self.spacer = spacer
|
||||
return self
|
@ -1,3 +1,4 @@
|
||||
import importlib.util
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@ -50,6 +51,10 @@ class Property(object):
|
||||
return self
|
||||
|
||||
|
||||
class ConfigNotFoundException(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class PropertyManager(object):
|
||||
sharedInstance = None
|
||||
|
||||
@ -128,10 +133,17 @@ class PropertyManager(object):
|
||||
p.setValue(other_pm[key])
|
||||
return self
|
||||
|
||||
def loadConfig(self, filename):
|
||||
cfg = __import__(filename)
|
||||
for name, value in cfg.__dict__.items():
|
||||
if name.startswith("__"):
|
||||
continue
|
||||
self[name] = value
|
||||
return self
|
||||
def loadConfig(self):
|
||||
for file in ["/etc/openwebrx/config_webrx.py", "./config_webrx.py"]:
|
||||
try:
|
||||
spec = importlib.util.spec_from_file_location("config_webrx", file)
|
||||
cfg = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(cfg)
|
||||
for name, value in cfg.__dict__.items():
|
||||
if name.startswith("__"):
|
||||
continue
|
||||
self[name] = value
|
||||
return self
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
raise ConfigNotFoundException("no usable config found! please make sure you have a valid configuration file!")
|
||||
|
@ -1,11 +1,17 @@
|
||||
from owrx.config import PropertyManager
|
||||
from owrx.source import DspManager, CpuUsageThread, SdrService, ClientRegistry
|
||||
from owrx.dsp import DspManager
|
||||
from owrx.cpu import CpuUsageThread
|
||||
from owrx.sdr import SdrService
|
||||
from owrx.source import SdrSource
|
||||
from owrx.client import ClientRegistry, TooManyClientsException
|
||||
from owrx.feature import FeatureDetector
|
||||
from owrx.version import openwebrx_version
|
||||
from owrx.bands import Bandplan
|
||||
from owrx.bookmarks import Bookmarks
|
||||
from owrx.map import Map
|
||||
from owrx.locator import Locator
|
||||
from multiprocessing import Queue
|
||||
from queue import Full
|
||||
import json
|
||||
import threading
|
||||
|
||||
@ -17,7 +23,7 @@ logger = logging.getLogger(__name__)
|
||||
class Client(object):
|
||||
def __init__(self, conn):
|
||||
self.conn = conn
|
||||
self.multiprocessingPipe = Queue()
|
||||
self.multiprocessingPipe = Queue(100)
|
||||
|
||||
def mp_passthru():
|
||||
run = True
|
||||
@ -38,7 +44,10 @@ class Client(object):
|
||||
self.multiprocessingPipe.close()
|
||||
|
||||
def mp_send(self, data):
|
||||
self.multiprocessingPipe.put(data, block=False)
|
||||
try:
|
||||
self.multiprocessingPipe.put(data, block=False)
|
||||
except Full:
|
||||
self.close()
|
||||
|
||||
def handleTextMessage(self, conn, message):
|
||||
pass
|
||||
@ -56,7 +65,6 @@ class OpenWebRxReceiverClient(Client):
|
||||
"waterfall_min_level",
|
||||
"waterfall_max_level",
|
||||
"waterfall_auto_level_margin",
|
||||
"lfo_offset",
|
||||
"samp_rate",
|
||||
"fft_size",
|
||||
"fft_fps",
|
||||
@ -64,12 +72,10 @@ class OpenWebRxReceiverClient(Client):
|
||||
"fft_compression",
|
||||
"max_clients",
|
||||
"start_mod",
|
||||
"client_audio_buffer_size",
|
||||
"start_freq",
|
||||
"center_freq",
|
||||
"mathbox_waterfall_colors",
|
||||
"mathbox_waterfall_history_length",
|
||||
"mathbox_waterfall_frequency_resolution",
|
||||
"initial_squelch_level",
|
||||
"profile_id",
|
||||
]
|
||||
|
||||
def __init__(self, conn):
|
||||
@ -78,8 +84,14 @@ class OpenWebRxReceiverClient(Client):
|
||||
self.dsp = None
|
||||
self.sdr = None
|
||||
self.configSub = None
|
||||
self.connectionProperties = {}
|
||||
|
||||
ClientRegistry.getSharedInstance().addClient(self)
|
||||
try:
|
||||
ClientRegistry.getSharedInstance().addClient(self)
|
||||
except TooManyClientsException:
|
||||
self.write_backoff_message("Too many clients")
|
||||
self.close()
|
||||
raise
|
||||
|
||||
pm = PropertyManager.getSharedInstance()
|
||||
|
||||
@ -89,15 +101,23 @@ class OpenWebRxReceiverClient(Client):
|
||||
receiver_keys = [
|
||||
"receiver_name",
|
||||
"receiver_location",
|
||||
"receiver_qra",
|
||||
"receiver_asl",
|
||||
"receiver_gps",
|
||||
"photo_title",
|
||||
"photo_desc",
|
||||
]
|
||||
receiver_details = dict((key, pm.getPropertyValue(key)) for key in receiver_keys)
|
||||
receiver_details["locator"] = Locator.fromCoordinates(receiver_details["receiver_gps"])
|
||||
self.write_receiver_details(receiver_details)
|
||||
|
||||
self.__sendProfiles()
|
||||
|
||||
features = FeatureDetector().feature_availability()
|
||||
self.write_features(features)
|
||||
|
||||
CpuUsageThread.getSharedInstance().add_client(self)
|
||||
|
||||
def __sendProfiles(self):
|
||||
profiles = [
|
||||
{"name": s.getName() + " " + p["name"], "id": sid + "|" + pid}
|
||||
for (sid, s) in SdrService.getSources().items()
|
||||
@ -105,11 +125,6 @@ class OpenWebRxReceiverClient(Client):
|
||||
]
|
||||
self.write_profiles(profiles)
|
||||
|
||||
features = FeatureDetector().feature_availability()
|
||||
self.write_features(features)
|
||||
|
||||
CpuUsageThread.getSharedInstance().add_client(self)
|
||||
|
||||
def handleTextMessage(self, conn, message):
|
||||
try:
|
||||
message = json.loads(message)
|
||||
@ -122,17 +137,23 @@ class OpenWebRxReceiverClient(Client):
|
||||
params = message["params"]
|
||||
self.setDspProperties(params)
|
||||
|
||||
if message["type"] == "config":
|
||||
elif message["type"] == "config":
|
||||
if "params" in message:
|
||||
self.setParams(message["params"])
|
||||
if message["type"] == "setsdr":
|
||||
elif message["type"] == "setsdr":
|
||||
if "params" in message:
|
||||
self.setSdr(message["params"]["sdr"])
|
||||
if message["type"] == "selectprofile":
|
||||
elif message["type"] == "selectprofile":
|
||||
if "params" in message and "profile" in message["params"]:
|
||||
profile = message["params"]["profile"].split("|")
|
||||
self.setSdr(profile[0])
|
||||
self.sdr.activateProfile(profile[1])
|
||||
elif message["type"] == "connectionproperties":
|
||||
if "params" in message:
|
||||
self.connectionProperties = message["params"]
|
||||
if self.dsp:
|
||||
self.setDspProperties(self.connectionProperties)
|
||||
|
||||
else:
|
||||
logger.warning("received message without type: {0}".format(message))
|
||||
|
||||
@ -140,19 +161,40 @@ class OpenWebRxReceiverClient(Client):
|
||||
logger.warning("message is not json: {0}".format(message))
|
||||
|
||||
def setSdr(self, id=None):
|
||||
next = SdrService.getSource(id)
|
||||
if next == self.sdr:
|
||||
return
|
||||
while True:
|
||||
next = None
|
||||
if id is not None:
|
||||
next = SdrService.getSource(id)
|
||||
if next is None:
|
||||
next = SdrService.getFirstSource()
|
||||
if next is None:
|
||||
# exit condition: no sdrs available
|
||||
self.handleNoSdrsAvailable()
|
||||
return
|
||||
|
||||
self.stopDsp()
|
||||
# exit condition: no change
|
||||
if next == self.sdr:
|
||||
return
|
||||
|
||||
if self.configSub is not None:
|
||||
self.configSub.cancel()
|
||||
self.configSub = None
|
||||
self.stopDsp()
|
||||
|
||||
self.sdr = next
|
||||
if self.configSub is not None:
|
||||
self.configSub.cancel()
|
||||
self.configSub = None
|
||||
|
||||
self.sdr = next
|
||||
|
||||
self.startDsp()
|
||||
|
||||
# keep trying until we find a suitable SDR
|
||||
if self.sdr.getState() == SdrSource.STATE_FAILED:
|
||||
self.write_log_message('SDR device "{0}" has failed, selecting new device'.format(self.sdr.getName()))
|
||||
else:
|
||||
break
|
||||
|
||||
# send initial config
|
||||
self.setDspProperties(self.connectionProperties)
|
||||
|
||||
configProps = (
|
||||
self.sdr.getProps()
|
||||
.collect(*OpenWebRxReceiverClient.config_keys)
|
||||
@ -163,6 +205,8 @@ class OpenWebRxReceiverClient(Client):
|
||||
config = dict((key, configProps[key]) for key in OpenWebRxReceiverClient.config_keys)
|
||||
# TODO mathematical properties? hmmmm
|
||||
config["start_offset_freq"] = configProps["start_freq"] - configProps["center_freq"]
|
||||
# TODO this is a hack to support multiple sdrs
|
||||
config["sdr_id"] = self.sdr.getId()
|
||||
self.write_config(config)
|
||||
|
||||
cf = configProps["center_freq"]
|
||||
@ -174,11 +218,15 @@ class OpenWebRxReceiverClient(Client):
|
||||
|
||||
self.configSub = configProps.wire(sendConfig)
|
||||
sendConfig(None, None)
|
||||
self.__sendProfiles()
|
||||
|
||||
self.sdr.addSpectrumClient(self)
|
||||
|
||||
def handleNoSdrsAvailable(self):
|
||||
self.write_sdr_error("No SDR Devices available")
|
||||
|
||||
def startDsp(self):
|
||||
if self.dsp is None:
|
||||
if self.dsp is None and self.sdr is not None:
|
||||
self.dsp = DspManager(self, self.sdr)
|
||||
self.dsp.start()
|
||||
|
||||
@ -202,7 +250,7 @@ class OpenWebRxReceiverClient(Client):
|
||||
# only the keys in the protected property manager can be overridden from the web
|
||||
protected = (
|
||||
self.sdr.getProps()
|
||||
.collect("samp_rate", "center_freq", "rf_gain", "type", "if_gain")
|
||||
.collect("samp_rate", "center_freq", "rf_gain", "type")
|
||||
.defaults(PropertyManager.getSharedInstance())
|
||||
)
|
||||
for key, value in params.items():
|
||||
@ -231,7 +279,8 @@ class OpenWebRxReceiverClient(Client):
|
||||
self.send(bytes([0x03]) + data)
|
||||
|
||||
def write_secondary_demod(self, data):
|
||||
self.send(bytes([0x04]) + data)
|
||||
message = data.decode("ascii", "replace")
|
||||
self.send({"type": "secondary_demod", "value": message})
|
||||
|
||||
def write_secondary_dsp_config(self, cfg):
|
||||
self.send({"type": "secondary_config", "value": cfg})
|
||||
@ -263,6 +312,18 @@ class OpenWebRxReceiverClient(Client):
|
||||
def write_aprs_data(self, data):
|
||||
self.send({"type": "aprs_data", "value": data})
|
||||
|
||||
def write_log_message(self, message):
|
||||
self.send({"type": "log_message", "value": message})
|
||||
|
||||
def write_sdr_error(self, message):
|
||||
self.send({"type": "sdr_error", "value": message})
|
||||
|
||||
def write_pocsag_data(self, data):
|
||||
self.send({"type": "pocsag_data", "value": data})
|
||||
|
||||
def write_backoff_message(self, reason):
|
||||
self.send({"type": "backoff", "reason": reason})
|
||||
|
||||
|
||||
class MapConnection(Client):
|
||||
def __init__(self, conn):
|
||||
|
@ -1,11 +1,12 @@
|
||||
import os
|
||||
import mimetypes
|
||||
import json
|
||||
import pkg_resources
|
||||
from datetime import datetime
|
||||
from string import Template
|
||||
from owrx.websocket import WebSocketConnection
|
||||
from owrx.config import PropertyManager
|
||||
from owrx.source import ClientRegistry
|
||||
from owrx.client import ClientRegistry
|
||||
from owrx.connection import WebSocketMessageHandler
|
||||
from owrx.version import openwebrx_version
|
||||
from owrx.feature import FeatureDetector
|
||||
@ -55,17 +56,17 @@ class StatusController(Controller):
|
||||
|
||||
|
||||
class AssetsController(Controller):
|
||||
def __init__(self, handler, request, path):
|
||||
if not path.endswith("/"):
|
||||
path += "/"
|
||||
self.path = path
|
||||
super().__init__(handler, request)
|
||||
def getModified(self, file):
|
||||
return None
|
||||
|
||||
def openFile(self, file):
|
||||
pass
|
||||
|
||||
def serve_file(self, file, content_type=None):
|
||||
try:
|
||||
modified = datetime.fromtimestamp(os.path.getmtime(self.path + file))
|
||||
modified = self.getModified(file)
|
||||
|
||||
if "If-Modified-Since" in self.handler.headers:
|
||||
if modified is not None and "If-Modified-Since" in self.handler.headers:
|
||||
client_modified = datetime.strptime(
|
||||
self.handler.headers["If-Modified-Since"], "%a, %d %b %Y %H:%M:%S %Z"
|
||||
)
|
||||
@ -73,7 +74,7 @@ class AssetsController(Controller):
|
||||
self.send_response("", code=304)
|
||||
return
|
||||
|
||||
f = open(self.path + file, "rb")
|
||||
f = self.openFile(file)
|
||||
data = f.read()
|
||||
f.close()
|
||||
|
||||
@ -89,21 +90,33 @@ class AssetsController(Controller):
|
||||
|
||||
|
||||
class OwrxAssetsController(AssetsController):
|
||||
def __init__(self, handler, request):
|
||||
super().__init__(handler, request, "htdocs/")
|
||||
def openFile(self, file):
|
||||
return pkg_resources.resource_stream("htdocs", file)
|
||||
|
||||
|
||||
class AprsSymbolsController(AssetsController):
|
||||
def __init__(self, handler, request):
|
||||
pm = PropertyManager.getSharedInstance()
|
||||
super().__init__(handler, request, pm["aprs_symbols_path"])
|
||||
path = pm["aprs_symbols_path"]
|
||||
if not path.endswith("/"):
|
||||
path += "/"
|
||||
self.path = path
|
||||
super().__init__(handler, request)
|
||||
|
||||
def getFilePath(self, file):
|
||||
return self.path + file
|
||||
|
||||
def getModified(self, file):
|
||||
return datetime.fromtimestamp(os.path.getmtime(self.getFilePath(file)))
|
||||
|
||||
def openFile(self, file):
|
||||
return open(self.getFilePath(file), "rb")
|
||||
|
||||
|
||||
class TemplateController(Controller):
|
||||
def render_template(self, file, **vars):
|
||||
f = open("htdocs/" + file, "r")
|
||||
template = Template(f.read())
|
||||
f.close()
|
||||
file_content = pkg_resources.resource_string("htdocs", file).decode("utf-8")
|
||||
template = Template(file_content)
|
||||
|
||||
return template.safe_substitute(**vars)
|
||||
|
||||
@ -152,4 +165,4 @@ class WebSocketController(Controller):
|
||||
def handle_request(self):
|
||||
conn = WebSocketConnection(self.handler, WebSocketMessageHandler())
|
||||
# enter read loop
|
||||
conn.read_loop()
|
||||
conn.handle()
|
||||
|
73
owrx/cpu.py
Normal file
73
owrx/cpu.py
Normal file
@ -0,0 +1,73 @@
|
||||
import threading
|
||||
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class CpuUsageThread(threading.Thread):
|
||||
sharedInstance = None
|
||||
|
||||
@staticmethod
|
||||
def getSharedInstance():
|
||||
if CpuUsageThread.sharedInstance is None:
|
||||
CpuUsageThread.sharedInstance = CpuUsageThread()
|
||||
return CpuUsageThread.sharedInstance
|
||||
|
||||
def __init__(self):
|
||||
self.clients = []
|
||||
self.doRun = True
|
||||
self.last_worktime = 0
|
||||
self.last_idletime = 0
|
||||
self.endEvent = threading.Event()
|
||||
super().__init__()
|
||||
|
||||
def run(self):
|
||||
while self.doRun:
|
||||
try:
|
||||
cpu_usage = self.get_cpu_usage()
|
||||
except:
|
||||
cpu_usage = 0
|
||||
for c in self.clients:
|
||||
c.write_cpu_usage(cpu_usage)
|
||||
self.endEvent.wait(timeout=3)
|
||||
logger.debug("cpu usage thread shut down")
|
||||
|
||||
def get_cpu_usage(self):
|
||||
try:
|
||||
f = open("/proc/stat", "r")
|
||||
except:
|
||||
return 0 # Workaround, possibly we're on a Mac
|
||||
line = ""
|
||||
while not "cpu " in line:
|
||||
line = f.readline()
|
||||
f.close()
|
||||
spl = line.split(" ")
|
||||
worktime = int(spl[2]) + int(spl[3]) + int(spl[4])
|
||||
idletime = int(spl[5])
|
||||
dworktime = worktime - self.last_worktime
|
||||
didletime = idletime - self.last_idletime
|
||||
rate = float(dworktime) / (didletime + dworktime)
|
||||
self.last_worktime = worktime
|
||||
self.last_idletime = idletime
|
||||
if self.last_worktime == 0:
|
||||
return 0
|
||||
return rate
|
||||
|
||||
def add_client(self, c):
|
||||
self.clients.append(c)
|
||||
if not self.is_alive():
|
||||
self.start()
|
||||
|
||||
def remove_client(self, c):
|
||||
try:
|
||||
self.clients.remove(c)
|
||||
except ValueError:
|
||||
pass
|
||||
if not self.clients:
|
||||
self.shutdown()
|
||||
|
||||
def shutdown(self):
|
||||
CpuUsageThread.sharedInstance = None
|
||||
self.doRun = False
|
||||
self.endEvent.set()
|
154
owrx/dsp.py
Normal file
154
owrx/dsp.py
Normal file
@ -0,0 +1,154 @@
|
||||
from owrx.config import PropertyManager
|
||||
from owrx.meta import MetaParser
|
||||
from owrx.wsjt import WsjtParser
|
||||
from owrx.aprs import AprsParser
|
||||
from owrx.pocsag import PocsagParser
|
||||
from owrx.source import SdrSource
|
||||
from csdr import csdr
|
||||
import threading
|
||||
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class DspManager(csdr.output):
|
||||
def __init__(self, handler, sdrSource):
|
||||
self.handler = handler
|
||||
self.sdrSource = sdrSource
|
||||
self.parsers = {
|
||||
"meta": MetaParser(self.handler),
|
||||
"wsjt_demod": WsjtParser(self.handler),
|
||||
"packet_demod": AprsParser(self.handler),
|
||||
"pocsag_demod": PocsagParser(self.handler),
|
||||
}
|
||||
|
||||
self.localProps = (
|
||||
self.sdrSource.getProps()
|
||||
.collect(
|
||||
"audio_compression",
|
||||
"fft_compression",
|
||||
"digimodes_fft_size",
|
||||
"csdr_dynamic_bufsize",
|
||||
"csdr_print_bufsizes",
|
||||
"csdr_through",
|
||||
"digimodes_enable",
|
||||
"samp_rate",
|
||||
"digital_voice_unvoiced_quality",
|
||||
"dmr_filter",
|
||||
"temporary_directory",
|
||||
"center_freq",
|
||||
)
|
||||
.defaults(PropertyManager.getSharedInstance())
|
||||
)
|
||||
|
||||
self.dsp = csdr.dsp(self)
|
||||
self.dsp.nc_port = self.sdrSource.getPort()
|
||||
|
||||
def set_low_cut(cut):
|
||||
bpf = self.dsp.get_bpf()
|
||||
bpf[0] = cut
|
||||
self.dsp.set_bpf(*bpf)
|
||||
|
||||
def set_high_cut(cut):
|
||||
bpf = self.dsp.get_bpf()
|
||||
bpf[1] = cut
|
||||
self.dsp.set_bpf(*bpf)
|
||||
|
||||
def set_dial_freq(key, value):
|
||||
freq = self.localProps["center_freq"] + self.localProps["offset_freq"]
|
||||
for parser in self.parsers.values():
|
||||
parser.setDialFrequency(freq)
|
||||
|
||||
self.subscriptions = [
|
||||
self.localProps.getProperty("audio_compression").wire(self.dsp.set_audio_compression),
|
||||
self.localProps.getProperty("fft_compression").wire(self.dsp.set_fft_compression),
|
||||
self.localProps.getProperty("digimodes_fft_size").wire(self.dsp.set_secondary_fft_size),
|
||||
self.localProps.getProperty("samp_rate").wire(self.dsp.set_samp_rate),
|
||||
self.localProps.getProperty("output_rate").wire(self.dsp.set_output_rate),
|
||||
self.localProps.getProperty("offset_freq").wire(self.dsp.set_offset_freq),
|
||||
self.localProps.getProperty("squelch_level").wire(self.dsp.set_squelch_level),
|
||||
self.localProps.getProperty("low_cut").wire(set_low_cut),
|
||||
self.localProps.getProperty("high_cut").wire(set_high_cut),
|
||||
self.localProps.getProperty("mod").wire(self.dsp.set_demodulator),
|
||||
self.localProps.getProperty("digital_voice_unvoiced_quality").wire(self.dsp.set_unvoiced_quality),
|
||||
self.localProps.getProperty("dmr_filter").wire(self.dsp.set_dmr_filter),
|
||||
self.localProps.getProperty("temporary_directory").wire(self.dsp.set_temporary_directory),
|
||||
self.localProps.collect("center_freq", "offset_freq").wire(set_dial_freq),
|
||||
]
|
||||
|
||||
self.dsp.set_offset_freq(0)
|
||||
self.dsp.set_bpf(-4000, 4000)
|
||||
self.dsp.csdr_dynamic_bufsize = self.localProps["csdr_dynamic_bufsize"]
|
||||
self.dsp.csdr_print_bufsizes = self.localProps["csdr_print_bufsizes"]
|
||||
self.dsp.csdr_through = self.localProps["csdr_through"]
|
||||
|
||||
if self.localProps["digimodes_enable"]:
|
||||
|
||||
def set_secondary_mod(mod):
|
||||
if mod == False:
|
||||
mod = None
|
||||
self.dsp.set_secondary_demodulator(mod)
|
||||
if mod is not None:
|
||||
self.handler.write_secondary_dsp_config(
|
||||
{
|
||||
"secondary_fft_size": self.localProps["digimodes_fft_size"],
|
||||
"if_samp_rate": self.dsp.if_samp_rate(),
|
||||
"secondary_bw": self.dsp.secondary_bw(),
|
||||
}
|
||||
)
|
||||
|
||||
self.subscriptions += [
|
||||
self.localProps.getProperty("secondary_mod").wire(set_secondary_mod),
|
||||
self.localProps.getProperty("secondary_offset_freq").wire(self.dsp.set_secondary_offset_freq),
|
||||
]
|
||||
|
||||
self.sdrSource.addClient(self)
|
||||
|
||||
super().__init__()
|
||||
|
||||
def start(self):
|
||||
if self.sdrSource.isAvailable():
|
||||
self.dsp.start()
|
||||
|
||||
def receive_output(self, t, read_fn):
|
||||
logger.debug("adding new output of type %s", t)
|
||||
writers = {
|
||||
"audio": self.handler.write_dsp_data,
|
||||
"smeter": self.handler.write_s_meter_level,
|
||||
"secondary_fft": self.handler.write_secondary_fft,
|
||||
"secondary_demod": self.handler.write_secondary_demod,
|
||||
}
|
||||
for demod, parser in self.parsers.items():
|
||||
writers[demod] = parser.parse
|
||||
|
||||
write = writers[t]
|
||||
|
||||
threading.Thread(target=self.pump(read_fn, write)).start()
|
||||
|
||||
def stop(self):
|
||||
self.dsp.stop()
|
||||
self.sdrSource.removeClient(self)
|
||||
for sub in self.subscriptions:
|
||||
sub.cancel()
|
||||
self.subscriptions = []
|
||||
|
||||
def setProperty(self, prop, value):
|
||||
self.localProps.getProperty(prop).setValue(value)
|
||||
|
||||
def getClientClass(self):
|
||||
return SdrSource.CLIENT_USER
|
||||
|
||||
def onStateChange(self, state):
|
||||
if state == SdrSource.STATE_RUNNING:
|
||||
logger.debug("received STATE_RUNNING, attempting DspSource restart")
|
||||
self.dsp.start()
|
||||
elif state == SdrSource.STATE_STOPPING:
|
||||
logger.debug("received STATE_STOPPING, shutting down DspSource")
|
||||
self.dsp.stop()
|
||||
elif state == SdrSource.STATE_FAILED:
|
||||
logger.debug("received STATE_FAILED, shutting down DspSource")
|
||||
self.dsp.stop()
|
||||
|
||||
def onBusyStateChange(self, state):
|
||||
pass
|
167
owrx/feature.py
167
owrx/feature.py
@ -1,10 +1,11 @@
|
||||
import os
|
||||
import subprocess
|
||||
from functools import reduce
|
||||
from operator import and_
|
||||
from operator import and_, or_
|
||||
import re
|
||||
from distutils.version import LooseVersion
|
||||
import inspect
|
||||
from owrx.config import PropertyManager
|
||||
import shlex
|
||||
|
||||
import logging
|
||||
|
||||
@ -17,15 +18,24 @@ class UnknownFeatureException(Exception):
|
||||
|
||||
class FeatureDetector(object):
|
||||
features = {
|
||||
# core features; we won't start without these
|
||||
"core": ["csdr", "nmux", "nc"],
|
||||
"rtl_sdr": ["rtl_sdr"],
|
||||
"sdrplay": ["rx_tools"],
|
||||
# different types of sdrs and their requirements
|
||||
"rtl_sdr": ["rtl_connector"],
|
||||
"rtl_sdr_soapy": ["soapy_connector", "soapy_rtl_sdr"],
|
||||
"sdrplay": ["soapy_connector", "soapy_sdrplay"],
|
||||
"hackrf": ["hackrf_transfer"],
|
||||
"airspy": ["airspy_rx"],
|
||||
"airspy": ["soapy_connector", "soapy_airspy"],
|
||||
"airspyhf": ["soapy_connector", "soapy_airspyhf"],
|
||||
"lime_sdr": ["soapy_connector", "soapy_lime_sdr"],
|
||||
"fifi_sdr": ["alsa"],
|
||||
"pluto_sdr": ["soapy_connector", "soapy_pluto_sdr"],
|
||||
# optional features and their requirements
|
||||
"digital_voice_digiham": ["digiham", "sox"],
|
||||
"digital_voice_dsd": ["dsd", "sox", "digiham"],
|
||||
"wsjt-x": ["wsjtx", "sox"],
|
||||
"packet": ["direwolf"],
|
||||
"packet": ["direwolf", "sox"],
|
||||
"pocsag": ["digiham", "sox"],
|
||||
}
|
||||
|
||||
def feature_availability(self):
|
||||
@ -83,7 +93,13 @@ class FeatureDetector(object):
|
||||
return inspect.getdoc(self._get_requirement_method(requirement))
|
||||
|
||||
def command_is_runnable(self, command):
|
||||
return os.system("{0} 2>/dev/null >/dev/null".format(command)) != 32512
|
||||
tmp_dir = PropertyManager.getSharedInstance()["temporary_directory"]
|
||||
cmd = shlex.split(command)
|
||||
try:
|
||||
process = subprocess.Popen(cmd, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, cwd=tmp_dir)
|
||||
return process.wait() != 32512
|
||||
except FileNotFoundError:
|
||||
return False
|
||||
|
||||
def has_csdr(self):
|
||||
"""
|
||||
@ -113,17 +129,6 @@ class FeatureDetector(object):
|
||||
"""
|
||||
return self.command_is_runnable("rtl_sdr --help")
|
||||
|
||||
def has_rx_tools(self):
|
||||
"""
|
||||
The rx_tools package can be used to interface with SDR devices compatible with SoapySDR. It is currently used
|
||||
to connect to SDRPlay devices. Please check the following pages for more details:
|
||||
|
||||
* [rx_tools GitHub page](https://github.com/rxseger/rx_tools)
|
||||
* [SoapySDR Project wiki](https://github.com/pothosware/SoapySDR/wiki)
|
||||
* [SDRPlay homepage](https://www.sdrplay.com/)
|
||||
"""
|
||||
return self.command_is_runnable("rx_sdr --help")
|
||||
|
||||
def has_hackrf_transfer(self):
|
||||
"""
|
||||
To use a HackRF, compile the HackRF host tools from its "stdout" branch:
|
||||
@ -144,9 +149,6 @@ class FeatureDetector(object):
|
||||
# TODO also check if it has the stdout feature
|
||||
return self.command_is_runnable("hackrf_transfer --help")
|
||||
|
||||
def command_exists(self, command):
|
||||
return os.system("which {0}".format(command)) == 0
|
||||
|
||||
def has_digiham(self):
|
||||
"""
|
||||
To use digital voice modes, the digiham package is required. You can find the package and installation
|
||||
@ -154,16 +156,19 @@ class FeatureDetector(object):
|
||||
|
||||
Please note: there is close interaction between digiham and openwebrx, so older versions will probably not work.
|
||||
If you have an older verison of digiham installed, please update it along with openwebrx.
|
||||
As of now, we require version 0.2 of digiham.
|
||||
As of now, we require version 0.3 of digiham.
|
||||
"""
|
||||
required_version = LooseVersion("0.2")
|
||||
required_version = LooseVersion("0.3")
|
||||
|
||||
digiham_version_regex = re.compile("^digiham version (.*)$")
|
||||
|
||||
def check_digiham_version(command):
|
||||
try:
|
||||
process = subprocess.Popen([command, "--version"], stdout=subprocess.PIPE)
|
||||
version = LooseVersion(digiham_version_regex.match(process.stdout.readline().decode()).group(1))
|
||||
matches = digiham_version_regex.match(process.stdout.readline().decode())
|
||||
if matches is None:
|
||||
return False
|
||||
version = LooseVersion(matches.group(1))
|
||||
process.wait(1)
|
||||
return version >= required_version
|
||||
except FileNotFoundError:
|
||||
@ -180,11 +185,111 @@ class FeatureDetector(object):
|
||||
"mbe_synthesizer",
|
||||
"gfsk_demodulator",
|
||||
"digitalvoice_filter",
|
||||
"fsk_demodulator",
|
||||
"pocsag_decoder",
|
||||
],
|
||||
),
|
||||
True,
|
||||
)
|
||||
|
||||
def _check_connector(self, command):
|
||||
required_version = LooseVersion("0.1")
|
||||
|
||||
owrx_connector_version_regex = re.compile("^owrx-connector version (.*)$")
|
||||
|
||||
try:
|
||||
process = subprocess.Popen([command, "--version"], stdout=subprocess.PIPE)
|
||||
matches = owrx_connector_version_regex.match(process.stdout.readline().decode())
|
||||
if matches is None:
|
||||
return False
|
||||
version = LooseVersion(matches.group(1))
|
||||
process.wait(1)
|
||||
return version >= required_version
|
||||
except FileNotFoundError:
|
||||
return False
|
||||
|
||||
def has_rtl_connector(self):
|
||||
"""
|
||||
The owrx_connector package offers direct interfacing between your hardware and openwebrx. It allows quicker
|
||||
frequency switching, uses less CPU and can even provide more stability in some cases.
|
||||
|
||||
You can get it [here](https://github.com/jketterl/owrx_connector).
|
||||
"""
|
||||
return self._check_connector("rtl_connector")
|
||||
|
||||
def has_soapy_connector(self):
|
||||
"""
|
||||
The owrx_connector package offers direct interfacing between your hardware and openwebrx. It allows quicker
|
||||
frequency switching, uses less CPU and can even provide more stability in some cases.
|
||||
|
||||
You can get it [here](https://github.com/jketterl/owrx_connector).
|
||||
"""
|
||||
return self._check_connector("soapy_connector")
|
||||
|
||||
def _has_soapy_driver(self, driver):
|
||||
try:
|
||||
process = subprocess.Popen(["SoapySDRUtil", "--info"], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL)
|
||||
driverRegex = re.compile("^Module found: .*lib(.*)Support.so")
|
||||
|
||||
def matchLine(line):
|
||||
matches = driverRegex.match(line.decode())
|
||||
return matches is not None and matches.group(1) == driver
|
||||
|
||||
lines = [matchLine(line) for line in process.stdout]
|
||||
return reduce(or_, lines, False)
|
||||
except FileNotFoundError:
|
||||
return False
|
||||
|
||||
def has_soapy_rtl_sdr(self):
|
||||
"""
|
||||
The SoapySDR module for rtl-sdr devices can be used as an alternative to the rtl_connector. It provides
|
||||
additional support for the direct sampling mod.
|
||||
|
||||
You can get it [here](https://github.com/pothosware/SoapyRTLSDR/wiki).
|
||||
"""
|
||||
return self._has_soapy_driver("rtlsdr")
|
||||
|
||||
def has_soapy_sdrplay(self):
|
||||
"""
|
||||
The SoapySDR module for sdrplay devices is required for interfacing with SDRPlay devices (RSP1*, RSP2*, RSPDuo)
|
||||
|
||||
You can get it [here](https://github.com/pothosware/SoapySDRPlay/wiki).
|
||||
"""
|
||||
return self._has_soapy_driver("sdrPlay")
|
||||
|
||||
def has_soapy_airspy(self):
|
||||
"""
|
||||
The SoapySDR module for airspy devices is required for interfacing with Airspy devices (Airspy R2, Airspy Mini).
|
||||
|
||||
You can get it [here](https://github.com/pothosware/SoapyAirspy/wiki).
|
||||
"""
|
||||
return self._has_soapy_driver("airspy")
|
||||
|
||||
def has_soapy_airspyhf(self):
|
||||
"""
|
||||
The SoapySDR module for airspyhf devices is required for interfacing with Airspy HF devices (Airspy HF+,
|
||||
Airspy HF discovery).
|
||||
|
||||
You can get it [here](https://github.com/pothosware/SoapyAirspyHF/wiki).
|
||||
"""
|
||||
return self._has_soapy_driver("airspyhf")
|
||||
|
||||
def has_soapy_lime_sdr(self):
|
||||
"""
|
||||
The Lime Suite installs - amongst others - a Soapy driver for the LimeSDR device series.
|
||||
|
||||
You can get it [here](https://github.com/myriadrf/LimeSuite).
|
||||
"""
|
||||
return self._has_soapy_driver("LMS7")
|
||||
|
||||
def has_soapy_pluto_sdr(self):
|
||||
"""
|
||||
The SoapySDR module for PlutoSDR devices is required for interfacing with PlutoSDR devices.
|
||||
|
||||
You can get it [here](https://github.com/photosware/SoapyPlutoSDR).
|
||||
"""
|
||||
return self._has_soapy_driver("PlutoSDR")
|
||||
|
||||
def has_dsd(self):
|
||||
"""
|
||||
The digital voice modes NXDN and D-Star can be decoded by the dsd project. Please note that you need the version
|
||||
@ -202,13 +307,18 @@ class FeatureDetector(object):
|
||||
return self.command_is_runnable("sox")
|
||||
|
||||
def has_direwolf(self):
|
||||
"""
|
||||
OpenWebRX uses the [direwolf](https://github.com/wb2osz/direwolf) software modem to decode Packet Radio and
|
||||
report data back to APRS-IS. Direwolf is available from the package manager on many distributions, or you can
|
||||
compile it from source.
|
||||
"""
|
||||
return self.command_is_runnable("direwolf --help")
|
||||
|
||||
def has_airspy_rx(self):
|
||||
"""
|
||||
In order to use an Airspy Receiver, you need to install the airspy_rx receiver software.
|
||||
"""
|
||||
return self.command_is_runnable("airspy_rx --help 2> /dev/null")
|
||||
return self.command_is_runnable("airspy_rx --help")
|
||||
|
||||
def has_wsjtx(self):
|
||||
"""
|
||||
@ -217,3 +327,10 @@ class FeatureDetector(object):
|
||||
on how to build from source.
|
||||
"""
|
||||
return reduce(and_, map(self.command_is_runnable, ["jt9", "wsprd"]), True)
|
||||
|
||||
def has_alsa(self):
|
||||
"""
|
||||
Some SDR receivers are identifying themselves as a soundcard. In order to read their data, OpenWebRX relies
|
||||
on the Alsa library. It is available as a package for most Linux distributions.
|
||||
"""
|
||||
return self.command_is_runnable("arecord --help")
|
||||
|
92
owrx/fft.py
Normal file
92
owrx/fft.py
Normal file
@ -0,0 +1,92 @@
|
||||
from owrx.config import PropertyManager
|
||||
from csdr import csdr
|
||||
import threading
|
||||
from owrx.source import SdrSource
|
||||
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class SpectrumThread(csdr.output):
|
||||
def __init__(self, sdrSource):
|
||||
self.sdrSource = sdrSource
|
||||
super().__init__()
|
||||
|
||||
self.props = props = self.sdrSource.props.collect(
|
||||
"samp_rate",
|
||||
"fft_size",
|
||||
"fft_fps",
|
||||
"fft_voverlap_factor",
|
||||
"fft_compression",
|
||||
"csdr_dynamic_bufsize",
|
||||
"csdr_print_bufsizes",
|
||||
"csdr_through",
|
||||
"temporary_directory",
|
||||
).defaults(PropertyManager.getSharedInstance())
|
||||
|
||||
self.dsp = dsp = csdr.dsp(self)
|
||||
dsp.nc_port = self.sdrSource.getPort()
|
||||
dsp.set_demodulator("fft")
|
||||
|
||||
def set_fft_averages(key, value):
|
||||
samp_rate = props["samp_rate"]
|
||||
fft_size = props["fft_size"]
|
||||
fft_fps = props["fft_fps"]
|
||||
fft_voverlap_factor = props["fft_voverlap_factor"]
|
||||
|
||||
dsp.set_fft_averages(
|
||||
int(round(1.0 * samp_rate / fft_size / fft_fps / (1.0 - fft_voverlap_factor)))
|
||||
if fft_voverlap_factor > 0
|
||||
else 0
|
||||
)
|
||||
|
||||
self.subscriptions = [
|
||||
props.getProperty("samp_rate").wire(dsp.set_samp_rate),
|
||||
props.getProperty("fft_size").wire(dsp.set_fft_size),
|
||||
props.getProperty("fft_fps").wire(dsp.set_fft_fps),
|
||||
props.getProperty("fft_compression").wire(dsp.set_fft_compression),
|
||||
props.getProperty("temporary_directory").wire(dsp.set_temporary_directory),
|
||||
props.collect("samp_rate", "fft_size", "fft_fps", "fft_voverlap_factor").wire(set_fft_averages),
|
||||
]
|
||||
|
||||
set_fft_averages(None, None)
|
||||
|
||||
dsp.csdr_dynamic_bufsize = props["csdr_dynamic_bufsize"]
|
||||
dsp.csdr_print_bufsizes = props["csdr_print_bufsizes"]
|
||||
dsp.csdr_through = props["csdr_through"]
|
||||
logger.debug("Spectrum thread initialized successfully.")
|
||||
|
||||
def start(self):
|
||||
self.sdrSource.addClient(self)
|
||||
if self.sdrSource.isAvailable():
|
||||
self.dsp.start()
|
||||
|
||||
def supports_type(self, t):
|
||||
return t == "audio"
|
||||
|
||||
def receive_output(self, type, read_fn):
|
||||
if self.props["csdr_dynamic_bufsize"]:
|
||||
read_fn(8) # dummy read to skip bufsize & preamble
|
||||
logger.debug("Note: CSDR_DYNAMIC_BUFSIZE_ON = 1")
|
||||
|
||||
threading.Thread(target=self.pump(read_fn, self.sdrSource.writeSpectrumData)).start()
|
||||
|
||||
def stop(self):
|
||||
self.dsp.stop()
|
||||
self.sdrSource.removeClient(self)
|
||||
for c in self.subscriptions:
|
||||
c.cancel()
|
||||
self.subscriptions = []
|
||||
|
||||
def getClientClass(self):
|
||||
return SdrSource.CLIENT_USER
|
||||
|
||||
def onStateChange(self, state):
|
||||
if state in [SdrSource.STATE_STOPPING, SdrSource.STATE_FAILED]:
|
||||
self.dsp.stop()
|
||||
elif state == SdrSource.STATE_RUNNING:
|
||||
self.dsp.start()
|
||||
|
||||
def onBusyStateChange(self, state):
|
||||
pass
|
37
owrx/map.py
37
owrx/map.py
@ -2,6 +2,7 @@ from datetime import datetime, timedelta
|
||||
import threading, time
|
||||
from owrx.config import PropertyManager
|
||||
from owrx.bands import Band
|
||||
import sys
|
||||
|
||||
import logging
|
||||
|
||||
@ -15,23 +16,35 @@ class Location(object):
|
||||
|
||||
class Map(object):
|
||||
sharedInstance = None
|
||||
creationLock = threading.Lock()
|
||||
|
||||
@staticmethod
|
||||
def getSharedInstance():
|
||||
if Map.sharedInstance is None:
|
||||
Map.sharedInstance = Map()
|
||||
with Map.creationLock:
|
||||
if Map.sharedInstance is None:
|
||||
Map.sharedInstance = Map()
|
||||
return Map.sharedInstance
|
||||
|
||||
def __init__(self):
|
||||
self.clients = []
|
||||
self.positions = {}
|
||||
self.positionsLock = threading.Lock()
|
||||
|
||||
def removeLoop():
|
||||
loops = 0
|
||||
while True:
|
||||
try:
|
||||
self.removeOldPositions()
|
||||
except Exception:
|
||||
logger.exception("error while removing old map positions")
|
||||
loops += 1
|
||||
# rebuild the positions dictionary every once in a while, it consumes lots of memory otherwise
|
||||
if loops == 60:
|
||||
try:
|
||||
self.rebuildPositions()
|
||||
except Exception:
|
||||
logger.exception("error while rebuilding positions")
|
||||
loops = 0
|
||||
time.sleep(60)
|
||||
|
||||
threading.Thread(target=removeLoop, daemon=True).start()
|
||||
@ -64,7 +77,8 @@ class Map(object):
|
||||
|
||||
def updateLocation(self, callsign, loc: Location, mode: str, band: Band = None):
|
||||
ts = datetime.now()
|
||||
self.positions[callsign] = {"location": loc, "updated": ts, "mode": mode, "band": band}
|
||||
with self.positionsLock:
|
||||
self.positions[callsign] = {"location": loc, "updated": ts, "mode": mode, "band": band}
|
||||
self.broadcast(
|
||||
[
|
||||
{
|
||||
@ -80,13 +94,15 @@ class Map(object):
|
||||
def touchLocation(self, callsign):
|
||||
# not implemented on the client side yet, so do not use!
|
||||
ts = datetime.now()
|
||||
if callsign in self.positions:
|
||||
self.positions[callsign]["updated"] = ts
|
||||
with self.positionsLock:
|
||||
if callsign in self.positions:
|
||||
self.positions[callsign]["updated"] = ts
|
||||
self.broadcast([{"callsign": callsign, "lastseen": ts.timestamp() * 1000}])
|
||||
|
||||
def removeLocation(self, callsign):
|
||||
self.positions.pop(callsign, None)
|
||||
# TODO broadcast removal to clients
|
||||
with self.positionsLock:
|
||||
del self.positions[callsign]
|
||||
# TODO broadcast removal to clients
|
||||
|
||||
def removeOldPositions(self):
|
||||
pm = PropertyManager.getSharedInstance()
|
||||
@ -97,6 +113,13 @@ class Map(object):
|
||||
for callsign in to_be_removed:
|
||||
self.removeLocation(callsign)
|
||||
|
||||
def rebuildPositions(self):
|
||||
logger.debug("rebuilding map storage; size before: %i", sys.getsizeof(self.positions))
|
||||
with self.positionsLock:
|
||||
p = {key: value for key, value in self.positions.items()}
|
||||
self.positions = p
|
||||
logger.debug("rebuild complete; size after: %i", sys.getsizeof(self.positions))
|
||||
|
||||
|
||||
class LatLngLocation(Location):
|
||||
def __init__(self, lat: float, lon: float):
|
||||
|
14
owrx/meta.py
14
owrx/meta.py
@ -6,6 +6,7 @@ import logging
|
||||
import threading
|
||||
from owrx.map import Map, LatLngLocation
|
||||
from owrx.bands import Bandplan
|
||||
from owrx.parser import Parser
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@ -62,7 +63,7 @@ class DmrMetaEnricher(object):
|
||||
cache = DmrCache.getSharedInstance()
|
||||
if not cache.isValid(id):
|
||||
if not id in self.threads:
|
||||
self.threads[id] = threading.Thread(target=self.downloadRadioIdData, args=[id])
|
||||
self.threads[id] = threading.Thread(target=self.downloadRadioIdData, args=[id], daemon=True)
|
||||
self.threads[id].start()
|
||||
return None
|
||||
data = cache.get(id)
|
||||
@ -83,17 +84,10 @@ class YsfMetaEnricher(object):
|
||||
return None
|
||||
|
||||
|
||||
class MetaParser(object):
|
||||
class MetaParser(Parser):
|
||||
def __init__(self, handler):
|
||||
self.handler = handler
|
||||
super().__init__(handler)
|
||||
self.enrichers = {"DMR": DmrMetaEnricher(), "YSF": YsfMetaEnricher(self)}
|
||||
self.band = None
|
||||
|
||||
def setDialFrequency(self, freq):
|
||||
self.band = Bandplan.getSharedInstance().findBand(freq)
|
||||
|
||||
def getBand(self):
|
||||
return self.band
|
||||
|
||||
def parse(self, meta):
|
||||
fields = meta.split(";")
|
||||
|
20
owrx/parser.py
Normal file
20
owrx/parser.py
Normal file
@ -0,0 +1,20 @@
|
||||
from abc import ABC, abstractmethod
|
||||
from owrx.bands import Bandplan
|
||||
|
||||
|
||||
class Parser(ABC):
|
||||
def __init__(self, handler):
|
||||
self.handler = handler
|
||||
self.dial_freq = None
|
||||
self.band = None
|
||||
|
||||
@abstractmethod
|
||||
def parse(self, raw):
|
||||
pass
|
||||
|
||||
def setDialFrequency(self, freq):
|
||||
self.dial_freq = freq
|
||||
self.band = Bandplan.getSharedInstance().findBand(freq)
|
||||
|
||||
def getBand(self):
|
||||
return self.band
|
10
owrx/pocsag.py
Normal file
10
owrx/pocsag.py
Normal file
@ -0,0 +1,10 @@
|
||||
from owrx.parser import Parser
|
||||
|
||||
|
||||
class PocsagParser(Parser):
|
||||
def parse(self, raw):
|
||||
fields = raw.decode("ascii", "replace").rstrip("\n").split(";")
|
||||
meta = {v[0]: "".join(v[1:]) for v in map(lambda x: x.split(":"), fields) if v[0] != ""}
|
||||
if "address" in meta:
|
||||
meta["address"] = int(meta["address"])
|
||||
self.handler.write_pocsag_data(meta)
|
@ -3,10 +3,12 @@ import threading
|
||||
import time
|
||||
import random
|
||||
import socket
|
||||
from sched import scheduler
|
||||
from functools import reduce
|
||||
from operator import and_
|
||||
from owrx.config import PropertyManager
|
||||
from owrx.version import openwebrx_version
|
||||
from owrx.locator import Locator
|
||||
from owrx.metrics import Metrics, CounterMetric
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@ -20,6 +22,9 @@ class PskReporterDummy(object):
|
||||
def spot(self, spot):
|
||||
pass
|
||||
|
||||
def cancelTimer(self):
|
||||
pass
|
||||
|
||||
|
||||
class PskReporter(object):
|
||||
sharedInstance = None
|
||||
@ -37,24 +42,46 @@ class PskReporter(object):
|
||||
PskReporter.sharedInstance = PskReporterDummy()
|
||||
return PskReporter.sharedInstance
|
||||
|
||||
@staticmethod
|
||||
def stop():
|
||||
if PskReporter.sharedInstance:
|
||||
PskReporter.sharedInstance.cancelTimer()
|
||||
|
||||
def __init__(self):
|
||||
self.spots = []
|
||||
self.spotLock = threading.Lock()
|
||||
self.uploader = Uploader()
|
||||
self.scheduler = scheduler(time.time, time.sleep)
|
||||
self.scheduleNextUpload()
|
||||
threading.Thread(target=self.scheduler.run).start()
|
||||
self.timer = None
|
||||
metrics = Metrics.getSharedInstance()
|
||||
self.dupeCounter = CounterMetric()
|
||||
metrics.addMetric("pskreporter.duplicates", self.dupeCounter)
|
||||
self.spotCounter = CounterMetric()
|
||||
metrics.addMetric("pskreporter.spots", self.spotCounter)
|
||||
|
||||
def scheduleNextUpload(self):
|
||||
if self.timer:
|
||||
return
|
||||
delay = PskReporter.interval + random.uniform(0, 30)
|
||||
logger.debug("scheduling next pskreporter upload in %f seconds", delay)
|
||||
self.scheduler.enter(delay, 1, self.upload)
|
||||
self.timer = threading.Timer(delay, self.upload)
|
||||
self.timer.start()
|
||||
|
||||
def spotEquals(self, s1, s2):
|
||||
keys = ["callsign", "timestamp", "locator", "mode", "msg"]
|
||||
|
||||
return reduce(and_, map(lambda key: s1[key] == s2[key], keys))
|
||||
|
||||
def spot(self, spot):
|
||||
if not spot["mode"] in PskReporter.supportedModes:
|
||||
return
|
||||
with self.spotLock:
|
||||
self.spots.append(spot)
|
||||
if any(x for x in self.spots if self.spotEquals(spot, x)):
|
||||
# dupe
|
||||
self.dupeCounter.inc()
|
||||
else:
|
||||
self.spotCounter.inc()
|
||||
self.spots.append(spot)
|
||||
self.scheduleNextUpload()
|
||||
|
||||
def upload(self):
|
||||
try:
|
||||
@ -67,8 +94,13 @@ class PskReporter(object):
|
||||
except Exception:
|
||||
logger.exception("Failed to upload spots")
|
||||
|
||||
self.timer = None
|
||||
self.scheduleNextUpload()
|
||||
|
||||
def cancelTimer(self):
|
||||
if self.timer:
|
||||
self.timer.cancel()
|
||||
|
||||
|
||||
class Uploader(object):
|
||||
receieverDelimiter = [0x99, 0x92]
|
||||
|
81
owrx/sdr.py
Normal file
81
owrx/sdr.py
Normal file
@ -0,0 +1,81 @@
|
||||
from owrx.config import PropertyManager
|
||||
from owrx.feature import FeatureDetector, UnknownFeatureException
|
||||
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class SdrService(object):
|
||||
sdrProps = None
|
||||
sources = {}
|
||||
lastPort = None
|
||||
|
||||
@staticmethod
|
||||
def loadProps():
|
||||
if SdrService.sdrProps is None:
|
||||
pm = PropertyManager.getSharedInstance()
|
||||
featureDetector = FeatureDetector()
|
||||
|
||||
def loadIntoPropertyManager(dict: dict):
|
||||
propertyManager = PropertyManager()
|
||||
for (name, value) in dict.items():
|
||||
propertyManager[name] = value
|
||||
return propertyManager
|
||||
|
||||
def sdrTypeAvailable(value):
|
||||
try:
|
||||
if not featureDetector.is_available(value["type"]):
|
||||
logger.error(
|
||||
'The RTL source type "{0}" is not available. please check requirements.'.format(
|
||||
value["type"]
|
||||
)
|
||||
)
|
||||
return False
|
||||
return True
|
||||
except UnknownFeatureException:
|
||||
logger.error(
|
||||
'The RTL source type "{0}" is invalid. Please check your configuration'.format(value["type"])
|
||||
)
|
||||
return False
|
||||
|
||||
# transform all dictionary items into PropertyManager object, filtering out unavailable ones
|
||||
SdrService.sdrProps = {
|
||||
name: loadIntoPropertyManager(value) for (name, value) in pm["sdrs"].items() if sdrTypeAvailable(value)
|
||||
}
|
||||
logger.info(
|
||||
"SDR sources loaded. Availables SDRs: {0}".format(
|
||||
", ".join(map(lambda x: x["name"], SdrService.sdrProps.values()))
|
||||
)
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def getFirstSource():
|
||||
sources = SdrService.getSources()
|
||||
if not sources:
|
||||
return None
|
||||
# TODO: configure default sdr in config? right now it will pick the first one off the list.
|
||||
return sources[list(sources.keys())[0]]
|
||||
|
||||
@staticmethod
|
||||
def getSource(id):
|
||||
SdrService.loadProps()
|
||||
sources = SdrService.getSources()
|
||||
if not sources:
|
||||
return None
|
||||
if not id in sources:
|
||||
return None
|
||||
return sources[id]
|
||||
|
||||
@staticmethod
|
||||
def getSources():
|
||||
SdrService.loadProps()
|
||||
for id in SdrService.sdrProps.keys():
|
||||
if not id in SdrService.sources:
|
||||
props = SdrService.sdrProps[id]
|
||||
sdrType = props["type"]
|
||||
className = "".join(x for x in sdrType.title() if x.isalnum()) + "Source"
|
||||
module = __import__("owrx.source.{0}".format(sdrType), fromlist=[className])
|
||||
cls = getattr(module, className)
|
||||
SdrService.sources[id] = cls(id, props)
|
||||
return {key: s for key, s in SdrService.sources.items() if not s.isFailed()}
|
@ -1,23 +1,26 @@
|
||||
import threading
|
||||
import socket
|
||||
from datetime import datetime, timezone, timedelta
|
||||
from owrx.source import SdrService
|
||||
from owrx.source import SdrSource
|
||||
from owrx.sdr import SdrService
|
||||
from owrx.bands import Bandplan
|
||||
from csdr import dsp, output
|
||||
from csdr.csdr import dsp, output
|
||||
from owrx.wsjt import WsjtParser
|
||||
from owrx.aprs import AprsParser
|
||||
from owrx.config import PropertyManager
|
||||
from owrx.source import Resampler
|
||||
from owrx.source.resampler import Resampler
|
||||
from owrx.feature import FeatureDetector
|
||||
from abc import ABCMeta, abstractmethod
|
||||
from .schedule import ServiceScheduler
|
||||
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class ServiceOutput(output):
|
||||
class ServiceOutput(output, metaclass=ABCMeta):
|
||||
def __init__(self, frequency):
|
||||
self.frequency = frequency
|
||||
|
||||
@abstractmethod
|
||||
def getParser(self):
|
||||
# abstract method; implement in subclasses
|
||||
pass
|
||||
@ -45,120 +48,6 @@ class AprsServiceOutput(ServiceOutput):
|
||||
return t == "packet_demod"
|
||||
|
||||
|
||||
class ScheduleEntry(object):
|
||||
def __init__(self, startTime, endTime, profile):
|
||||
self.startTime = startTime
|
||||
self.endTime = endTime
|
||||
self.profile = profile
|
||||
|
||||
def isCurrent(self, time):
|
||||
if self.startTime < self.endTime:
|
||||
return self.startTime <= time < self.endTime
|
||||
else:
|
||||
return self.startTime <= time or time < self.endTime
|
||||
|
||||
def getProfile(self):
|
||||
return self.profile
|
||||
|
||||
def getScheduledEnd(self):
|
||||
now = datetime.utcnow()
|
||||
end = now.combine(date=now.date(), time=self.endTime)
|
||||
while end < now:
|
||||
end += timedelta(days=1)
|
||||
return end
|
||||
|
||||
def getNextActivation(self):
|
||||
now = datetime.utcnow()
|
||||
start = now.combine(date=now.date(), time=self.startTime)
|
||||
while start < now:
|
||||
start += timedelta(days=1)
|
||||
return start
|
||||
|
||||
|
||||
class Schedule(object):
|
||||
@staticmethod
|
||||
def parse(scheduleDict):
|
||||
entries = []
|
||||
for time, profile in scheduleDict.items():
|
||||
if len(time) != 9:
|
||||
logger.warning("invalid schedule spec: %s", time)
|
||||
continue
|
||||
|
||||
startTime = datetime.strptime(time[0:4], "%H%M").replace(tzinfo=timezone.utc).time()
|
||||
endTime = datetime.strptime(time[5:9], "%H%M").replace(tzinfo=timezone.utc).time()
|
||||
entries.append(ScheduleEntry(startTime, endTime, profile))
|
||||
return Schedule(entries)
|
||||
|
||||
def __init__(self, entries):
|
||||
self.entries = entries
|
||||
|
||||
def getCurrentEntry(self):
|
||||
current = [p for p in self.entries if p.isCurrent(datetime.utcnow().time())]
|
||||
if current:
|
||||
return current[0]
|
||||
return None
|
||||
|
||||
def getNextEntry(self):
|
||||
s = sorted(self.entries, key=lambda e: e.getNextActivation())
|
||||
if s:
|
||||
return s[0]
|
||||
return None
|
||||
|
||||
|
||||
class ServiceScheduler(object):
|
||||
def __init__(self, source, schedule):
|
||||
self.source = source
|
||||
self.schedule = Schedule.parse(schedule)
|
||||
self.active = False
|
||||
self.source.addClient(self)
|
||||
self.selectionTimer = None
|
||||
self.scheduleSelection()
|
||||
|
||||
def scheduleSelection(self, time=None):
|
||||
seconds = 10
|
||||
if time is not None:
|
||||
delta = time - datetime.utcnow()
|
||||
seconds = delta.total_seconds()
|
||||
if self.selectionTimer:
|
||||
self.selectionTimer.cancel()
|
||||
self.selectionTimer = threading.Timer(seconds, self.selectProfile)
|
||||
self.selectionTimer.start()
|
||||
|
||||
def isActive(self):
|
||||
return self.active
|
||||
|
||||
def onSdrAvailable(self):
|
||||
pass
|
||||
|
||||
def onSdrUnavailable(self):
|
||||
self.scheduleSelection()
|
||||
|
||||
def selectProfile(self):
|
||||
self.active = False
|
||||
if self.source.hasActiveClients():
|
||||
logger.debug("source has active clients; not touching")
|
||||
return
|
||||
logger.debug("source seems to be idle, selecting profile for background services")
|
||||
entry = self.schedule.getCurrentEntry()
|
||||
|
||||
if entry is None:
|
||||
logger.debug("schedule did not return a profile. checking next entry...")
|
||||
nextEntry = self.schedule.getNextEntry()
|
||||
if nextEntry is not None:
|
||||
self.scheduleSelection(nextEntry.getNextActivation())
|
||||
return
|
||||
|
||||
logger.debug("scheduling end for current profile: %s", entry.getScheduledEnd())
|
||||
self.scheduleSelection(entry.getScheduledEnd())
|
||||
|
||||
try:
|
||||
self.active = True
|
||||
self.source.activateProfile(entry.getProfile())
|
||||
self.source.start()
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
|
||||
class ServiceHandler(object):
|
||||
def __init__(self, source):
|
||||
self.lock = threading.Lock()
|
||||
@ -170,21 +59,53 @@ class ServiceHandler(object):
|
||||
props.collect("center_freq", "samp_rate").wire(self.onFrequencyChange)
|
||||
if self.source.isAvailable():
|
||||
self.scheduleServiceStartup()
|
||||
if "schedule" in props:
|
||||
ServiceScheduler(self.source, props["schedule"])
|
||||
self.scheduler = None
|
||||
if "schedule" in props or "scheduler" in props:
|
||||
self.scheduler = ServiceScheduler(self.source)
|
||||
|
||||
def isActive(self):
|
||||
return False
|
||||
def getClientClass(self):
|
||||
return SdrSource.CLIENT_INACTIVE
|
||||
|
||||
def onSdrAvailable(self):
|
||||
self.scheduleServiceStartup()
|
||||
def onStateChange(self, state):
|
||||
if state == SdrSource.STATE_RUNNING:
|
||||
self.scheduleServiceStartup()
|
||||
elif state == SdrSource.STATE_STOPPING:
|
||||
logger.debug("sdr source becoming unavailable; stopping services.")
|
||||
self.stopServices()
|
||||
elif state == SdrSource.STATE_FAILED:
|
||||
logger.debug("sdr source failed; stopping services.")
|
||||
self.stopServices()
|
||||
if self.scheduler:
|
||||
self.scheduler.shutdown()
|
||||
|
||||
def onSdrUnavailable(self):
|
||||
logger.debug("sdr source becoming unavailable; stopping services.")
|
||||
self.stopServices()
|
||||
def onBusyStateChange(self, state):
|
||||
pass
|
||||
|
||||
def isSupported(self, mode):
|
||||
return mode in PropertyManager.getSharedInstance()["services_decoders"]
|
||||
# TODO this should be in a more central place (the frontend also needs this)
|
||||
requirements = {
|
||||
"ft8": "wsjt-x",
|
||||
"ft4": "wsjt-x",
|
||||
"jt65": "wsjt-x",
|
||||
"jt9": "wsjt-x",
|
||||
"wspr": "wsjt-x",
|
||||
"packet": "packet",
|
||||
}
|
||||
fd = FeatureDetector()
|
||||
|
||||
# this looks overly complicated... but i'd like modes with no requirements to be always available without
|
||||
# being listed in the hash above
|
||||
unavailable = [mode for mode, req in requirements.items() if not fd.is_available(req)]
|
||||
configured = PropertyManager.getSharedInstance()["services_decoders"]
|
||||
available = [mode for mode in configured if mode not in unavailable]
|
||||
|
||||
return mode in available
|
||||
|
||||
def shutdown(self):
|
||||
self.stopServices()
|
||||
self.source.removeClient(self)
|
||||
if self.scheduler:
|
||||
self.scheduler.shutdown()
|
||||
|
||||
def stopServices(self):
|
||||
with self.lock:
|
||||
@ -206,14 +127,6 @@ class ServiceHandler(object):
|
||||
self.startupTimer = threading.Timer(10, self.updateServices)
|
||||
self.startupTimer.start()
|
||||
|
||||
def getAvailablePort(self):
|
||||
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
s.bind(("", 0))
|
||||
s.listen(1)
|
||||
port = s.getsockname()[1]
|
||||
s.close()
|
||||
return port
|
||||
|
||||
def updateServices(self):
|
||||
logger.debug("re-scheduling services due to sdr changes")
|
||||
self.stopServices()
|
||||
@ -238,23 +151,30 @@ class ServiceHandler(object):
|
||||
with self.lock:
|
||||
self.services = []
|
||||
|
||||
for group in self.optimizeResampling(dials, sr):
|
||||
frequencies = sorted([f["frequency"] for f in group])
|
||||
min = frequencies[0]
|
||||
max = frequencies[-1]
|
||||
cf = (min + max) / 2
|
||||
bw = max - min
|
||||
logger.debug("group center frequency: {0}, bandwidth: {1}".format(cf, bw))
|
||||
resampler_props = PropertyManager()
|
||||
resampler_props["center_freq"] = cf
|
||||
# TODO the + 24000 is a temporary fix since the resampling optimizer does not account for required bandwidths
|
||||
resampler_props["samp_rate"] = bw + 24000
|
||||
resampler = Resampler(resampler_props, self.getAvailablePort(), self.source)
|
||||
resampler.start()
|
||||
self.services.append(resampler)
|
||||
groups = self.optimizeResampling(dials, sr)
|
||||
if groups is None:
|
||||
for dial in dials:
|
||||
self.services.append(self.setupService(dial["mode"], dial["frequency"], self.source))
|
||||
else:
|
||||
for group in groups:
|
||||
frequencies = sorted([f["frequency"] for f in group])
|
||||
min = frequencies[0]
|
||||
max = frequencies[-1]
|
||||
cf = (min + max) / 2
|
||||
bw = max - min
|
||||
logger.debug("group center frequency: {0}, bandwidth: {1}".format(cf, bw))
|
||||
resampler_props = PropertyManager()
|
||||
resampler_props["center_freq"] = cf
|
||||
# TODO the + 24000 is a temporary fix since the resampling optimizer does not account for required bandwidths
|
||||
resampler_props["samp_rate"] = bw + 24000
|
||||
resampler = Resampler(resampler_props, self.source)
|
||||
resampler.start()
|
||||
|
||||
for dial in group:
|
||||
self.services.append(self.setupService(dial["mode"], dial["frequency"], resampler))
|
||||
for dial in group:
|
||||
self.services.append(self.setupService(dial["mode"], dial["frequency"], resampler))
|
||||
|
||||
# resampler goes in after the services since it must not be shutdown as long as the services are still running
|
||||
self.services.append(resampler)
|
||||
|
||||
def optimizeResampling(self, freqs, bandwidth):
|
||||
freqs = sorted(freqs, key=lambda f: f["frequency"])
|
||||
@ -285,14 +205,17 @@ class ServiceHandler(object):
|
||||
return {"num_splits": num_splits, "total_bandwidth": total_bandwidth, "groups": groups}
|
||||
|
||||
usages = [calculate_usage(i) for i in range(0, len(freqs))]
|
||||
# this is simulating no resampling. i haven't seen this as the best result yet
|
||||
# another possible outcome might be that it's best not to resample at all. this is a special case.
|
||||
usages += [{"num_splits": None, "total_bandwidth": bandwidth * len(freqs), "groups": [freqs]}]
|
||||
results = sorted(usages, key=lambda f: f["total_bandwidth"])
|
||||
|
||||
for r in results:
|
||||
logger.debug("splits: {0}, total: {1}".format(r["num_splits"], r["total_bandwidth"]))
|
||||
|
||||
return results[0]["groups"]
|
||||
best = results[0]
|
||||
if best["num_splits"] is None:
|
||||
return None
|
||||
return best["groups"]
|
||||
|
||||
def setupService(self, mode, frequency, source):
|
||||
logger.debug("setting up service {0} on frequency {1}".format(mode, frequency))
|
||||
@ -333,17 +256,19 @@ class AprsHandler(object):
|
||||
|
||||
|
||||
class Services(object):
|
||||
handlers = []
|
||||
|
||||
@staticmethod
|
||||
def start():
|
||||
if not PropertyManager.getSharedInstance()["services_enabled"]:
|
||||
return
|
||||
for source in SdrService.getSources().values():
|
||||
ServiceHandler(source)
|
||||
props = source.getProps()
|
||||
if "services" not in props or props["services"] is not False:
|
||||
Services.handlers.append(ServiceHandler(source))
|
||||
|
||||
|
||||
class Service(object):
|
||||
pass
|
||||
|
||||
|
||||
class WsjtService(Service):
|
||||
pass
|
||||
@staticmethod
|
||||
def stop():
|
||||
for handler in Services.handlers:
|
||||
handler.shutdown()
|
||||
Services.handlers = []
|
272
owrx/service/schedule.py
Normal file
272
owrx/service/schedule.py
Normal file
@ -0,0 +1,272 @@
|
||||
from datetime import datetime, timezone, timedelta
|
||||
from owrx.source import SdrSource
|
||||
from owrx.config import PropertyManager
|
||||
import threading
|
||||
import math
|
||||
from abc import ABC, ABCMeta, abstractmethod
|
||||
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class ScheduleEntry(ABC):
|
||||
def __init__(self, startTime, endTime, profile):
|
||||
self.startTime = startTime
|
||||
self.endTime = endTime
|
||||
self.profile = profile
|
||||
|
||||
def getProfile(self):
|
||||
return self.profile
|
||||
|
||||
def __str__(self):
|
||||
return "{0} - {1}: {2}".format(self.startTime, self.endTime, self.profile)
|
||||
|
||||
@abstractmethod
|
||||
def isCurrent(self, dt):
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def getScheduledEnd(self):
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def getNextActivation(self):
|
||||
pass
|
||||
|
||||
|
||||
class TimeScheduleEntry(ScheduleEntry):
|
||||
def isCurrent(self, dt):
|
||||
time = dt.time()
|
||||
if self.startTime < self.endTime:
|
||||
return self.startTime <= time < self.endTime
|
||||
else:
|
||||
return self.startTime <= time or time < self.endTime
|
||||
|
||||
def getScheduledEnd(self):
|
||||
now = datetime.utcnow()
|
||||
end = now.combine(date=now.date(), time=self.endTime)
|
||||
while end < now:
|
||||
end += timedelta(days=1)
|
||||
return end
|
||||
|
||||
def getNextActivation(self):
|
||||
now = datetime.utcnow()
|
||||
start = now.combine(date=now.date(), time=self.startTime)
|
||||
while start < now:
|
||||
start += timedelta(days=1)
|
||||
return start
|
||||
|
||||
|
||||
class DatetimeScheduleEntry(ScheduleEntry):
|
||||
def isCurrent(self, dt):
|
||||
return self.startTime <= dt < self.endTime
|
||||
|
||||
def getScheduledEnd(self):
|
||||
return self.endTime
|
||||
|
||||
def getNextActivation(self):
|
||||
return self.startTime
|
||||
|
||||
class Schedule(ABC):
|
||||
@staticmethod
|
||||
def parse(props):
|
||||
# downwards compatibility
|
||||
if "schedule" in props:
|
||||
return StaticSchedule(props["schedule"])
|
||||
elif "scheduler" in props:
|
||||
sc = props["scheduler"]
|
||||
t = sc["type"] if "type" in sc else "static"
|
||||
if t == "static":
|
||||
return StaticSchedule(sc["schedule"])
|
||||
elif t == "daylight":
|
||||
return DaylightSchedule(sc["schedule"])
|
||||
else:
|
||||
logger.warning("Invalid scheduler type: %s", t)
|
||||
|
||||
@abstractmethod
|
||||
def getCurrentEntry(self):
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def getNextEntry(self):
|
||||
pass
|
||||
|
||||
|
||||
class TimerangeSchedule(Schedule, metaclass=ABCMeta):
|
||||
@abstractmethod
|
||||
def getEntries(self):
|
||||
pass
|
||||
|
||||
def getCurrentEntry(self):
|
||||
current = [p for p in self.getEntries() if p.isCurrent(datetime.utcnow())]
|
||||
if current:
|
||||
return current[0]
|
||||
return None
|
||||
|
||||
def getNextEntry(self):
|
||||
s = sorted(self.getEntries(), key=lambda e: e.getNextActivation())
|
||||
if s:
|
||||
return s[0]
|
||||
return None
|
||||
|
||||
|
||||
class StaticSchedule(TimerangeSchedule):
|
||||
def __init__(self, scheduleDict):
|
||||
self.entries = []
|
||||
for time, profile in scheduleDict.items():
|
||||
if len(time) != 9:
|
||||
logger.warning("invalid schedule spec: %s", time)
|
||||
continue
|
||||
|
||||
startTime = datetime.strptime(time[0:4], "%H%M").replace(tzinfo=timezone.utc).time()
|
||||
endTime = datetime.strptime(time[5:9], "%H%M").replace(tzinfo=timezone.utc).time()
|
||||
self.entries.append(TimeScheduleEntry(startTime, endTime, profile))
|
||||
|
||||
def getEntries(self):
|
||||
return self.entries
|
||||
|
||||
|
||||
class DaylightSchedule(TimerangeSchedule):
|
||||
greyLineTime = timedelta(hours=1)
|
||||
|
||||
def __init__(self, scheduleDict):
|
||||
self.schedule = scheduleDict
|
||||
|
||||
def getSunTimes(self, date):
|
||||
pm = PropertyManager.getSharedInstance()
|
||||
lat, lng = pm["receiver_gps"]
|
||||
degtorad = math.pi / 180
|
||||
radtodeg = 180 / math.pi
|
||||
|
||||
#Number of days since 01/01
|
||||
days = date.timetuple().tm_yday
|
||||
|
||||
# Longitudinal correction
|
||||
longCorr = 4 * lng
|
||||
|
||||
# calibrate for solstice
|
||||
b = 2 * math.pi * (days - 81) / 365
|
||||
|
||||
# Equation of Time Correction
|
||||
eoTCorr = 9.87 * math.sin(2 * b) - 7.53 * math.cos(b) - 1.5 * math.sin(b)
|
||||
|
||||
# Solar correction
|
||||
solarCorr = longCorr + eoTCorr
|
||||
|
||||
# Solar declination
|
||||
declination = math.asin(math.sin(23.45 * degtorad) * math.sin(b))
|
||||
|
||||
sunrise = 12 - math.acos(-math.tan(lat * degtorad) * math.tan(declination)) * radtodeg / 15 - solarCorr / 60
|
||||
sunset = 12 + math.acos(-math.tan(lat * degtorad) * math.tan(declination)) * radtodeg / 15 - solarCorr / 60
|
||||
|
||||
midnight = datetime.combine(date, datetime.min.time())
|
||||
sunrise = midnight + timedelta(hours=sunrise)
|
||||
sunset = midnight + timedelta(hours=sunset)
|
||||
logger.debug("for {date} sunrise: {sunrise} sunset {sunset}".format(date=date, sunrise=sunrise, sunset=sunset))
|
||||
|
||||
return sunrise, sunset
|
||||
|
||||
def getEntries(self):
|
||||
now = datetime.utcnow()
|
||||
date = now.date()
|
||||
# greyline is optional, it its set it will shorten the other profiles
|
||||
useGreyline = "greyline" in self.schedule
|
||||
entries = []
|
||||
|
||||
delta = DaylightSchedule.greyLineTime if useGreyline else timedelta()
|
||||
events = []
|
||||
# we need to start yesterday for longitudes close to the date line
|
||||
offset = -1
|
||||
while len(events) < 1:
|
||||
sunrise, sunset = self.getSunTimes(date + timedelta(days=offset))
|
||||
offset += 1
|
||||
events += [{"type": "sunrise", "time": sunrise}, {"type": "sunset", "time": sunset}]
|
||||
# keep only events in the future
|
||||
events = [v for v in events if v["time"] + delta > now]
|
||||
events.sort(key=lambda e: e["time"])
|
||||
|
||||
previousEvent = None
|
||||
for event in events:
|
||||
# night profile _until_ sunrise, day profile _until_ sunset
|
||||
stype = "night" if event["type"] == "sunrise" else "day"
|
||||
if previousEvent is not None or event["time"] - delta > now:
|
||||
start = now if previousEvent is None else previousEvent
|
||||
entries.append(DatetimeScheduleEntry(start, event["time"] - delta, self.schedule[stype]))
|
||||
if useGreyline:
|
||||
entries.append(
|
||||
DatetimeScheduleEntry(event["time"] - delta, event["time"] + delta, self.schedule["greyline"])
|
||||
)
|
||||
previousEvent = event["time"] + delta
|
||||
|
||||
logger.debug([str(e) for e in entries])
|
||||
return entries
|
||||
|
||||
|
||||
class ServiceScheduler(object):
|
||||
def __init__(self, source):
|
||||
self.source = source
|
||||
self.selectionTimer = None
|
||||
self.source.addClient(self)
|
||||
props = self.source.getProps()
|
||||
self.schedule = Schedule.parse(props)
|
||||
props.collect("center_freq", "samp_rate").wire(self.onFrequencyChange)
|
||||
self.scheduleSelection()
|
||||
|
||||
def shutdown(self):
|
||||
self.cancelTimer()
|
||||
self.source.removeClient(self)
|
||||
|
||||
def scheduleSelection(self, time=None):
|
||||
if self.source.getState() == SdrSource.STATE_FAILED:
|
||||
return
|
||||
seconds = 10
|
||||
if time is not None:
|
||||
delta = time - datetime.utcnow()
|
||||
seconds = delta.total_seconds()
|
||||
self.cancelTimer()
|
||||
self.selectionTimer = threading.Timer(seconds, self.selectProfile)
|
||||
self.selectionTimer.start()
|
||||
|
||||
def cancelTimer(self):
|
||||
if self.selectionTimer:
|
||||
self.selectionTimer.cancel()
|
||||
|
||||
def getClientClass(self):
|
||||
return SdrSource.CLIENT_BACKGROUND
|
||||
|
||||
def onStateChange(self, state):
|
||||
if state == SdrSource.STATE_STOPPING:
|
||||
self.scheduleSelection()
|
||||
elif state == SdrSource.STATE_FAILED:
|
||||
self.cancelTimer()
|
||||
|
||||
def onBusyStateChange(self, state):
|
||||
if state == SdrSource.BUSYSTATE_IDLE:
|
||||
self.scheduleSelection()
|
||||
|
||||
def onFrequencyChange(self, name, value):
|
||||
self.scheduleSelection()
|
||||
|
||||
def selectProfile(self):
|
||||
if self.source.hasClients(SdrSource.CLIENT_USER):
|
||||
logger.debug("source has active users; not touching")
|
||||
return
|
||||
logger.debug("source seems to be idle, selecting profile for background services")
|
||||
entry = self.schedule.getCurrentEntry()
|
||||
|
||||
if entry is None:
|
||||
logger.debug("schedule did not return a profile. checking next entry...")
|
||||
nextEntry = self.schedule.getNextEntry()
|
||||
if nextEntry is not None:
|
||||
self.scheduleSelection(nextEntry.getNextActivation())
|
||||
return
|
||||
|
||||
logger.debug("selected profile %s until %s", entry.getProfile(), entry.getScheduledEnd())
|
||||
self.scheduleSelection(entry.getScheduledEnd())
|
||||
|
||||
try:
|
||||
self.source.activateProfile(entry.getProfile())
|
||||
self.source.start()
|
||||
except KeyError:
|
||||
pass
|
10
owrx/socket.py
Normal file
10
owrx/socket.py
Normal file
@ -0,0 +1,10 @@
|
||||
import socket
|
||||
|
||||
|
||||
def getAvailablePort():
|
||||
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
s.bind(("", 0))
|
||||
s.listen(1)
|
||||
port = s.getsockname()[1]
|
||||
s.close()
|
||||
return port
|
739
owrx/source.py
739
owrx/source.py
@ -1,739 +0,0 @@
|
||||
import subprocess
|
||||
from owrx.config import PropertyManager
|
||||
from owrx.feature import FeatureDetector, UnknownFeatureException
|
||||
from owrx.meta import MetaParser
|
||||
from owrx.wsjt import WsjtParser
|
||||
from owrx.aprs import AprsParser
|
||||
from owrx.metrics import Metrics, DirectMetric
|
||||
import threading
|
||||
import csdr
|
||||
import time
|
||||
import os
|
||||
import signal
|
||||
import sys
|
||||
import socket
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class SdrService(object):
|
||||
sdrProps = None
|
||||
sources = {}
|
||||
lastPort = None
|
||||
|
||||
@staticmethod
|
||||
def getNextPort():
|
||||
pm = PropertyManager.getSharedInstance()
|
||||
(start, end) = pm["iq_port_range"]
|
||||
if SdrService.lastPort is None:
|
||||
SdrService.lastPort = start
|
||||
else:
|
||||
SdrService.lastPort += 1
|
||||
if SdrService.lastPort > end:
|
||||
raise IndexError("no more available ports to start more sdrs")
|
||||
return SdrService.lastPort
|
||||
|
||||
@staticmethod
|
||||
def loadProps():
|
||||
if SdrService.sdrProps is None:
|
||||
pm = PropertyManager.getSharedInstance()
|
||||
featureDetector = FeatureDetector()
|
||||
|
||||
def loadIntoPropertyManager(dict: dict):
|
||||
propertyManager = PropertyManager()
|
||||
for (name, value) in dict.items():
|
||||
propertyManager[name] = value
|
||||
return propertyManager
|
||||
|
||||
def sdrTypeAvailable(value):
|
||||
try:
|
||||
if not featureDetector.is_available(value["type"]):
|
||||
logger.error(
|
||||
'The RTL source type "{0}" is not available. please check requirements.'.format(
|
||||
value["type"]
|
||||
)
|
||||
)
|
||||
return False
|
||||
return True
|
||||
except UnknownFeatureException:
|
||||
logger.error(
|
||||
'The RTL source type "{0}" is invalid. Please check your configuration'.format(value["type"])
|
||||
)
|
||||
return False
|
||||
|
||||
# transform all dictionary items into PropertyManager object, filtering out unavailable ones
|
||||
SdrService.sdrProps = {
|
||||
name: loadIntoPropertyManager(value) for (name, value) in pm["sdrs"].items() if sdrTypeAvailable(value)
|
||||
}
|
||||
logger.info(
|
||||
"SDR sources loaded. Availables SDRs: {0}".format(
|
||||
", ".join(map(lambda x: x["name"], SdrService.sdrProps.values()))
|
||||
)
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def getSource(id=None):
|
||||
SdrService.loadProps()
|
||||
if id is None:
|
||||
# TODO: configure default sdr in config? right now it will pick the first one off the list.
|
||||
id = list(SdrService.sdrProps.keys())[0]
|
||||
sources = SdrService.getSources()
|
||||
return sources[id]
|
||||
|
||||
@staticmethod
|
||||
def getSources():
|
||||
SdrService.loadProps()
|
||||
for id in SdrService.sdrProps.keys():
|
||||
if not id in SdrService.sources:
|
||||
props = SdrService.sdrProps[id]
|
||||
className = "".join(x for x in props["type"].title() if x.isalnum()) + "Source"
|
||||
cls = getattr(sys.modules[__name__], className)
|
||||
SdrService.sources[id] = cls(props, SdrService.getNextPort())
|
||||
return SdrService.sources
|
||||
|
||||
|
||||
class SdrSourceException(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class SdrSource(object):
|
||||
def __init__(self, props, port):
|
||||
self.props = props
|
||||
self.activateProfile()
|
||||
self.rtlProps = self.props.collect(
|
||||
"samp_rate", "nmux_memory", "center_freq", "ppm", "rf_gain", "lna_gain", "rf_amp", "antenna", "if_gain"
|
||||
).defaults(PropertyManager.getSharedInstance())
|
||||
|
||||
def restart(name, value):
|
||||
logger.debug("restarting sdr source due to property change: {0} changed to {1}".format(name, value))
|
||||
self.stop()
|
||||
self.start()
|
||||
|
||||
self.rtlProps.wire(restart)
|
||||
self.port = port
|
||||
self.monitor = None
|
||||
self.clients = []
|
||||
self.spectrumClients = []
|
||||
self.spectrumThread = None
|
||||
self.process = None
|
||||
self.modificationLock = threading.Lock()
|
||||
|
||||
# override this in subclasses
|
||||
def getCommand(self):
|
||||
pass
|
||||
|
||||
# override this in subclasses, if necessary
|
||||
def getFormatConversion(self):
|
||||
return None
|
||||
|
||||
def activateProfile(self, profile_id=None):
|
||||
profiles = self.props["profiles"]
|
||||
if profile_id is None:
|
||||
profile_id = list(profiles.keys())[0]
|
||||
logger.debug("activating profile {0}".format(profile_id))
|
||||
profile = profiles[profile_id]
|
||||
for (key, value) in profile.items():
|
||||
# skip the name, that would overwrite the source name.
|
||||
if key == "name":
|
||||
continue
|
||||
self.props[key] = value
|
||||
|
||||
def getProfiles(self):
|
||||
return self.props["profiles"]
|
||||
|
||||
def getName(self):
|
||||
return self.props["name"]
|
||||
|
||||
def getProps(self):
|
||||
return self.props
|
||||
|
||||
def getPort(self):
|
||||
return self.port
|
||||
|
||||
def start(self):
|
||||
self.modificationLock.acquire()
|
||||
if self.monitor:
|
||||
self.modificationLock.release()
|
||||
return
|
||||
|
||||
props = self.rtlProps
|
||||
|
||||
start_sdr_command = self.getCommand().format(
|
||||
**props.collect(
|
||||
"samp_rate", "center_freq", "ppm", "rf_gain", "lna_gain", "rf_amp", "antenna", "if_gain"
|
||||
).__dict__()
|
||||
)
|
||||
|
||||
format_conversion = self.getFormatConversion()
|
||||
if format_conversion is not None:
|
||||
start_sdr_command += " | " + format_conversion
|
||||
|
||||
nmux_bufcnt = nmux_bufsize = 0
|
||||
while nmux_bufsize < props["samp_rate"] / 4:
|
||||
nmux_bufsize += 4096
|
||||
while nmux_bufsize * nmux_bufcnt < props["nmux_memory"] * 1e6:
|
||||
nmux_bufcnt += 1
|
||||
if nmux_bufcnt == 0 or nmux_bufsize == 0:
|
||||
logger.error(
|
||||
"Error: nmux_bufsize or nmux_bufcnt is zero. These depend on nmux_memory and samp_rate options in config_webrx.py"
|
||||
)
|
||||
self.modificationLock.release()
|
||||
return
|
||||
logger.debug("nmux_bufsize = %d, nmux_bufcnt = %d" % (nmux_bufsize, nmux_bufcnt))
|
||||
cmd = start_sdr_command + " | nmux --bufsize %d --bufcnt %d --port %d --address 127.0.0.1" % (
|
||||
nmux_bufsize,
|
||||
nmux_bufcnt,
|
||||
self.port,
|
||||
)
|
||||
self.process = subprocess.Popen(cmd, shell=True, preexec_fn=os.setpgrp)
|
||||
logger.info("Started rtl source: " + cmd)
|
||||
|
||||
available = False
|
||||
|
||||
def wait_for_process_to_end():
|
||||
rc = self.process.wait()
|
||||
logger.debug("shut down with RC={0}".format(rc))
|
||||
self.monitor = None
|
||||
|
||||
self.monitor = threading.Thread(target=wait_for_process_to_end)
|
||||
self.monitor.start()
|
||||
|
||||
retries = 1000
|
||||
while retries > 0:
|
||||
retries -= 1
|
||||
if self.monitor is None:
|
||||
break
|
||||
testsock = socket.socket()
|
||||
try:
|
||||
testsock.connect(("127.0.0.1", self.getPort()))
|
||||
testsock.close()
|
||||
available = True
|
||||
break
|
||||
except:
|
||||
time.sleep(0.1)
|
||||
|
||||
self.modificationLock.release()
|
||||
|
||||
if not available:
|
||||
raise SdrSourceException("rtl source failed to start up")
|
||||
|
||||
for c in self.clients:
|
||||
c.onSdrAvailable()
|
||||
|
||||
def isAvailable(self):
|
||||
return self.monitor is not None
|
||||
|
||||
def stop(self):
|
||||
for c in self.clients:
|
||||
c.onSdrUnavailable()
|
||||
|
||||
self.modificationLock.acquire()
|
||||
|
||||
if self.process is not None:
|
||||
try:
|
||||
os.killpg(os.getpgid(self.process.pid), signal.SIGTERM)
|
||||
except ProcessLookupError:
|
||||
# been killed by something else, ignore
|
||||
pass
|
||||
if self.monitor:
|
||||
self.monitor.join()
|
||||
self.sleepOnRestart()
|
||||
self.modificationLock.release()
|
||||
|
||||
def sleepOnRestart(self):
|
||||
pass
|
||||
|
||||
def hasActiveClients(self):
|
||||
activeClients = [c for c in self.clients if c.isActive()]
|
||||
return len(activeClients) > 0
|
||||
|
||||
def addClient(self, c):
|
||||
self.clients.append(c)
|
||||
if self.hasActiveClients():
|
||||
self.start()
|
||||
|
||||
def removeClient(self, c):
|
||||
try:
|
||||
self.clients.remove(c)
|
||||
except ValueError:
|
||||
pass
|
||||
if not self.hasActiveClients():
|
||||
self.stop()
|
||||
|
||||
def addSpectrumClient(self, c):
|
||||
self.spectrumClients.append(c)
|
||||
if self.spectrumThread is None:
|
||||
self.spectrumThread = SpectrumThread(self)
|
||||
self.spectrumThread.start()
|
||||
|
||||
def removeSpectrumClient(self, c):
|
||||
try:
|
||||
self.spectrumClients.remove(c)
|
||||
except ValueError:
|
||||
pass
|
||||
if not self.spectrumClients and self.spectrumThread is not None:
|
||||
self.spectrumThread.stop()
|
||||
self.spectrumThread = None
|
||||
|
||||
def writeSpectrumData(self, data):
|
||||
for c in self.spectrumClients:
|
||||
c.write_spectrum_data(data)
|
||||
|
||||
|
||||
class Resampler(SdrSource):
|
||||
def __init__(self, props, port, sdr):
|
||||
sdrProps = sdr.getProps()
|
||||
self.shift = (sdrProps["center_freq"] - props["center_freq"]) / sdrProps["samp_rate"]
|
||||
self.decimation = int(float(sdrProps["samp_rate"]) / props["samp_rate"])
|
||||
if_samp_rate = sdrProps["samp_rate"] / self.decimation
|
||||
self.transition_bw = 0.15 * (if_samp_rate / float(sdrProps["samp_rate"]))
|
||||
props["samp_rate"] = if_samp_rate
|
||||
|
||||
self.sdr = sdr
|
||||
super().__init__(props, port)
|
||||
|
||||
def start(self):
|
||||
self.modificationLock.acquire()
|
||||
if self.monitor:
|
||||
self.modificationLock.release()
|
||||
return
|
||||
|
||||
props = self.rtlProps
|
||||
|
||||
resampler_command = [
|
||||
"nc -v 127.0.0.1 {nc_port}".format(nc_port=self.sdr.getPort()),
|
||||
"csdr shift_addition_cc {shift}".format(shift=self.shift),
|
||||
"csdr fir_decimate_cc {decimation} {ddc_transition_bw} HAMMING".format(
|
||||
decimation=self.decimation, ddc_transition_bw=self.transition_bw
|
||||
),
|
||||
]
|
||||
|
||||
nmux_bufcnt = nmux_bufsize = 0
|
||||
while nmux_bufsize < props["samp_rate"] / 4:
|
||||
nmux_bufsize += 4096
|
||||
while nmux_bufsize * nmux_bufcnt < props["nmux_memory"] * 1e6:
|
||||
nmux_bufcnt += 1
|
||||
if nmux_bufcnt == 0 or nmux_bufsize == 0:
|
||||
logger.error(
|
||||
"Error: nmux_bufsize or nmux_bufcnt is zero. These depend on nmux_memory and samp_rate options in config_webrx.py"
|
||||
)
|
||||
self.modificationLock.release()
|
||||
return
|
||||
logger.debug("nmux_bufsize = %d, nmux_bufcnt = %d" % (nmux_bufsize, nmux_bufcnt))
|
||||
resampler_command += [
|
||||
"nmux --bufsize %d --bufcnt %d --port %d --address 127.0.0.1" % (nmux_bufsize, nmux_bufcnt, self.port)
|
||||
]
|
||||
cmd = " | ".join(resampler_command)
|
||||
logger.debug("resampler command: %s", cmd)
|
||||
self.process = subprocess.Popen(cmd, shell=True, preexec_fn=os.setpgrp)
|
||||
logger.info("Started resampler source: " + cmd)
|
||||
|
||||
available = False
|
||||
|
||||
def wait_for_process_to_end():
|
||||
rc = self.process.wait()
|
||||
logger.debug("shut down with RC={0}".format(rc))
|
||||
self.monitor = None
|
||||
|
||||
self.monitor = threading.Thread(target=wait_for_process_to_end)
|
||||
self.monitor.start()
|
||||
|
||||
retries = 1000
|
||||
while retries > 0:
|
||||
retries -= 1
|
||||
if self.monitor is None:
|
||||
break
|
||||
testsock = socket.socket()
|
||||
try:
|
||||
testsock.connect(("127.0.0.1", self.getPort()))
|
||||
testsock.close()
|
||||
available = True
|
||||
break
|
||||
except:
|
||||
time.sleep(0.1)
|
||||
|
||||
self.modificationLock.release()
|
||||
|
||||
if not available:
|
||||
raise SdrSourceException("resampler source failed to start up")
|
||||
|
||||
for c in self.clients:
|
||||
c.onSdrAvailable()
|
||||
|
||||
def activateProfile(self, profile_id=None):
|
||||
pass
|
||||
|
||||
|
||||
class RtlSdrSource(SdrSource):
|
||||
def getCommand(self):
|
||||
return "rtl_sdr -s {samp_rate} -f {center_freq} -p {ppm} -g {rf_gain} -"
|
||||
|
||||
def getFormatConversion(self):
|
||||
return "csdr convert_u8_f"
|
||||
|
||||
|
||||
class HackrfSource(SdrSource):
|
||||
def getCommand(self):
|
||||
return "hackrf_transfer -s {samp_rate} -f {center_freq} -g {rf_gain} -l{lna_gain} -a{rf_amp} -r-"
|
||||
|
||||
def getFormatConversion(self):
|
||||
return "csdr convert_s8_f"
|
||||
|
||||
|
||||
class SdrplaySource(SdrSource):
|
||||
def getCommand(self):
|
||||
command = "rx_sdr -F CF32 -s {samp_rate} -f {center_freq} -p {ppm}"
|
||||
gainMap = {"rf_gain": "RFGR", "if_gain": "IFGR"}
|
||||
gains = [
|
||||
"{0}={{{1}}}".format(gainMap[name], name)
|
||||
for (name, value) in self.rtlProps.collect("rf_gain", "if_gain").__dict__().items()
|
||||
if value is not None
|
||||
]
|
||||
if gains:
|
||||
command += " -g {gains}".format(gains=",".join(gains))
|
||||
if self.rtlProps["antenna"] is not None:
|
||||
command += ' -a "{antenna}"'
|
||||
command += " -"
|
||||
return command
|
||||
|
||||
def sleepOnRestart(self):
|
||||
time.sleep(1)
|
||||
|
||||
|
||||
class AirspySource(SdrSource):
|
||||
def getCommand(self):
|
||||
frequency = self.props["center_freq"] / 1e6
|
||||
command = "airspy_rx"
|
||||
command += " -f{0}".format(frequency)
|
||||
command += " -r /dev/stdout -a{samp_rate} -g {rf_gain}"
|
||||
return command
|
||||
|
||||
def getFormatConversion(self):
|
||||
return "csdr convert_s16_f"
|
||||
|
||||
|
||||
class SpectrumThread(csdr.output):
|
||||
def __init__(self, sdrSource):
|
||||
self.sdrSource = sdrSource
|
||||
super().__init__()
|
||||
|
||||
self.props = props = self.sdrSource.props.collect(
|
||||
"samp_rate",
|
||||
"fft_size",
|
||||
"fft_fps",
|
||||
"fft_voverlap_factor",
|
||||
"fft_compression",
|
||||
"csdr_dynamic_bufsize",
|
||||
"csdr_print_bufsizes",
|
||||
"csdr_through",
|
||||
"temporary_directory",
|
||||
).defaults(PropertyManager.getSharedInstance())
|
||||
|
||||
self.dsp = dsp = csdr.dsp(self)
|
||||
dsp.nc_port = self.sdrSource.getPort()
|
||||
dsp.set_demodulator("fft")
|
||||
|
||||
def set_fft_averages(key, value):
|
||||
samp_rate = props["samp_rate"]
|
||||
fft_size = props["fft_size"]
|
||||
fft_fps = props["fft_fps"]
|
||||
fft_voverlap_factor = props["fft_voverlap_factor"]
|
||||
|
||||
dsp.set_fft_averages(
|
||||
int(round(1.0 * samp_rate / fft_size / fft_fps / (1.0 - fft_voverlap_factor)))
|
||||
if fft_voverlap_factor > 0
|
||||
else 0
|
||||
)
|
||||
|
||||
self.subscriptions = [
|
||||
props.getProperty("samp_rate").wire(dsp.set_samp_rate),
|
||||
props.getProperty("fft_size").wire(dsp.set_fft_size),
|
||||
props.getProperty("fft_fps").wire(dsp.set_fft_fps),
|
||||
props.getProperty("fft_compression").wire(dsp.set_fft_compression),
|
||||
props.getProperty("temporary_directory").wire(dsp.set_temporary_directory),
|
||||
props.collect("samp_rate", "fft_size", "fft_fps", "fft_voverlap_factor").wire(set_fft_averages),
|
||||
]
|
||||
|
||||
set_fft_averages(None, None)
|
||||
|
||||
dsp.csdr_dynamic_bufsize = props["csdr_dynamic_bufsize"]
|
||||
dsp.csdr_print_bufsizes = props["csdr_print_bufsizes"]
|
||||
dsp.csdr_through = props["csdr_through"]
|
||||
logger.debug("Spectrum thread initialized successfully.")
|
||||
|
||||
def start(self):
|
||||
self.sdrSource.addClient(self)
|
||||
if self.sdrSource.isAvailable():
|
||||
self.dsp.start()
|
||||
|
||||
def supports_type(self, t):
|
||||
return t == "audio"
|
||||
|
||||
def receive_output(self, type, read_fn):
|
||||
if self.props["csdr_dynamic_bufsize"]:
|
||||
read_fn(8) # dummy read to skip bufsize & preamble
|
||||
logger.debug("Note: CSDR_DYNAMIC_BUFSIZE_ON = 1")
|
||||
|
||||
threading.Thread(target=self.pump(read_fn, self.sdrSource.writeSpectrumData)).start()
|
||||
|
||||
def stop(self):
|
||||
self.dsp.stop()
|
||||
self.sdrSource.removeClient(self)
|
||||
for c in self.subscriptions:
|
||||
c.cancel()
|
||||
self.subscriptions = []
|
||||
|
||||
def isActive(self):
|
||||
return True
|
||||
|
||||
def onSdrAvailable(self):
|
||||
self.dsp.start()
|
||||
|
||||
def onSdrUnavailable(self):
|
||||
self.dsp.stop()
|
||||
|
||||
|
||||
class DspManager(csdr.output):
|
||||
def __init__(self, handler, sdrSource):
|
||||
self.handler = handler
|
||||
self.sdrSource = sdrSource
|
||||
self.metaParser = MetaParser(self.handler)
|
||||
self.wsjtParser = WsjtParser(self.handler)
|
||||
self.aprsParser = AprsParser(self.handler)
|
||||
|
||||
self.localProps = (
|
||||
self.sdrSource.getProps()
|
||||
.collect(
|
||||
"audio_compression",
|
||||
"fft_compression",
|
||||
"digimodes_fft_size",
|
||||
"csdr_dynamic_bufsize",
|
||||
"csdr_print_bufsizes",
|
||||
"csdr_through",
|
||||
"digimodes_enable",
|
||||
"samp_rate",
|
||||
"digital_voice_unvoiced_quality",
|
||||
"dmr_filter",
|
||||
"temporary_directory",
|
||||
"center_freq",
|
||||
)
|
||||
.defaults(PropertyManager.getSharedInstance())
|
||||
)
|
||||
|
||||
self.dsp = csdr.dsp(self)
|
||||
self.dsp.nc_port = self.sdrSource.getPort()
|
||||
|
||||
def set_low_cut(cut):
|
||||
bpf = self.dsp.get_bpf()
|
||||
bpf[0] = cut
|
||||
self.dsp.set_bpf(*bpf)
|
||||
|
||||
def set_high_cut(cut):
|
||||
bpf = self.dsp.get_bpf()
|
||||
bpf[1] = cut
|
||||
self.dsp.set_bpf(*bpf)
|
||||
|
||||
def set_dial_freq(key, value):
|
||||
freq = self.localProps["center_freq"] + self.localProps["offset_freq"]
|
||||
self.wsjtParser.setDialFrequency(freq)
|
||||
self.aprsParser.setDialFrequency(freq)
|
||||
self.metaParser.setDialFrequency(freq)
|
||||
|
||||
self.subscriptions = [
|
||||
self.localProps.getProperty("audio_compression").wire(self.dsp.set_audio_compression),
|
||||
self.localProps.getProperty("fft_compression").wire(self.dsp.set_fft_compression),
|
||||
self.localProps.getProperty("digimodes_fft_size").wire(self.dsp.set_secondary_fft_size),
|
||||
self.localProps.getProperty("samp_rate").wire(self.dsp.set_samp_rate),
|
||||
self.localProps.getProperty("output_rate").wire(self.dsp.set_output_rate),
|
||||
self.localProps.getProperty("offset_freq").wire(self.dsp.set_offset_freq),
|
||||
self.localProps.getProperty("squelch_level").wire(self.dsp.set_squelch_level),
|
||||
self.localProps.getProperty("low_cut").wire(set_low_cut),
|
||||
self.localProps.getProperty("high_cut").wire(set_high_cut),
|
||||
self.localProps.getProperty("mod").wire(self.dsp.set_demodulator),
|
||||
self.localProps.getProperty("digital_voice_unvoiced_quality").wire(self.dsp.set_unvoiced_quality),
|
||||
self.localProps.getProperty("dmr_filter").wire(self.dsp.set_dmr_filter),
|
||||
self.localProps.getProperty("temporary_directory").wire(self.dsp.set_temporary_directory),
|
||||
self.localProps.collect("center_freq", "offset_freq").wire(set_dial_freq),
|
||||
]
|
||||
|
||||
self.dsp.set_offset_freq(0)
|
||||
self.dsp.set_bpf(-4000, 4000)
|
||||
self.dsp.csdr_dynamic_bufsize = self.localProps["csdr_dynamic_bufsize"]
|
||||
self.dsp.csdr_print_bufsizes = self.localProps["csdr_print_bufsizes"]
|
||||
self.dsp.csdr_through = self.localProps["csdr_through"]
|
||||
|
||||
if self.localProps["digimodes_enable"]:
|
||||
|
||||
def set_secondary_mod(mod):
|
||||
if mod == False:
|
||||
mod = None
|
||||
self.dsp.set_secondary_demodulator(mod)
|
||||
if mod is not None:
|
||||
self.handler.write_secondary_dsp_config(
|
||||
{
|
||||
"secondary_fft_size": self.localProps["digimodes_fft_size"],
|
||||
"if_samp_rate": self.dsp.if_samp_rate(),
|
||||
"secondary_bw": self.dsp.secondary_bw(),
|
||||
}
|
||||
)
|
||||
|
||||
self.subscriptions += [
|
||||
self.localProps.getProperty("secondary_mod").wire(set_secondary_mod),
|
||||
self.localProps.getProperty("secondary_offset_freq").wire(self.dsp.set_secondary_offset_freq),
|
||||
]
|
||||
|
||||
self.sdrSource.addClient(self)
|
||||
|
||||
super().__init__()
|
||||
|
||||
def start(self):
|
||||
if self.sdrSource.isAvailable():
|
||||
self.dsp.start()
|
||||
|
||||
def receive_output(self, t, read_fn):
|
||||
logger.debug("adding new output of type %s", t)
|
||||
writers = {
|
||||
"audio": self.handler.write_dsp_data,
|
||||
"smeter": self.handler.write_s_meter_level,
|
||||
"secondary_fft": self.handler.write_secondary_fft,
|
||||
"secondary_demod": self.handler.write_secondary_demod,
|
||||
"meta": self.metaParser.parse,
|
||||
"wsjt_demod": self.wsjtParser.parse,
|
||||
"packet_demod": self.aprsParser.parse,
|
||||
}
|
||||
write = writers[t]
|
||||
|
||||
threading.Thread(target=self.pump(read_fn, write)).start()
|
||||
|
||||
def stop(self):
|
||||
self.dsp.stop()
|
||||
self.sdrSource.removeClient(self)
|
||||
for sub in self.subscriptions:
|
||||
sub.cancel()
|
||||
self.subscriptions = []
|
||||
|
||||
def setProperty(self, prop, value):
|
||||
self.localProps.getProperty(prop).setValue(value)
|
||||
|
||||
def isActive(self):
|
||||
return True
|
||||
|
||||
def onSdrAvailable(self):
|
||||
logger.debug("received onSdrAvailable, attempting DspSource restart")
|
||||
self.dsp.start()
|
||||
|
||||
def onSdrUnavailable(self):
|
||||
logger.debug("received onSdrUnavailable, shutting down DspSource")
|
||||
self.dsp.stop()
|
||||
|
||||
|
||||
class CpuUsageThread(threading.Thread):
|
||||
sharedInstance = None
|
||||
|
||||
@staticmethod
|
||||
def getSharedInstance():
|
||||
if CpuUsageThread.sharedInstance is None:
|
||||
CpuUsageThread.sharedInstance = CpuUsageThread()
|
||||
return CpuUsageThread.sharedInstance
|
||||
|
||||
def __init__(self):
|
||||
self.clients = []
|
||||
self.doRun = True
|
||||
self.last_worktime = 0
|
||||
self.last_idletime = 0
|
||||
self.endEvent = threading.Event()
|
||||
super().__init__()
|
||||
|
||||
def run(self):
|
||||
while self.doRun:
|
||||
try:
|
||||
cpu_usage = self.get_cpu_usage()
|
||||
except:
|
||||
cpu_usage = 0
|
||||
for c in self.clients:
|
||||
c.write_cpu_usage(cpu_usage)
|
||||
self.endEvent.wait(timeout=3)
|
||||
logger.debug("cpu usage thread shut down")
|
||||
|
||||
def get_cpu_usage(self):
|
||||
try:
|
||||
f = open("/proc/stat", "r")
|
||||
except:
|
||||
return 0 # Workaround, possibly we're on a Mac
|
||||
line = ""
|
||||
while not "cpu " in line:
|
||||
line = f.readline()
|
||||
f.close()
|
||||
spl = line.split(" ")
|
||||
worktime = int(spl[2]) + int(spl[3]) + int(spl[4])
|
||||
idletime = int(spl[5])
|
||||
dworktime = worktime - self.last_worktime
|
||||
didletime = idletime - self.last_idletime
|
||||
rate = float(dworktime) / (didletime + dworktime)
|
||||
self.last_worktime = worktime
|
||||
self.last_idletime = idletime
|
||||
if self.last_worktime == 0:
|
||||
return 0
|
||||
return rate
|
||||
|
||||
def add_client(self, c):
|
||||
self.clients.append(c)
|
||||
if not self.is_alive():
|
||||
self.start()
|
||||
|
||||
def remove_client(self, c):
|
||||
try:
|
||||
self.clients.remove(c)
|
||||
except ValueError:
|
||||
pass
|
||||
if not self.clients:
|
||||
self.shutdown()
|
||||
|
||||
def shutdown(self):
|
||||
CpuUsageThread.sharedInstance = None
|
||||
self.doRun = False
|
||||
self.endEvent.set()
|
||||
|
||||
|
||||
class TooManyClientsException(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class ClientRegistry(object):
|
||||
sharedInstance = None
|
||||
creationLock = threading.Lock()
|
||||
|
||||
@staticmethod
|
||||
def getSharedInstance():
|
||||
with ClientRegistry.creationLock:
|
||||
if ClientRegistry.sharedInstance is None:
|
||||
ClientRegistry.sharedInstance = ClientRegistry()
|
||||
return ClientRegistry.sharedInstance
|
||||
|
||||
def __init__(self):
|
||||
self.clients = []
|
||||
Metrics.getSharedInstance().addMetric("openwebrx.users", DirectMetric(self.clientCount))
|
||||
super().__init__()
|
||||
|
||||
def broadcast(self):
|
||||
n = self.clientCount()
|
||||
for c in self.clients:
|
||||
c.write_clients(n)
|
||||
|
||||
def addClient(self, client):
|
||||
pm = PropertyManager.getSharedInstance()
|
||||
if len(self.clients) >= pm["max_clients"]:
|
||||
raise TooManyClientsException()
|
||||
self.clients.append(client)
|
||||
self.broadcast()
|
||||
|
||||
def clientCount(self):
|
||||
return len(self.clients)
|
||||
|
||||
def removeClient(self, client):
|
||||
try:
|
||||
self.clients.remove(client)
|
||||
except ValueError:
|
||||
pass
|
||||
self.broadcast()
|
291
owrx/source/__init__.py
Normal file
291
owrx/source/__init__.py
Normal file
@ -0,0 +1,291 @@
|
||||
from owrx.config import PropertyManager
|
||||
import threading
|
||||
import subprocess
|
||||
import os
|
||||
import socket
|
||||
import shlex
|
||||
import time
|
||||
import signal
|
||||
from abc import ABC, abstractmethod
|
||||
from owrx.command import CommandMapper
|
||||
from owrx.socket import getAvailablePort
|
||||
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class SdrSource(ABC):
|
||||
STATE_STOPPED = 0
|
||||
STATE_STARTING = 1
|
||||
STATE_RUNNING = 2
|
||||
STATE_STOPPING = 3
|
||||
STATE_TUNING = 4
|
||||
STATE_FAILED = 5
|
||||
|
||||
BUSYSTATE_IDLE = 0
|
||||
BUSYSTATE_BUSY = 1
|
||||
|
||||
CLIENT_INACTIVE = 0
|
||||
CLIENT_BACKGROUND = 1
|
||||
CLIENT_USER = 2
|
||||
|
||||
def __init__(self, id, props):
|
||||
self.id = id
|
||||
self.props = props
|
||||
self.profile_id = None
|
||||
self.activateProfile()
|
||||
self.rtlProps = self.props.collect(*self.getEventNames()).defaults(PropertyManager.getSharedInstance())
|
||||
self.wireEvents()
|
||||
self.commandMapper = None
|
||||
|
||||
if "port" in props and props["port"] is not None:
|
||||
self.port = props["port"]
|
||||
else:
|
||||
self.port = getAvailablePort()
|
||||
self.monitor = None
|
||||
self.clients = []
|
||||
self.spectrumClients = []
|
||||
self.spectrumThread = None
|
||||
self.process = None
|
||||
self.modificationLock = threading.Lock()
|
||||
self.failed = False
|
||||
self.state = SdrSource.STATE_STOPPED
|
||||
self.busyState = SdrSource.BUSYSTATE_IDLE
|
||||
|
||||
if self.isAlwaysOn():
|
||||
self.start()
|
||||
|
||||
def isAlwaysOn(self):
|
||||
return "always-on" in self.props and self.props["always-on"]
|
||||
|
||||
def getEventNames(self):
|
||||
return [
|
||||
"samp_rate",
|
||||
"center_freq",
|
||||
"ppm",
|
||||
"rf_gain",
|
||||
"lfo_offset",
|
||||
]
|
||||
|
||||
def getCommandMapper(self):
|
||||
if self.commandMapper is None:
|
||||
self.commandMapper = CommandMapper()
|
||||
return self.commandMapper
|
||||
|
||||
@abstractmethod
|
||||
def onPropertyChange(self, name, value):
|
||||
pass
|
||||
|
||||
def wireEvents(self):
|
||||
self.rtlProps.wire(self.onPropertyChange)
|
||||
|
||||
def getCommand(self):
|
||||
return [self.getCommandMapper().map(self.getCommandValues())]
|
||||
|
||||
def activateProfile(self, profile_id=None):
|
||||
profiles = self.props["profiles"]
|
||||
if profile_id is None:
|
||||
profile_id = list(profiles.keys())[0]
|
||||
if profile_id not in profiles:
|
||||
logger.warning("invalid profile %s for sdr %s. ignoring", profile_id, self.id)
|
||||
return
|
||||
if profile_id == self.profile_id:
|
||||
return
|
||||
logger.debug("activating profile {0}".format(profile_id))
|
||||
self.profile_id = profile_id
|
||||
profile = profiles[profile_id]
|
||||
self.props["profile_id"] = profile_id
|
||||
for (key, value) in profile.items():
|
||||
# skip the name, that would overwrite the source name.
|
||||
if key == "name":
|
||||
continue
|
||||
self.props[key] = value
|
||||
|
||||
def getId(self):
|
||||
return self.id
|
||||
|
||||
def getProfileId(self):
|
||||
return self.profile_id
|
||||
|
||||
def getProfiles(self):
|
||||
return self.props["profiles"]
|
||||
|
||||
def getName(self):
|
||||
return self.props["name"]
|
||||
|
||||
def getProps(self):
|
||||
return self.props
|
||||
|
||||
def getPort(self):
|
||||
return self.port
|
||||
|
||||
def getCommandValues(self):
|
||||
dict = self.rtlProps.collect(*self.getEventNames()).__dict__()
|
||||
if "lfo_offset" in dict and dict["lfo_offset"] is not None:
|
||||
dict["tuner_freq"] = dict["center_freq"] + dict["lfo_offset"]
|
||||
else:
|
||||
dict["tuner_freq"] = dict["center_freq"]
|
||||
return dict
|
||||
|
||||
def start(self):
|
||||
with self.modificationLock:
|
||||
if self.monitor:
|
||||
return
|
||||
|
||||
try:
|
||||
self.preStart()
|
||||
except Exception:
|
||||
logger.exception("Exception during preStart()")
|
||||
|
||||
cmd = self.getCommand()
|
||||
cmd = [c for c in cmd if c is not None]
|
||||
|
||||
# don't use shell mode for commands without piping
|
||||
if len(cmd) > 1:
|
||||
# multiple commands with pipes
|
||||
cmd = "|".join(cmd)
|
||||
self.process = subprocess.Popen(cmd, shell=True, start_new_session=True)
|
||||
else:
|
||||
# single command
|
||||
cmd = cmd[0]
|
||||
# start_new_session can go as soon as there's no piped commands left
|
||||
# the os.killpg call must be replaced with something more reasonable at the same time
|
||||
self.process = subprocess.Popen(shlex.split(cmd), start_new_session=True)
|
||||
logger.info("Started sdr source: " + cmd)
|
||||
|
||||
available = False
|
||||
|
||||
def wait_for_process_to_end():
|
||||
rc = self.process.wait()
|
||||
logger.debug("shut down with RC={0}".format(rc))
|
||||
self.monitor = None
|
||||
|
||||
self.monitor = threading.Thread(target=wait_for_process_to_end)
|
||||
self.monitor.start()
|
||||
|
||||
retries = 1000
|
||||
while retries > 0:
|
||||
retries -= 1
|
||||
if self.monitor is None:
|
||||
break
|
||||
testsock = socket.socket()
|
||||
try:
|
||||
testsock.connect(("127.0.0.1", self.getPort()))
|
||||
testsock.close()
|
||||
available = True
|
||||
break
|
||||
except:
|
||||
time.sleep(0.1)
|
||||
|
||||
if not available:
|
||||
self.failed = True
|
||||
|
||||
try:
|
||||
self.postStart()
|
||||
except Exception:
|
||||
logger.exception("Exception during postStart()")
|
||||
self.failed = True
|
||||
|
||||
self.setState(SdrSource.STATE_FAILED if self.failed else SdrSource.STATE_RUNNING)
|
||||
|
||||
def preStart(self):
|
||||
"""
|
||||
override this method in subclasses if there's anything to be done before starting up the actual SDR
|
||||
"""
|
||||
pass
|
||||
|
||||
def postStart(self):
|
||||
"""
|
||||
override this method in subclasses if there's things to do after the actual SDR has started up
|
||||
"""
|
||||
pass
|
||||
|
||||
def isAvailable(self):
|
||||
return self.monitor is not None
|
||||
|
||||
def isFailed(self):
|
||||
return self.failed
|
||||
|
||||
def stop(self):
|
||||
self.setState(SdrSource.STATE_STOPPING)
|
||||
|
||||
with self.modificationLock:
|
||||
|
||||
if self.process is not None:
|
||||
try:
|
||||
os.killpg(os.getpgid(self.process.pid), signal.SIGTERM)
|
||||
except ProcessLookupError:
|
||||
# been killed by something else, ignore
|
||||
pass
|
||||
if self.monitor:
|
||||
self.monitor.join()
|
||||
|
||||
self.setState(SdrSource.STATE_STOPPED)
|
||||
|
||||
def hasClients(self, *args):
|
||||
clients = [c for c in self.clients if c.getClientClass() in args]
|
||||
return len(clients) > 0
|
||||
|
||||
def addClient(self, c):
|
||||
self.clients.append(c)
|
||||
hasUsers = self.hasClients(SdrSource.CLIENT_USER)
|
||||
hasBackgroundTasks = self.hasClients(SdrSource.CLIENT_BACKGROUND)
|
||||
if hasUsers or hasBackgroundTasks:
|
||||
self.start()
|
||||
self.setBusyState(SdrSource.BUSYSTATE_BUSY if hasUsers else SdrSource.BUSYSTATE_IDLE)
|
||||
|
||||
def removeClient(self, c):
|
||||
try:
|
||||
self.clients.remove(c)
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
# no need to check for users if we are always-on
|
||||
if self.isAlwaysOn():
|
||||
return
|
||||
|
||||
hasUsers = self.hasClients(SdrSource.CLIENT_USER)
|
||||
hasBackgroundTasks = self.hasClients(SdrSource.CLIENT_BACKGROUND)
|
||||
self.setBusyState(SdrSource.BUSYSTATE_BUSY if hasUsers else SdrSource.BUSYSTATE_IDLE)
|
||||
if not hasUsers and not hasBackgroundTasks:
|
||||
self.stop()
|
||||
|
||||
def addSpectrumClient(self, c):
|
||||
self.spectrumClients.append(c)
|
||||
if self.spectrumThread is None:
|
||||
# local import due to circular depencency
|
||||
from owrx.fft import SpectrumThread
|
||||
|
||||
self.spectrumThread = SpectrumThread(self)
|
||||
self.spectrumThread.start()
|
||||
|
||||
def removeSpectrumClient(self, c):
|
||||
try:
|
||||
self.spectrumClients.remove(c)
|
||||
except ValueError:
|
||||
pass
|
||||
if not self.spectrumClients and self.spectrumThread is not None:
|
||||
self.spectrumThread.stop()
|
||||
self.spectrumThread = None
|
||||
|
||||
def writeSpectrumData(self, data):
|
||||
for c in self.spectrumClients:
|
||||
c.write_spectrum_data(data)
|
||||
|
||||
def getState(self):
|
||||
return self.state
|
||||
|
||||
def setState(self, state):
|
||||
if state == self.state:
|
||||
return
|
||||
self.state = state
|
||||
for c in self.clients:
|
||||
c.onStateChange(state)
|
||||
|
||||
def setBusyState(self, state):
|
||||
if state == self.busyState:
|
||||
return
|
||||
self.busyState = state
|
||||
for c in self.clients:
|
||||
c.onBusyStateChange(state)
|
13
owrx/source/airspy.py
Normal file
13
owrx/source/airspy.py
Normal file
@ -0,0 +1,13 @@
|
||||
from owrx.command import Flag
|
||||
from .soapy import SoapyConnectorSource
|
||||
|
||||
|
||||
class AirspySource(SoapyConnectorSource):
|
||||
def getCommandMapper(self):
|
||||
return super().getCommandMapper().setMappings({"bias_tee": Flag("-t biastee=true")})
|
||||
|
||||
def getDriver(self):
|
||||
return "airspy"
|
||||
|
||||
def getEventNames(self):
|
||||
return super().getEventNames() + ["bias_tee"]
|
6
owrx/source/airspyhf.py
Normal file
6
owrx/source/airspyhf.py
Normal file
@ -0,0 +1,6 @@
|
||||
from .soapy import SoapyConnectorSource
|
||||
|
||||
|
||||
class AirspyhfSource(SoapyConnectorSource):
|
||||
def getDriver(self):
|
||||
return "airspyhf"
|
74
owrx/source/connector.py
Normal file
74
owrx/source/connector.py
Normal file
@ -0,0 +1,74 @@
|
||||
from . import SdrSource
|
||||
from owrx.socket import getAvailablePort
|
||||
import socket
|
||||
from owrx.command import CommandMapper, Flag, Option
|
||||
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class ConnectorSource(SdrSource):
|
||||
def __init__(self, id, props):
|
||||
self.controlSocket = None
|
||||
self.controlPort = getAvailablePort()
|
||||
super().__init__(id, props)
|
||||
|
||||
def getCommandMapper(self):
|
||||
return super().getCommandMapper().setMappings(
|
||||
{
|
||||
"samp_rate": Option("-s"),
|
||||
"tuner_freq": Option("-f"),
|
||||
"port": Option("-p"),
|
||||
"controlPort": Option("-c"),
|
||||
"device": Option("-d"),
|
||||
"iqswap": Flag("-i"),
|
||||
"rtltcp_compat": Flag("-r"),
|
||||
"ppm": Option("-P"),
|
||||
"rf_gain": Option("-g"),
|
||||
}
|
||||
)
|
||||
|
||||
def getEventNames(self):
|
||||
return super().getEventNames() + [
|
||||
"device",
|
||||
"iqswap",
|
||||
"rtltcp_compat",
|
||||
]
|
||||
|
||||
def sendControlMessage(self, prop, value):
|
||||
logger.debug("sending property change over control socket: {0} changed to {1}".format(prop, value))
|
||||
self.controlSocket.sendall("{prop}:{value}\n".format(prop=prop, value=value).encode())
|
||||
|
||||
def onPropertyChange(self, prop, value):
|
||||
if self.monitor is None:
|
||||
return
|
||||
if (
|
||||
(prop == "center_freq" or prop == "lfo_offset")
|
||||
and "lfo_offset" in self.rtlProps
|
||||
and self.rtlProps["lfo_offset"] is not None
|
||||
):
|
||||
freq = self.rtlProps["center_freq"] + self.rtlProps["lfo_offset"]
|
||||
self.sendControlMessage("center_freq", freq)
|
||||
else:
|
||||
self.sendControlMessage(prop, value)
|
||||
|
||||
def postStart(self):
|
||||
logger.debug("opening control socket...")
|
||||
self.controlSocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
self.controlSocket.connect(("localhost", self.controlPort))
|
||||
|
||||
def stop(self):
|
||||
super().stop()
|
||||
if self.controlSocket:
|
||||
self.controlSocket.close()
|
||||
self.controlSocket = None
|
||||
|
||||
def getControlPort(self):
|
||||
return self.controlPort
|
||||
|
||||
def getCommandValues(self):
|
||||
values = super().getCommandValues()
|
||||
values["port"] = self.getPort()
|
||||
values["controlPort"] = self.getControlPort()
|
||||
return values
|
54
owrx/source/direct.py
Normal file
54
owrx/source/direct.py
Normal file
@ -0,0 +1,54 @@
|
||||
from abc import ABCMeta
|
||||
from . import SdrSource
|
||||
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class DirectSource(SdrSource, metaclass=ABCMeta):
|
||||
def onPropertyChange(self, name, value):
|
||||
logger.debug(
|
||||
"restarting sdr source due to property change: {0} changed to {1}".format(
|
||||
name, value
|
||||
)
|
||||
)
|
||||
self.stop()
|
||||
self.sleepOnRestart()
|
||||
self.start()
|
||||
|
||||
def getEventNames(self):
|
||||
return super().getEventNames() + [
|
||||
"nmux_memory",
|
||||
]
|
||||
|
||||
def getNmuxCommand(self):
|
||||
props = self.rtlProps
|
||||
|
||||
nmux_bufcnt = nmux_bufsize = 0
|
||||
while nmux_bufsize < props["samp_rate"] / 4:
|
||||
nmux_bufsize += 4096
|
||||
while nmux_bufsize * nmux_bufcnt < props["nmux_memory"] * 1e6:
|
||||
nmux_bufcnt += 1
|
||||
if nmux_bufcnt == 0 or nmux_bufsize == 0:
|
||||
raise ValueError(
|
||||
"Error: nmux_bufsize or nmux_bufcnt is zero. "
|
||||
"These depend on nmux_memory and samp_rate options in config_webrx.py"
|
||||
)
|
||||
|
||||
return ["nmux --bufsize %d --bufcnt %d --port %d --address 127.0.0.1" % (
|
||||
nmux_bufsize,
|
||||
nmux_bufcnt,
|
||||
self.port,
|
||||
)]
|
||||
|
||||
def getCommand(self):
|
||||
return super().getCommand() + self.getFormatConversion() + self.getNmuxCommand()
|
||||
|
||||
# override this in subclasses, if necessary
|
||||
def getFormatConversion(self):
|
||||
return []
|
||||
|
||||
# override this in subclasses, if necessary
|
||||
def sleepOnRestart(self):
|
||||
pass
|
36
owrx/source/fifi_sdr.py
Normal file
36
owrx/source/fifi_sdr.py
Normal file
@ -0,0 +1,36 @@
|
||||
from owrx.command import Option
|
||||
from .direct import DirectSource
|
||||
from subprocess import Popen
|
||||
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class FifiSdrSource(DirectSource):
|
||||
def getCommandMapper(self):
|
||||
return super().getCommandMapper().setBase("arecord").setMappings(
|
||||
{"device": Option("-D"), "samp_rate": Option("-r")}
|
||||
).setStatic("-f S16_LE -c2 -")
|
||||
|
||||
def getEventNames(self):
|
||||
return super().getEventNames() + ["device"]
|
||||
|
||||
def getFormatConversion(self):
|
||||
return ["csdr convert_s16_f", "csdr gain_ff 30"]
|
||||
|
||||
def sendRockProgFrequency(self, frequency):
|
||||
process = Popen(["rockprog", "--vco", "-w", "--", "freq={}".format(frequency / 1E6)])
|
||||
process.communicate()
|
||||
rc = process.wait()
|
||||
if rc != 0:
|
||||
logger.warning("rockprog failed to set frequency; rc=%i", rc)
|
||||
|
||||
def preStart(self):
|
||||
values = self.getCommandValues()
|
||||
self.sendRockProgFrequency(values["tuner_freq"])
|
||||
|
||||
def onPropertyChange(self, name, value):
|
||||
if name != "center_freq":
|
||||
return
|
||||
self.sendRockProgFrequency(value)
|
24
owrx/source/hackrf.py
Normal file
24
owrx/source/hackrf.py
Normal file
@ -0,0 +1,24 @@
|
||||
from .direct import DirectSource
|
||||
from owrx.command import Flag, Option
|
||||
|
||||
|
||||
class HackrfSource(DirectSource):
|
||||
def getCommandMapper(self):
|
||||
return super().getCommandMapper().setBase("hackrf_transfer").setMappings(
|
||||
{
|
||||
"samp_rate": Option("-s"),
|
||||
"tuner_freq": Option("-f"),
|
||||
"rf_gain": Option("-g"),
|
||||
"lna_gain": Option("-l"),
|
||||
"rf_amp": Option("-a"),
|
||||
}
|
||||
).setStatic("-r-")
|
||||
|
||||
def getEventNames(self):
|
||||
return super().getEventNames() + [
|
||||
"lna_gain",
|
||||
"rf_amp",
|
||||
]
|
||||
|
||||
def getFormatConversion(self):
|
||||
return ["csdr convert_s8_f"]
|
6
owrx/source/lime_sdr.py
Normal file
6
owrx/source/lime_sdr.py
Normal file
@ -0,0 +1,6 @@
|
||||
from .soapy import SoapyConnectorSource
|
||||
|
||||
|
||||
class LimeSdrSource(SoapyConnectorSource):
|
||||
def getDriver(self):
|
||||
return "lime"
|
6
owrx/source/pluto_sdr.py
Normal file
6
owrx/source/pluto_sdr.py
Normal file
@ -0,0 +1,6 @@
|
||||
from .soapy import SoapyConnectorSource
|
||||
|
||||
|
||||
class PlutoSdrSource(SoapyConnectorSource):
|
||||
def getDriver(self):
|
||||
return "plutosdr"
|
40
owrx/source/resampler.py
Normal file
40
owrx/source/resampler.py
Normal file
@ -0,0 +1,40 @@
|
||||
from .direct import DirectSource
|
||||
from . import SdrSource
|
||||
import subprocess
|
||||
import threading
|
||||
import os
|
||||
import socket
|
||||
import time
|
||||
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Resampler(DirectSource):
|
||||
def onPropertyChange(self, name, value):
|
||||
logger.warning("Resampler is unable to handle property change ({0} changed to {1})".format(name, value))
|
||||
|
||||
def __init__(self, props, sdr):
|
||||
sdrProps = sdr.getProps()
|
||||
self.shift = (sdrProps["center_freq"] - props["center_freq"]) / sdrProps["samp_rate"]
|
||||
self.decimation = int(float(sdrProps["samp_rate"]) / props["samp_rate"])
|
||||
if_samp_rate = sdrProps["samp_rate"] / self.decimation
|
||||
self.transition_bw = 0.15 * (if_samp_rate / float(sdrProps["samp_rate"]))
|
||||
props["samp_rate"] = if_samp_rate
|
||||
|
||||
self.sdr = sdr
|
||||
super().__init__(None, props)
|
||||
|
||||
def getCommand(self):
|
||||
return [
|
||||
"nc -v 127.0.0.1 {nc_port}".format(nc_port=self.sdr.getPort()),
|
||||
"csdr shift_addition_cc {shift}".format(shift=self.shift),
|
||||
"csdr fir_decimate_cc {decimation} {ddc_transition_bw} HAMMING".format(
|
||||
decimation=self.decimation, ddc_transition_bw=self.transition_bw
|
||||
),
|
||||
] + self.getNmuxCommand()
|
||||
|
||||
def activateProfile(self, profile_id=None):
|
||||
logger.warning("Resampler does not support setting profiles")
|
||||
pass
|
6
owrx/source/rtl_sdr.py
Normal file
6
owrx/source/rtl_sdr.py
Normal file
@ -0,0 +1,6 @@
|
||||
from .connector import ConnectorSource
|
||||
|
||||
|
||||
class RtlSdrSource(ConnectorSource):
|
||||
def getCommandMapper(self):
|
||||
return super().getCommandMapper().setBase("rtl_connector")
|
13
owrx/source/rtl_sdr_soapy.py
Normal file
13
owrx/source/rtl_sdr_soapy.py
Normal file
@ -0,0 +1,13 @@
|
||||
from .soapy import SoapyConnectorSource
|
||||
from owrx.command import Option
|
||||
|
||||
|
||||
class RtlSdrSoapySource(SoapyConnectorSource):
|
||||
def getCommandMapper(self):
|
||||
return super().getCommandMapper().setMappings({"direct_sampling": Option("-t direct_samp").setSpacer("=")})
|
||||
|
||||
def getDriver(self):
|
||||
return "rtlsdr"
|
||||
|
||||
def getEventNames(self):
|
||||
return super().getEventNames() + ["direct_sampling"]
|
6
owrx/source/sdrplay.py
Normal file
6
owrx/source/sdrplay.py
Normal file
@ -0,0 +1,6 @@
|
||||
from .soapy import SoapyConnectorSource
|
||||
|
||||
|
||||
class SdrplaySource(SoapyConnectorSource):
|
||||
def getDriver(self):
|
||||
return "sdrplay"
|
58
owrx/source/soapy.py
Normal file
58
owrx/source/soapy.py
Normal file
@ -0,0 +1,58 @@
|
||||
from abc import ABCMeta, abstractmethod
|
||||
from owrx.command import Option
|
||||
|
||||
from .connector import ConnectorSource
|
||||
|
||||
|
||||
class SoapyConnectorSource(ConnectorSource, metaclass=ABCMeta):
|
||||
def getCommandMapper(self):
|
||||
return super().getCommandMapper().setBase("soapy_connector").setMappings({"antenna": Option("-a")})
|
||||
|
||||
"""
|
||||
must be implemented by child classes to be able to build a driver-based device selector by default.
|
||||
return value must be the corresponding soapy driver identifier.
|
||||
"""
|
||||
|
||||
@abstractmethod
|
||||
def getDriver(self):
|
||||
pass
|
||||
|
||||
def getEventNames(self):
|
||||
return super().getEventNames() + [
|
||||
"antenna",
|
||||
]
|
||||
|
||||
def parseDeviceString(self, dstr):
|
||||
def decodeComponent(c):
|
||||
kv = c.split("=", 1)
|
||||
if len(kv) < 2:
|
||||
return c
|
||||
else:
|
||||
return {kv[0]: kv[1]}
|
||||
|
||||
return [decodeComponent(c) for c in dstr.split(",")]
|
||||
|
||||
def encodeDeviceString(self, dobj):
|
||||
def encodeComponent(c):
|
||||
if isinstance(c, str):
|
||||
return c
|
||||
else:
|
||||
return ",".join(["{0}={1}".format(key, value) for key, value in c.items()])
|
||||
|
||||
return ",".join([encodeComponent(c) for c in dobj])
|
||||
|
||||
"""
|
||||
this method always attempts to inject a driver= part into the soapysdr query, depending on what connector was used.
|
||||
this prevents the soapy_connector from using the wrong device in scenarios where there's no same-type sdrs.
|
||||
"""
|
||||
|
||||
def getCommandValues(self):
|
||||
values = super().getCommandValues()
|
||||
if "device" in values and values["device"] is not None:
|
||||
parsed = self.parseDeviceString(values["device"])
|
||||
parsed = [v for v in parsed if "driver" not in v]
|
||||
parsed += [{"driver": self.getDriver()}]
|
||||
values["device"] = self.encodeDeviceString(parsed)
|
||||
else:
|
||||
values["device"] = "driver={0}".format(self.getDriver())
|
||||
return values
|
@ -1 +1,5 @@
|
||||
openwebrx_version = "v0.18"
|
||||
from distutils.version import StrictVersion
|
||||
|
||||
_versionstring = "0.18.0"
|
||||
strictversion = StrictVersion(_versionstring)
|
||||
openwebrx_version = "v{0}".format(strictversion)
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user