Draft of new semantics

This commit is contained in:
Joel Collins 2020-01-29 11:55:39 +00:00
parent b39a0653f2
commit 19af98736d
13 changed files with 252 additions and 187 deletions

View file

@ -26,17 +26,13 @@ We override the logging settings in api.app by setting a level for PIL here.
pil_logger = logging.getLogger("PIL")
pil_logger.setLevel(logging.INFO)
# MAIN CLASS
class MockStreamer(BaseCamera):
class MissingCamera(BaseCamera):
def __init__(self):
# Run BaseCamera init
BaseCamera.__init__(self)
# Store state of PiCameraStreamer
self.status.update(
{"stream_active": False, "record_active": False, "board": None}
)
# Update config properties
self.image_resolution = (1312, 976)
self.stream_resolution = (640, 480)
@ -71,6 +67,16 @@ class MockStreamer(BaseCamera):
image.save(self.stream, format="JPEG")
@property
def configuration(self):
"""The current camera configuration."""
return {}
@property
def state(self):
"""The current read-only camera state."""
return {}
def initialisation(self):
"""Run any initialisation code when the frame iterator starts."""
pass
@ -101,7 +107,7 @@ class MockStreamer(BaseCamera):
return conf_dict
def apply_settings(self, config: dict):
def update_settings(self, config: dict):
"""
Write a config dictionary to the PiCameraStreamer config.
@ -117,7 +123,7 @@ class MockStreamer(BaseCamera):
with self.lock:
# Apply valid config params to camera object
if not self.status["record_active"]: # If not recording a video
if not self.record_active: # If not recording a video
for key, value in config.items(): # For each provided setting
if hasattr(self, key):