Add a get route for the stage type and rename

This commit is contained in:
samuelmcdermott 2020-10-12 01:23:44 +01:00
parent 79f3104409
commit 81ca2c9cb1
2 changed files with 11 additions and 4 deletions

View file

@ -40,8 +40,8 @@ _actions = {
"conditions": True,
},
"setStage": {
"rule" : "/stage/set/",
"view_class": stage.SetStageAPI,
"rule" : "/stage/type/",
"view_class": stage.StageTypeAPI,
"conditions": True,
},
"shutdown": {

View file

@ -66,7 +66,7 @@ class ZeroStageAPI(ActionView):
# TODO: Make schema for microscope state
return microscope.state["stage"]
class SetStageAPI(ActionView):
class StageTypeAPI(ActionView):
args = {
"stage_type": fields.String(missing = None, example = "SangaStage", description = "The stage geometry [SangaStage, SangaDeltaStage]")
}
@ -78,5 +78,12 @@ class SetStageAPI(ActionView):
microscope.set_stage(stage_type=args.get("stage_type"))
# TODO: Make schema for microscope state
return microscope.state["stage"]
return microscope.configuration["stage"]["type"]
def get(self):
"""
Get the stage geometry.
"""
microscope = find_component("org.openflexure.microscope")
return microscope.configuration["stage"]["type"]