# Path: basil/HL/RegisterHardwareLayer.py
# class RegisterHardwareLayer(HardwareLayer):
#     def __init__(self, intf, conf):
#     def init(self):
#     def set_value(self, value, addr, size, offset, **kwargs):
#     def get_value(self, addr, size, offset, **kwargs):
#     def set_bytes(self, data, addr, **kwargs):
#     def get_bytes(self, addr, size, **kwargs):
#     def set_configuration(self, conf):
#     def get_configuration(self):
#     def add_property(self, attribute):
#         def getter(self):
#         def setter(self, value):
#     def set_default(self):
#     def _get(self, reg):
#     def _set(self, reg, value):
#     def __getitem__(self, name):
#     def __setitem__(self, name, value):
#     def __getattr__(self, name):
#         def method(*args, **kwargs):
#     def __setattr__(self, name, value):


import logging
import struct
from basil.HL.RegisterHardwareLayer import HardwareLayer
            return -1
        elif ret[0] == 2 and ret[1] == cmd[1] and ret[2] == cmd[2]:
            return ((ret[3] << 24) & 0xFF000000) | ((ret[4] << 16) & 0xFF0000) | ((ret[5] << 8) & 0xFF00) | (ret[6] & 0xFF)
        else:
            logger.debug("ELFLOW.get_valve_output() ret error ret=%s" % str(ret))
            return -1

    def set_controller_speed(self, value):
        value = struct.unpack('<I', struct.pack('<f', value))[0]
        cmd = [1, 114, 0x40 + 30, (value >> 24) & 0xFF, (value >> 16) & 0xFF, (value >> 8) & 0xFF, value & 0xFF]
        self.write(cmd)
        ret = self.read()
        if len(ret) != 3:
            logger.debug("ELFLOW.set_controller_speed() data lenth error ret=%s" % str(ret))
            return -1
        elif ret[0] == 0 and ret[1] == 0 and ret[2] == 7:
            return 0
        else:
            logger.debug("ELFLOW.set_controller_speed() ret error ret=%s" % str(ret))
            return -1

    def get_controller_speed(self):
        cmd = [4, 114, 0x41, 114, 0x40 + 30]
        self.write(cmd)
        ret = self.read()
        if len(ret) != 7:
            logger.debug("ELFLOW.set_setpoint() data lenth error ret=%s" % str(ret))
            return -1
        elif ret[0] == 2 and ret[1] == cmd[1] and ret[2] == cmd[2]:
            return struct.unpack('!f', chr(ret[3]) + chr(ret[4]) + chr(ret[5]) + chr(ret[6]))[0]

# Path: basil/HL/RegisterHardwareLayer.py
# class RegisterHardwareLayer(HardwareLayer):
#     def __init__(self, intf, conf):
#     def init(self):
#     def set_value(self, value, addr, size, offset, **kwargs):
#     def get_value(self, addr, size, offset, **kwargs):
#     def set_bytes(self, data, addr, **kwargs):
#     def get_bytes(self, addr, size, **kwargs):
#     def set_configuration(self, conf):
#     def get_configuration(self):
#     def add_property(self, attribute):
#         def getter(self):
#         def setter(self, value):
#     def set_default(self):
#     def _get(self, reg):
#     def _set(self, reg, value):
#     def __getitem__(self, name):
#     def __setitem__(self, name, value):
#     def __getattr__(self, name):
#         def method(*args, **kwargs):
#     def __setattr__(self, name, value):


# Path: basil/HL/bronkhorst_elflow.py
import logging
import struct
from basil.HL.RegisterHardwareLayer import HardwareLayer

            return -1
        elif ret[0] == 2 and ret[1] == cmd[1] and ret[2] == cmd[2]:
            return ((ret[3] << 24) & 0xFF000000) | ((ret[4] << 16) & 0xFF0000) | ((ret[5] << 8) & 0xFF00) | (ret[6] & 0xFF)
        else:
            logger.debug("ELFLOW.get_valve_output() ret error ret=%s" % str(ret))
            return -1

    def set_controller_speed(self, value):
        value = struct.unpack('<I', struct.pack('<f', value))[0]
        cmd = [1, 114, 0x40 + 30, (value >> 24) & 0xFF, (value >> 16) & 0xFF, (value >> 8) & 0xFF, value & 0xFF]
        self.write(cmd)
        ret = self.read()
        if len(ret) != 3:
            logger.debug("ELFLOW.set_controller_speed() data lenth error ret=%s" % str(ret))
            return -1
        elif ret[0] == 0 and ret[1] == 0 and ret[2] == 7:
            return 0
        else:
            logger.debug("ELFLOW.set_controller_speed() ret error ret=%s" % str(ret))
            return -1

    def get_controller_speed(self):
        cmd = [4, 114, 0x41, 114, 0x40 + 30]
        self.write(cmd)
        ret = self.read()
        if len(ret) != 7:
            logger.debug("ELFLOW.set_setpoint() data lenth error ret=%s" % str(ret))
            return -1
        elif ret[0] == 2 and ret[1] == cmd[1] and ret[2] == cmd[2]:
            return struct.unpack('!f', chr(ret[3]) + chr(ret[4]) + chr(ret[5]) + chr(ret[6]))[0]

        else: