DAQ: Add commissioning mode

This commit is contained in:
2025-09-30 11:28:21 +02:00
parent 64d7f3bfa9
commit 478aea06fc
4 changed files with 21 additions and 1 deletions
+1
View File
@@ -560,6 +560,7 @@ class BeamlineStatus(BaseModel):
sample_camera: SampleCameraSettings
transmission: Annotated[float, Field(ge=0.0, le=1.0)] | None
zoom: float
commissioning_mode: bool
class SessionStatus(BaseModel):
session: SessionsStateEnum = SessionsStateEnum.Vacant
+13
View File
@@ -137,6 +137,19 @@ class BeamlineConfig:
else:
self.__client.set(f"{self.__bl}:pgroup", pgroup)
@property
def commissioning_mode(self) -> bool:
tmp = self.__client.get(f"{self.__bl}:commissioning_mode")
if tmp is None:
return False
return True
@commissioning_mode.setter
def commissioning_mode(self, commisioning_mode: bool) -> None:
if commisioning_mode:
self.__client.set(f"{self.__bl}:commissioning_mode", "1")
else:
self.__client.delete(f"{self.__bl}:commissioning_mode")
# Beamline state management
# Atomic check if beamline is busy and if not set state to busy
+2 -1
View File
@@ -1333,7 +1333,8 @@ class AareDAQ:
sample_camera=self.__devs.samcam_settings,
name=self.__bl,
transmission=self.__devs.transmission.get(),
zoom=self.__devs.zoom
zoom=self.__devs.zoom,
commissioning_mode=self.__cfg.commissioning_mode
)
@property
+5
View File
@@ -359,6 +359,11 @@ async def del_pgroup(token: str = Depends(oauth2_scheme)) -> str:
cfg.pgroup = None
return "OK"
@app.put("/beamline/commissioning_mode")
async def set_commissioning_mode(val: bool, token: str = Depends(oauth2_scheme)) -> str:
auth.check_jwt_staff(cfg, auth.parse_token(token))
cfg.commissioning_mode = val
return "OK"
@app.post("/access/end_session")
async def end_session(token: str = Depends(oauth2_scheme)) -> str: