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
« 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 -*-
4from daiquiri.core.hardware.abstract import HardwareObject
5from daiquiri.core.schema.hardware import HardwareSchema
6from daiquiri.core.schema.validators import RequireEmpty, OneOf
8import logging
10logger = logging.getLogger(__name__)
12ActuatorStatues = ["IN", "OUT", "UNKNOWN", "ERROR"]
15class ActuatorPropertiesSchema(HardwareSchema):
16 state = OneOf(ActuatorStatues, metadata={"readOnly": True})
19class ActuatorCallablesSchema(HardwareSchema):
20 move_in = RequireEmpty()
21 move_out = RequireEmpty()
22 toggle = RequireEmpty()
25class Actuator(HardwareObject):
26 _type = "actuator"
27 _state_ok = [ActuatorStatues[0], ActuatorStatues[1]]
29 _properties = ActuatorPropertiesSchema()
30 _callables = ActuatorCallablesSchema()
32 def move_in(self, **kwargs):
33 self.call("ain", **kwargs)
35 def move_out(self, **kwargs):
36 self.call("aout", **kwargs)