Restructured entire API into blueprints
This commit is contained in:
parent
aede078eb9
commit
c995a15fdc
13 changed files with 739 additions and 1024 deletions
38
openflexure_microscope/api/v1/blueprints/camera/preview.py
Normal file
38
openflexure_microscope/api/v1/blueprints/camera/preview.py
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
from openflexure_microscope.api.utilities import parse_payload, get_from_payload, gen, get_bool
|
||||
from openflexure_microscope.api.v1.views import MicroscopeView
|
||||
|
||||
from flask import Response, Blueprint, jsonify, request, abort, url_for, redirect, send_file
|
||||
|
||||
import logging
|
||||
|
||||
|
||||
class GPUPreviewAPI(MicroscopeView):
|
||||
|
||||
def post(self, operation):
|
||||
"""
|
||||
Create a new image capture.
|
||||
|
||||
.. :quickref: GPU Preview; Start/stop preview
|
||||
|
||||
**Example requests**:
|
||||
|
||||
.. sourcecode:: http
|
||||
|
||||
POST /camera/preview/start HTTP/1.1
|
||||
Accept: application/json
|
||||
|
||||
.. sourcecode:: http
|
||||
|
||||
POST /camera/preview/stop HTTP/1.1
|
||||
Accept: application/json
|
||||
|
||||
:>header Accept: application/json
|
||||
|
||||
:<header Content-Type: application/json
|
||||
:status 200: preview started/stopped
|
||||
"""
|
||||
if operation == "start":
|
||||
self.microscope.camera.start_preview()
|
||||
elif operation == "stop":
|
||||
self.microscope.camera.stop_preview()
|
||||
return jsonify(self.microscope.state)
|
||||
Loading…
Add table
Add a link
Reference in a new issue