Skip to content

Commit

Permalink
Send all custom fields via UDP broadcast, add baud rate and modulatio…
Browse files Browse the repository at this point in the history
…n details to sondehub uploader
  • Loading branch information
Mark Jessop authored and Mark Jessop committed Sep 17, 2022
1 parent a377c0a commit 84ad11e
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 4 deletions.
2 changes: 1 addition & 1 deletion horusdemodlib/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.3.7"
__version__ = "0.3.9"
5 changes: 5 additions & 0 deletions horusdemodlib/horusudp.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ def send_payload_summary(telemetry, port=55672, comment="HorusDemodLib"):
if 'speed' in telemetry:
packet['speed'] = telemetry['speed']

# Add in any field names from the custom field section
if "custom_field_names" in telemetry:
for _custom_field_name in telemetry["custom_field_names"]:
if _custom_field_name in telemetry:
packet[_custom_field_name] = telemetry[_custom_field_name]

# Set up our UDP socket
_s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
Expand Down
6 changes: 6 additions & 0 deletions horusdemodlib/sondehubamateur.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,12 @@ def reformat_data(self, telemetry):
if "modulation" in telemetry:
_output["modulation"] = telemetry["modulation"]

if "modulation_detail" in telemetry:
_output["modulation_detail"] = telemetry["modulation_detail"]

if "baud_rate" in telemetry:
_output["baud_rate"] = telemetry["baud_rate"]

# Add in any field names from the custom field section
if "custom_field_names" in telemetry:
for _custom_field_name in telemetry["custom_field_names"]:
Expand Down
13 changes: 11 additions & 2 deletions horusdemodlib/uploader.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ def main():
# parser.add_argument("--summary", type=int, default=-1, help="Override user.cfg UDP Summary output port. (NOT IMPLEMENTED)")
parser.add_argument("--freq_hz", type=float, default=None, help="Receiver IQ centre frequency in Hz, used in determine the absolute frequency of a telemetry burst.")
parser.add_argument("--freq_target_hz", type=float, default=None, help="Receiver 'target' frequency in Hz, used to add metadata to station position info.")
parser.add_argument("--baud_rate", type=int, default=None, help="Modulation baud rate (Hz), used to add additional metadata info.")
parser.add_argument("-v", "--verbose", action="store_true", default=False, help="Verbose output (set logging level to DEBUG)")
args = parser.parse_args()

Expand Down Expand Up @@ -184,6 +185,10 @@ def main():
_decoded['f_centre'] = int(demod_stats.fest_mean) + int(args.freq_hz)
habitat_uploader.last_freq_hz = _decoded['f_centre']

# Add in baud rate, if provided.
if args.baud_rate:
_decoded['baud_rate'] = int(args.baud_rate)

# Send via UDP
send_payload_summary(_decoded, port=user_config['summary_port'])

Expand Down Expand Up @@ -229,11 +234,15 @@ def main():
_decoded['f_centre'] = int(demod_stats.fest_mean) + int(args.freq_hz)
habitat_uploader.last_freq_hz = _decoded['f_centre']

# Add in baud rate, if provided.
if args.baud_rate:
_decoded['baud_rate'] = int(args.baud_rate)

# Send via UDP
send_payload_summary(_decoded, port=user_config['summary_port'])

# Upload to Habitat
habitat_uploader.add(_decoded['ukhas_str']+'\n')
# Do not upload Horus Binary packets to the Habitat endpoint.
# habitat_uploader.add(_decoded['ukhas_str']+'\n')

# Upload the string to Sondehub Amateur
sondehub_uploader.add(_decoded)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "horusdemodlib"
version = "0.3.7"
version = "0.3.9"
description = "Project Horus HAB Telemetry Demodulators"
authors = ["Mark Jessop"]
license = "LGPL-2.1-or-later"
Expand Down

0 comments on commit 84ad11e

Please sign in to comment.