Communication Package

tmtccmd.com.tcpip_utils.determine_recv_buffer_len(json_cfg_path: str, tcpip_type: TcpIpType)
tmtccmd.com.tcpip_utils.determine_tcp_send_address(cfg_path: str) EthAddr | None
tmtccmd.com.tcpip_utils.determine_udp_recv_address(cfg_path: str) EthAddr | None
tmtccmd.com.tcpip_utils.determine_udp_send_address(cfg_path: str) EthAddr | None
tmtccmd.com.tcpip_utils.load_tcpip_address_from_toml(tcpip_type: TcpIpType, toml_cfg_path: str) EthAddr | None
tmtccmd.com.tcpip_utils.load_tcpip_address_json(tcpip_type: TcpIpType, json_cfg_path: str) EthAddr | None
tmtccmd.com.tcpip_utils.prompt_ip_address(type_str: str) EthAddr

Prompt a valid IP address from the user

tmtccmd.com.tcpip_utils.prompt_recv_buffer_len(tcpip_type: TcpIpType) int
tmtccmd.com.ser_utils.check_port_validity(com_port_to_check: str) bool
tmtccmd.com.ser_utils.determine_baud_rate(cfg_path: str) int | None

Determine baud rate. Tries to read from JSON first. If the baud rate is not contained in the config JSON, prompt it from user instead with the option to store value in JSON file.

Returns:

Determined baud rate

tmtccmd.com.ser_utils.determine_com_port(cfg_path: str) str | None

Determine serial port. Tries to read from JSON first. If the serial port is not contained in the config JSON, prompt it from user instead with the option to store value in JSON file.

Returns:

Determined serial port

tmtccmd.com.ser_utils.find_com_port_from_hint(hint: str) tuple[bool, str]

Find a COM port based on a hint string

tmtccmd.com.ser_utils.load_baud_rate_from_json(cfg_path: str) int | None
tmtccmd.com.ser_utils.load_baud_rate_from_toml(cfg_path: str) int | None
tmtccmd.com.ser_utils.load_serial_port_from_toml(cfg_path: str) str | None
tmtccmd.com.ser_utils.prompt_com_port() str

Dummy Virtual Communication Interface. Currently serves to use the TMTC program without needing external hardware or an extra socket

class tmtccmd.com.dummy.DummyHandler

Bases: object

generate_reply_package()

Generate a reply package. Currently, this only generates a reply for a ping telecommand.

insert_telecommand(data: bytearray | bytes)
receive_reply_package() list[bytes]
class tmtccmd.com.dummy.DummyInterface

Bases: ComInterface

close(args: Any | None = None) None

Closes the ComIF and releases any held resources (for example a Communication Port).

Returns:

property id: str
initialize(args: Any | None = None) None

Perform initializations step which can not be done in constructor or which require returnvalues.

is_open() bool

Can be used to check whether the communication interface is open. This is useful if opening a COM interface takes a longer time and is non-blocking

open(args: Any | None = None) None

Opens the communication interface to allow communication.

Returns:

packets_available(parameters: Any = 0) int

Poll whether packets are available.

Parameters:

parameters – Can be an arbitrary parameter.

Raises:

ReceptionDecodeError – If the underlying COM interface uses encoding and decoding when determining the number of available packets, this exception can be thrown on decoding errors.

Returns:

Number of packets available.

receive(parameters: Any = 0) list[bytes]

Returns a list of received packets. The child class can use a separate thread to poll for the packets or use some other mechanism and container like a deque to store packets to be returned here.

Parameters:

parameters

Raises:

ReceptionDecodeError – If the underlying COM interface uses encoding and decoding and the decoding fails, this exception will be returned.

Returns:

send(data: bytes | bytearray)

Send raw data.

Raises:

SendError – Sending failed for some reason.

tmtccmd.com.utils.determine_com_if(com_if_dict: Mapping[str, tuple[str, Any]], cfg_path: str, use_prompts: bool) str
tmtccmd.com.utils.load_com_if_from_json(cfg_path: str) str | None
tmtccmd.com.utils.load_com_if_from_toml(cfg_path: str) str | None
tmtccmd.com.utils.prompt_com_if(com_if_dict: Mapping[str, tuple[str, Any]]) str
tmtccmd.com.utils.store_com_if_json(com_if_string: str, json_cfg_path: str)