Camera metadata includes subclass name, and test

This commit is contained in:
Joe Knapper 2026-03-03 13:23:30 +00:00
parent ac9852a7ad
commit 5019884175
5 changed files with 215 additions and 26 deletions

View file

@ -643,8 +643,12 @@ class BaseCamera(lt.Thing):
@property
def thing_state(self) -> Mapping[str, Any]:
"""Empty metadata dict for subclasses to populate."""
return {}
"""Return camera-specific metadata.
By default, this just adds the subclass name as the camera type.
Subclasses can extend by overriding this property and calling `super()`.
"""
return {"camera": self.__class__.__name__}
def downsample(factor: int, image: np.ndarray) -> np.ndarray:

View file

@ -927,4 +927,9 @@ class StreamingPiCamera2(BaseCamera):
"""Update generic camera metadata with Picamera-specific data."""
state = dict(super().thing_state)
state["camera_board"] = self._camera_board
state["tuning"] = {
"exposure_time": self.exposure_time,
"colour_gains": self.colour_gains,
"analogue_gain": self.analogue_gain,
}
return state