56 lines
1.6 KiB
Python
56 lines
1.6 KiB
Python
import ctypes
|
|
from ..datatypes.navigation import Semicircle
|
|
from ..datatypes.enums import RdrModes
|
|
|
|
class RdrModeCommandBits(ctypes.LittleEndianStructure):
|
|
"""Bitfield structure for Radar Mode Command Word."""
|
|
_pack_ = 1
|
|
_fields_ = [
|
|
("spare", ctypes.c_uint16, 1),
|
|
("transfer_feature_bug", ctypes.c_uint16, 1),
|
|
("sar_type", ctypes.c_uint16, 1),
|
|
("silence", ctypes.c_uint16, 1),
|
|
("reserved11", ctypes.c_uint16, 1),
|
|
("stop_powerup", ctypes.c_uint16, 1),
|
|
("freeze", ctypes.c_uint16, 1),
|
|
("stby", ctypes.c_uint16, 1),
|
|
("ibit", ctypes.c_uint16, 1),
|
|
("des_ctrl", ctypes.c_uint16, 3),
|
|
("master_mode", ctypes.c_uint16, 4),
|
|
]
|
|
|
|
_enums_ = {
|
|
"master_mode": RdrModes
|
|
}
|
|
|
|
class RdrModeCommandWord(ctypes.Union):
|
|
"""Radar Mode Command Word (16 bits)."""
|
|
_pack_ = 1
|
|
_fields_ = [
|
|
("raw", ctypes.c_uint16),
|
|
("bits", RdrModeCommandBits)
|
|
]
|
|
|
|
class RdrFunAndParam1(ctypes.Union):
|
|
"""Function and Parameter 1 (placeholder for now)."""
|
|
_pack_ = 1
|
|
_fields_ = [("raw", ctypes.c_uint16)]
|
|
|
|
class RdrFunAndParam2(ctypes.Union):
|
|
"""Function and Parameter 2 (placeholder for now)."""
|
|
_pack_ = 1
|
|
_fields_ = [("raw", ctypes.c_uint16)]
|
|
|
|
class MsgA2Payload(ctypes.Structure):
|
|
"""
|
|
Payload structure for Message A2: Radar Operation Command.
|
|
"""
|
|
_pack_ = 1
|
|
_fields_ = [
|
|
("rdr_mode_command", RdrModeCommandWord),
|
|
("param1", RdrFunAndParam1),
|
|
("param2", RdrFunAndParam2),
|
|
]
|
|
|
|
# Rimosso __init__ - ctypes.Structure gestisce automaticamente l'inizializzazione
|