├── .github └── ISSUE_TEMPLATE │ └── bug_report.md ├── .gitignore ├── Dockerfile ├── LICENSE ├── README.md ├── UHRH.crt ├── UHRH.key ├── UHRR ├── UHRR.conf ├── UHRR_users.db ├── docker-compose.yml ├── opus ├── LICENSE ├── __init__.py ├── __pycache__ │ ├── __init__.cpython-37.pyc │ ├── decoder.cpython-37.pyc │ └── exceptions.cpython-37.pyc ├── api │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-37.pyc │ │ ├── constants.cpython-37.pyc │ │ ├── ctl.cpython-37.pyc │ │ ├── decoder.cpython-37.pyc │ │ └── info.cpython-37.pyc │ ├── constants.py │ ├── ctl.py │ ├── decoder.py │ ├── encoder.py │ └── info.py ├── decoder.py ├── encoder.py └── exceptions.py └── www ├── controls.js ├── favicon.ico ├── favicon.png ├── img ├── config.png ├── critsgreen.png ├── critsgrey.png ├── critsred.png ├── critsyellow.png ├── logout.png ├── panfft.png ├── poweroff.png ├── poweron.png ├── smeter.png └── spinner.gif ├── index.html ├── panadapter ├── panfft.css ├── panfft.html └── panfft.js └── style.css /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **describe your equipment** 27 | Raspberry pi model: 28 | Transceiver model: 29 | Sound card model: 30 | CAT interface model: 31 | Other: 32 | 33 | **RaspiOS and libs versions** 34 | - Raspberry pi OS version: [see 'uname -a' e.g. Linux raspberrypi 5.4.51-v7l+] 35 | - Hamlib version: [see 'rigctl --version' e.g. rigctl(d), Hamlib 4.1~git ] 36 | - Python version: [see 'python3 --version' e.g. Python 3.7.3] 37 | - others: [like 'pip3 freeze | grep tornado' or 'pip3 freeze | grep pyalsa' 38 | 39 | **Desktop (please complete the following information):** 40 | - OS: [e.g. iOS, win10 or Linux_Ubuntu...] 41 | - Browser [e.g. chrome, safari] 42 | - Version [e.g. 22] 43 | 44 | **Smartphone (please complete the following information):** 45 | - Device: [e.g. iPhone6] 46 | - OS: [e.g. iOS8.1] 47 | - Browser [e.g. stock browser, safari] 48 | - Version [e.g. 22] 49 | 50 | **Additional context** 51 | Add any other context about the problem here. 52 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | UHRR.log 2 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine:latest 2 | MAINTAINER Niccolò Izzo 3 | 4 | ENV HAMLIB_VERSION '4.5.5' 5 | 6 | # Install dependencies 7 | RUN apk add --no-cache git \ 8 | python3 \ 9 | py3-pyalsaaudio \ 10 | py3-numpy \ 11 | py3-tornado \ 12 | py3-pyserial \ 13 | py3-pyaudio \ 14 | py3-hamlib \ 15 | py3-pip \ 16 | librtlsdr \ 17 | autoconf \ 18 | automake \ 19 | libtool \ 20 | swig \ 21 | alpine-sdk 22 | RUN apk add --repository=https://dl-cdn.alpinelinux.org/alpine/edge/testing py3-pam 23 | RUN pip3 install pyrtlsdr --break-system-packages 24 | 25 | # Build hamlib from source 26 | RUN mkdir /hamlib 27 | WORKDIR /hamlib 28 | RUN git clone https://github.com/Hamlib/Hamlib.git src 29 | RUN cd src && git checkout Hamlib-$HAMLIB_VERSION && ./bootstrap && mkdir ../build && cd ../build && \ 30 | ../src/configure --prefix=$HOME/hamlib-prefix --disable-shared --enable-static --without-cxx-binding --disable-winradio CFLAGS="-g -O2 -fdata-sections -ffunction-sections" LDFLAGS="-Wl,--gc-sections" && \ 31 | make -j4 && make install-strip && cd ../../ 32 | 33 | # Copy UHRR source files from host dir 34 | RUN mkdir /uhrh 35 | WORKDIR /uhrh 36 | COPY . /uhrh 37 | RUN ls /uhrh 38 | 39 | # ENV PYTHONPATH=/usr/local/lib/python3.7/site-packages:$PYTHONPATH 40 | CMD ["./UHRR"] 41 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Universal_HamRadio_Remote_HTML5 2 | Universal HamRadio Remote HTML5 interface. 3 | This is an implementation of a python server and HTML5 frontend to provide a web interface to use your TRX for both RX and TX. 4 | You can use basic and some advanced functions of your radio. 5 | You use the speaker and microphone of your computer to communicate. 6 | This project is more oriented for voice (phone) or CW. 7 | 8 | Please send me an email with your success story. olivier@f4htb.fr 9 | 10 | More info on the wiki page: https://github.com/F4HTB/Universal_HamRadio_Remote_HTML5/wiki 11 | 12 | News: https://github.com/F4HTB/Universal_HamRadio_Remote_HTML5/wiki/History
13 | 14 | Caution: 15 | It is designed for Raspberry Pi OS (32-bit) Lite (actually "Minimal image based on Debian Buster"). 16 | Use only if it is legal in your country. 17 | It is intended for remote use, it is not designed for use on the same computer as an interface even though it will likely work. 18 | Please don't raise an issue for anything outside of the intended design. 19 | 20 | 21 | ![UHRR_Pict](https://user-images.githubusercontent.com/18350938/99989724-e1263580-2daa-11eb-9e3e-c132d4c2d7eb.png) 22 | 23 | This utility is used to set up an amateur radio station remotely via a web browser. 24 | 25 | You need: 26 | - a radio station compatible with Hamlib. 27 | - a cat interface. 28 | - a circuit making it possible to adapt the audio levels between the microphone input, the speaker output and the sound card. 29 | 30 | Assuming your raspberry pi hostname is set to UHRR, you can access it at https://UHRR.local:8888/ 31 | Note the HTTP S . 32 | You can configure all of this by logging into https://UHRR.local:8888/CONFIG 33 | If the original configuration is invalid or missing, this will automatically switch to the configuration page. 34 | 35 | 36 | ![func_princ](https://user-images.githubusercontent.com/18350938/99989800-f3a06f00-2daa-11eb-9b45-d695b75904f7.png) 37 | 38 | ![sound_diagram](https://user-images.githubusercontent.com/18350938/99989819-fe5b0400-2daa-11eb-884f-c09341a03541.png) 39 | 40 | Special thanks to : 41 | 42 | -Mike W9MDB! and all the hamlib team for all their hard work 43 | 44 | -All contributors :) 45 | 46 | -------------------------------------------------------------------------------- /UHRH.crt: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIDazCCAlOgAwIBAgIUFZazUUKBBIYvF+HJuDNOXN1FQewwDQYJKoZIhvcNAQEL 3 | BQAwRTELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoM 4 | GEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDAeFw0yMDA1MjAxODA2MjhaFw0yMDA2 5 | MTkxODA2MjhaMEUxCzAJBgNVBAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEw 6 | HwYDVQQKDBhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQwggEiMA0GCSqGSIb3DQEB 7 | AQUAA4IBDwAwggEKAoIBAQCcydQ7PQ2q9mh0RxiQ7D0xYpLmUrsWq6J1oEMzT1Q0 8 | Cglib2cRkwE4gWx67tHmL+IqA0HdYyZQkvc81T4z8DFgchQY997uhCFZvmtEvJln 9 | KvJIS8wPXuZqQCJAKSfmyGGS+WBiMb7l1nrM0kDVGgllWFxleTWkjn+dKJHlcTQs 10 | ankV2SmPKSBbp96tid5oLF9Po9l3A7HoCTGSiV+CnNPsr0ptAx7wYjx+FXZiwBx3 11 | zBfiprtCyfja0bQZLkCZOkRjNn6Px5g8vuN8O/NO6UdEKJdoNwfn40nQ+ledOwca 12 | /TgcbHwzFvZD1cMXceScZDQxhzaVlOYUxxEKgxlxOXSzAgMBAAGjUzBRMB0GA1Ud 13 | DgQWBBRFcsDAW0GZCgiFES0Yfr8ITkCtnjAfBgNVHSMEGDAWgBRFcsDAW0GZCgiF 14 | ES0Yfr8ITkCtnjAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQBb 15 | F1Lq/K8MYtQ8co9QY4C/sRiFpxh+gSZan4N7wdpCupqlphsN58G0zw/YxjrqLu8k 16 | wdmv4nV95zFqzpBH+eit3dIrGSRdO3rln+fMLiNMhvK23v1BsfWbwgqd513RTTlQ 17 | mUloWsPIca2S6PiMcfTnZRTyyZOg6ciVsKv1b+NyMfnFDHc90+WNz6dZG2TjgdCJ 18 | mC5oV52KG+Ju3sQYnv/1a8zUsAeB6uG/gjFbbg/ANPdWh7jvmY8wXSd22jYVzWxZ 19 | YTkPLIBf+GegWvWLkNTbydmDdmAROzlJVLVhfMaOQuvAnrdKpd0oFqDs+uNiPMgB 20 | b7H5eusoH7uXuOD8NQNK 21 | -----END CERTIFICATE----- 22 | -------------------------------------------------------------------------------- /UHRH.key: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIIEowIBAAKCAQEAnMnUOz0NqvZodEcYkOw9MWKS5lK7FquidaBDM09UNAoJYm9n 3 | EZMBOIFseu7R5i/iKgNB3WMmUJL3PNU+M/AxYHIUGPfe7oQhWb5rRLyZZyrySEvM 4 | D17makAiQCkn5shhkvlgYjG+5dZ6zNJA1RoJZVhcZXk1pI5/nSiR5XE0LGp5Fdkp 5 | jykgW6ferYneaCxfT6PZdwOx6AkxkolfgpzT7K9KbQMe8GI8fhV2YsAcd8wX4qa7 6 | Qsn42tG0GS5AmTpEYzZ+j8eYPL7jfDvzTulHRCiXaDcH5+NJ0PpXnTsHGv04HGx8 7 | Mxb2Q9XDF3HknGQ0MYc2lZTmFMcRCoMZcTl0swIDAQABAoIBAHD+Z6x1mKcQREEg 8 | h8zR5Fv1/YZuMxTohwGciTGuRzHl1dOSE8avmh6d7489FBp/gc/jXxFtBkzlTbcS 9 | u2x0+zDVpjREVu6wXNSvjeEQxsF6SvfdYGfnbck/BTAWOQJygReKD3NVBI3hn8iC 10 | 8mRiCkl2f8hFrWo1pDSf611e00n6JRg2YPlH/gBqV2T0mDJL7CXTP6Tggaa6jInQ 11 | Ux7OgPz8djEvk5jFm0lGVxHzo/kbTGfBTLbKfJv/NTxiHH7Qt8NeaFzzJo7sH1eM 12 | E8JT8sZZdCiBtlEmmgp/vX+r9M1gqi2i/evOzJxayx6J+CaGiS/j/VuXC5sQJB8L 13 | jaorwikCgYEAyc1YZ0uxWoCy2M6fYG3ClJ9P3n2rfwdBwzhXaPm6B8EI7UCPR/0/ 14 | EcckGe34QGc2XmtwgxHIJ+hiidzLTn5hMDHYO82JOKa8cQppIKdGGnRwGhyiZhaf 15 | tRyUD5ySPEFL8GR+Mau19NYy5bic5mDrFmSiCtgsxf3kzgAPmxF/BZcCgYEAxuWe 16 | yRsLX5XZHZJRdrGt6lrSnr0BosKIjNxJDwh9VUVh49bzWa1Kvp7u+XMlN48A335I 17 | Aukicujtoe0gIGS9btFOPX5seBs+lReWFpVn0Xa0OJQby7oX3Fp1XDTsbvtrcDHV 18 | vXsZLNv3ip0OGKRh1p1va/idTpajeqPRDB5HBUUCgYACu/2OqL/mcgf6WBJgxBv2 19 | 15HFef5w4jBJ7OGCUp/qqvrr/Av09cF9BC3BDDBo7v0Vmm8T15HWuJddNtiqX5wB 20 | gyti5A4P7nJvNazm/F0+zoUWVXz91SCk25ZF/+EbX+cfgr0S/zif8KcP5ch6dqW4 21 | z/RCIVu58w6+m9GaUEpgUQKBgQCX7E60GBdA5MnZn6jf++n3B3a3z3EPbH428hBQ 22 | DlEFsCCMkuSAjDB6mBW7rmswG+gzzlac+ozYrvjMZb7TX3+exPt5VzbtKwpLgZ+g 23 | EnEhewU/7kmo/LU7GFFqo/Yw85RmN3qm5/8b180mML7SrcUZ1FmGZHlrzP6EL9r+ 24 | 4aWn7QKBgFXxU/vI5RVpvG35dt5BwomBMIx0W2UtXIG+/u8j7S9GBUXFXUyUVr9W 25 | rPsI1TpIZKR9r95RIaj8B25DyUApJVlH7jf2DDoASqr5dR77fmQVaANrrDhgMjNl 26 | QmPd4kw52/wr5KLJukLK9dg8kmwDIMGvHy9rBGo5uoKk4+daUjTW 27 | -----END RSA PRIVATE KEY----- 28 | -------------------------------------------------------------------------------- /UHRR: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | 4 | import os 5 | import tornado.httpserver 6 | import tornado.ioloop 7 | import tornado.web 8 | import tornado.websocket 9 | import alsaaudio 10 | import threading 11 | import time 12 | import numpy 13 | import gc 14 | from opus.decoder import Decoder as OpusDecoder 15 | import datetime 16 | import configparser 17 | import sys 18 | import Hamlib 19 | from rtlsdr import RtlSdr 20 | import numpy as np 21 | import math 22 | 23 | ############ Global variables ################################## 24 | CTRX=None 25 | config = configparser.ConfigParser() 26 | config.read('UHRR.conf') 27 | e="No" 28 | 29 | ############ Global functions ################################## 30 | def writte_log(logmsg): 31 | logfile = open(config['SERVER']['log_file'],"w") 32 | msg = str(datetime.datetime.now())+":"+str(logmsg) 33 | logfile.write(msg) 34 | print(msg) 35 | logfile.close() 36 | 37 | ############ BaseHandler tornado ############## 38 | class BaseHandler(tornado.web.RequestHandler): 39 | def get_current_user(self): 40 | return self.get_secure_cookie("user") 41 | 42 | ############ Generate and send FFT from RTLSDR ############## 43 | is_rtlsdr_present = True 44 | 45 | try: 46 | FFTSIZE=4096 47 | nbBuffer=24 48 | nbsamples=nbBuffer/2*FFTSIZE 49 | ptime=nbsamples/int(config['PANADAPTER']['sample_rate']) 50 | sdr_windows = eval("np."+config['PANADAPTER']['fft_window']+ "(FFTSIZE)") 51 | fftpaquetlen=int(FFTSIZE*8/2048) 52 | sdr = RtlSdr() 53 | sdr.sample_rate = int(config['PANADAPTER']['sample_rate']) # Hz 54 | sdr.center_freq = int(config['PANADAPTER']['center_freq']) # Hz 55 | sdr.freq_correction = int(config['PANADAPTER']['freq_correction']) # PPM 56 | sdr.gain = int(config['PANADAPTER']['gain']) #or 'auto' 57 | except: 58 | is_rtlsdr_present = False 59 | 60 | 61 | 62 | AudioPanaHandlerClients = [] 63 | 64 | class loadFFTdata(threading.Thread): 65 | 66 | def __init__(self): 67 | threading.Thread.__init__(self) 68 | self.get_log_power_spectrum_w = np.empty(FFTSIZE) 69 | for i in range(FFTSIZE): 70 | self.get_log_power_spectrum_w[i] = 0.5 * (1. - math.cos((2 * math.pi * i) / (FFTSIZE - 1))) 71 | 72 | def run(self): 73 | while True: 74 | time.sleep(ptime) 75 | self.getFFT_data() 76 | 77 | 78 | def get_log_power_spectrum(self,data): 79 | 80 | pulse = 10 81 | rejected_count = 0 82 | power_spectrum = np.zeros(FFTSIZE) 83 | db_adjust = 20. * math.log10(FFTSIZE * 2 ** 15) 84 | 85 | # Time-domain analysis: Often we have long normal signals interrupted 86 | # by huge wide-band pulses that degrade our power spectrum average. 87 | # We find the "normal" signal level, by computing the median of the 88 | # absolute value. We only do this for the first buffer of a chunk, 89 | # using the median for the remaining buffers in the chunk. 90 | # A "noise pulse" is a signal level greater than some threshold 91 | # times the median. When such a pulse is found, we skip the current 92 | # buffer. It would be better to blank out just the pulse, but that 93 | # would be more costly in CPU time. 94 | 95 | # Find the median abs value of first buffer to use for this chunk. 96 | td_median = np.median(np.abs(data[:FFTSIZE])) 97 | # Calculate our current threshold relative to measured median. 98 | td_threshold = pulse * td_median 99 | nbuf_taken = 0 # Actual number of buffers accumulated 100 | for ic in range(nbBuffer-1): 101 | start=ic * int(FFTSIZE/2) 102 | end=start+FFTSIZE 103 | td_segment = data[start:end]*sdr_windows 104 | 105 | # remove the 0hz spike 106 | td_segment = np.subtract(td_segment, np.average(td_segment)) 107 | 108 | td_max = np.amax(np.abs(td_segment)) # Do we have a noise pulse? 109 | if td_max < td_threshold: # No, get pwr spectrum etc. 110 | # EXPERIMENTAL TAPERfd 111 | td_segment *= self.get_log_power_spectrum_w 112 | 113 | fd_spectrum = np.fft.fft(td_segment) 114 | # Frequency-domain: 115 | # Rotate array to place 0 freq. in center. (It was at left.) 116 | fd_spectrum_rot = np.fft.fftshift(fd_spectrum) 117 | # Compute the real-valued squared magnitude (ie power) and 118 | # accumulate into pwr_acc. 119 | # fastest way to sum |z|**2 ?? 120 | nbuf_taken += 1 121 | power_spectrum = power_spectrum + \ 122 | np.real(fd_spectrum_rot * fd_spectrum_rot.conj()) 123 | else: # Yes, abort buffer. 124 | rejected_count += 1 125 | # if DEBUG: print "REJECT! %d" % self.rejected_count 126 | if nbuf_taken > 0: 127 | power_spectrum = power_spectrum / nbuf_taken # normalize the sum. 128 | else: 129 | power_spectrum = np.ones(FFTSIZE) # if no good buffers! 130 | # Convert to dB. Note log(0) = "-inf" in Numpy. It can happen if ADC 131 | # isn't working right. Numpy issues a warning. 132 | log_power_spectrum = 10. * np.log10(power_spectrum) 133 | return log_power_spectrum - db_adjust # max poss. signal = 0 dB 134 | 135 | def getFFT_data(self): 136 | samples = sdr.read_samples(nbsamples) 137 | samples = np.imag(samples) + 1j * np.real(samples) 138 | 139 | max_pow = -254 140 | min_pow = 0 141 | 142 | power = self.get_log_power_spectrum(samples) 143 | 144 | # search whole data set for maximum and minimum value 145 | for dat in power: 146 | if dat > max_pow: 147 | max_pow = dat 148 | elif dat < min_pow: 149 | min_pow = dat 150 | 151 | byteslist=bytearray() 152 | try: 153 | for dat in power: 154 | try: 155 | byteslist.append(self.FFTmymap(dat, min_pow, max_pow, 0, 255)) 156 | except (RuntimeError, TypeError, NameError): 157 | byteslist.append(255) 158 | pass 159 | byteslist+=bytearray((65280+int(min_pow)).to_bytes(2, byteorder="big")) 160 | byteslist+=bytearray((65280+int(max_pow)).to_bytes(2, byteorder="big")) 161 | for c in AudioPanaHandlerClients: 162 | c.fftframes.append(bytes(byteslist)) 163 | except: 164 | return None 165 | 166 | def FFTmymap(self, x, in_min, in_max, out_min, out_max): 167 | ret=int((x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min) 168 | return ret 169 | 170 | 171 | 172 | class WS_panFFTHandler(tornado.websocket.WebSocketHandler): 173 | 174 | @tornado.gen.coroutine 175 | def sendFFT(self): 176 | global ptime, fftpaquetlen 177 | try: 178 | while len(self.fftframes)>0: 179 | yield self.write_message(self.fftframes[0],binary=True) 180 | del self.fftframes[0] 181 | except: 182 | return None 183 | tornado.ioloop.IOLoop.instance().add_timeout(datetime.timedelta(seconds=ptime), self.sendFFT) 184 | 185 | def open(self): 186 | global is_rtlsdr_present 187 | print('new connection on FFT socket, is_rtlsdr_present = '+str(is_rtlsdr_present)) 188 | if self not in AudioPanaHandlerClients: 189 | AudioPanaHandlerClients.append(self) 190 | self.fftframes = [] 191 | 192 | def on_message(self, data) : 193 | print(data) 194 | if str(data)=="ready": 195 | self.sendFFT() 196 | elif str(data)=="init": 197 | self.write_message("fftsr:"+str(config['PANADAPTER']['sample_rate'])); 198 | self.write_message("fftsz:"+str(FFTSIZE)); 199 | self.write_message("fftst"); 200 | 201 | def on_close(self): 202 | print('connection closed for FFT socket') 203 | 204 | ############ websocket for send RX audio from TRX ############## 205 | flagWavstart = False 206 | AudioRXHandlerClients = [] 207 | 208 | class loadWavdata(threading.Thread): 209 | 210 | def __init__(self): 211 | global flagWavstart 212 | threading.Thread.__init__(self) 213 | self.inp = alsaaudio.PCM(alsaaudio.PCM_CAPTURE, alsaaudio.PCM_NORMAL, channels=1, rate=8000, format=alsaaudio.PCM_FORMAT_FLOAT_LE, periodsize=256, device=config['AUDIO']['inputdevice']) 214 | print('recording...') 215 | 216 | def run(self): 217 | global Wavframes, flagWavstart 218 | ret=b'' 219 | while True: 220 | while not flagWavstart: 221 | time.sleep(0.5) 222 | l, ret = self.inp.read() 223 | if l > 0: 224 | for c in AudioRXHandlerClients: 225 | c.Wavframes.append(ret) 226 | else: 227 | print("overrun") 228 | time.sleep(0.01) 229 | 230 | 231 | class WS_AudioRXHandler(tornado.websocket.WebSocketHandler): 232 | 233 | def open(self): 234 | self.set_nodelay(True) 235 | global flagWavstart 236 | if self not in AudioRXHandlerClients: 237 | AudioRXHandlerClients.append(self) 238 | self.Wavframes = [] 239 | print('new connection on AudioRXHandler socket.') 240 | flagWavstart = True 241 | self.tailstream() 242 | self.set_nodelay(True) 243 | 244 | @tornado.gen.coroutine 245 | def tailstream(self): 246 | while flagWavstart: 247 | while len(self.Wavframes)==0: 248 | yield tornado.gen.sleep(0.1) 249 | yield self.write_message(self.Wavframes[0],binary=True) 250 | del self.Wavframes[0] 251 | 252 | def on_close(self): 253 | if self in AudioRXHandlerClients: 254 | AudioRXHandlerClients.remove(self) 255 | global flagWavstart 256 | print('connection closed for audioRX') 257 | if len(AudioRXHandlerClients)<=0: 258 | flagWavstart = False 259 | self.Wavframes = [] 260 | gc.collect() 261 | 262 | ############ websocket for control TX ############## 263 | last_AudioTXHandler_msg_time=0 264 | AudioTXHandlerClients = [] 265 | 266 | class WS_AudioTXHandler(tornado.websocket.WebSocketHandler): 267 | 268 | def stoppttontimeout(self): 269 | global last_AudioTXHandler_msg_time 270 | try: 271 | if time.time() > last_AudioTXHandler_msg_time + 10: 272 | if self.ws_connection and CTRX.infos["PTT"]==True: 273 | CTRX.setPTT("false") 274 | print("stop ptt on timeout") 275 | except: 276 | return None 277 | tornado.ioloop.IOLoop.instance().add_timeout(datetime.timedelta(seconds=1), self.stoppttontimeout) 278 | 279 | 280 | def TX_init(self, msg) : 281 | 282 | itrate, is_encoded, op_rate, op_frm_dur = [int(i) for i in msg.split(',')] 283 | self.is_encoded = is_encoded 284 | self.decoder = OpusDecoder(op_rate, 1) 285 | self.frame_size = op_frm_dur * op_rate 286 | 287 | device = config['AUDIO']['outputdevice'] 288 | self.inp = alsaaudio.PCM(alsaaudio.PCM_PLAYBACK, alsaaudio.PCM_NONBLOCK, channels=1, rate=itrate, format=alsaaudio.PCM_FORMAT_S16_LE, periodsize=2048, device=device) 289 | 290 | def open(self): 291 | global last_AudioTXHandler_msg_time, AudioTXHandlerClients 292 | if self not in AudioTXHandlerClients: 293 | AudioTXHandlerClients.append(self) 294 | print('new connection on AudioTXHandler socket.') 295 | last_AudioTXHandler_msg_time=time.time() 296 | self.stoppttontimeout() 297 | self.set_nodelay(True) 298 | 299 | def on_message(self, data) : 300 | global last_AudioTXHandler_msg_time 301 | last_AudioTXHandler_msg_time=time.time() 302 | 303 | if str(data).startswith('m:') : 304 | self.TX_init(str(data[2:])) 305 | elif str(data).startswith('s:') : 306 | self.inp.close() 307 | else : 308 | if self.is_encoded : 309 | pcm = self.decoder.decode(data, self.frame_size, False) 310 | self.inp.write(pcm) 311 | gc.collect() 312 | 313 | else : 314 | self.inp.write(data) 315 | gc.collect() 316 | 317 | def on_close(self): 318 | global AudioTXHandlerClients 319 | if(hasattr(self,"inp")): 320 | self.inp.close() 321 | if self in AudioTXHandlerClients: 322 | AudioTXHandlerClients.remove(self) 323 | if (not len(AudioTXHandlerClients)) and (CTRX.infos["PTT"]==True): 324 | CTRX.setPTT("false") 325 | print('connection closed for TX socket') 326 | 327 | ############ websocket for control TRX ############## 328 | ControlTRXHandlerClients = [] 329 | LastPing = time.time() 330 | 331 | class TRXRIG: 332 | def __init__(self): 333 | self.spoints = {"0":-54, "1":-48, "2":-42, "3":-36, "4":-30, "5":-24, "6":-18, "7":-12, "8":-6, "9":0, "10":10, "20":20, "30":30, "40":40, "50":50, "60":60} 334 | self.infos = {} 335 | self.infos["PTT"]=False 336 | self.infos["powerstat"]=False 337 | self.serialport = Hamlib.hamlib_port_parm_serial 338 | self.serialport.rate=config['HAMLIB']['rig_rate'] 339 | try: 340 | Hamlib.rig_set_debug(Hamlib.RIG_DEBUG_NONE) 341 | self.rig_model = "RIG_MODEL_"+str(config['HAMLIB']['rig_model']) 342 | self.rig_pathname = config['HAMLIB']['rig_pathname'] 343 | self.rig = Hamlib.Rig(Hamlib.__dict__[self.rig_model]) # Look up the model's numerical index in Hamlib's symbol dictionary. 344 | self.rig.set_conf("rig_pathname", self.rig_pathname) 345 | if(config['HAMLIB']['rig_rate']!=""): 346 | self.rig.set_conf("serial_speed", str(config['HAMLIB']['rig_rate'])) 347 | if(config['HAMLIB']['data_bits']!=""): 348 | self.rig.set_conf("data_bits", str(config['HAMLIB']['data_bits'])) #8 as default 349 | if(config['HAMLIB']['stop_bits']!=""): 350 | self.rig.set_conf("stop_bits", str(config['HAMLIB']['stop_bits'])) #2 as default 351 | if(config['HAMLIB']['serial_parity']!=""): 352 | self.rig.set_conf("serial_parity", str(config['HAMLIB']['serial_parity']))# None as default NONE ODD EVEN MARK SPACE 353 | if(config['HAMLIB']['serial_handshake']!=""): 354 | self.rig.set_conf("serial_handshake", str(config['HAMLIB']['serial_handshake'])) # None as default NONE XONXOFF HARDWARE 355 | if(config['HAMLIB']['dtr_state']!=""): 356 | self.rig.set_conf("dtr_state", str(config['HAMLIB']['dtr_state'])) #ON or OFF 357 | if(config['HAMLIB']['rts_state']!=""): 358 | self.rig.set_conf("rts_state", str(config['HAMLIB']['rts_state'])) #ON or OFF 359 | self.rig.set_conf("retry", config['HAMLIB']['retry']) 360 | self.rig.open() 361 | except: 362 | print("Could not open a communication channel to the rig via Hamlib!") 363 | 364 | self.setPower(1) 365 | self.getvfo() 366 | self.getFreq() 367 | self.getMode() 368 | 369 | def parsedbtospoint(self,spoint): 370 | for key, value in self.spoints.items(): 371 | if (spoint
""") 557 | self.write("""[SERVER]

""") 558 | self.write("""SERVER TCP/IP port:Defautl:8888.The server port

""") 559 | self.write("""SERVER Authentification type: Defautl:leave blank. Else you can use "FILE" or/and "PAM".

""") 560 | self.write("""SERVER database users file: Defautl:UHRR_users.db Only if you use Authentification type "FILE".

""") 561 | self.write("""You can change database users file in UHRR.conf.
To add a user in FILE type, add it in UHRR_users.db (default file name).
Add one account per line as login password.
""") 562 | self.write("""If you plan to use PAM you can add account in command line: adduser --no-create-home --system thecallsign.

""") 563 | self.write("""If you whant to change certfile and keyfile, replace "UHRH.crt" and "UHRH.key" in the boot folder, and when the pi boot, it will use those files to start http ssl.

""") 564 | 565 | self.write("""[AUDIO]

""") 566 | self.write("""AUDIO outputdevice: Output from audio soundcard to the mic input of TRX.

""") 572 | 573 | self.write("""AUDIO inputdevice: Input from audio soundcard from the speaker output of TRX.

""") 579 | 580 | self.write("""[HAMLIB]

""") 581 | 582 | self.write("""HAMLIB radio model: Hamlib trx model.

""") 588 | 589 | self.write("""HAMLIB serial port: Serial port of the CAT interface.

""") 595 | 596 | self.write("""HAMLIB radio rate: Serial port baud rate.

""") 612 | 613 | self.write("""HAMLIB auto tx poweroff: Set to auto power off the trx when it's not in use

""") 619 | 620 | CDVALUE="" 621 | if(config['HAMLIB']['data_bits']!=""): 622 | CDVALUE=config['HAMLIB']['data_bits'] 623 | self.write("""HAMLIB serial data bits: Leave blank to use the HAMIB default value.

""") 624 | 625 | CDVALUE="" 626 | if(config['HAMLIB']['stop_bits']!=""): 627 | CDVALUE=config['HAMLIB']['stop_bits'] 628 | self.write("""HAMLIB serial stop bits: Leave blank to use the HAMIB default value.

""") 629 | 630 | self.write("""HAMLIB serial parity: Leave blank to use the HAMIB default value.

""") 640 | 641 | self.write("""HAMLIB serial handshake: Leave blank to use the HAMIB default value.

""") 649 | 650 | self.write("""HAMLIB dtr state: Leave blank to use the HAMIB default value.

""") 657 | 658 | self.write("""HAMLIB rts state: Leave blank to use the HAMIB default value.

""") 665 | 666 | self.write("""[PANADAPTER]

""") 667 | self.write("""PANADAPTER FI frequency (hz):

""") 668 | 669 | self.write("""HAMLIB radio rate (samples/s):

""") 681 | 682 | self.write("""PANADAPTER frequency correction (ppm):

""") 683 | 684 | self.write("""PANADAPTER initial gain:

""") 685 | 686 | self.write("""PANADAPTER windowing:

""") 694 | 695 | self.write("""

Possible problem:"""+e+"""""") 696 | 697 | def post(self): 698 | 699 | if bool(config['SERVER']['auth']) and not self.current_user: 700 | self.redirect("/login") 701 | return 702 | 703 | for x in self.request.arguments: 704 | (s,o)=x.split(".") 705 | v=self.get_argument(x) 706 | print(s,o,v) 707 | if config.has_option(s,o): 708 | config[s][o]=v 709 | with open('UHRR.conf', 'w') as configfile: 710 | config.write(configfile) 711 | self.write("""You will be redirected automatically. Please wait...
""") 712 | self.flush() 713 | time.sleep(2) 714 | os.system("sleep 2;./UHRR &") 715 | os._exit(1) 716 | 717 | ############ Login ############## 718 | class AuthLoginHandler(BaseHandler): 719 | 720 | def get(self): 721 | if not bool(config['SERVER']['auth']): 722 | self.redirect("/") 723 | return 724 | self.write('
' 725 | 'CallSign:
' 726 | 'Password:
' 727 | '' 728 | '
') 729 | 730 | def post(self): 731 | if self.get_argument("name") != "" and self.get_argument("passwd") != "": 732 | if self.bind(self.get_argument("name"),self.get_argument("passwd")): 733 | self.set_secure_cookie("user", self.get_argument("name")) 734 | self.set_cookie("callsign", self.get_argument("name")) 735 | self.set_cookie("autha", "1") 736 | else: 737 | writte_log("Auth error for CallSign:"+str(self.get_argument("name"))) 738 | self.redirect("/") 739 | 740 | def bind(self,user="",password=""): 741 | retval = False 742 | if (user!="" and password!=""): 743 | if config['SERVER']['auth'].find("FILE") != -1: #test with users db file 744 | f = open(config['SERVER']['db_users_file'], "r") 745 | for x in f: 746 | if x[0]!="#": 747 | db=x.strip('\n').split(" ") 748 | if db[0] == user and db[1]== password: 749 | retval = True 750 | break 751 | if not retval and config['SERVER']['auth'].find("PAM") != -1:#test with pam module 752 | if config['SERVER']['pam_account'].find(user) != -1: 753 | import pam 754 | retval = pam.authenticate(user, password) 755 | return retval 756 | 757 | class AuthLogoutHandler(BaseHandler): 758 | def get(self): 759 | self.clear_cookie("user") 760 | self.clear_cookie("autha") 761 | self.redirect(self.get_argument("next", "/")) 762 | 763 | ############ Main ############## 764 | class MainHandler(BaseHandler): 765 | 766 | def get(self): 767 | print("Tornado current user:"+str(self.current_user)) 768 | if bool(config['SERVER']['auth']) and not self.current_user: 769 | self.redirect("/login") 770 | return 771 | self.application.settings.get("compiled_template_cache", False) 772 | self.set_header('Cache-Control', 'no-store, no-cache, must-revalidate, max-age=0') 773 | self.render("www/index.html") 774 | 775 | if __name__ == "__main__": 776 | 777 | try: 778 | if is_rtlsdr_present: 779 | threadFFT = loadFFTdata() 780 | threadFFT.start() 781 | 782 | threadloadWavdata = loadWavdata() 783 | threadloadWavdata.start() 784 | 785 | CTRX = TRXRIG() 786 | 787 | threadticksTRXRIG = ticksTRXRIG() 788 | threadticksTRXRIG.start() 789 | 790 | if(config['HAMLIB']['trxautopower']=="True"): 791 | threadsurveilTRX = threadtimeoutTRXshutdown() 792 | threadsurveilTRX.start() 793 | 794 | 795 | app = tornado.web.Application([ 796 | (r'/login', AuthLoginHandler), 797 | (r'/logout', AuthLogoutHandler), 798 | (r'/WSaudioRX', WS_AudioRXHandler), 799 | (r'/WSaudioTX', WS_AudioTXHandler), 800 | (r'/WSCTRX', WS_ControlTRX), 801 | (r'/WSpanFFT', WS_panFFTHandler), 802 | (r'/(panfft.*)', tornado.web.StaticFileHandler, { 'path' : './www/panadapter' }), 803 | (r'/CONFIG', ConfigHandler), 804 | (r'/', MainHandler), 805 | (r'/(.*)', tornado.web.StaticFileHandler, { 'path' : './www' }) 806 | ],debug=bool(config['SERVER']['debug']), websocket_ping_interval=10, cookie_secret=config['SERVER']['cookie_secret']) 807 | except: 808 | e = str(sys.exc_info()) 809 | print(e) 810 | app = tornado.web.Application([ 811 | (r'/CONFIG', ConfigHandler), 812 | (r'/', ConfigHandler), 813 | (r'/(.*)', tornado.web.StaticFileHandler, { 'path' : './www' }) 814 | ],debug=bool(config['SERVER']['debug'])) 815 | 816 | http_server = tornado.httpserver.HTTPServer(app, ssl_options={ 817 | "certfile": os.path.join(config['SERVER']['certfile']), 818 | "keyfile": os.path.join(config['SERVER']['keyfile']), 819 | }) 820 | http_server.listen(int(config['SERVER']['port'])) 821 | print('HTTP server started.') 822 | tornado.ioloop.IOLoop.instance().start() 823 | 824 | -------------------------------------------------------------------------------- /UHRR.conf: -------------------------------------------------------------------------------- 1 | [SERVER] 2 | port = 8888 3 | certfile = UHRH.crt 4 | keyfile = UHRH.key 5 | auth = 6 | cookie_secret = L8LwECiNRxq2N0N2eGxx9MZlrpmuMEimlydNX/vt1LM= 7 | db_users_file = UHRR_users.db 8 | pam_account = pi 9 | log_file = UHRR.log 10 | debug = True 11 | 12 | [CTRL] 13 | interval_smeter_update = 0.5 14 | debug = True 15 | 16 | [AUDIO] 17 | outputdevice = plughw:CARD=U0x41e0x30d3,DEV=0 18 | inputdevice = plughw:CARD=U0x41e0x30d3,DEV=0 19 | 20 | [HAMLIB] 21 | rig_pathname = /dev/ttyUSB0 22 | retry = 5 23 | rig_model = FT817 24 | trxautopower = True 25 | rig_rate = 38400 26 | data_bits = 27 | stop_bits = 28 | serial_parity = 29 | serial_handshake = 30 | dtr_state = 31 | rts_state = 32 | 33 | [PANADAPTER] 34 | sample_rate = 960000 35 | center_freq = 68330000 36 | freq_correction = 1 37 | gain = 10 38 | fft_window = hamming 39 | 40 | -------------------------------------------------------------------------------- /UHRR_users.db: -------------------------------------------------------------------------------- 1 | #one line per account like : 2 | #1AAW Paul! 3 | F4HTB test 4 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | uhrh: 3 | build: . 4 | container_name: uhrh 5 | restart: always 6 | devices: 7 | - /dev/snd:/dev/snd 8 | - /dev/ttyUSB0:/dev/ttyUSB0 9 | ports: 10 | - 8888:8888 11 | -------------------------------------------------------------------------------- /opus/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012, SvartalF 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | * Redistributions of source code must retain the above copyright 7 | notice, this list of conditions and the following disclaimer. 8 | * Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | * Neither the name of the SvartalF nor the 12 | names of its contributors may be used to endorse or promote products 13 | derived from this software without specific prior written permission. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY 19 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /opus/__init__.py: -------------------------------------------------------------------------------- 1 | """Python bindings to the libopus, IETF low-delay audio codec""" 2 | -------------------------------------------------------------------------------- /opus/__pycache__/__init__.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/F4HTB/Universal_HamRadio_Remote_HTML5/55ea7dc19326917bcadf0c8e0054f4b3a9a12057/opus/__pycache__/__init__.cpython-37.pyc -------------------------------------------------------------------------------- /opus/__pycache__/decoder.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/F4HTB/Universal_HamRadio_Remote_HTML5/55ea7dc19326917bcadf0c8e0054f4b3a9a12057/opus/__pycache__/decoder.cpython-37.pyc -------------------------------------------------------------------------------- /opus/__pycache__/exceptions.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/F4HTB/Universal_HamRadio_Remote_HTML5/55ea7dc19326917bcadf0c8e0054f4b3a9a12057/opus/__pycache__/exceptions.cpython-37.pyc -------------------------------------------------------------------------------- /opus/api/__init__.py: -------------------------------------------------------------------------------- 1 | import ctypes 2 | from ctypes.util import find_library 3 | 4 | 5 | libopus = ctypes.CDLL(find_library('opus')) 6 | 7 | c_int_pointer = ctypes.POINTER(ctypes.c_int) 8 | c_int16_pointer = ctypes.POINTER(ctypes.c_int16) 9 | c_float_pointer = ctypes.POINTER(ctypes.c_float) 10 | -------------------------------------------------------------------------------- /opus/api/__pycache__/__init__.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/F4HTB/Universal_HamRadio_Remote_HTML5/55ea7dc19326917bcadf0c8e0054f4b3a9a12057/opus/api/__pycache__/__init__.cpython-37.pyc -------------------------------------------------------------------------------- /opus/api/__pycache__/constants.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/F4HTB/Universal_HamRadio_Remote_HTML5/55ea7dc19326917bcadf0c8e0054f4b3a9a12057/opus/api/__pycache__/constants.cpython-37.pyc -------------------------------------------------------------------------------- /opus/api/__pycache__/ctl.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/F4HTB/Universal_HamRadio_Remote_HTML5/55ea7dc19326917bcadf0c8e0054f4b3a9a12057/opus/api/__pycache__/ctl.cpython-37.pyc -------------------------------------------------------------------------------- /opus/api/__pycache__/decoder.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/F4HTB/Universal_HamRadio_Remote_HTML5/55ea7dc19326917bcadf0c8e0054f4b3a9a12057/opus/api/__pycache__/decoder.cpython-37.pyc -------------------------------------------------------------------------------- /opus/api/__pycache__/info.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/F4HTB/Universal_HamRadio_Remote_HTML5/55ea7dc19326917bcadf0c8e0054f4b3a9a12057/opus/api/__pycache__/info.cpython-37.pyc -------------------------------------------------------------------------------- /opus/api/constants.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | """Matches to `opus_defines.h`""" 4 | 5 | # No Error 6 | OK = 0 7 | 8 | # One or more invalid/out of range arguments 9 | BAD_ARG = -1 10 | 11 | # The mode struct passed is invalid 12 | BUFFER_TOO_SMALL = -2 13 | 14 | # The compressed data passed is corrupted 15 | INVALID_PACKET = -4 16 | 17 | # Invalid/unsupported request number 18 | UNIMPLEMENTED = -5 19 | 20 | 21 | # Pre-defined values for CTL interface 22 | 23 | APPLICATION_VOIP = 2048 24 | APPLICATION_AUDIO = 2049 25 | APPLICATION_RESTRICTED_LOWDELAY = 2051 26 | 27 | SIGNAL_MUSIC = 3002 28 | 29 | # Values for the various encoder CTLs 30 | 31 | SET_APPLICATION_REQUEST = 4000 32 | GET_APPLICATION_REQUEST = 4001 33 | SET_BITRATE_REQUEST = 4002 34 | GET_BITRATE_REQUEST = 4003 35 | SET_MAX_BANDWIDTH_REQUEST = 4004 36 | GET_MAX_BANDWIDTH_REQUEST = 4005 37 | SET_VBR_REQUEST = 4006 38 | GET_VBR_REQUEST = 4007 39 | SET_BANDWIDTH_REQUEST = 4008 40 | GET_BANDWIDTH_REQUEST = 4009 41 | SET_COMPLEXITY_REQUEST = 4010 42 | GET_COMPLEXITY_REQUEST = 4011 43 | SET_INBAND_FEC_REQUEST = 4012 44 | GET_INBAND_FEC_REQUEST = 4013 45 | SET_PACKET_LOSS_PERC_REQUEST = 4014 46 | GET_PACKET_LOSS_PERC_REQUEST = 4015 47 | SET_DTX_REQUEST = 4016 48 | GET_DTX_REQUEST = 4017 49 | SET_VBR_CONSTRAINT_REQUEST = 4020 50 | GET_VBR_CONSTRAINT_REQUEST = 4021 51 | SET_FORCE_CHANNELS_REQUEST = 4022 52 | GET_FORCE_CHANNELS_REQUEST = 4023 53 | SET_SIGNAL_REQUEST = 4024 54 | GET_SIGNAL_REQUEST = 4025 55 | GET_LOOKAHEAD_REQUEST = 4027 56 | RESET_STATE = 4028 57 | GET_SAMPLE_RATE_REQUEST = 4029 58 | GET_FINAL_RANGE_REQUEST = 4031 59 | GET_PITCH_REQUEST = 4033 60 | SET_GAIN_REQUEST = 4034 61 | GET_GAIN_REQUEST = 4045 62 | SET_LSB_DEPTH_REQUEST = 4036 63 | GET_LSB_DEPTH_REQUEST = 4037 64 | 65 | AUTO = -1000 66 | 67 | BANDWIDTH_NARROWBAND = 1101 68 | BANDWIDTH_MEDIUMBAND = 1102 69 | BANDWIDTH_WIDEBAND = 1103 70 | BANDWIDTH_SUPERWIDEBAND = 1104 71 | BANDWIDTH_FULLBAND = 1105 72 | -------------------------------------------------------------------------------- /opus/api/ctl.py: -------------------------------------------------------------------------------- 1 | """CTL macros rewritten to Python 2 | 3 | Usage example: 4 | 5 | from opus.api import decoder, ctl 6 | 7 | dec = decoder.create(48000, 2) 8 | decoder.ctl(dec, ctl.set_gain, -15) 9 | gain_value = decoder.ctl(dec, ctl.get_gain) 10 | 11 | """ 12 | 13 | import ctypes 14 | 15 | from opus.api import constants 16 | from opus.exceptions import OpusError 17 | 18 | 19 | def query(request): 20 | """Query encoder/decoder with a request value""" 21 | 22 | def inner(func, obj): 23 | result_code = func(obj, request) 24 | 25 | if result_code is not constants.OK: 26 | raise OpusError(result_code) 27 | 28 | return result_code 29 | 30 | return inner 31 | 32 | 33 | def get(request, result_type): 34 | """Get CTL value from a encoder/decoder""" 35 | 36 | def inner(func, obj): 37 | result = result_type() 38 | result_code = func(obj, request, ctypes.byref(result)) 39 | 40 | if result_code is not constants.OK: 41 | raise OpusError(result_code) 42 | 43 | return result.value 44 | 45 | return inner 46 | 47 | 48 | def set(request): 49 | """Set new CTL value to a encoder/decoder""" 50 | 51 | def inner(func, obj, value): 52 | result_code = func(obj, request, value) 53 | if result_code is not constants.OK: 54 | raise OpusError(result_code) 55 | 56 | return inner 57 | 58 | # 59 | # Generic CTLs 60 | # 61 | 62 | # Resets the codec state to be equivalent to a freshly initialized state 63 | reset_state = query(constants.RESET_STATE) 64 | 65 | # Gets the final state of the codec's entropy coder 66 | get_final_range = get(constants.GET_FINAL_RANGE_REQUEST, ctypes.c_uint) 67 | 68 | # Gets the encoder's configured bandpass or the decoder's last bandpass 69 | get_bandwidth = get(constants.GET_BANDWIDTH_REQUEST, ctypes.c_int) 70 | 71 | # Gets the pitch of the last decoded frame, if available 72 | get_pitch = get(constants.GET_PITCH_REQUEST, ctypes.c_int) 73 | 74 | # Configures the depth of signal being encoded 75 | set_lsb_depth = set(constants.SET_LSB_DEPTH_REQUEST) 76 | 77 | # Gets the encoder's configured signal depth 78 | get_lsb_depth = get(constants.GET_LSB_DEPTH_REQUEST, ctypes.c_int) 79 | 80 | # 81 | # Decoder related CTLs 82 | # 83 | 84 | # Gets the decoder's configured gain adjustment 85 | get_gain = get(constants.GET_GAIN_REQUEST, ctypes.c_int) 86 | 87 | # Configures decoder gain adjustment 88 | set_gain = set(constants.SET_GAIN_REQUEST) 89 | 90 | # 91 | # Encoder related CTLs 92 | # 93 | 94 | # Configures the encoder's computational complexity 95 | set_complexity = set(constants.SET_COMPLEXITY_REQUEST) 96 | 97 | # Gets the encoder's complexity configuration 98 | get_complexity = get(constants.GET_COMPLEXITY_REQUEST, ctypes.c_int) 99 | 100 | # Configures the bitrate in the encoder 101 | set_bitrate = set(constants.SET_BITRATE_REQUEST) 102 | 103 | # Gets the encoder's bitrate configuration 104 | get_bitrate = get(constants.GET_BITRATE_REQUEST, ctypes.c_int) 105 | 106 | # Enables or disables variable bitrate (VBR) in the encoder 107 | set_vbr = set(constants.SET_VBR_REQUEST) 108 | 109 | # Determine if variable bitrate (VBR) is enabled in the encoder 110 | get_vbr = get(constants.GET_VBR_REQUEST, ctypes.c_int) 111 | 112 | # Enables or disables constrained VBR in the encoder 113 | set_vbr_constraint = set(constants.SET_VBR_CONSTRAINT_REQUEST) 114 | 115 | # Determine if constrained VBR is enabled in the encoder 116 | get_vbr_constraint = get(constants.GET_VBR_CONSTRAINT_REQUEST, ctypes.c_int) 117 | 118 | # Configures mono/stereo forcing in the encoder 119 | set_force_channels = set(constants.SET_FORCE_CHANNELS_REQUEST) 120 | 121 | # Gets the encoder's forced channel configuration 122 | get_force_channels = get(constants.GET_FORCE_CHANNELS_REQUEST, ctypes.c_int) 123 | 124 | # Configures the maximum bandpass that the encoder will select automatically 125 | set_max_bandwidth = set(constants.SET_MAX_BANDWIDTH_REQUEST) 126 | 127 | # Gets the encoder's configured maximum allowed bandpass 128 | get_max_bandwidth = get(constants.GET_MAX_BANDWIDTH_REQUEST, ctypes.c_int) 129 | 130 | # Sets the encoder's bandpass to a specific value 131 | set_bandwidth = set(constants.SET_BANDWIDTH_REQUEST) 132 | 133 | # Configures the type of signal being encoded 134 | set_signal = set(constants.SET_SIGNAL_REQUEST) 135 | 136 | # Gets the encoder's configured signal type 137 | get_signal = get(constants.GET_SIGNAL_REQUEST, ctypes.c_int) 138 | 139 | # Configures the encoder's intended application 140 | set_application = set(constants.SET_APPLICATION_REQUEST) 141 | 142 | # Gets the encoder's configured application 143 | get_application = get(constants.GET_APPLICATION_REQUEST, ctypes.c_int) 144 | 145 | # Gets the sampling rate the encoder or decoder was initialized with 146 | get_sample_rate = get(constants.GET_SAMPLE_RATE_REQUEST, ctypes.c_int) 147 | 148 | # Gets the total samples of delay added by the entire codec 149 | get_lookahead = get(constants.GET_LOOKAHEAD_REQUEST, ctypes.c_int) 150 | 151 | # Configures the encoder's use of inband forward error correction (FEC) 152 | set_inband_fec = set(constants.SET_INBAND_FEC_REQUEST) 153 | 154 | # Gets encoder's configured use of inband forward error correction 155 | get_inband_fec = get(constants.GET_INBAND_FEC_REQUEST, ctypes.c_int) 156 | 157 | # Configures the encoder's expected packet loss percentage 158 | set_packet_loss_perc = set(constants.SET_PACKET_LOSS_PERC_REQUEST) 159 | 160 | # Gets the encoder's configured packet loss percentage 161 | get_packet_loss_perc = get(constants.GET_PACKET_LOSS_PERC_REQUEST, ctypes.c_int) 162 | 163 | # Configures the encoder's use of discontinuous transmission (DTX) 164 | set_dtx = set(constants.SET_DTX_REQUEST) 165 | 166 | # Gets encoder's configured use of discontinuous transmission 167 | get_dtx = get(constants.GET_DTX_REQUEST, ctypes.c_int) 168 | 169 | # 170 | # Other stuff 171 | # 172 | 173 | unimplemented = query(constants.UNIMPLEMENTED) 174 | -------------------------------------------------------------------------------- /opus/api/decoder.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | import array 4 | import ctypes 5 | 6 | from opus.api import libopus, c_int_pointer, c_int16_pointer, c_float_pointer 7 | from opus.exceptions import OpusError 8 | 9 | 10 | class Decoder(ctypes.Structure): 11 | """Opus decoder state. 12 | 13 | This contains the complete state of an Opus decoder. 14 | """ 15 | 16 | pass 17 | 18 | DecoderPointer = ctypes.POINTER(Decoder) 19 | 20 | 21 | get_size = libopus.opus_decoder_get_size 22 | get_size.argtypes = (ctypes.c_int,) 23 | get_size.restype = ctypes.c_int 24 | get_size.__doc__ = 'Gets the size of an OpusDecoder structure' 25 | 26 | 27 | _create = libopus.opus_decoder_create 28 | _create.argtypes = (ctypes.c_int, ctypes.c_int, c_int_pointer) 29 | _create.restype = DecoderPointer 30 | 31 | 32 | def create(fs, channels): 33 | """Allocates and initializes a decoder state""" 34 | 35 | result_code = ctypes.c_int() 36 | 37 | result = _create(fs, channels, ctypes.byref(result_code)) 38 | if result_code.value is not 0: 39 | raise OpusError(result_code.value) 40 | 41 | return result 42 | 43 | 44 | _packet_get_bandwidth = libopus.opus_packet_get_bandwidth 45 | _packet_get_bandwidth.argtypes = (ctypes.c_char_p,) 46 | _packet_get_bandwidth.restype = ctypes.c_int 47 | 48 | 49 | def packet_get_bandwidth(data): 50 | """Gets the bandwidth of an Opus packet.""" 51 | 52 | data_pointer = ctypes.c_char_p(data) 53 | 54 | result = _packet_get_bandwidth(data_pointer) 55 | if result < 0: 56 | raise OpusError(result) 57 | 58 | return result 59 | 60 | 61 | _packet_get_nb_channels = libopus.opus_packet_get_nb_channels 62 | _packet_get_nb_channels.argtypes = (ctypes.c_char_p,) 63 | _packet_get_nb_channels.restype = ctypes.c_int 64 | 65 | 66 | def packet_get_nb_channels(data): 67 | """Gets the number of channels from an Opus packet""" 68 | 69 | data_pointer = ctypes.c_char_p(data) 70 | 71 | result = _packet_get_nb_channels(data_pointer) 72 | if result < 0: 73 | raise OpusError(result) 74 | 75 | return result 76 | 77 | 78 | _packet_get_nb_frames = libopus.opus_packet_get_nb_frames 79 | _packet_get_nb_frames.argtypes = (ctypes.c_char_p, ctypes.c_int) 80 | _packet_get_nb_frames.restype = ctypes.c_int 81 | 82 | 83 | def packet_get_nb_frames(data, length=None): 84 | """Gets the number of frames in an Opus packet""" 85 | 86 | data_pointer = ctypes.c_char_p(data) 87 | if length is None: 88 | length = len(data) 89 | 90 | result = _packet_get_nb_frames(data_pointer, ctypes.c_int(length)) 91 | if result < 0: 92 | raise OpusError(result) 93 | 94 | return result 95 | 96 | 97 | _packet_get_samples_per_frame = libopus.opus_packet_get_samples_per_frame 98 | _packet_get_samples_per_frame.argtypes = (ctypes.c_char_p, ctypes.c_int) 99 | _packet_get_samples_per_frame.restype = ctypes.c_int 100 | 101 | 102 | def packet_get_samples_per_frame(data, fs): 103 | """Gets the number of samples per frame from an Opus packet""" 104 | 105 | data_pointer = ctypes.c_char_p(data) 106 | 107 | result = _packet_get_nb_frames(data_pointer, ctypes.c_int(fs)) 108 | if result < 0: 109 | raise OpusError(result) 110 | 111 | return result 112 | 113 | 114 | _get_nb_samples = libopus.opus_decoder_get_nb_samples 115 | _get_nb_samples.argtypes = (DecoderPointer, ctypes.c_char_p, ctypes.c_int32) 116 | _get_nb_samples.restype = ctypes.c_int 117 | 118 | 119 | def get_nb_samples(decoder, packet, length): 120 | result = _get_nb_samples(decoder, packet, length) 121 | if result < 0: 122 | raise OpusError(result) 123 | 124 | return result 125 | 126 | 127 | _decode = libopus.opus_decode 128 | _decode.argtypes = (DecoderPointer, ctypes.c_char_p, ctypes.c_int32, c_int16_pointer, ctypes.c_int, ctypes.c_int) 129 | _decode.restype = ctypes.c_int 130 | 131 | 132 | def decode(decoder, data, length, frame_size, decode_fec, channels=2): 133 | """Decode an Opus frame 134 | 135 | Unlike the `opus_decode` function , this function takes an additional parameter `channels`, 136 | which indicates the number of channels in the frame 137 | """ 138 | 139 | pcm_size = frame_size * channels * ctypes.sizeof(ctypes.c_int16) 140 | pcm = (ctypes.c_int16 * pcm_size)() 141 | pcm_pointer = ctypes.cast(pcm, c_int16_pointer) 142 | 143 | # Converting from a boolean to int 144 | decode_fec = int(bool(decode_fec)) 145 | 146 | result = _decode(decoder, data, length, pcm_pointer, frame_size, decode_fec) 147 | if result < 0: 148 | raise OpusError(result) 149 | 150 | return array.array('h', pcm[ :result * channels ]).tostring() 151 | 152 | 153 | _decode_float = libopus.opus_decode_float 154 | _decode_float.argtypes = (DecoderPointer, ctypes.c_char_p, ctypes.c_int32, c_float_pointer, ctypes.c_int, ctypes.c_int) 155 | _decode_float.restype = ctypes.c_int 156 | 157 | 158 | def decode_float(decoder, data, length, frame_size, decode_fec, channels=2): 159 | pcm_size = frame_size * channels * ctypes.sizeof(ctypes.c_float) 160 | pcm = (ctypes.c_float * pcm_size)() 161 | pcm_pointer = ctypes.cast(pcm, c_float_pointer) 162 | 163 | # Converting from a boolean to int 164 | decode_fec = int(bool(decode_fec)) 165 | 166 | result = _decode_float(decoder, data, length, pcm_pointer, frame_size, decode_fec) 167 | if result < 0: 168 | raise OpusError(result) 169 | 170 | return array.array('f', pcm[ : result * channels ]).tostring() 171 | 172 | 173 | _ctl = libopus.opus_decoder_ctl 174 | _ctl.restype = ctypes.c_int 175 | 176 | 177 | def ctl(decoder, request, value=None): 178 | if value is not None: 179 | return request(_ctl, decoder, value) 180 | 181 | return request(_ctl, decoder) 182 | 183 | 184 | destroy = libopus.opus_decoder_destroy 185 | destroy.argtypes = (DecoderPointer,) 186 | destroy.restype = None 187 | destroy.__doc__ = 'Frees an OpusDecoder allocated by opus_decoder_create()' 188 | -------------------------------------------------------------------------------- /opus/api/encoder.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | import ctypes 4 | import array 5 | 6 | from opus.api import constants, libopus, c_int_pointer, c_int16_pointer, c_float_pointer 7 | from opus.exceptions import OpusError 8 | 9 | 10 | class Encoder(ctypes.Structure): 11 | """Opus encoder state. 12 | 13 | This contains the complete state of an Opus encoder. 14 | """ 15 | 16 | pass 17 | 18 | EncoderPointer = ctypes.POINTER(Encoder) 19 | 20 | 21 | _get_size = libopus.opus_encoder_get_size 22 | _get_size.argtypes = (ctypes.c_int,) 23 | _get_size.restype = ctypes.c_int 24 | 25 | 26 | def get_size(channels): 27 | """Gets the size of an OpusEncoder structure.""" 28 | 29 | if not channels in (1, 2): 30 | raise ValueError('Wrong channels value. Must be equal to 1 or 2') 31 | 32 | return _get_size(channels) 33 | 34 | 35 | _create = libopus.opus_encoder_create 36 | _create.argtypes = (ctypes.c_int, ctypes.c_int, ctypes.c_int, c_int_pointer) 37 | _create.restype = EncoderPointer 38 | 39 | 40 | def create(fs, channels, application): 41 | """Allocates and initializes an encoder state.""" 42 | 43 | result_code = ctypes.c_int() 44 | 45 | result = _create(fs, channels, application, ctypes.byref(result_code)) 46 | if result_code.value is not constants.OK: 47 | raise OpusError(result_code.value) 48 | 49 | return result 50 | 51 | 52 | _ctl = libopus.opus_encoder_ctl 53 | _ctl.restype = ctypes.c_int 54 | 55 | 56 | def ctl(encoder, request, value=None): 57 | if value is not None: 58 | return request(_ctl, encoder, value) 59 | 60 | return request(_ctl, encoder) 61 | 62 | 63 | _encode = libopus.opus_encode 64 | _encode.argtypes = (EncoderPointer, c_int16_pointer, ctypes.c_int, ctypes.c_char_p, ctypes.c_int32) 65 | _encode.restype = ctypes.c_int32 66 | 67 | 68 | def encode(encoder, pcm, frame_size, max_data_bytes): 69 | """Encodes an Opus frame 70 | 71 | Returns string output payload 72 | """ 73 | 74 | pcm = ctypes.cast(pcm, c_int16_pointer) 75 | data = (ctypes.c_char * max_data_bytes)() 76 | 77 | result = _encode(encoder, pcm, frame_size, data, max_data_bytes) 78 | if result < 0: 79 | raise OpusError(result) 80 | 81 | return array.array('c', data[:result]).tostring() 82 | 83 | 84 | _encode_float = libopus.opus_encode_float 85 | _encode_float.argtypes = (EncoderPointer, c_float_pointer, ctypes.c_int, ctypes.c_char_p, ctypes.c_int32) 86 | _encode_float.restype = ctypes.c_int32 87 | 88 | 89 | def encode_float(encoder, pcm, frame_size, max_data_bytes): 90 | """Encodes an Opus frame from floating point input""" 91 | 92 | pcm = ctypes.cast(pcm, c_float_pointer) 93 | data = (ctypes.c_char * max_data_bytes)() 94 | 95 | result = _encode_float(encoder, pcm, frame_size, data, max_data_bytes) 96 | if result < 0: 97 | raise OpusError(result) 98 | 99 | return array.array('c', data[:result]).tostring() 100 | 101 | 102 | destroy = libopus.opus_encoder_destroy 103 | destroy.argtypes = (EncoderPointer,) 104 | destroy.restype = None 105 | destroy.__doc__ = "Frees an OpusEncoder allocated by opus_encoder_create()" 106 | -------------------------------------------------------------------------------- /opus/api/info.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | import ctypes 4 | 5 | from opus.api import libopus 6 | 7 | 8 | strerror = libopus.opus_strerror 9 | strerror.argtypes = (ctypes.c_int,) 10 | strerror.restype = ctypes.c_char_p 11 | strerror.__doc__ = '''Converts an opus error code into a human readable string''' 12 | 13 | 14 | get_version_string = libopus.opus_get_version_string 15 | get_version_string.argtypes = None 16 | get_version_string.restype = ctypes.c_char_p 17 | get_version_string.__doc__ = 'Gets the libopus version string' 18 | -------------------------------------------------------------------------------- /opus/decoder.py: -------------------------------------------------------------------------------- 1 | """High-level interface to a opus.api.decoder functions""" 2 | 3 | from opus.api import decoder, ctl 4 | 5 | 6 | class Decoder(object): 7 | 8 | def __init__(self, fs, channels): 9 | """ 10 | Parameters: 11 | fs : sampling rate 12 | channels : number of channels 13 | """ 14 | 15 | self._fs = fs 16 | self._channels = channels 17 | self._state = decoder.create(fs, channels) 18 | 19 | def __del__(self): 20 | if hasattr(self, '_state'): 21 | # Destroying state only if __init__ completed successfully 22 | decoder.destroy(self._state) 23 | 24 | def reset_state(self): 25 | """Resets the codec state to be equivalent to a freshly initialized state""" 26 | 27 | decoder.ctl(self._state, ctl.reset_state) 28 | 29 | def decode(self, data, frame_size, decode_fec=False): 30 | return decoder.decode(self._state, data, len(data), frame_size, decode_fec, channels=self._channels) 31 | 32 | def decode_float(self, data, frame_size, decode_fec=False): 33 | return decoder.decode_float(self._state, data, len(data), frame_size, decode_fec, channels=self._channels) 34 | 35 | # CTL interfaces 36 | 37 | _get_final_range = lambda self: decoder.ctl(self._state, ctl.get_final_range) 38 | 39 | final_range = property(_get_final_range) 40 | 41 | _get_bandwidth = lambda self: decoder.ctl(self._state, ctl.get_bandwidth) 42 | 43 | bandwidth = property(_get_bandwidth) 44 | 45 | _get_pitch = lambda self: decoder.ctl(self._state, ctl.get_pitch) 46 | 47 | pitch = property(_get_pitch) 48 | 49 | _get_lsb_depth = lambda self: decoder.ctl(self._state, ctl.get_lsb_depth) 50 | 51 | _set_lsb_depth = lambda self, x: decoder.ctl(self._state, ctl.set_lsb_depth, x) 52 | 53 | lsb_depth = property(_get_lsb_depth, _set_lsb_depth) 54 | 55 | _get_gain = lambda self: decoder.ctl(self._state, ctl.get_gain) 56 | 57 | _set_gain = lambda self, x: decoder.ctl(self._state, ctl.set_gain, x) 58 | 59 | gain = property(_get_gain, _set_gain) 60 | -------------------------------------------------------------------------------- /opus/encoder.py: -------------------------------------------------------------------------------- 1 | """High-level interface to a opus.api.encoder functions""" 2 | 3 | from opus.api import encoder, ctl, constants 4 | 5 | APPLICATION_TYPES_MAP = { 6 | 'voip': constants.APPLICATION_VOIP, 7 | 'audio': constants.APPLICATION_AUDIO, 8 | 'restricted_lowdelay': constants.APPLICATION_RESTRICTED_LOWDELAY, 9 | } 10 | 11 | 12 | class Encoder(object): 13 | 14 | def __init__(self, fs, channels, application): 15 | """ 16 | Parameters: 17 | fs : sampling rate 18 | channels : number of channels 19 | """ 20 | 21 | if application in APPLICATION_TYPES_MAP.keys(): 22 | application = APPLICATION_TYPES_MAP[application] 23 | elif application in APPLICATION_TYPES_MAP.values(): 24 | pass # Nothing to do here 25 | else: 26 | raise ValueError("`application` value must be in 'voip', 'audio' or 'restricted_lowdelay'") 27 | 28 | self._fs = fs 29 | self._channels = channels 30 | self._application = application 31 | self._state = encoder.create(fs, channels, application) 32 | 33 | def __del__(self): 34 | if hasattr(self, '_state'): 35 | # Destroying state only if __init__ completed successfully 36 | encoder.destroy(self._state) 37 | 38 | def reset_state(self): 39 | """Resets the codec state to be equivalent to a freshly initialized state""" 40 | 41 | encoder.ctl(self._state, ctl.reset_state) 42 | 43 | def encode(self, data, frame_size): 44 | return encoder.encode(self._state, data, frame_size, len(data)) 45 | 46 | def encode_float(self, data, frame_size, decode_fec=False): 47 | return encoder.encode_float(self._state, data, frame_size, len(data)) 48 | 49 | # CTL interfaces 50 | 51 | _get_final_range = lambda self: encoder.ctl(self._state, ctl.get_final_range) 52 | 53 | final_range = property(_get_final_range) 54 | 55 | _get_bandwidth = lambda self: encoder.ctl(self._state, ctl.get_bandwidth) 56 | 57 | bandwidth = property(_get_bandwidth) 58 | 59 | _get_pitch = lambda self: encoder.ctl(self._state, ctl.get_pitch) 60 | 61 | pitch = property(_get_pitch) 62 | 63 | _get_lsb_depth = lambda self: encoder.ctl(self._state, ctl.get_lsb_depth) 64 | 65 | _set_lsb_depth = lambda self, x: encoder.ctl(self._state, ctl.set_lsb_depth, x) 66 | 67 | lsb_depth = property(_get_lsb_depth, _set_lsb_depth) 68 | 69 | _get_complexity = lambda self: encoder.ctl(self._state, ctl.get_complexity) 70 | 71 | _set_complexity = lambda self, x: encoder.ctl(self._state, ctl.set_complexity, x) 72 | 73 | complexity = property(_get_complexity, _set_complexity) 74 | 75 | _get_bitrate = lambda self: encoder.ctl(self._state, ctl.get_bitrate) 76 | 77 | _set_bitrate = lambda self, x: encoder.ctl(self._state, ctl.set_bitrate, x) 78 | 79 | bitrate = property(_get_bitrate, _set_bitrate) 80 | 81 | _get_vbr = lambda self: encoder.ctl(self._state, ctl.get_vbr) 82 | 83 | _set_vbr = lambda self, x: encoder.ctl(self._state, ctl.set_vbr, x) 84 | 85 | vbr = property(_get_vbr, _set_vbr) 86 | 87 | _get_vbr_constraint = lambda self: encoder.ctl(self._state, ctl.get_vbr_constraint) 88 | 89 | _set_vbr_constraint = lambda self, x: encoder.ctl(self._state, ctl.set_vbr_constraint, x) 90 | 91 | vbr_constraint = property(_get_vbr_constraint, _set_vbr_constraint) 92 | 93 | _get_force_channels = lambda self: encoder.ctl(self._state, ctl.get_force_channels) 94 | 95 | _set_force_channels = lambda self, x: encoder.ctl(self._state, ctl.set_force_channels, x) 96 | 97 | force_channels = property(_get_force_channels, _set_force_channels) 98 | 99 | _get_max_bandwidth = lambda self: encoder.ctl(self._state, ctl.get_max_bandwidth) 100 | 101 | _set_max_bandwidth = lambda self, x: encoder.ctl(self._state, ctl.set_max_bandwidth, x) 102 | 103 | max_bandwidth = property(_get_max_bandwidth, _set_max_bandwidth) 104 | 105 | _set_bandwidth = lambda self, x: encoder.ctl(self._state, ctl.set_bandwidth, x) 106 | 107 | bandwidth = property(None, _set_bandwidth) 108 | 109 | _get_signal = lambda self: encoder.ctl(self._state, ctl.get_signal) 110 | 111 | _set_signal = lambda self, x: encoder.ctl(self._state, ctl.set_signal, x) 112 | 113 | signal = property(_get_signal, _set_signal) 114 | 115 | _get_application = lambda self: encoder.ctl(self._state, ctl.get_application) 116 | 117 | _set_application = lambda self, x: encoder.ctl(self._state, ctl.set_application, x) 118 | 119 | application = property(_get_application, _set_application) 120 | 121 | _get_sample_rate = lambda self: encoder.ctl(self._state, ctl.get_sample_rate) 122 | 123 | sample_rate = property(_get_sample_rate) 124 | 125 | _get_lookahead = lambda self: encoder.ctl(self._state, ctl.get_lookahead) 126 | 127 | lookahead = property(_get_lookahead) 128 | 129 | _get_inband_fec = lambda self: encoder.ctl(self._state, ctl.get_inband_fec) 130 | 131 | _set_inband_fec = lambda self, x: encoder.ctl(self._state, ctl.set_inband_fec) 132 | 133 | inband_fec = property(_get_inband_fec, _set_inband_fec) 134 | 135 | _get_packet_loss_perc = lambda self: encoder.ctl(self._state, ctl.get_packet_loss_perc) 136 | 137 | _set_packet_loss_perc = lambda self, x: encoder.ctl(self._state, ctl.set_packet_loss_perc, x) 138 | 139 | packet_loss_perc = property(_get_packet_loss_perc, _set_packet_loss_perc) 140 | 141 | _get_dtx = lambda self: encoder.ctl(self._state, ctl.get_dtx) 142 | 143 | _set_dtx = lambda self, x: encoder.ctl(self._state, ctl.get_dtx, x) 144 | -------------------------------------------------------------------------------- /opus/exceptions.py: -------------------------------------------------------------------------------- 1 | from opus.api.info import strerror 2 | 3 | 4 | class OpusError(Exception): 5 | 6 | def __init__(self, code): 7 | self.code = code 8 | 9 | def __str__(self): 10 | return strerror(self.code) 11 | -------------------------------------------------------------------------------- /www/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/F4HTB/Universal_HamRadio_Remote_HTML5/55ea7dc19326917bcadf0c8e0054f4b3a9a12057/www/favicon.ico -------------------------------------------------------------------------------- /www/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/F4HTB/Universal_HamRadio_Remote_HTML5/55ea7dc19326917bcadf0c8e0054f4b3a9a12057/www/favicon.png -------------------------------------------------------------------------------- /www/img/config.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/F4HTB/Universal_HamRadio_Remote_HTML5/55ea7dc19326917bcadf0c8e0054f4b3a9a12057/www/img/config.png -------------------------------------------------------------------------------- /www/img/critsgreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/F4HTB/Universal_HamRadio_Remote_HTML5/55ea7dc19326917bcadf0c8e0054f4b3a9a12057/www/img/critsgreen.png -------------------------------------------------------------------------------- /www/img/critsgrey.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/F4HTB/Universal_HamRadio_Remote_HTML5/55ea7dc19326917bcadf0c8e0054f4b3a9a12057/www/img/critsgrey.png -------------------------------------------------------------------------------- /www/img/critsred.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/F4HTB/Universal_HamRadio_Remote_HTML5/55ea7dc19326917bcadf0c8e0054f4b3a9a12057/www/img/critsred.png -------------------------------------------------------------------------------- /www/img/critsyellow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/F4HTB/Universal_HamRadio_Remote_HTML5/55ea7dc19326917bcadf0c8e0054f4b3a9a12057/www/img/critsyellow.png -------------------------------------------------------------------------------- /www/img/logout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/F4HTB/Universal_HamRadio_Remote_HTML5/55ea7dc19326917bcadf0c8e0054f4b3a9a12057/www/img/logout.png -------------------------------------------------------------------------------- /www/img/panfft.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/F4HTB/Universal_HamRadio_Remote_HTML5/55ea7dc19326917bcadf0c8e0054f4b3a9a12057/www/img/panfft.png -------------------------------------------------------------------------------- /www/img/poweroff.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/F4HTB/Universal_HamRadio_Remote_HTML5/55ea7dc19326917bcadf0c8e0054f4b3a9a12057/www/img/poweroff.png -------------------------------------------------------------------------------- /www/img/poweron.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/F4HTB/Universal_HamRadio_Remote_HTML5/55ea7dc19326917bcadf0c8e0054f4b3a9a12057/www/img/poweron.png -------------------------------------------------------------------------------- /www/img/smeter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/F4HTB/Universal_HamRadio_Remote_HTML5/55ea7dc19326917bcadf0c8e0054f4b3a9a12057/www/img/smeter.png -------------------------------------------------------------------------------- /www/img/spinner.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/F4HTB/Universal_HamRadio_Remote_HTML5/55ea7dc19326917bcadf0c8e0054f4b3a9a12057/www/img/spinner.gif -------------------------------------------------------------------------------- /www/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Universal Hamradio Remote by F4HTB 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 |

Wait For connection....

14 |
15 | 16 |
17 | Click to connect or disconnect interface 18 | 19 |
20 | AF GAIN: 21 |
22 | 23 |
24 |
25 |
RX volume:
26 | 27 |
28 |
29 |
30 | 31 |
32 | MIC GAIN: 33 |
34 | 35 |
36 |
37 |
TX volume:
38 | 39 |
40 |
41 |
42 | 43 |
44 |
    45 |
  • 46 |
  • 47 |
  • 48 |
  • 49 |
  • 50 |
  • 51 |
  • 52 |
  • 53 |
  • 54 |
  • 55 |
  • 56 |
57 |
    58 | 59 |
  • 0
  • 60 |
  • 0
  • 61 |
  • 0
  • 62 |
  • .
  • 63 |
  • 0
  • 64 |
  • 0
  • 65 |
  • 0
  • 66 |
  • .
  • 67 |
  • 0
  • 68 |
  • 0
  • 69 |
  • 0
  • 70 |
71 |
    72 |
  • 73 |
  • 74 |
  • 75 |
  • 76 |
  • 77 |
  • 78 |
  • 79 |
  • 80 |
  • 81 |
  • 82 |
  • 83 |
84 |
85 | 86 |
87 |
    88 |
  • 160m
  • 89 |
  • 80m
  • 90 |
  • 40m
  • 91 |
  • 30m
  • 92 |
  • 20m
  • 93 |
  • 17m
  • 94 |
  • 15m
  • 95 |
  • 11m
  • 96 |
  • 12m
  • 97 |
  • 10m
  • 98 |
  • 6m
  • 99 |
  • 4m
  • 100 |
  • 2m
  • 101 |
  • 70cm
  • 102 |
  • WWW
  • 103 |
104 |
105 | 106 |
107 |
    108 |
  • None
  • 109 |
  • LP 4.4k
  • 110 |
  • LP 3.3k
  • 111 |
  • LP 2.7k
  • 112 |
  • LP 2.1k
  • 113 |
  • LP 1.0k
  • 114 |
  • BP 300Hz
  • 115 |
  • BP 500Hz
  • 116 |
  • BP 800Hz
  • 117 |
  • BP 1kHz
  • 118 |
  • BP click
  • 119 |
  • Custom
  • 120 |
121 |
122 | 123 |
124 | filter_type:
135 | Freq:hz
136 | Q Factor:
137 | Gain:
138 | 139 |
140 | 141 | 142 |
143 | SQL: 144 |
145 | 146 |
147 | 148 | 150 | 151 | 152 | 153 |
154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 |
166 |
167 | 168 | 169 | 170 |
S9+40dB
171 |
172 |
    173 |
  • USB
  • 174 |
  • LSB
  • 175 |
  • CW
  • 176 |
  • AM
  • 177 |
  • FM
  • 178 |
179 |
180 | 181 |
182 | TX 183 | TX Lock 184 |
185 | Encode TX
186 |
187 |
188 | 189 |
190 |

wsTX

191 |

wsRX

192 |

wsCtrl

193 |
194 | 195 |
latency:∞
196 | 197 |
198 | 199 | 200 | 201 | -------------------------------------------------------------------------------- /www/panadapter/panfft.css: -------------------------------------------------------------------------------- 1 | body { 2 | color: white; 3 | font:normal bold 14px tahoma; 4 | -webkit-touch-callout: none; 5 | -webkit-user-select: none; 6 | -khtml-user-select: none; 7 | -moz-user-select: none; 8 | -ms-user-select: none; 9 | user-select: none; 10 | padding:0px; 11 | margin:0px; 12 | } 13 | 14 | #div-sp 15 | { 16 | position:relative; 17 | width:100%; 18 | height:45%; 19 | padding:0px; 20 | margin:0px; 21 | } 22 | 23 | .cansp{ 24 | width:100%; 25 | height:100%; 26 | float:center; 27 | background-color:black; 28 | } 29 | 30 | #div-wf 31 | { 32 | position:relative; 33 | width:100%; 34 | height:45%; 35 | padding:0px; 36 | margin:0px; 37 | } 38 | 39 | .canwf{ 40 | width:100%; 41 | height:100%; 42 | background:#00007f; 43 | background-color:bleu; 44 | } 45 | 46 | #div-ctrl 47 | { 48 | display: inline-flex; 49 | background-color:#171717; 50 | position:fixed; 51 | width:100%; 52 | height:10%; 53 | padding:0px; 54 | margin:0px; 55 | left: 0%; 56 | align-items: center; /* Vertical */ 57 | } 58 | 59 | .ctrl_visual{ 60 | margin: 0px 10px 0px 10px; 61 | } 62 | 63 | #div-scoketscontrols 64 | { 65 | position: fixed; 66 | bottom: 0; 67 | right: 0; 68 | } 69 | 70 | #div-scoketscontrols > img 71 | { 72 | margin-right:5px; 73 | width:25px; 74 | height:25px; 75 | } 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /www/panadapter/panfft.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | FFT Universal Hamradio Remote by F4HTB 5 | 6 | 7 | 8 |
9 | 10 |
11 | 12 |
13 | 14 |
15 | 16 |
17 | 18 |
19 | Center Frequency:
| 20 | SampleRate:
| 21 | FFT resolution:
| 22 | Mouse Frequency:
| 23 | Windows Zoom:
100%
| 24 | Spectrogram dynamic: 25 | Spectrogram min: 26 |
27 | 28 |
wsFFT
29 |
30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /www/panadapter/panfft.js: -------------------------------------------------------------------------------- 1 | var canvas_width_SP=document.getElementById("cansp").width; 2 | var canvas_height_SP=document.getElementById("cansp").height; 3 | var canvas_width_WF=document.getElementById("canwf").width; 4 | var canvas_height_WF=document.getElementById("canwf").height; 5 | var wshFFT = ""; 6 | var zoom_FFT=100; 7 | var samplerate = "960000"; 8 | var FFTSIZE = 4096; 9 | var localcenterfrequency=0; 10 | var freqmouse=0; 11 | 12 | var FFT_Viso_Dynamic=50 13 | var FFT_Viso_min=-180 14 | 15 | 16 | const visual_CenterFrequency = document.getElementById("div-CenterFrequency"); 17 | const visual_SampleRate = document.getElementById("div-SampleRate"); 18 | const visual_FFtResolution = document.getElementById("div-FFtResolution"); 19 | const visual_freq = document.getElementById("div-mouseFrequency"); 20 | const visual_WindowsZoom = document.getElementById("div-WindowsZoom"); 21 | 22 | const canvasSP = document.getElementById("cansp"); 23 | const canvasWF = document.getElementById("canwf") 24 | 25 | function bodyload(){ 26 | initFFT(); 27 | startFFT(); 28 | } 29 | 30 | function set_FFT_Viso_Dynamic(v){FFT_Viso_Dynamic=v;} 31 | function set_FFT_Viso_min(v){FFT_Viso_min=v;} 32 | 33 | 34 | 35 | 36 | function startFFT(){ 37 | document.getElementById("div-scoketscontrols").innerHTML='wsFFT'; 38 | wshFFT = new WebSocket( 'wss://' + window.location.href.split( '/' )[2] + '/WSpanFFT' ); 39 | wshFFT.onopen = appendwshFFTOpen; 40 | wshFFT.onmessage = init_showFFT; 41 | wshFFT.onerror = appendwshFFTError; 42 | wshFFT.onclose = appendwshFFTclose; 43 | } 44 | 45 | function appendwshFFTclose(){ 46 | document.getElementById("div-scoketscontrols").innerHTML='wsFFT'; 47 | } 48 | 49 | function appendwshFFTOpen(){ 50 | document.getElementById("div-scoketscontrols").innerHTML='wsFFT'; 51 | wshFFT.send("init"); 52 | } 53 | 54 | function appendwshFFTError(err){ 55 | document.getElementById("div-scoketscontrols").innerHTML='wsFFT'; 56 | wshFFT.close(); 57 | startFFT(); 58 | } 59 | 60 | function stopFFT(){ 61 | wshFFT.close(); 62 | initFFT(); 63 | } 64 | 65 | function initFFT(){ 66 | initCanvas("cansp"); 67 | initCanvas("canwf"); 68 | } 69 | 70 | var globmsg = ""; 71 | 72 | 73 | 74 | function init_showFFT( msg ){ 75 | datas = msg.data.split(':'); 76 | if(datas[0] == "fftsr"){ 77 | samplerate=datas[1]; 78 | } 79 | else if(datas[0] == "fftsz"){ 80 | FFTSIZE=parseInt(datas[1]); 81 | canvasSP.width=parseInt(FFTSIZE); 82 | canvasWF.width=parseInt(FFTSIZE); 83 | var canvas_width_SP=document.getElementById("cansp").width; 84 | var canvas_height_SP=document.getElementById("cansp").height; 85 | var canvas_width_WF=document.getElementById("canwf").width; 86 | var canvas_height_WF=document.getElementById("canwf").height; 87 | } 88 | else if(datas[0] == "fftst"){ 89 | visual_SampleRate.innerHTML = samplerate+"sps"; 90 | visual_FFtResolution.innerHTML=samplerate/FFTSIZE+"hz/px"; 91 | wshFFT.send("ready"); 92 | window.opener.ControlTRX_getFreq(); 93 | wshFFT.binaryType = 'arraybuffer'; 94 | wshFFT.onmessage = showFFT; 95 | } 96 | } 97 | 98 | function showFFT( msg ){ 99 | var buffer = new Uint8Array(msg.data); 100 | let FFTdata = buffer.subarray(0, FFTSIZE); 101 | FFTdata_scale_min = ((buffer[FFTSIZE] << 8) + (buffer[FFTSIZE+1]))-65280; 102 | FFTdata_scale_max= ((buffer[FFTSIZE+2] << 8) + (buffer[FFTSIZE+3]))-65280; 103 | 104 | min_Factor=FFTdata_scale_min-FFT_Viso_min; 105 | max_Factor=(FFTdata_scale_max-FFTdata_scale_min)/FFT_Viso_Dynamic; 106 | 107 | SetImageDataWF(FFTdata,min_Factor,max_Factor); 108 | SetImageDataSP(FFTdata,min_Factor,max_Factor); 109 | } 110 | 111 | 112 | const ctxSP = canvasSP.getContext("2d");// imgObjSP = ctxSP.createImageData(canvasSP.width, canvas_height); 113 | const midle_SP = canvas_width_SP*2; 114 | 115 | function SetImageDataSP(datas,scale_min,scale_max) { 116 | imgObjSP = new ImageData(canvasSP.width, canvas_height_SP); 117 | let i = 0; 118 | for(let Line = 0; Line < canvas_height_SP; Line++){ 119 | i = 4*(Line * canvas_width_SP); 120 | y = canvas_height_SP - Line; 121 | for (let px = 0; px < canvas_width_SP; px++) { 122 | let dat = (datas[px]*scale_max + scale_min); 123 | if(y <= dat){ 124 | //imgObjSP.data[i] = 0; // red 125 | imgObjSP.data[++i] = 215; // green 126 | imgObjSP.data[++i] = 233; // blue 127 | imgObjSP.data[++i] = 255; // alpha 128 | ++i; 129 | } 130 | else{i += 4 ;} 131 | } 132 | i -= midle_SP ; 133 | //imgObjSP.data[i] = 0; // red 134 | imgObjSP.data[++i] = 255; // green 135 | imgObjSP.data[++i] = 0; // blue 136 | imgObjSP.data[++i] = 255; // alpha 137 | } 138 | ctxSP.putImageData(imgObjSP, 0, 0); 139 | } 140 | 141 | const ctxWF = canvasWF.getContext("2d"),imgObjWF = ctxWF.createImageData(canvasWF.width, 1); 142 | //const colMap = [[0,0,0,255],[40,0,0,255],[56,0,4,255],[61,0,9,255],[64,0,12,255],[66,0,14,255],[69,0,17,255],[73,0,20,255],[74,0,22,255],[78,0,25,255],[79,0,27,255],[83,0,30,255],[85,0,31,255],[86,0,33,255],[90,0,36,255],[91,0,38,255],[93,0,39,255],[95,0,41,255],[96,0,43,255],[100,0,46,255],[102,0,47,255],[103,0,49,255],[105,0,51,255],[107,0,52,255],[108,0,54,255],[110,0,55,255],[112,0,57,255],[112,0,57,255],[113,0,58,255],[115,0,60,255],[117,0,62,255],[119,0,63,255],[120,0,65,255],[122,0,66,255],[124,0,68,255],[125,0,70,255],[127,0,71,255],[129,0,73,255],[129,0,73,255],[130,0,74,255],[132,0,76,255],[134,0,78,255],[136,0,79,255],[137,0,81,255],[139,0,82,255],[141,0,84,255],[142,0,86,255],[144,0,87,255],[146,0,89,255],[147,0,90,255],[149,0,92,255],[151,0,94,255],[151,0,94,255],[153,0,95,255],[154,0,97,255],[156,0,98,255],[158,0,100,255],[159,0,102,255],[161,0,103,255],[163,0,105,255],[164,0,106,255],[166,0,108,255],[168,0,109,255],[170,0,111,255],[171,0,113,255],[173,0,114,255],[175,0,116,255],[176,0,117,255],[178,0,119,255],[180,0,121,255],[180,0,121,255],[181,0,122,255],[183,0,124,255],[185,0,125,255],[187,0,127,255],[188,0,129,255],[190,0,130,255],[192,0,132,255],[193,0,133,255],[195,0,135,255],[197,0,137,255],[198,0,138,255],[200,0,140,255],[202,0,141,255],[204,0,143,255],[204,0,143,255],[205,0,145,255],[207,0,146,255],[209,0,148,255],[210,0,149,255],[212,0,151,255],[214,0,153,255],[215,0,154,255],[217,0,156,255],[219,0,157,255],[221,0,159,255],[222,0,160,255],[222,0,160,255],[224,0,162,255],[226,0,164,255],[227,0,165,255],[229,0,167,255],[231,0,168,255],[232,0,170,255],[234,0,172,255],[236,0,173,255],[238,0,175,255],[238,0,175,255],[239,0,176,255],[241,0,178,255],[243,0,180,255],[244,0,181,255],[246,0,183,255],[248,2,184,255],[249,4,186,255],[249,4,186,255],[249,4,186,255],[251,6,188,255],[251,6,188,255],[253,9,189,255],[253,9,189,255],[255,11,191,255],[255,11,191,255],[255,13,192,255],[255,13,192,255],[255,13,192,255],[255,16,194,255],[255,18,196,255],[255,20,197,255],[255,20,197,255],[255,23,199,255],[255,25,200,255],[255,27,202,255],[255,30,204,255],[255,32,205,255],[255,34,207,255],[255,37,208,255],[255,37,208,255],[255,39,210,255],[255,41,211,255],[255,44,213,255],[255,46,215,255],[255,48,216,255],[255,51,218,255],[255,53,219,255],[255,53,219,255],[255,55,221,255],[255,57,223,255],[255,60,224,255],[255,62,226,255],[255,64,227,255],[255,67,229,255],[255,67,229,255],[255,69,231,255],[255,71,232,255],[255,74,234,255],[255,76,235,255],[255,78,237,255],[255,81,239,255],[255,81,239,255],[255,83,240,255],[255,85,242,255],[255,88,243,255],[255,90,245,255],[255,92,247,255],[255,95,248,255],[255,95,248,255],[255,97,250,255],[255,99,251,255],[255,102,253,255],[255,104,255,255],[255,106,255,255],[255,106,255,255],[255,108,255,255],[255,111,255,255],[255,113,255,255],[255,115,255,255],[255,115,255,255],[255,118,255,255],[255,120,255,255],[255,122,255,255],[255,122,255,255],[255,125,255,255],[255,127,255,255],[255,129,255,255],[255,129,255,255],[255,132,255,255],[255,134,255,255],[255,136,255,255],[255,136,255,255],[255,139,255,255],[255,141,255,255],[255,143,255,255],[255,143,255,255],[255,146,255,255],[255,148,255,255],[255,150,255,255],[255,150,255,255],[255,153,255,255],[255,155,255,255],[255,155,255,255],[255,157,255,255],[255,159,255,255],[255,159,255,255],[255,162,255,255],[255,164,255,255],[255,164,255,255],[255,166,255,255],[255,169,255,255],[255,171,255,255],[255,171,255,255],[255,173,255,255],[255,176,255,255],[255,176,255,255],[255,178,255,255],[255,180,255,255],[255,180,255,255],[255,183,255,255],[255,185,255,255],[255,185,255,255],[255,187,255,255],[255,190,255,255],[255,190,255,255],[255,192,255,255],[255,194,255,255],[255,197,255,255],[255,197,255,255],[255,199,255,255],[255,201,255,255],[255,204,255,255],[255,204,255,255],[255,206,255,255],[255,208,255,255],[255,210,255,255],[255,210,255,255],[255,213,255,255],[255,215,255,255],[255,217,255,255],[255,217,255,255],[255,220,255,255],[255,222,255,255],[255,224,255,255],[255,227,255,255],[255,229,255,255],[255,229,255,255],[255,231,255,255],[255,234,255,255],[255,236,255,255],[255,238,255,255],[255,241,255,255],[255,243,255,255],[255,243,255,255],[255,245,255,255],[255,248,255,255],[255,250,255,255],[255,255,255,255]]; 143 | const colMap = [[0,0,127,255],[0,0,131,255],[0,0,135,255],[0,0,139,255],[0,0,143,255],[0,0,147,255],[0,0,151,255],[0,0,155,255],[0,0,159,255],[0,0,163,255],[0,0,167,255],[0,0,171,255],[0,0,175,255],[0,0,179,255],[0,0,183,255],[0,0,187,255],[0,0,191,255],[0,0,195,255],[0,0,199,255],[0,0,203,255],[0,0,207,255],[0,0,211,255],[0,0,215,255],[0,0,219,255],[0,0,223,255],[0,0,227,255],[0,0,231,255],[0,0,235,255],[0,0,239,255],[0,0,243,255],[0,0,247,255],[0,0,251,255],[0,0,255,255],[0,4,255,255],[0,8,255,255],[0,12,255,255],[0,16,255,255],[0,20,255,255],[0,24,255,255],[0,28,255,255],[0,32,255,255],[0,36,255,255],[0,40,255,255],[0,44,255,255],[0,48,255,255],[0,52,255,255],[0,56,255,255],[0,60,255,255],[0,64,255,255],[0,68,255,255],[0,72,255,255],[0,76,255,255],[0,80,255,255],[0,84,255,255],[0,88,255,255],[0,92,255,255],[0,96,255,255],[0,100,255,255],[0,104,255,255],[0,108,255,255],[0,112,255,255],[0,116,255,255],[0,120,255,255],[0,124,255,255],[0,128,255,255],[0,132,255,255],[0,136,255,255],[0,140,255,255],[0,144,255,255],[0,148,255,255],[0,152,255,255],[0,156,255,255],[0,160,255,255],[0,164,255,255],[0,168,255,255],[0,172,255,255],[0,176,255,255],[0,180,255,255],[0,184,255,255],[0,188,255,255],[0,192,255,255],[0,196,255,255],[0,200,255,255],[0,204,255,255],[0,208,255,255],[0,212,255,255],[0,216,255,255],[0,220,255,255],[0,224,255,255],[0,228,255,255],[0,232,255,255],[0,236,255,255],[0,240,255,255],[0,244,255,255],[0,248,255,255],[0,252,255,255],[1,255,253,255],[5,255,249,255],[9,255,245,255],[13,255,241,255],[17,255,237,255],[21,255,233,255],[25,255,229,255],[29,255,225,255],[33,255,221,255],[37,255,217,255],[41,255,213,255],[45,255,209,255],[49,255,205,255],[53,255,201,255],[57,255,197,255],[61,255,193,255],[65,255,189,255],[69,255,185,255],[73,255,181,255],[77,255,177,255],[81,255,173,255],[85,255,169,255],[89,255,165,255],[93,255,161,255],[97,255,157,255],[101,255,153,255],[105,255,149,255],[109,255,145,255],[113,255,141,255],[117,255,137,255],[121,255,133,255],[125,255,129,255],[129,255,125,255],[133,255,121,255],[137,255,117,255],[141,255,113,255],[145,255,109,255],[149,255,105,255],[153,255,101,255],[157,255,97,255],[161,255,93,255],[165,255,89,255],[169,255,85,255],[173,255,81,255],[177,255,77,255],[181,255,73,255],[185,255,69,255],[189,255,65,255],[193,255,61,255],[197,255,57,255],[201,255,53,255],[205,255,49,255],[209,255,45,255],[213,255,41,255],[217,255,37,255],[221,255,33,255],[225,255,29,255],[229,255,25,255],[233,255,21,255],[237,255,17,255],[241,255,13,255],[245,255,9,255],[249,255,5,255],[253,255,1,255],[255,252,0,255],[255,248,0,255],[255,244,0,255],[255,240,0,255],[255,236,0,255],[255,232,0,255],[255,228,0,255],[255,224,0,255],[255,220,0,255],[255,216,0,255],[255,212,0,255],[255,208,0,255],[255,204,0,255],[255,200,0,255],[255,196,0,255],[255,192,0,255],[255,188,0,255],[255,184,0,255],[255,180,0,255],[255,176,0,255],[255,172,0,255],[255,168,0,255],[255,164,0,255],[255,160,0,255],[255,156,0,255],[255,152,0,255],[255,148,0,255],[255,144,0,255],[255,140,0,255],[255,136,0,255],[255,132,0,255],[255,128,0,255],[255,124,0,255],[255,120,0,255],[255,116,0,255],[255,112,0,255],[255,108,0,255],[255,104,0,255],[255,100,0,255],[255,96,0,255],[255,92,0,255],[255,88,0,255],[255,84,0,255],[255,80,0,255],[255,76,0,255],[255,72,0,255],[255,68,0,255],[255,64,0,255],[255,60,0,255],[255,56,0,255],[255,52,0,255],[255,48,0,255],[255,44,0,255],[255,40,0,255],[255,36,0,255],[255,32,0,255],[255,28,0,255],[255,24,0,255],[255,20,0,255],[255,16,0,255],[255,12,0,255],[255,8,0,255],[255,4,0,255],[255,0,0,255],[251,0,0,255],[247,0,0,255],[243,0,0,255],[239,0,0,255],[235,0,0,255],[231,0,0,255],[227,0,0,255],[223,0,0,255],[219,0,0,255],[215,0,0,255],[211,0,0,255],[207,0,0,255],[203,0,0,255],[199,0,0,255],[195,0,0,255],[191,0,0,255],[187,0,0,255],[183,0,0,255],[179,0,0,255],[175,0,0,255],[171,0,0,255],[167,0,0,255],[163,0,0,255],[159,0,0,255],[155,0,0,255],[151,0,0,255],[147,0,0,255],[143,0,0,255],[139,0,0,255],[135,0,0,255],[131,0,0,255],[127,0,0,255]]; 144 | const midle_WF = canvas_width_WF*2; 145 | 146 | function SetImageDataWF(datas,scale_min,scale_max) { 147 | var canvasBuffer = document.createElement("canvas"); 148 | canvasBuffer.width = canvas_width_WF; 149 | canvasBuffer.height = canvas_height_WF; 150 | var ctxBuffer = canvasBuffer.getContext("2d"); 151 | 152 | ctxBuffer.clearRect(0,0,canvas_width_WF,canvas_height_WF); //clear buffer 153 | ctxBuffer.drawImage(canvasWF,0,0); //store display data in buffer 154 | ctxWF.clearRect(0,0,canvas_width_WF,canvas_height_WF); //clear display 155 | ctxWF.drawImage(canvasBuffer,0,1); //copy buffer to display 156 | 157 | 158 | var px=0; 159 | var i=0; 160 | for (px = 0; px < canvas_width_WF; px++) { 161 | i = 4*px; 162 | 163 | let dat = Math.floor(datas[px]*scale_max + scale_min); 164 | 165 | if(dat<0){dat=0;} 166 | if(dat>255){dat=255;} 167 | 168 | // let rgba = colMap[datas[px]]; // lookup color rgba values 169 | imgObjWF.data[i] = colMap[dat][0]; // red 170 | imgObjWF.data[i+1] = colMap[dat][1]; // green 171 | imgObjWF.data[i+2] = colMap[dat][2]; // blue 172 | imgObjWF.data[i+3] = colMap[dat][3]; // alpha 173 | } 174 | 175 | imgObjWF.data[midle_WF] = 0; 176 | imgObjWF.data[midle_WF+1] = 255; 177 | imgObjWF.data[midle_WF+2] = 0; 178 | imgObjWF.data[midle_WF+3] = 255; 179 | 180 | ctxWF.putImageData(imgObjWF, 0, 0); 181 | 182 | } 183 | 184 | 185 | 186 | function initCanvas(cvsIDwf) { 187 | var canvas = document.getElementById(cvsIDwf); 188 | var ctx = canvas.getContext("2d"); 189 | ctx.fillStyle = "black"; 190 | ctx.fillRect(0, 0, canvas.width, canvas.height); 191 | 192 | canvas.addEventListener('wheel', (event) => { 193 | set_FFT_zoom(); 194 | event.stopImmediatePropagation(); // WORKED!! 195 | }, false) 196 | 197 | canvas.addEventListener('mousemove', showOnmouseInfo, false); 198 | 199 | canvas.addEventListener('mouseout', function(event) {visual_freq.innerHTML="∞hz";}, false); 200 | 201 | canvas.addEventListener('click', function() {window.opener.sendTRXfreq(freqmouse);}, false); 202 | 203 | } 204 | 205 | 206 | function showOnmouseInfo(event) { 207 | var rect = this.getBoundingClientRect() 208 | var scaleX = this.width / rect.width; // relationship bitmap vs. element for X 209 | var hzperpixel=samplerate/this.width; 210 | // console.log(this.width); 211 | // console.log(rect.width); 212 | 213 | hz=((window.scrollX+event.clientX)*scaleX*hzperpixel)-(samplerate/2); 214 | freqmouse=window.opener.TRXfrequency+hz; 215 | //var scale_hz = Math.exp(parseInt(document.getElementById("canBFFFT_scale_multhz").value)/100); 216 | // var start = (parseInt(document.getElementById("canBFFFT_scale_start").value)*Audio_analyser.frequencyBinCount/100)*scale_hz; 217 | 218 | // scaleY = canvas.height / rect.height; // relationship bitmap vs. element for Y 219 | // var scale_mult = Math.exp(parseInt(document.getElementById("canBFFFT_scale_multdb").value)/100); 220 | // var scale_floor = parseInt(document.getElementById("canBFFFT_scale_floor").value); 221 | 222 | // console.log(parseInt(((((evt.clientX - rect.left)/(scale_hz*scale_hz) * scaleX ) - (start/scale_hz))* (AudioRX_sampleRate/2))/canvasBFFFT.width) + 'hz ,-' + parseInt(((evt.clientY - rect.top) * scaleY)/(scale_mult) + (scale_floor))+'dB'); 223 | //console.log(scaleX); 224 | //console.log(window.opener.TRXfrequency); 225 | //console.log(event.clientX); 226 | visual_freq.innerHTML=Math.floor(freqmouse)+"hz"; 227 | } 228 | 229 | 230 | function set_FFT_zoom() { 231 | if(event.deltaY>0){ 232 | if(zoom_FFT >= 150){zoom_FFT/=1.5;} 233 | }else{ 234 | zoom_FFT*=1.5; 235 | } 236 | visual_WindowsZoom.innerHTML=canvasWF.style.width = canvasSP.style.width = zoom_FFT + "%"; 237 | window.scroll((window.screen.width*(zoom_FFT/100)/2)-window.screen.width/2, 0); 238 | visual_FFtResolution.innerHTML=Math.floor(samplerate/FFTSIZE/(zoom_FFT/100))+"hz/px"; 239 | } 240 | 241 | 242 | function setcenterfrequency (freq){ 243 | localcenterfrequency=freq; 244 | visual_CenterFrequency.innerHTML=localcenterfrequency+"hz";; 245 | } 246 | -------------------------------------------------------------------------------- /www/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | color: white; 3 | font:normal bold 14px tahoma; 4 | -webkit-touch-callout: none; 5 | -webkit-user-select: none; 6 | -khtml-user-select: none; 7 | -moz-user-select: none; 8 | -ms-user-select: none; 9 | user-select: none; 10 | /* overflow: hidden; */ 11 | } 12 | 13 | #ombre-body{ 14 | display: none; 15 | position: absolute; 16 | left: 0; 17 | top: 0; 18 | right: 0; 19 | bottom: 0; 20 | background: rgba(0,0,0,0.7); 21 | z-index: 1000; 22 | cursor: default; 23 | } 24 | 25 | #pop-upspinner{ 26 | display: none; 27 | position: fixed; 28 | left: calc(50% - 100px); 29 | top: 50%; 30 | z-index: 2000; 31 | cursor: default; 32 | overflow: hidden; 33 | } 34 | 35 | #div-princ { 36 | margin: 20px auto; 37 | width: 1800px; 38 | height: 860px; 39 | background-color:#171717; 40 | box-shadow:5px 5px 5px 5px rgba(0, 0, 0, 0.5),0px 0px 0px 0px rgba(255, 255, 255, 0.5) inset; 41 | border-radius: 30px 30px 30px 30px ; 42 | position:relative 43 | } 44 | 45 | #button_power 46 | { 47 | position:absolute; 48 | left:105px; 49 | top:105px; 50 | width:150px; 51 | height:150px; 52 | } 53 | 54 | .button_pressed{ 55 | box-shadow:0px 2px 2px 0px rgba(0, 0, 0, 0.5) inset,0px 2px 2px 0px rgba(255, 255, 255, 0.5); 56 | } 57 | 58 | .button_unpressed{ 59 | box-shadow:0px 2px 2px 0px rgba(0, 0, 0, 0.5),0px 2px 2px 0px rgba(255, 255, 255, 0.5) inset; 60 | } 61 | 62 | .button_white{ 63 | color: #e0e0e0; 64 | background: #a5cd4e; 65 | } 66 | 67 | .button_green { 68 | color: #7FFF00; 69 | text-shadow: 0 0 10px #6a6767, 0 0 20px #444, 0 0 30px #515151, 0 0 40px #FFFAFC, 0 0 70px #3AFF11, 0 0 80px #45FF11, 0 0 100px #4F4F4F, 0 0 150px #18FF11; 70 | } 71 | 72 | .button_red { 73 | color: #ff3a3a; 74 | background: #a5cd4e; 75 | } 76 | 77 | .button_blue { 78 | color: #176fff; 79 | background: #70c9e3; 80 | } 81 | 82 | #callsign{ 83 | position:absolute; 84 | left: 1450px; 85 | top:20px; 86 | height:80px; 87 | width:300px; 88 | font: normal bold 25px tahoma; 89 | text-align:center; 90 | } 91 | 92 | #callsign > a > img{ 93 | height:25px; 94 | width:25px; 95 | } 96 | 97 | #personalfrequency 98 | { 99 | position:absolute; 100 | left: 1450px; 101 | top:420px; 102 | height:110px; 103 | width:300px; 104 | font: normal bold 25px tahoma; 105 | text-align:center; 106 | margin:0px; 107 | padding:0px; 108 | } 109 | 110 | #personalfrequency > select 111 | { 112 | width:300px; 113 | font: normal bold 25px tahoma; 114 | } 115 | 116 | #div-bandshortcut 117 | { 118 | position:absolute; 119 | left: 1450px; 120 | top:250px; 121 | width: 300px; 122 | } 123 | 124 | #div-bandshortcut > ul 125 | { 126 | padding:0; 127 | margin:0px; 128 | width:300px; 129 | } 130 | 131 | #div-bandshortcut > ul > li { 132 | display: inline-block; 133 | font:normal bold 25px tahoma; 134 | text-align:center; 135 | width:32%; 136 | } 137 | 138 | #div-customfilter 139 | { 140 | position:absolute; 141 | left: 425px; 142 | top:600px; 143 | width: 450px; 144 | height:200px; 145 | display:none; 146 | z-index:100; 147 | background-color:#171717; 148 | } 149 | 150 | #div-filtershortcut 151 | { 152 | position:absolute; 153 | left: 425px; 154 | top:600px; 155 | width: 450px; 156 | height:200px; 157 | } 158 | 159 | #div-filtershortcut > ul 160 | { 161 | padding:0; 162 | width: 450px; 163 | height:200px; 164 | margin:0px; 165 | padding:0px; 166 | } 167 | 168 | #div-filtershortcut > ul > li { 169 | display: inline-block; 170 | font:normal bold 25px tahoma; 171 | text-align:center; 172 | width:32%; 173 | } 174 | 175 | 176 | #div-freq 177 | { 178 | position:absolute; 179 | left: 425px; 180 | top:80px; 181 | height: 200px; 182 | width:450px; 183 | } 184 | 185 | #div-freq > ul > li { 186 | display: inline-block; 187 | font:normal bold 37px tahoma; 188 | text-align:center; 189 | width:8%; 190 | } 191 | 192 | #freq_disp{ 193 | border-radius: 5px 5px 5px 5px ; 194 | box-shadow:0px 2px 2px 0px rgba(0, 0, 0, 0.5) inset,0px 2px 2px 0px rgba(255, 255, 255, 0.5); 195 | background-color: black; 196 | width:450px; 197 | padding-top:5px; 198 | padding-left:0px; 199 | margin-top:10px; 200 | margin-bottom:10px; 201 | height: 60px; 202 | text-align:center; 203 | } 204 | 205 | #freq_disp > ul > li { 206 | display: inline-block; 207 | font:normal bold 14px tahoma; 208 | text-align:center; 209 | } 210 | 211 | #freq_disp > ul > li:before{ 212 | content: ''; 213 | display: inline-block; 214 | vertical-align: middle; 215 | height: 100%; 216 | } 217 | 218 | #freq_disp_input_text{ 219 | content: ''; 220 | display: inline-block; 221 | vertical-align: middle; 222 | height: 100%; 223 | width:100%; 224 | font:normal bold 45px tahoma; 225 | text-align:center; 226 | display:none; 227 | } 228 | 229 | #freq_but{ 230 | width:450px; 231 | margin:0; 232 | padding-left:0px; 233 | text-align:center; 234 | } 235 | 236 | #freq_but > ul > li { 237 | display: inline-block; 238 | font:normal bold 14px tahoma; 239 | text-align:center; 240 | margin-top:5px; 241 | margin-bottom:5px; 242 | width:8%; 243 | } 244 | 245 | #freq_but > ul > li:before{ 246 | content: ''; 247 | display: inline-block; 248 | vertical-align: middle; 249 | height: 100%; 250 | margin-top:5px; 251 | margin-bottom:5px; 252 | width:8%; 253 | } 254 | 255 | #div-scoketscontrols 256 | { 257 | position:absolute; 258 | left: 1100px; 259 | top:800px; 260 | width: 580px; 261 | } 262 | 263 | #div-scoketscontrols > p 264 | { 265 | display: inline-block; 266 | font:normal bold 25px tahoma; 267 | text-align:center; 268 | margin-right:10px; 269 | } 270 | 271 | #div-scoketscontrols > p > img 272 | { 273 | margin-right:5px; 274 | width:25px; 275 | height:25px; 276 | } 277 | 278 | #div-conf 279 | { 280 | position:absolute; 281 | left: 1750px; 282 | top:20px; 283 | width: 580px; 284 | } 285 | 286 | #div-conf > a > img 287 | { 288 | margin-right:5px; 289 | width:25px; 290 | height:25px; 291 | } 292 | 293 | #div-panfft 294 | { 295 | position:absolute; 296 | left: 1750px; 297 | top:55px; 298 | width: 580px; 299 | display: none; 300 | } 301 | 302 | #div-panfft > a > img 303 | { 304 | margin-right:5px; 305 | width:25px; 306 | height:25px; 307 | } 308 | 309 | #div-latencymeter 310 | { 311 | font:normal bold 25px tahoma; 312 | position:absolute; 313 | left:1600px; 314 | top:825px; 315 | } 316 | 317 | #div-latencymeter > img 318 | { 319 | margin-right:5px; 320 | width:25px; 321 | height:25px; 322 | } 323 | 324 | #RX-GAIN_control 325 | { 326 | width:300px; 327 | height:140px; 328 | position:absolute; 329 | left:50px; 330 | top:300px; 331 | font:normal bold 25px tahoma; 332 | text-align:center; 333 | } 334 | 335 | div#Txmeters > div { 336 | text-align:center; 337 | width:300px; 338 | position:absolute; 339 | left: 50px; 340 | top:600px; 341 | font:normal bold 25px tahoma; 342 | } 343 | 344 | div#Txmeters div.label { 345 | display: inline-block; 346 | } 347 | 348 | div#Txmeters div.value { 349 | display: inline-block; 350 | } 351 | 352 | div#Rxmeters > div { 353 | text-align:center; 354 | width:300px; 355 | position:absolute; 356 | left: 50px; 357 | top:380px; 358 | font:normal bold 25px tahoma; 359 | } 360 | 361 | div#Rxmeters div.label { 362 | display: inline-block; 363 | } 364 | 365 | div#Rxmeters div.value { 366 | display: inline-block; 367 | } 368 | 369 | #TX-GAIN_control 370 | { 371 | width:300px; 372 | height:140px; 373 | position:absolute; 374 | left:50px; 375 | top:530px; 376 | font:normal bold 25px tahoma; 377 | text-align:center; 378 | } 379 | 380 | #div-TX{ 381 | position:absolute; 382 | left:1450px; 383 | top:590px; 384 | width: 300px; 385 | height: 200px; 386 | } 387 | #TX-record 388 | { 389 | text-align:center; 390 | font:normal bold 90px tahoma; 391 | height:140px; 392 | width:100%; 393 | display: inline-block; 394 | } 395 | 396 | #TX-record_record_opus 397 | { 398 | font:normal bold 10px tahoma; 399 | text-align:center; 400 | } 401 | 402 | #TX-record-lock 403 | { 404 | text-align:center; 405 | font:normal bold 25px tahoma; 406 | height:50px; 407 | width:100%; 408 | display: inline-block; 409 | } 410 | 411 | #record_opus 412 | { 413 | text-align:center; 414 | width:200px; 415 | height:170px; 416 | width:100%; 417 | } 418 | 419 | #canBFSPC{ 420 | position:absolute; 421 | left:425px; 422 | top:320px; 423 | width:450px; 424 | height:250px; 425 | background:black; 426 | background-color:black; 427 | border-radius: 5px 5px 5px 5px; 428 | box-shadow:0px 2px 2px 0px rgba(0, 0, 0, 0.5) inset,0px 2px 2px 0px rgba(255, 255, 255, 0.5); 429 | } 430 | 431 | #canBFFFT{ 432 | position:absolute; 433 | left:950px; 434 | top:320px; 435 | width:450px; 436 | height:250px; 437 | background:black; 438 | background-color:black; 439 | border-radius: 5px 5px 5px 5px; 440 | box-shadow:0px 2px 2px 0px rgba(0, 0, 0, 1) inset,0px 2px 2px 0px rgba(255, 255, 255, 1); 441 | } 442 | .slider-wrapper{ 443 | -webkit-appearance: none; 444 | height: 0px; 445 | border-radius: 5px; 446 | outline: none; 447 | opacity: 0.4; 448 | -webkit-transition: .2s; 449 | transition: opacity .2s; 450 | background: #FF0000; 451 | } 452 | 453 | .slider-wrapper:hover { 454 | opacity: 1; 455 | } 456 | 457 | .slider-wrapper:hover::-moz-range-thumb{ 458 | opacity: 1; 459 | height: 10px; 460 | width: 20px; 461 | } 462 | 463 | .slider-wrapper::-webkit-slider-thumb{ 464 | background: #FF0000; 465 | } 466 | 467 | .slider-wrapper::-moz-range-thumb{ 468 | background: #FF0000; 469 | height: 4px; 470 | width: 4px; 471 | } 472 | 473 | .slider-wrapper_floor{ 474 | width: 250px; 475 | height: 0px; 476 | margin: 0; 477 | transform-origin: 75px 75px; 478 | transform: rotate(-90deg); 479 | position:absolute; 480 | left: 940px; 481 | top: 420px; 482 | z-index: 2; 483 | } 484 | 485 | .slider-wrapper_multdb{ 486 | width: 250px; 487 | height: 0px; 488 | margin: 0; 489 | transform-origin: 75px 75px; 490 | transform: rotate(+90deg); 491 | position:absolute; 492 | left: 1260px; 493 | top: 320px; 494 | z-index: 2; 495 | } 496 | 497 | .slider-wrapper_start{ 498 | width: 450px; 499 | height: 0px; 500 | margin: 0; 501 | transform-origin: 75px 75px; 502 | transform: rotate(+180deg); 503 | position:absolute; 504 | left: 1250px; 505 | top: 430px; 506 | z-index: 2; 507 | } 508 | 509 | .slider-wrapper_multhz{ 510 | width: 450px; 511 | height: 0px; 512 | margin: 0; 513 | position:absolute; 514 | left: 950px; 515 | top: 310px; 516 | z-index: 2; 517 | } 518 | 519 | #canvasBFFFT_coord{ 520 | position:absolute; 521 | top:600px; 522 | left:950px; 523 | z-index: 4; 524 | display: none; 525 | margin:0px; 526 | padding:0px; 527 | } 528 | 529 | #div-mode_menu 530 | { 531 | position:absolute; 532 | left: 950px; 533 | top:80px; 534 | width: 450px; 535 | height:200px; 536 | } 537 | 538 | #div-mode_menu > ul 539 | { 540 | padding:0; 541 | margin:0; 542 | width:450px; 543 | height:200px; 544 | } 545 | 546 | #div-mode_menu > ul > li { 547 | display: inline-block; 548 | font: normal bold 45px tahoma; 549 | } 550 | 551 | #div-mode_menu > ul > li:before{ 552 | content: ''; 553 | display: inline-block; 554 | vertical-align: middle; 555 | height: 100%; 556 | } 557 | 558 | .button_mode{ 559 | width:222px; 560 | height: 65px; 561 | text-align:center; 562 | } 563 | 564 | 565 | #canRXsmeter{ 566 | position:absolute; 567 | left:1475px; 568 | top:80px; 569 | width:250px; 570 | height:50px; 571 | background:black; 572 | background-color:black; 573 | border-radius: 5px 5px 5px 5px; 574 | box-shadow:0px 2px 2px 0px rgba(0, 0, 0, 0.5) inset,0px 2px 2px 0px rgba(255, 255, 255, 0.5); 575 | background: url(img/smeter.png) no-repeat center center 576 | } 577 | 578 | #div-smeterdigitRX 579 | { 580 | position:absolute; 581 | left:1475px; 582 | top:140px; 583 | text-align:center; 584 | font: normal bold 25px tahoma; 585 | width: 250px; 586 | } 587 | 588 | #SQUELCH_control 589 | { 590 | margin:0px; 591 | padding:0px; 592 | width:300px; 593 | height:70px; 594 | position:absolute; 595 | left:1450px; 596 | top:180px; 597 | font:normal bold 25px tahoma; 598 | text-align:center; 599 | } 600 | 601 | /* @group Blink */ 602 | .blink { 603 | -webkit-animation: blink .75s linear infinite; 604 | -moz-animation: blink .75s linear infinite; 605 | -ms-animation: blink .75s linear infinite; 606 | -o-animation: blink .75s linear infinite; 607 | animation: blink .75s linear infinite; 608 | } 609 | @-webkit-keyframes blink { 610 | 0% { opacity: 1; } 611 | 50% { opacity: 1; } 612 | 50.01% { opacity: 0; } 613 | 100% { opacity: 0; } 614 | } 615 | @-moz-keyframes blink { 616 | 0% { opacity: 1; } 617 | 50% { opacity: 1; } 618 | 50.01% { opacity: 0; } 619 | 100% { opacity: 0; } 620 | } 621 | @-ms-keyframes blink { 622 | 0% { opacity: 1; } 623 | 50% { opacity: 1; } 624 | 50.01% { opacity: 0; } 625 | 100% { opacity: 0; } 626 | } 627 | @-o-keyframes blink { 628 | 0% { opacity: 1; } 629 | 50% { opacity: 1; } 630 | 50.01% { opacity: 0; } 631 | 100% { opacity: 0; } 632 | } 633 | @keyframes blink { 634 | 0% { opacity: 1; } 635 | 50% { opacity: 1; } 636 | 50.01% { opacity: 0; } 637 | 100% { opacity: 0; } 638 | } 639 | /* @end */ 640 | --------------------------------------------------------------------------------