1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2019 Daniel Estevez <daniel@destevez.net>
#
# This file is part of gr-satellites
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
from construct import *
from .csp import CSPHeader
from ..adapters import UNIXTimestampAdapter, LinearAdapter
Voltage = LinearAdapter(1000.0, Int16ub)
Timestamp = UNIXTimestampAdapter(Int32ub)
EPS = Struct(
'timestamp' / Timestamp,
'vboost' / Voltage[3],
'vbatt' / Voltage,
'curout' / Int16ub[7],
'curin' / Int16ub[3],
'cursun' / Int16ub,
'cursys' / Int16ub,
'eps_temp' / Int16sb[6],
'battmode' / Int8ub
)
Temperature = LinearAdapter(10.0, Int16sb)
COM = Struct(
'timestamp' / Timestamp,
'temp_brd' / Temperature,
'temp_pa' / Temperature,
'last_rssi' / Int16sb,
'last_rferr' / Int16sb,
'bgnd_rssi' / Int16sb
)
OBC = Struct(
'timestamp' / Timestamp,
'cur_gssb' / Int16ub[2],
'cur_flash' / Int16ub,
'temp' / Temperature[2]
)
ADCS = Struct(
'timestamp' / Timestamp,
'cur_gssb' / Int16ub[2],
'cur_flash' / Int16ub,
'cur_pwm' / Int16ub,
'cur_gps' / Int16ub,
'cur_wde' / Int16ub,
'temp' / Temperature[2]
)
ADSB = Struct(
'timestamp' / Timestamp,
'cur5v0brd' / Int16ub,
'cur3v3brd' / Int16ub,
'cur3v3sd' / Int16ub,
'cur1v2' / Int16ub,
'cur2v5' / Int16ub,
'cur3v3fpga' / Int16ub,
'cur3v3adc' / Int16ub,
'last_icao' / Hex(Int32ub),
'last_lat' / Float32b,
'last_lon' / Float32b,
'last_alt' / Int32ub,
'last_time' / Timestamp
)
gomx_3 = Struct(
'csp_header' / CSPHeader,
'beacon_type' / Int8ub,
'beacon' / If(
((this.csp_header.destination == 10)
& (this.csp_header.destination_port == 30)
& (this.csp_header.source == 1)
& (this.beacon_type == 0)),
Struct(
'eps' / EPS,
'com' / COM,
'obc' / OBC,
'adcs' / ADCS,
'adsb' / ADSB
)
)
)
|