PositionPacket

class aprspy.packets.position.CompressionFix

Enum to represent GPS fix types.

See APRS 1.01 C9 P39.

  • OLD - old (last) GPS fix

  • CURRENT - current GPS fix

class aprspy.packets.position.CompressionSource

Enum to represent NMEA sources.

See APRS 1.01 C9 P39.

  • OTHER - other

  • GLL - GPS GLL

  • GGA - GPS GGA

  • RMC - GPS RMC

See https://www.gpsinformation.org/dale/nmea.htm for an explanation of the various GPS sentence types.

class aprspy.packets.position.CompressionOrigin

Enum to represent the compression origin.

See APRS 1.01 C9 P39.

  • COMPRESSED - Compressed

  • TNC_BTEXT - TNC BText

  • SOFTWARE - Software applications

  • TBD - TBD

  • KPC3 - KPC3 TNC

  • PICO - Pico

  • OTHER - Other trackers

  • DIGIPEATER - Digipeater conversion

class aprspy.packets.position.PositionPacket(latitude: float = 0.0, longitude: float = 0.0, ambiguity: int = 0, course: int = None, speed: float = None, altitude: int = None, comment: str = None, power: int = None, height: int = None, gain: int = None, directivity: int = None, radio_range: int = None, strength: int = None, bearing: int = None, number: float = None, df_range: int = None, quality: int = None, compressed: bool = False, messaging: bool = False, data_type_id: str = '!', compression_fix: aprspy.packets.position.CompressionFix = None, compression_source: aprspy.packets.position.CompressionSource = None, compression_origin: aprspy.packets.position.CompressionOrigin = None, *args, **kwargs)

Class to represent various kinds of position packets.

This class represents packets which provide position information - including weather reports.

__init__(latitude: float = 0.0, longitude: float = 0.0, ambiguity: int = 0, course: int = None, speed: float = None, altitude: int = None, comment: str = None, power: int = None, height: int = None, gain: int = None, directivity: int = None, radio_range: int = None, strength: int = None, bearing: int = None, number: float = None, df_range: int = None, quality: int = None, compressed: bool = False, messaging: bool = False, data_type_id: str = '!', compression_fix: aprspy.packets.position.CompressionFix = None, compression_source: aprspy.packets.position.CompressionSource = None, compression_origin: aprspy.packets.position.CompressionOrigin = None, *args, **kwargs)

Initialize self. See help(type(self)) for accurate signature.

__repr__()

Return repr(self).

static _generate_compressed_byte(fix: aprspy.packets.position.CompressionFix, source: aprspy.packets.position.CompressionSource, origin: aprspy.packets.position.CompressionOrigin) → str

Generate the compression byte based on the fix, source and origin values.

Parameters

For more information, see APRS 1.01 C9 P39.

classmethod _generate_compressed_position(latitude: float, longitude: float, symbol_table: str, symbol_id: str, altitude: int = None, course: int = None, speed: int = None, radio_range: int = None, fix: aprspy.packets.position.CompressionFix = <CompressionFix.OLD: 0>, source: aprspy.packets.position.CompressionSource = <CompressionSource.OTHER: 0>, origin: aprspy.packets.position.CompressionOrigin = <CompressionOrigin.SOFTWARE: 2>) → str

Generate compressed position data for a packet.

Parameters
  • latitude (float) – the position’s latitude

  • longitude (float) – the position’s longitude

  • symbol_table (str) – the symbol table reference

  • symbol_id (str) – the symbol ID

  • altitude (int) – the altitude, in feet

  • course (int) – the course, in degrees

  • speed (int) – the speed, in knots

  • radio_range (int) – the radio range, in miles

  • fix (str) – the GPS fix type

  • source (str) – the NMEA source

  • origin (str) – the compression origin

Given the latitude, longitude, symbol table, symbol ID, this will return an information field containing these values in an uncompressed format.

Additional (mutually exclusive) optional values can also be added:- * course and speed * altitude * radio range

The fix, source and origin values are used to generate the ‘Compression byte’ (see APRS 1.01 C9 P39). See CompressionFix, CompressionSource and CompressionOrigin.

If altitude is specified, then source will be overridden.

