Skip to content

Commit

Permalink
a couple of linking and style fix-ups
Browse files Browse the repository at this point in the history
  • Loading branch information
ampledata committed Jan 17, 2024
1 parent 2c9f832 commit b984f00
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 29 deletions.
5 changes: 2 additions & 3 deletions adsbcot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
26 changes: 18 additions & 8 deletions adsbcot/classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>"
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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)


Expand Down Expand Up @@ -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")

Expand Down
2 changes: 1 addition & 1 deletion adsbcot/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
21 changes: 13 additions & 8 deletions adsbcot/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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
)
2 changes: 1 addition & 1 deletion docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
4 changes: 2 additions & 2 deletions docs/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
8 changes: 4 additions & 4 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>
copyright: Copyright Sensors & Signals LLC https://www.snstac.com

Expand Down
2 changes: 1 addition & 1 deletion tests/test_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit b984f00

Please sign in to comment.