Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self, address=None, values=None, **kwargs):
''' Initializes a new instance
:param address: The starting request address
:param values: The values to write
'''
ModbusRequest.__init__(self, **kwargs)
self.address = address
if not values: values = []
elif not hasattr(values, '__iter__'): values = [values]
self.values = values
self.byte_count = (len(self.values) + 7) // 8
def __init__(self, **kwargs):
''' Initializes a new instance
'''
ModbusRequest.__init__(self, **kwargs)
def __init__(self, address=None, count=None):
''' Initializes a new instance
:param address: The address to start writing to
:param count: The number of registers to write to
'''
ModbusRequest.__init__(self)
self.address = address
if count != None and count > 0:
self.registers = [0] * count
else: self.registers = []
def __init__(self, **kwargs):
''' Initializes a new instance
'''
ModbusRequest.__init__(self, **kwargs)
def __init__(self, **kwargs):
'''
Base initializer for a diagnostic request
'''
ModbusRequest.__init__(self, **kwargs)
self.message = None
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 to apply to the register address
:param or_mask: The or bitmask to apply to the register address
'''
ModbusRequest.__init__(self, **kwargs)
self.address = address
self.and_mask = and_mask
self.or_mask = or_mask
def __init__(self, address=None, count=None):
''' Initializes a new instance
:param address: The starting request address
:param count: Number of bits to read after address
'''
ModbusRequest.__init__(self)
self.address = address
if count != None and count > 0:
self.coils = [False] * count
else: self.coils = []
def __init__(self, address, count, **kwargs):
''' Initializes the read request data
:param address: The start address to read from
:param count: The number of bits after 'address' to read
'''
ModbusRequest.__init__(self, **kwargs)
self.address = address
self.count = count
def __init__(self, address=None, value=None):
''' Initializes a new instance
:param address: The variable address to write
:param value: The value to write at address
'''
ModbusRequest.__init__(self)
self.address = address
self.value = 0xff00 if value else 0x0000