Added stream snapshot route
This commit is contained in:
parent
28a49774a9
commit
93966e093a
1 changed files with 23 additions and 0 deletions
|
|
@ -25,6 +25,25 @@ class StreamAPI(MicroscopeView):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class SnapshotAPI(MicroscopeView):
|
||||||
|
def get(self):
|
||||||
|
"""
|
||||||
|
Single snapshot from the camera stream
|
||||||
|
|
||||||
|
.. :quickref: State; Camera snapshot
|
||||||
|
|
||||||
|
:>header Accept: image/jpeg
|
||||||
|
:>header Content-Type: image/jpeg
|
||||||
|
:status 200: stream active
|
||||||
|
"""
|
||||||
|
# Restart stream worker thread
|
||||||
|
self.microscope.camera.start_worker()
|
||||||
|
|
||||||
|
return Response(
|
||||||
|
self.microscope.camera.get_frame(),
|
||||||
|
mimetype="image/jpeg",
|
||||||
|
)
|
||||||
|
|
||||||
class StateAPI(MicroscopeView):
|
class StateAPI(MicroscopeView):
|
||||||
def get(self):
|
def get(self):
|
||||||
"""
|
"""
|
||||||
|
|
@ -220,6 +239,10 @@ def construct_blueprint(microscope_obj):
|
||||||
"/stream", view_func=StreamAPI.as_view("stream", microscope=microscope_obj)
|
"/stream", view_func=StreamAPI.as_view("stream", microscope=microscope_obj)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
blueprint.add_url_rule(
|
||||||
|
"/snapshot", view_func=SnapshotAPI.as_view("snapshot", microscope=microscope_obj)
|
||||||
|
)
|
||||||
|
|
||||||
blueprint.add_url_rule(
|
blueprint.add_url_rule(
|
||||||
"/state", view_func=StateAPI.as_view("state", microscope=microscope_obj)
|
"/state", view_func=StateAPI.as_view("state", microscope=microscope_obj)
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue