Coverage for farmbot/functions/camera.py: 100%
13 statements
« prev ^ index » next coverage.py v7.4.4, created at 2024-09-12 12:03 -0700
« prev ^ index » next coverage.py v7.4.4, created at 2024-09-12 12:03 -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
13class Camera():
14 """Camera class."""
16 def __init__(self, state):
17 self.broker = BrokerConnect(state)
18 self.state = state
20 def calibrate_camera(self):
21 """Performs camera calibration. This action will reset camera calibration settings."""
23 self.state.print_status(description="Calibrating camera")
25 calibrate_message = {
26 "kind": "execute_script",
27 "args": {
28 "label": "camera-calibration"
29 },
30 }
32 self.broker.publish(calibrate_message)
34 def take_photo(self):
35 """Takes photo using the device camera and uploads it to the web app."""
37 self.state.print_status(description="Taking a photo")
39 photo_message = {
40 "kind": "take_photo",
41 "args": {}
42 }
44 self.broker.publish(photo_message)
46 # TODO: photo_grid()