Coverage for functions/camera.py: 100%
13 statements
« prev ^ index » next coverage.py v7.4.4, created at 2024-08-30 11:51 -0700
« prev ^ index » next coverage.py v7.4.4, created at 2024-08-30 11:51 -0700
1"""
2Camera class.
3"""
5# └── functions/camera.py
6# ├── [BROKER] calibrate_camera()
7# ├── [BROKER] take_photo()
8# └── [BROKER] photo_grid()
10from .broker import BrokerConnect
12class Camera():
13 """Camera class."""
14 def __init__(self, state):
15 self.broker = BrokerConnect(state)
16 self.state = state
18 def calibrate_camera(self):
19 """Performs camera calibration. This action will reset camera calibration settings."""
21 self.state.print_status(description="Calibrating camera")
23 calibrate_message = {
24 "kind": "execute_script",
25 "args": {
26 "label": "camera-calibration"
27 },
28 }
30 self.broker.publish(calibrate_message)
32 def take_photo(self):
33 """Takes photo using the device camera and uploads it to the web app."""
35 self.state.print_status(description="Taking a photo")
37 photo_message = {
38 "kind": "take_photo",
39 "args": {}
40 }
42 self.broker.publish(photo_message)
44 # TODO: photo_grid()