#22 Begin python rework

This commit is contained in:
James Hodgson
2022-10-07 14:40:39 +01:00
parent 97adf57e2e
commit 783eff7636
9 changed files with 204 additions and 65 deletions

46
src/picam/picam.py Normal file
View File

@@ -0,0 +1,46 @@
class PiCam:
def __init__(self, config: dict):
self.capture_resolution = config["capture_resolution"]
self.preview_resolution = config["preview_resolution"]
def set_capture_resolution(self, resolution: "tuple[int, int]") -> None:
"""Set capture resolution for camera
:param resolution: New resolution for camera captures
"""
self.capture_resolution = resolution
def set_preview_resolution(self, resolution: "tuple[int, int]") -> None:
"""Set resolution for camera preview (viewfinder)
:param resolution: New resolution for camera preview
"""
self.preview_resolution = resolution
def get_preview_resolution(self) -> "tuple[int, int]":
"""Get the current preview resolution
:returns: Tuple containing current preview resolution (x, y)
"""
raise NotImplementedError
def get_capture_resolution(self) -> "tuple[int, int]":
"""Get the current capture resolution
:returns: Tuple containing current capture resolution (x, y)
"""
raise NotImplementedError
def capture(self) -> bytes:
"""Capture an image
:returns: Image data as a byte buffer
"""
raise NotImplementedError
def capture_preview(self) -> bytes:
"""Capture a preview image for the viewfinder
:returns: Image data as a byte buffer
"""
raise NotImplementedError