diff --git a/README.md b/README.md index 80daf77..273af11 100644 --- a/README.md +++ b/README.md @@ -2,69 +2,87 @@ # USRP_Client (pyUC) ## Introduction -The pyUC python application is a GUI front end for accessing ham radio digital networks from your PC. It is the front end app for the DVSwitch suite of software and connects to the Analog_Bridge component. + +The pyUC python application is a GUI front end for accessing ham radio digital +networks from your PC. It is the front end app for the +[DVSwitch](https://github.com/dvswitch) suite of software. pyUC connects +directly to the Analog_Bridge component. + ## Features + The user can: - - Select digital network - - Select "talk group" or reflector from a list - - Transmit and receive to the network using their speakers and mic - - Record a list of stations received in the session - - See pictures of the hams from QRZ.com +* Select digital network +* Select "talk group" or reflector from a list +* Transmit and receive to the network using their speakers and mic +* Record a list of stations received in the session +* See pictures of the hams from QRZ.com ## Installation + Download and unzip https://github.com/DVSwitch/USRP_Client/archive/master.zip +or clone this repository with `git`. Install instructions by platform: -- Windows 10 - - Use Python 3.7 from the Microsoft Store - Open a command prompt - **python -m pip install --upgrade pip** - Download PyAudio from https://www.lfd.uci.edu/~gohlke/pythonlibs/ for your version (32 or 64 bit) - - **pip install PyAudio-0.2.11-cp37-cp37m-win_XXX.whl - pip install bs4 - pip install Pillow - pip install requests** - Edit pyUC.ini - - If you get an error about MSVCP140.DLL, then you will need to install the MSVC C++ runtime library. - Get it from: https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads - -- Linux (Tested on a Raspberry Pi running Buster and Linux Mint 19) - - Open a command prompt - **sudo apt-get install python3-pyaudio - sudo apt-get install portaudio19-dev - sudo apt-get install python3-pil.imagetk** - Edit pyUC.ini - -- Mac - - **ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" - brew install python - brew install portaudio - pip3 install pyaudio - pip3 install bs4 Pillow requests** - Edit pyUC.ini +* Windows 10 + * Use Python 3.7 from the Microsoft Store + * Open a command prompt + * `python -m pip install --upgrade pip` + * Download PyAudio from https://www.lfd.uci.edu/~gohlke/pythonlibs/ for your version (32 or 64 bit) + * `pip install PyAudio-0.2.11-cp37-cp37m-win_XXX.whl` + * `pip install bs4 Pillow requests` + * Edit pyUC.ini + * If you get an error about MSVCP140.DLL, then you will need to install the + [MSVC C++ runtime library.](Get it from: https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads) +* Linux (Tested on a Raspberry Pi running Buster and Linux Mint 19) + * Open a command prompt + * `sudo apt-get install python3-pyaudio` + * `sudo apt-get install portaudio19-dev` + * `sudo apt-get install python3-pil.imagetk` + * Edit pyUC.ini +* Mac + * Install [Homebrew](http://brew.sh) + * `brew install python` + * `brew install portaudio` + * `pip3 install pyaudio` + * May need to ensure that `python`, `pip3`, etc resolve to Homebrew + python. Something like this in your `.bashrc` should do the trick: + ``` + export HOMEBREW_PATH=/usr/local + export PATH=$HOMEBREW_PATH/opt/python@3.8/libexec/bin:$HOMEBREW_PATH/bin:$PATH + ``` + * May need to explicitly tell pip3 where to find Homebrew includes: + ``` + pip3 install --global-option='build_ext' \ + --global-option='-I$HOMEBREW_PATH/include' \ + --global-option='-L$HOMEBREW_PATH/lib' pyaudio + ``` + * `pip3 install bs4 Pillow requests` + * Edit pyUC.ini ## Contributing -We encourage others to submit pull request to this repository. We only ask that you submit the pull request on the development branch. Your pull will be reviewed and merged into the master branch. + +We encourage others to submit pull request to this repository. We only ask +that you submit the pull request on the development branch. Your pull will be +reviewed and merged into the master branch. + ## Related projects -DVSwitch + +[DVSwitch](https://github.com/DVSwitch) + ## Licensing -This software is for use on amateur radio networks only, it is to be used -for educational purposes only. Its use on commercial networks is strictly -prohibited. Permission to use, copy, modify, and/or distribute this software -hereby granted, provided that the above copyright notice and this permission -notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND DVSWITCH DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL N4IRR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE -OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. + +This software is for use on amateur radio networks only, it is to be used +for educational purposes only. Its use on commercial networks is strictly +prohibited. Permission to use, copy, modify, and/or distribute this software +hereby granted, provided that the above copyright notice and this permission +notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND DVSWITCH DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL N4IRR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. diff --git a/pyUC.ini b/pyUC.ini old mode 100755 new mode 100644 diff --git a/pyUC.py b/pyUC.py index 39a4afa..28b6b90 100755 --- a/pyUC.py +++ b/pyUC.py @@ -1,4 +1,4 @@ -#!/usr/bin/python3 +#!/usr/bin/env python3 ################################################################################### # pyUC ("puck") # Copyright (C) 2014, 2015, 2016, 2019, 2020 N4IRR @@ -97,6 +97,7 @@ transmit_enable = True # Make sure that UC is half duplex useQRZ = True level_every_sample = 1 +NAT_ping_timer = 0 listbox = None # tk object (talkgroup) transmitButton = None # tk object @@ -240,7 +241,10 @@ def showQRZImage( msg, in_label ): current_name.set(msg[3]) ################################################################################### - +def ping_thread(): + while done == False: + sleep(20.0) + sendUSRPCommand(bytes("PING", 'ASCII'), USRP_TYPE_PING) ################################################################################### # Log output to console @@ -943,6 +947,8 @@ def disconnect(): ################################################################################### def popup_toast(msg): global toast_frame + if toast_frame != None: # If a toast is still on the screen, kill it first + toast_frame.destroy() toast_frame = Toplevel() toast_frame.wm_title(msg[1]) toast_frame.overrideredirect(1) @@ -956,13 +962,16 @@ def popup_toast(msg): toast_frame.after(2000, toast_fade_away) def toast_fade_away(): - alpha = toast_frame.attributes("-alpha") - if alpha > 0: - alpha -= .1 - toast_frame.attributes("-alpha", alpha) - toast_frame.after(100, toast_fade_away) - else: - toast_frame.destroy() + global toast_frame + if toast_frame != None: + alpha = toast_frame.attributes("-alpha") + if alpha > 0: + alpha -= .1 + toast_frame.attributes("-alpha", alpha) + toast_frame.after(100, toast_fade_away) + else: + toast_frame.destroy() + toast_frame = None def process_queue(): try: @@ -1559,6 +1568,7 @@ def popupFocusOut(self,event=None): asl_mode = makeTkVar(IntVar, config.get('DEFAULTS', "aslMode").split(None)[0]) useQRZ = bool(readValue(config, 'DEFAULTS', 'useQRZ', True, int)) level_every_sample = int(readValue(config, 'DEFAULTS', 'levelEverySample', 2, int)) + NAT_ping_timer = int(readValue(config, 'DEFAULTS', 'pingTimer', 0, int)) in_index = readValue(config, 'DEFAULTS', 'in_index', None, int) out_index = readValue(config, 'DEFAULTS', 'out_index', None, int) @@ -1611,6 +1621,8 @@ def popupFocusOut(self,event=None): if in_index != -1: # Do not launch the TX thread if the user wants RX only access _thread.start_new_thread( txAudioStream, () ) _thread.start_new_thread( html_thread, () ) # Start up the HTML thread for background image loads +if NAT_ping_timer > 0: + _thread.start_new_thread( ping_thread, () ) disconnect() # Start out in the disconnected state start() # Begin the handshake with AB (register) diff --git a/test.md b/test.md deleted file mode 100644 index 5e4d2a6..0000000 --- a/test.md +++ /dev/null @@ -1,67 +0,0 @@ - -# USRP_Client (pyUC) - -## Introduction -The pyUC python application is a GUI front end for accessing ham radio digital networks from your PC. It is the front end app for the DVSwitch suite of software and connects to the Analog_Bridge component. -## Features -The user can: - - - Select digital network - - Select "talk group" or reflector from a list - - Transmit and receive to the network using their speakers and mic - - Record a list of stations received in the session - - See pictures of the hams from QRZ.com - -## Installation -Download and unzip https://github.com/DVSwitch/USRP_Client/archive/master.zip - -Install instructions by platform: - -- Windows 10 - - Use Python 3.7 from the Microsoft Store - Open a command prompt - **python -m pip install --upgrade pip** - Download PyAudio from https://www.lfd.uci.edu/~gohlke/pythonlibs/ for your version (32 or 64 bit) - - **pip install PyAudio-0.2.11-cp37-cp37m-win_XXX.whl - pip install bs4 - pip install Pillow - pip install requests** - Edit pyUC.ini - -- Linux (Tested on a Raspberry Pi running Buster and Linux Mint 19) - - Open a command prompt - **sudo apt-get install python3-pyaudio - sudo apt-get install portaudio19-dev - sudo apt-get install python3-pil.imagetk** - Edit pyUC.ini - -- Mac - - **ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" - brew install python - brew install portaudio - pip3 install pyaudio - pip3 install bs4 Pillow requests** - Edit pyUC.ini - -## Contributing -We encourage others of submit pull request tp this repository. We only ask that you submit the pull request on the development branch. Your pull will be reviewed and merged into the master branch. -## Related projects -DVSwitch -## Licensing -This software is for use on amateur radio networks only, it is to be used -for educational purposes only. Its use on commercial networks is strictly -prohibited. Permission to use, copy, modify, and/or distribute this software -hereby granted, provided that the above copyright notice and this permission -notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND DVSWITCH DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL N4IRR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE -OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE.