Skip to content

Commit

Permalink
Merge pull request #79 from us-irs/ecss-tmtc-ctor-default-apid
Browse files Browse the repository at this point in the history
allow setting APID for packets separately
  • Loading branch information
robamu committed Apr 23, 2024
2 parents bd352cc + fc34df6 commit a514263
Show file tree
Hide file tree
Showing 15 changed files with 30 additions and 9 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

# [unreleased]

# [v0.24.1] 2024-04-23

## Reverted

- The `apid` constructor arguments for the PUS TMTC constructors now have a default value of 0.
This allows setting the APID in a centralized manner for APID groups and can reduce duplication.

# [v0.24.0] 2024-04-23

## Removed
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
name = "spacepackets"
description = "Various CCSDS and ECSS packet implementations"
readme = "README.md"
version = "0.24.0"
version = "0.24.1"
requires-python = ">=3.8"
license = {text = "Apache-2.0"}
authors = [
Expand Down Expand Up @@ -38,7 +38,7 @@ dependencies = [
[tool.setuptools.packages]
find = {}

[tool.ruff]
[tool.ruff.lint]
ignore = ["E501"]
[tool.ruff.extend-per-file-ignores]
[tool.ruff.lint.extend-per-file-ignores]
"__init__.py" = ["F401"]
1 change: 1 addition & 0 deletions spacepackets/ccsds/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""This package contains all CCSDS related components"""

from .spacepacket import (
SpHeader,
SpacePacketHeader,
Expand Down
1 change: 1 addition & 0 deletions spacepackets/ccsds/spacepacket.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""This module also includes the :py:class:`SpacePacketHeader` class, which is the header component
of all CCSDS packets."""

from __future__ import annotations

from abc import abstractmethod, ABC
Expand Down
1 change: 1 addition & 0 deletions spacepackets/ccsds/time/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"""This module contains the CCSDS specific time code implementations."""

from .common import CcsdsTimeProvider, CcsdsTimeCodeId, SECONDS_PER_DAY, MS_PER_DAY
from .cds import CdsShortTimestamp
1 change: 1 addition & 0 deletions spacepackets/cfdp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
You can find a usage example including multiple packet data units used to perform a full
unacknowledged file transfer on the :ref:`example <examples:CFDP Packets>` page.
"""

from .defs import (
PduType,
ChecksumType,
Expand Down
1 change: 1 addition & 0 deletions spacepackets/cfdp/tlv/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Please note that most of the submodules of the TLV submodule are re-exported, so usually you
can import everything from :py:mod:`spacepackets.cfdp.tlv`"""

from .tlv import (
CfdpTlv,
EntityIdTlv,
Expand Down
1 change: 1 addition & 0 deletions spacepackets/cfdp/tlv/msg_to_user.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""This submodule contains the Message To User TLV abstractions. It also contains
the Reserved CFDP Message abstractions which are a subtype of the Message To User TLV.
"""

from __future__ import annotations

import dataclasses
Expand Down
3 changes: 2 additions & 1 deletion spacepackets/cfdp/tlv/tlv.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,8 @@ def from_tlv(cls, cfdp_tlv: CfdpTlv) -> FaultHandlerOverrideTlv:

def create_cfdp_proxy_and_dir_op_message_marker() -> bytes:
"""CCSDS 727.0-B-5 p.88: The message identifier for standard CFDP proxy and dir op messages
is the presence of the ASCII characters 'cfdp' in the first four octests of each message"""
is the presence of the ASCII characters 'cfdp' in the first four octests of each message
"""
return "cfdp".encode()


Expand Down
1 change: 1 addition & 0 deletions spacepackets/crc.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""This modules contains generic CRC support."""

from crcmod.predefined import mkPredefinedCrcFun

#: CRC calculator function as specified in the PUS standard B.1
Expand Down
3 changes: 2 additions & 1 deletion spacepackets/ecss/tc.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""This module contains the PUS telecommand class representation to pack telecommands, most notably
the :py:class:`PusTelecommand` class.
"""

from __future__ import annotations

from spacepackets import BytesTooShortError
Expand Down Expand Up @@ -119,9 +120,9 @@ class PusTc(AbstractSpacePacket):

def __init__(
self,
apid: int,
service: int,
subservice: int,
apid: int = 0,
app_data: bytes = bytes(),
seq_count: int = 0,
source_id: int = 0,
Expand Down
3 changes: 2 additions & 1 deletion spacepackets/ecss/tm.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""This module contains import PUS TM packet classes, most notably the
:py:class:`spacepackets.ecss.tm.PusTelemetry` class.
"""

from __future__ import annotations

from abc import abstractmethod
Expand Down Expand Up @@ -224,11 +225,11 @@ class PusTm(AbstractPusTm):

def __init__(
self,
apid: int,
service: int,
subservice: int,
timestamp: bytes,
source_data: bytes = bytes(),
apid: int = 0,
seq_count: int = 0,
message_counter: int = 0,
space_time_ref: int = 0b0000,
Expand Down
1 change: 1 addition & 0 deletions spacepackets/seqcount.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""This module provides generic sequence counter abstractions and implementation which are commonly
needed when working with space packet protocols.
"""

from abc import abstractmethod, ABC
from pathlib import Path

Expand Down
3 changes: 2 additions & 1 deletion spacepackets/uslp/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ class TfdzConstructionRules(enum.IntEnum):

class UslpProtocolIdentifier(enum.IntEnum):
"""Also called UPID. Identifies the CCSDS recognized protocol, procedure, or type of data
contained within the TFDZ. See list here: https://sanaregistry.org/r/uslp_protocol_id/"""
contained within the TFDZ. See list here: https://sanaregistry.org/r/uslp_protocol_id/
"""

SPACE_PACKETS_ENCAPSULATION_PACKETS = 0b00000
COP_1_CTRL_COMMANDS = 0b00001
Expand Down
6 changes: 4 additions & 2 deletions spacepackets/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ def unsigned_struct_specifier(byte_num: int) -> str:
@staticmethod
def to_signed(byte_num: int, val: int) -> bytes:
"""Convert number of bytes in a field to the struct API signed format specifier,
assuming network endianness. Raises value error if number is not inside [1, 2, 4, 8]"""
assuming network endianness. Raises value error if number is not inside [1, 2, 4, 8]
"""
if byte_num not in [0, 1, 2, 4, 8]:
raise ValueError("Invalid byte number, must be one of [0, 1, 2, 4, 8]")
if byte_num == 0:
Expand All @@ -92,7 +93,8 @@ def to_signed(byte_num: int, val: int) -> bytes:
@staticmethod
def to_unsigned(byte_num: int, val: int) -> bytes:
"""Convert number of bytes in a field to the struct API unsigned format specifier,
assuming network endianness. Raises value error if number is not inside [1, 2, 4, 8]"""
assuming network endianness. Raises value error if number is not inside [1, 2, 4, 8]
"""
if byte_num not in [0, 1, 2, 4, 8]:
raise ValueError("Invalid byte number, must be one of [1, 2, 4, 8]")
if byte_num == 0:
Expand Down

0 comments on commit a514263

Please sign in to comment.