File: fossasat_2.py

package info (click to toggle)
gr-satellites 5.8.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 10,836 kB
  • sloc: python: 29,546; cpp: 5,448; ansic: 1,247; sh: 118; makefile: 24
file content (43 lines) | stat: -rw-r--r-- 1,463 bytes parent folder | download | duplicates (3)
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
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

# Copyright 2020 jgromes <gromes.jan@gmail.com>
#
# This file is part of gr-satellites
#
# SPDX-License-Identifier: GPL-3.0-or-later
#

from construct import *

from ..adapters import LinearAdapter
from .fossasat import *

fossasat_2 = Struct(
    'callsign' / Const(b"FOSSASAT-2"),
    'func_id' / FuncId,
    'opt_data_len' / Optional(Int8ul),
    'payload' / Switch(this.func_id, {
        'RESP_PONG': Pong,
        'RESP_REPEATED_MESSAGE': RepeatedMessage,
        'RESP_REPEATED_MESSAGE_CUSTOM': RepeatedMessage,
        'RESP_SYSTEM_INFO': SystemInfo,
        'RESP_PACKET_INFO': PacketInfo,
        'RESP_STATISTICS': Statistics,
        'RESP_FULL_SYSTEM_INFO': FullSystemInfo,
        'RESP_STORE_AND_FORWARD_ASSIGNED_SLOT': StoreAndForwardAssigned,
        'RESP_FORWARDED_MESSAGE': ForwardedMessage,
        'RESP_PUBLIC_PICTURE': CameraPicture,
        'RESP_DEPLOYMENT_STATE': DeploymentState,
        'RESP_CAMERA_STATE': CameraState,
        'RESP_RECORDED_IMU': RecordedIMU,
        'RESP_MANUAL_ACS_RESULT': ManualACSResult,
        'RESP_GPS_LOG': GPSLog,
        'RESP_GPS_LOG_STATE': GPSLogState,
        'RESP_FLASH_CONTENTS': FlashContents,
        'RESP_CAMERA_PICTURE': CameraPicture,
        'RESP_CAMERA_PICTURE_LENGTH': CameraPictureLength,
        'RESP_GPS_COMMAND_RESPONSE': GPSCommandResponse,
        'RESP_ACKNOWLEDGE': Acknowledge,
        }, default=HexDump(GreedyBytes)),
    )