From 47e82d31dd4888be1be51f1d776e95250a25b199 Mon Sep 17 00:00:00 2001 From: Greg Albrecht Date: Fri, 10 Jun 2022 10:46:56 -0700 Subject: [PATCH] final v6 --- .github/workflows/debian.yml | 2 +- .travis.yml | 13 ------- README.rst | 70 +++++++++++++++++++++--------------- aprscot/classes.py | 10 ++++-- aprscot/commands.py | 10 ++++-- example-config.ini | 10 +++--- setup.py | 2 +- tox.ini | 5 --- 8 files changed, 65 insertions(+), 57 deletions(-) delete mode 100644 .travis.yml delete mode 100644 tox.ini diff --git a/.github/workflows/debian.yml b/.github/workflows/debian.yml index bc170fb..035a5ba 100644 --- a/.github/workflows/debian.yml +++ b/.github/workflows/debian.yml @@ -30,7 +30,7 @@ jobs: - name: Build Debian/Apt bdist_deb run: | - export REPO_NAME=$(echo ${github.repository} | awk -F"/" '{print $2}') + export REPO_NAME=$(echo ${{ github.repository }} | awk -F"/" '{print $2}') python3 setup.py --command-packages=stdeb.command bdist_deb ls -al deb_dist/ cp deb_dist/python3-${REPO_NAME}_*_all.deb deb_dist/python3-${REPO_NAME}_latest_all.deb diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 55bd2d5..0000000 --- a/.travis.yml +++ /dev/null @@ -1,13 +0,0 @@ -language: python - -python: - - "3.6" - - "3.7" - - "3.8" - -install: - - python setup.py install - - pip install tox - -script: - - tox diff --git a/README.rst b/README.rst index ae515a2..9cbb8fc 100644 --- a/README.rst +++ b/README.rst @@ -1,17 +1,15 @@ aprscot - APRS Cursor-on-Target Gateway. **************************************** -IF YOU HAVE AN URGENT OPERATIONAL NEED: Email ops@undef.net or call/sms +1-415-598-8226 - .. image:: https://raw.githubusercontent.com/ampledata/aprscot/main/docs/screenshot_1637083240_16797-50p.png - :alt: Screenshot of APRS PLI in ATAK.. + :alt: Screenshot of APRS PLI in ATAK. :target: https://raw.githubusercontent.com/ampledata/aprscot/main/docs/screenshot_1637083240_16797.png -The ``aprscot`` "APRS to Cursor On Target (COT) Gateway" provides beyond -line-of-sight blue force tracking capabilities using commercial off the shelf -components. This gateway uses the Automatic Packet Reporting System (APRS) -and APRS-IS network to forward APRS position reports to Cursor On Target (COT) -clients such as the Android Team Awareness Kit (ATAK), WinTAK, et al. Other +The APRS to Cursor On Target Gateway (APRSCOT) provides beyond line-of-sight +blue force tracking capabilities using commercial off the shelf components. +This gateway uses the Automatic Packet Reporting System (APRS) and APRS-IS +network to forward APRS position reports to Cursor On Target (COT) clients +such as the Android Team Awareness Kit (ATAK), WinTAK, et al. Other situational awareness & common operating picture platforms are supported through use of COT, such as TAKX & COPERS. @@ -37,25 +35,27 @@ Concept: :alt: APRSCOT concept diagram. :target: https://raw.githubusercontent.com/ampledata/aprscot/main/docs/aprscot-concept.png -Support aprscot Development -============================ -aprscot has been developed for the Disaster Response, Public Safety, and -Frontline community. This software is currently provided at no-cost to -our end-users. All development is self-funded and all time-spent is entirely -voluntary. Any contribution you can make to further these software development -efforts, and the mission of aprscot to provide ongoing SA capabilities to our -end-users, is greatly appreciated: +Support Development +=================== + +**Tech Support**: Email support@undef.net or Signal/WhatsApp: +1-310-621-9598 + +This tool has been developed for the Disaster Response, Public Safety and +Frontline Healthcare community. This software is currently provided at no-cost +to users. Any contribution you can make to further this project's development +efforts is greatly appreciated. .. image:: https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png :target: https://www.buymeacoffee.com/ampledata - :alt: Support aprscot development: Buy me a coffee! + :alt: Support Development: Buy me a coffee! + Installation ============ The APRS to COT gateway is service started with a command-line tool -called `aprscot`. There are three options for installing `aprscot`, in order +called ``aprscot``. There are three options for installing ``aprscot``, in order preferred option they are: **Option I: Install as a Debian / Ubuntu Package**:: @@ -70,20 +70,20 @@ preferred option they are: Option II: Install from the Python Package Index (PyPI):: - $ pip install aprscot + $ python3 -m pip install aprscot Option III: Install from this source tree:: $ git clone https://github.com/ampledata/aprscot.git $ cd aprscot/ - $ python setup.py install + $ python3 setup.py install Usage ===== -The `aprscot` program has one command-line argument:: +The ``aprscot`` program has one command-line argument:: $ aprscot -h usage: aprscot [-h] [-c CONFIG_FILE] @@ -92,13 +92,13 @@ The `aprscot` program has one command-line argument:: -h, --help show this help message and exit -c CONFIG_FILE, --CONFIG_FILE CONFIG_FILE -You must create a configuration file, see `example-config.ini` in the source +You must create a configuration file, see ``example-config.ini`` in the source repository. -An example config, `COT_URL` is our COT destination server or client:: +An example config, ``COT_URL`` is our COT destination server or client:: [aprscot] - COT_URL = tcp:takserver.example.com:8088 + COT_URL = tcp://takserver.example.com:8088 `APRS-IS Server-side Filter Commands `_ @@ -109,7 +109,7 @@ can be used to filter incoming APRS Frames:: APRSIS_FILTER = f/W6PW-10/50 PLI Transforms can be created using per-station sections. In this example, -we're overriding `W2GMD-9`'s COT Type & Callsign, and `NB6F-2`'s Callsign:: +we're overriding ``W2GMD-9``'s COT Type & Callsign, and ``NB6F-2``'s Callsign:: [aprscot] COT_URL = tcp:takserver.example.com:8088 @@ -127,18 +127,32 @@ Source ====== Github: https://github.com/ampledata/aprscot + Author ====== Greg Albrecht W2GMD oss@undef.net https://ampledata.org/ + Copyright ========= -Copyright 2022 Greg Albrecht -`Automatic Packet Reporting System (APRS) `_ is Copyright Bob Bruninga WB4APR (SK) wb4apr@amsat.org +* APRSCOT is Copyright 2022 Greg Albrecht +* `Automatic Packet Reporting System (APRS) `_ is Copyright Bob Bruninga WB4APR (SK) wb4apr@amsat.org + License ======= -Apache License, Version 2.0. See LICENSE for details. + +Copyright 2022 Greg Albrecht + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/aprscot/classes.py b/aprscot/classes.py index dbeb95c..d1c706b 100644 --- a/aprscot/classes.py +++ b/aprscot/classes.py @@ -20,6 +20,8 @@ import asyncio +from configparser import ConfigParser + import aprslib.parsing import pytak @@ -34,6 +36,10 @@ class APRSWorker(pytak.QueueWorker): """APRS Cursor-on-Target Worker Class.""" + def __init__(self, queue: asyncio.Queue, config: ConfigParser): + super().__init__(queue, config) + _ = [x.setFormatter(aprscot.LOG_FORMAT) for x in self._logger.handlers] + async def handle_data(self, data: bytes) -> None: """Handles messages from APRS Worker.""" self._logger.debug("APRS data='%s'", data) @@ -47,10 +53,10 @@ async def handle_data(self, data: bytes) -> None: # Some APRS Frame types are not supported by aprslib yet: try: frame = aprslib.parsing.parse(data) - except aprslib.exceptions.UnknownFormat as exc: + except aprslib.exceptions.UnknownFormat: self._logger.warning("Unhandled APRS Frame: '%s'", data) return - except aprslib.exceptions.ParseError as exc2: + except aprslib.exceptions.ParseError: self._logger.warning("Invalid Format: '%s'", data) return diff --git a/aprscot/commands.py b/aprscot/commands.py index 86dc44a..2f1c06c 100644 --- a/aprscot/commands.py +++ b/aprscot/commands.py @@ -25,5 +25,11 @@ __license__ = "Apache License, Version 2.0" -# PyTAK CLI tool boilerplate: -pytak.cli(__name__.split(".")[0]) +def main() -> None: + """Main func.""" + # PyTAK CLI tool boilerplate: + pytak.cli(__name__.split(".")[0]) + + +if __name__ == "__main__": + main() diff --git a/example-config.ini b/example-config.ini index 67bbb73..a28390a 100644 --- a/example-config.ini +++ b/example-config.ini @@ -1,10 +1,10 @@ [aprscot] -#specify protocol:server:port to receive COT -COT_URL = tcp:127.0.0.1:8087 -#fill with your callsign +# specify protocol:server:port to receive COT +COT_URL = tcp://127.0.0.1:8087 +# fill with your callsign CALLSIGN = N0CALL -#fill with aprs server side filter, ie. f/call/dist +# fill with aprs server side filter, ie. f/call/dist APRSIS_FILTER = f/N0CALL/50 -#for server other than default to rotate.aprs.net:14580, ie. local xastir +# for server other than default to rotate.aprs.net:14580, ie. local xastir APRS_HOST = localhost APRS_PORT = 2023 diff --git a/setup.py b/setup.py index 0e1c83c..1ac9b32 100644 --- a/setup.py +++ b/setup.py @@ -51,7 +51,7 @@ def publish(): packages=[__title__], package_dir={__title__: __title__}, url=f"https://github.com/ampledata/{__title__}", - entry_points={"console_scripts": [f"{__title__} = {__title__}.commands"]}, + entry_points={"console_scripts": [f"{__title__} = {__title__}.commands:main"]}, description="APRS Cursor-on-Target Gateway.", author="Greg Albrecht", author_email="oss@undef.net", diff --git a/tox.ini b/tox.ini deleted file mode 100644 index 73efa6b..0000000 --- a/tox.ini +++ /dev/null @@ -1,5 +0,0 @@ -[tox] - -[testenv] -deps = pytest -commands = pytest