diff --git a/Apps/GroundSoftware/IrisBackendv3/codec/files/__init__.py b/Apps/GroundSoftware/IrisBackendv3/codec/files/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/Apps/GroundSoftware/IrisBackendv3/codec/files/file.py b/Apps/GroundSoftware/IrisBackendv3/codec/files/file.py new file mode 100644 index 00000000..786a3433 --- /dev/null +++ b/Apps/GroundSoftware/IrisBackendv3/codec/files/file.py @@ -0,0 +1,27 @@ +from typing import TypeAlias, Dict, List, Final, ClassVar + +from dataclasses import dataclass + +from ..payload import FileMetadata, FileBlockPayload + +HashedId: TypeAlias = int + +class File: + _FILE_EXT: ClassVar[str] = '.iris.hex' + + _metadata: FileMetadata + + _blocks: Dict[int, FileBlockPayload] + + @property + def hashedId(self) -> HashedId: + return self._metadata.hashedId + + def ingest_block(block: FileBlockPayload) -> None: + pass + + def generate_file_contents() -> bytes: + # TODO: Make a cached property? + pass + + def save_file(self, path: str) \ No newline at end of file diff --git a/Apps/GroundSoftware/IrisBackendv3/codec/files/file_manager.py b/Apps/GroundSoftware/IrisBackendv3/codec/files/file_manager.py new file mode 100644 index 00000000..2baf421c --- /dev/null +++ b/Apps/GroundSoftware/IrisBackendv3/codec/files/file_manager.py @@ -0,0 +1,15 @@ +from typing import TypeAlias, Dict, List + +from .file import File, HashedId +from ..packet import Packet + +class FileManager: + in_progress_files: Dict[HashedId, File] + + def process_packet(packet: Packet) -> bool: + """ Extracts any file blocks from the given packet and uses them to + build or continue building a file. + """ + raise NotImplementedError() + + def save_all_files() diff --git a/Apps/GroundSoftware/IrisBackendv3/codec/files/image.py b/Apps/GroundSoftware/IrisBackendv3/codec/files/image.py new file mode 100644 index 00000000..9d748d91 --- /dev/null +++ b/Apps/GroundSoftware/IrisBackendv3/codec/files/image.py @@ -0,0 +1,7 @@ +from .file import File + +class Image(File): + # override save + + def to_b64(self) -> str: + pass