static _generate_data(phg: str = None, rng: str = None, dfs: str = None, course: int = None, speed: int = None, altitude: int = None, comment: str = None) → str

Generate additional information for the information field.

Parameters
  • phg (str) – a PHG value

  • rng (str) – an RNG value

  • dfs (str) – a DFS value

  • course (int) – course, in degrees

  • speed (int) – speed, in knots

  • altitude (int) – altitude, in feet

  • comment (str) – a comment

Position packets can have additional information in them, such as station power, antenna height, antenna gain, etc. These are described in APRS 1.01 C7. This will generate an information field based on these values.

Note that PHG, RNG, DFS and course/speed are mutually exclusive. Altitude is specified as part of the comment and so can coexist with any of the other values.

static _generate_uncompressed_position(latitude: float, longitude: float, symbol_table: str, symbol_id: str, ambiguity: int = 0) → str

Generate uncompressed position data for a packet.

Parameters
  • latitude (float) – the position’s latitude

  • longitude (float) – the position’s longitude

  • ambiguity (int) – the level of ambiguity for the position

  • symbol_table (str) – the symbol table reference

  • symbol_id (str) – the symbol ID

Given the latitude, longitude, symbol table, symbol ID and an optional ambiguity value, this will return an information field containing these values in an uncompressed format.

_parse() → bool

Parse a position packet.

There are a number of different position packet types - with or without a timestamp, and with or without messaging capability. The data type ID is used to distinguish between them.

The position data itself can either be compressed or uncompressed, regardless of the data type ID.

The parsed and decoded values are stored in the current object.

static _parse_compressed_byte(compression_byte: str) → Tuple[aprspy.packets.position.CompressionFix, aprspy.packets.position.CompressionSource, aprspy.packets.position.CompressionOrigin]

Parse the compression byte.

Parameters

compression_byte (str) – the compression byte

This will return a tuple of Enums denoting the compression fix, source and origin.

For more information, see APRS 1.01 C9 P39.

classmethod _parse_compressed_position(data: str) → Tuple[float, float, Optional[float], Optional[float], Optional[float], Optional[float], Optional[aprspy.packets.position.CompressionFix], Optional[aprspy.packets.position.CompressionSource], Optional[aprspy.packets.position.CompressionOrigin]]

Parse compressed position data from a packet.

Parameters

data (str) – the information field of a packet, minus the initial data type identifier

Given the information field of a packet with the initial data type identifier stripped, this will parse the latitude and longitude, and optionally the altitude, course, speed and radio range.

static _parse_data(data: str) → Tuple[str, str, str, int, int, int, str]

Parse additional information from the information field.

Parameters

data (str) – the information field of a packet, minus the initial data type identifier

Position packets can have additional information in them, such as station power, antenna height, antenna gain, etc. These are described in APRS 1.01 C7. This will parse out the raw values, but not decode them.

static _parse_uncompressed_position(data: str) → Tuple[float, float, int, str, str]

Parse uncompressed position data from a packet.

Parameters

data (str) – the information field of a packet, minus the initial data type identifier

Given the information field of a packet with the initial data type identifier stripped, this will parse the latitude, longitude, position ambiguity, symbol table and symbol ID, and return them in a tuple.

property altitude

Get the altitude of the station

property ambiguity

Get the ambiguity level of the packet

property bearing

Get the DF signal bearing (in degrees)

property comment

Get the packet’s comment

property compressed

Get whether this packet is using compressed positions or not

property compression_fix

Get the compression fix type.

property compression_origin

Get the compression origin type.

property compression_source

Get the compression source type.

property course

Get the course of the station

property df_range

Get the DF range (in miles)

property directivity

Get the antenna directivity (in degrees)

property gain

Get the antenna gain (in dB)

property height

Get the antenna height above average terrain (in feet)

property info

Generate the information field for a position packet.

property latitude

Get the latitude of the station

property longitude

Get the longitude of the station

property messaging

Get whether this station is message-capable or not

property number

Get the DF hit ratio percentage

property point

Get a point representing the latitude, longitude and optionally the altitude

property power

Get the power (in watts)

property quality

Get the DF bearing accuracy (in degrees)

property radio_range

Get the radio range (in miles)

property speed

Get the speed of the station

property strength

Get the DF signal strength (in S-points)