Exemplo n.º 1
0
    def __init__(self, records=None, **kwargs):
        """ Initializes a new instance

        :param records: The file record requests to be read
        """
        ModbusResponse.__init__(self, **kwargs)
        self.records = records or []
Exemplo n.º 2
0
    def __init__(self, status=0x00, **kwargs):
        """ Initializes a new instance

        :param status: The status response to report
        """
        ModbusResponse.__init__(self, **kwargs)
        self.status = status
Exemplo n.º 3
0
    def __init__(self, values, **kwargs):
        """ Initializes a new instance

        :param values: The values to write to
        """
        ModbusResponse.__init__(self, **kwargs)
        self.registers = values or []
Exemplo n.º 4
0
    def __init__(self, values=None, **kwargs):
        """ Initializes a new instance

        :param values: The list of values of the fifo to return
        """
        ModbusResponse.__init__(self, **kwargs)
        self.values = values or []
Exemplo n.º 5
0
    def __init__(self, values, **kwargs):
        """ Initializes a new instance

        :param values: The values to write to
        """
        ModbusResponse.__init__(self, **kwargs)
        self.registers = values or []
Exemplo n.º 6
0
 def __init__(self, **kwargs):
     """
     Base initializer for a diagnostic response
     """
     self.sub_function_code = None
     ModbusResponse.__init__(self, **kwargs)
     self.message = None
Exemplo n.º 7
0
    def __init__(self, count=0x0000, **kwargs):
        """ Initializes a new instance

        :param count: The current event counter value
        """
        ModbusResponse.__init__(self, **kwargs)
        self.count = count
        self.status = True  # this means we are ready, not waiting
Exemplo n.º 8
0
    def __init__(self, values, **kwargs):
        """ Initializes a new instance

        :param values: The requested values to be returned
        """
        self.byte_count = None
        ModbusResponse.__init__(self, **kwargs)
        self.bits = values or []
Exemplo n.º 9
0
    def __init__(self, values, **kwargs):
        """ Initializes a new instance

        :param values: The requested values to be returned
        """
        self.byte_count = None
        ModbusResponse.__init__(self, **kwargs)
        self.bits = values or []
Exemplo n.º 10
0
    def __init__(self, address=None, value=None, **kwargs):
        """ Initializes a new instance

        :param address: The address to start writing add
        :param value: The values to write
        """
        ModbusResponse.__init__(self, **kwargs)
        self.address = address
        self.value = value
Exemplo n.º 11
0
    def __init__(self, address=None, count=None, **kwargs):
        """ Initializes a new instance

        :param address: The address to start writing to
        :param count: The number of registers to write to
        """
        ModbusResponse.__init__(self, **kwargs)
        self.address = address
        self.count = count
Exemplo n.º 12
0
    def __init__(self, address=None, value=None, **kwargs):
        """ Initializes a new instance

        :param address: The address to start writing add
        :param value: The values to write
        """
        ModbusResponse.__init__(self, **kwargs)
        self.address = address
        self.value = value
Exemplo n.º 13
0
    def __init__(self, address=None, count=None, **kwargs):
        """ Initializes a new instance

        :param address: The starting variable address written to
        :param count: The number of values written
        """
        ModbusResponse.__init__(self, **kwargs)
        self.address = address
        self.count = count
Exemplo n.º 14
0
    def __init__(self, address=None, value=None, **kwargs):
        """ Initializes a new instance

        :param address: The variable address written to
        :param value: The value written at address
        """
        ModbusResponse.__init__(self, **kwargs)
        self.address = address
        self.value = value
Exemplo n.º 15
0
    def __init__(self, identifier=b'\x00', status=True, **kwargs):
        """ Initializes a new instance

        :param identifier: The identifier of the slave
        :param status: The status response to report
        """
        ModbusResponse.__init__(self, **kwargs)
        self.identifier = identifier
        self.status = status
Exemplo n.º 16
0
    def __init__(self, address=None, count=None, **kwargs):
        """ Initializes a new instance

        :param address: The starting variable address written to
        :param count: The number of values written
        """
        ModbusResponse.__init__(self, **kwargs)
        self.address = address
        self.count = count
Exemplo n.º 17
0
    def __init__(self, address=None, count=None, **kwargs):
        """ Initializes a new instance

        :param address: The address to start writing to
        :param count: The number of registers to write to
        """
        ModbusResponse.__init__(self, **kwargs)
        self.address = address
        self.count = count
Exemplo n.º 18
0
    def __init__(self, address=None, value=None, **kwargs):
        """ Initializes a new instance

        :param address: The variable address written to
        :param value: The value written at address
        """
        ModbusResponse.__init__(self, **kwargs)
        self.address = address
        self.value = value
Exemplo n.º 19
0
    def __init__(self, **kwargs):
        """ Initializes a new instance

        :param status: The status response to report
        :param message_count: The current message count
        :param event_count: The current event count
        :param events: The collection of events to send
        """
        ModbusResponse.__init__(self, **kwargs)
        self.status = kwargs.get('status', True)
        self.message_count = kwargs.get('message_count', 0)
        self.event_count = kwargs.get('event_count', 0)
        self.events = kwargs.get('events', [])
Exemplo n.º 20
0
    def __init__(
            self, address=0x0000, and_mask=0xffff, or_mask=0x0000, **kwargs
    ):
        """ Initializes a new instance

        :param address: The mask pointer address (0x0000 to 0xffff)
        :param and_mask: The and bitmask applied to the register address
        :param or_mask: The or bitmask applied to the register address
        """
        ModbusResponse.__init__(self, **kwargs)
        self.address = address
        self.and_mask = and_mask
        self.or_mask = or_mask
Exemplo n.º 21
0
    def __init__(self, read_code=None, information=None, **kwargs):
        """ Initializes a new instance

        :param read_code: The device information read code
        :param information: The requested information request
        """
        ModbusResponse.__init__(self, **kwargs)
        self.read_code = read_code or DeviceInformation.Basic
        self.information = information or {}
        self.number_of_objects = len(self.information)
        self.conformity = 0x83  # I support everything right now

        # TODO calculate
        self.next_object_id = 0x00  # self.information[-1](0)
        self.more_follows = MoreData.Nothing
Exemplo n.º 22
0
    def __init__(self, read_code=None, information=None, **kwargs):
        """ Initializes a new instance

        :param read_code: The device information read code
        :param information: The requested information request
        """
        ModbusResponse.__init__(self, **kwargs)
        self.read_code = read_code or DeviceInformation.Basic
        self.information = information or {}
        self.number_of_objects = len(self.information)
        self.conformity = 0x83  # I support everything right now

        # TODO calculate
        self.next_object_id = 0x00  # self.information[-1](0)
        self.more_follows = MoreData.Nothing