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

21 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 -*- 

3 

4from daiquiri.core.hardware.abstract import HardwareObject 

5from daiquiri.core.schema.hardware import HardwareSchema 

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

7 

8import logging 

9 

10logger = logging.getLogger(__name__) 

11 

12ActuatorStatues = ["IN", "OUT", "UNKNOWN", "ERROR"] 

13 

14 

15class ActuatorPropertiesSchema(HardwareSchema): 

16 state = OneOf(ActuatorStatues, metadata={"readOnly": True}) 

17 

18 

19class ActuatorCallablesSchema(HardwareSchema): 

20 move_in = RequireEmpty() 

21 move_out = RequireEmpty() 

22 toggle = RequireEmpty() 

23 

24 

25class Actuator(HardwareObject): 

26 _type = "actuator" 

27 _state_ok = [ActuatorStatues[0], ActuatorStatues[1]] 

28 

29 _properties = ActuatorPropertiesSchema() 

30 _callables = ActuatorCallablesSchema() 

31 

32 def move_in(self, **kwargs): 

33 self.call("ain", **kwargs) 

34 

35 def move_out(self, **kwargs): 

36 self.call("aout", **kwargs)