diff --git a/adsbcot/__init__.py b/adsbcot/__init__.py index d905665..5f9e75d 100644 --- a/adsbcot/__init__.py +++ b/adsbcot/__init__.py @@ -40,7 +40,6 @@ from .classes import ADSBWorker, ADSBNetReceiver, ADSBNetWorker # NOQA except ImportError as exc: import warnings - warnings.warn( - "Unable to import required modules, IGNORING for Python 3.6 compat. Original Exception: " - ) + warnings.warn(str(exc)) + warnings.warn("ADSBCOT ignoring ImportError - Python 3.6 compat work-around.") diff --git a/adsbcot/classes.py b/adsbcot/classes.py index 9368c25..c4b5179 100644 --- a/adsbcot/classes.py +++ b/adsbcot/classes.py @@ -37,16 +37,18 @@ # We don't require inotify, as it only would work on Linux try: from asyncinotify import Inotify, Mask -except: - pass +except ImportError as exc: + warnings.warn(str(exc)) + warnings.warn("ADSBCOT ignoring ImportError for: asyncinotify") # We won't use pyModeS if it isn't installed: try: import pyModeS.streamer.source import pyModeS.streamer.decode import pyModeS as pms -except ImportError: - pass +except ImportError as exc: + warnings.warn(str(exc)) + warnings.warn("ADSBCOT ignoring ImportError for: pyModeS") __author__ = "Greg Albrecht " @@ -179,7 +181,9 @@ async def run(self, _=-1) -> None: alt_upper: int = int(self.config.get("ALT_UPPER", "0")) alt_lower: int = int(self.config.get("ALT_LOWER", "0")) if alt_upper or alt_lower: - self._logger.info("Using Altitude Filters: Upper = %s, Lower = %s", alt_upper, alt_lower) + self._logger.info( + "Using Altitude Filters: Upper = %s, Lower = %s", alt_upper, alt_lower + ) feed_url: ParseResultBytes = urlparse(url) @@ -223,7 +227,9 @@ async def get_file_feed(self, feed_url) -> None: if data is None: return - self._logger.info("Retrieved %s ADS-B aircraft messages.", str(len(data) or "No")) + self._logger.info( + "Retrieved %s ADS-B aircraft messages.", str(len(data) or "No") + ) await self.handle_data(data) @@ -416,8 +422,12 @@ async def handle_data(self, data: list) -> None: else: continue - if "~" in icao and not self.config.getboolean("INCLUDE_TISB"): - continue + if "~" in icao: + if not self.config.getboolean("INCLUDE_TISB"): + continue + else: + if self.config.getboolean("TISB_ONLY"): + continue known_craft: dict = aircot.get_known_craft(self.known_craft_db, icao, "HEX") diff --git a/adsbcot/constants.py b/adsbcot/constants.py index c08b67b..a5d1449 100644 --- a/adsbcot/constants.py +++ b/adsbcot/constants.py @@ -30,5 +30,5 @@ DEFAULT_POLL_INTERVAL: str = "3" # Default non-HTTP TCP ports for raw & beast. -DEFAULT_TCP_RAW_PORT: int = 30002 +DEFAULT_TCP_RAW_PORT: int = 30003 DEFAULT_TCP_BEAST_PORT: int = 30005 diff --git a/adsbcot/functions.py b/adsbcot/functions.py index abf0b8e..76977d6 100644 --- a/adsbcot/functions.py +++ b/adsbcot/functions.py @@ -45,9 +45,7 @@ pass -def create_tasks( - config: SectionProxy, clitool: pytak.CLITool -) -> Set[pytak.Worker,]: +def create_tasks(config: SectionProxy, clitool: pytak.CLITool) -> Set[pytak.Worker,]: """Create specific coroutine task set for this application. Parameters @@ -84,9 +82,12 @@ def create_tasks( elif "tcp" in feed_url.scheme: if importlib.util.find_spec("pyModeS") is None: warnings.warn( - (f"Please reinstall {APP_NAME} with pyModeS support:" - f"$ python3 -m pip install {APP_NAME}[with_pymodes]"), - ImportWarning) + ( + f"Please reinstall {APP_NAME} with pyModeS support:" + f"$ python3 -m pip install {APP_NAME}[with_pymodes]" + ), + ImportWarning, + ) raise ValueError net_queue: asyncio.Queue = asyncio.Queue() @@ -206,7 +207,9 @@ def adsb_to_cot_xml( # NOQA pylint: disable=too-many-locals,too-many-branches,t else: callsign = icao_hex - _, callsign = aircot.set_name_callsign(icao_hex, reg, craft_type, flight, known_craft) + _, callsign = aircot.set_name_callsign( + icao_hex, reg, craft_type, flight, known_craft + ) cat = aircot.set_category(cat, known_craft) cot_type = aircot.set_cot_type(icao_hex, cat, flight, known_craft) @@ -268,5 +271,7 @@ def adsb_to_cot( """Return CoT XML object as an XML string.""" cot: Optional[etree.Element] = adsb_to_cot_xml(craft, config, known_craft) return ( - b"\n".join([pytak.DEFAULT_XML_DECLARATION, etree.tostring(cot)]) if cot else None + b"\n".join([pytak.DEFAULT_XML_DECLARATION, etree.tostring(cot)]) + if cot + else None ) diff --git a/docs/configuration.md b/docs/configuration.md index a7e12a0..3c447db 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -17,7 +17,7 @@ ADSBCOT has the following built-in configuration parameters: - ``tcp+beast://`` A dump1090 Beast binary mode host & port URL (ex. ``tcp+beast://sensor.example.com:30005``). * **`POLL_INTERVAL`**: - * Default: ``30`` + * Default: ``3`` seconds If the `FEED_URL` is of type HTTP, the period, in seconds, to poll this URL. diff --git a/docs/examples.md b/docs/examples.md index 23712b7..9f99fee 100644 --- a/docs/examples.md +++ b/docs/examples.md @@ -8,7 +8,7 @@ ADS-B data is transformed into TAK data and forwarded to our TAK Server over TCP ```ini [adsbcot] COT_URL = tcp://takserver.example.com:8087 -FEED_URL = tcp+beast://sensor.example.com:30003 +FEED_URL = tcp://sensor.example.com:30003 ``` ### Usage @@ -26,7 +26,7 @@ ADS-B data is transformed into TAK data and forwarded to our ATAK Mesh SA Multic ```ini [adsbcot] COT_URL = udp+wo://239.2.3.1:6969 -FEED_URL = tcp+beast://10.1.2.24:30003 +FEED_URL = tcp://10.1.2.24:30003 ``` ### Usage diff --git a/docs/index.md b/docs/index.md index a0da36a..0500d88 100644 --- a/docs/index.md +++ b/docs/index.md @@ -4,7 +4,7 @@ ADSBCOT is software for monitoring and analyzing aviation surveillance data via the Team Awareness Kit (TAK) ecosystem of products. -ADSBCOT captures & reports real-time ADS-B data received from aircraft (or other airbrone vehicles and drones) into TAK products using native TAK protocols, including Cursor on Target (CoT). +ADSBCOT captures & reports real-time ADS-B data received from aircraft (and other airborne vehicles & drones) into TAK products using native TAK protocols, including Cursor on Target (CoT). ADSBCOT has been evaluated with WinTAK, iTAK, ATAK & TAK Server. diff --git a/mkdocs.yml b/mkdocs.yml index 724f945..e706793 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -1,7 +1,7 @@ -site_name: ADSBXCOT - Display Aircraft in TAK -site_url: https://adsbxcot.rtfd.io/ -repo_url: https://github.com/snstac/adsbxcot/ -site_description: A gateway for displaying aircraft tracks from ADS-B Aggregators in TAK Products, including ATAK. +site_name: ADSBCOT - Display Aircraft in TAK +site_url: https://adsbcot.rtfd.io/ +repo_url: https://github.com/snstac/adsbcot/ +site_description: Software for monitoring and analyzing aviation surveillance data via the Team Awareness Kit (TAK) ecosystem of products. site_author: Greg Albrecht copyright: Copyright Sensors & Signals LLC https://www.snstac.com diff --git a/tests/test_functions.py b/tests/test_functions.py index 3d5b346..2154c86 100644 --- a/tests/test_functions.py +++ b/tests/test_functions.py @@ -57,7 +57,7 @@ "version": 2, "reg": "test_reg_1234", "squawk": "3514", - "t": "test_craft_type_1234" + "t": "test_craft_type_1234", }, { "alt_baro": 37000,