Coverage for /opt/conda/envs/apienv/lib/python3.10/site-packages/daiquiri/core/hardware/abstract/beamviewer.py: 0%

24 statements  

« prev     ^ index     » next       coverage.py v7.6.4, created at 2024-11-14 02:13 +0000

1#!/usr/bin/env python 

2# -*- coding: utf-8 -*- 

3from marshmallow import fields 

4 

5from daiquiri.core.hardware.abstract import HardwareObject 

6from daiquiri.core.schema.hardware import HardwareSchema 

7from daiquiri.core.schema.validators import RequireEmpty, OneOf 

8 

9import logging 

10 

11logger = logging.getLogger(__name__) 

12 

13BeamviewerStates = ["ON", "OFF", "UNKNOWN", "FAULT"] 

14 

15 

16class BeamviewerPropertiesSchema(HardwareSchema): 

17 state = OneOf(BeamviewerStates, metadata={"readOnly": True}) 

18 foil = OneOf(["IN", "OUT", "UNKNOWN", "NONE"], metadata={"readOnly": True}) 

19 led = OneOf(["ON", "OFF"], metadata={"readOnly": True}) 

20 screen = OneOf(["IN", "OUT", "UNKNOWN"], metadata={"readOnly": True}) 

21 diode_ranges = fields.List(fields.Str(), metadata={"readOnly": True}) 

22 diode_range = fields.Str() 

23 

24 

25class BeamviewerCallablesSchema(HardwareSchema): 

26 led = fields.Bool() 

27 screen = fields.Bool() 

28 foil = fields.Bool() 

29 current = RequireEmpty() 

30 

31 

32class Beamviewer(HardwareObject): 

33 _type = "beamviewer" 

34 _state_ok = [BeamviewerStates[0], BeamviewerStates[1]] 

35 

36 _properties = BeamviewerPropertiesSchema() 

37 _callables = BeamviewerCallablesSchema()