本文整理汇总了Python中pymodbus.pdu.ModbusRequest.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python ModbusRequest.__init__方法的具体用法?Python ModbusRequest.__init__怎么用?Python ModbusRequest.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pymodbus.pdu.ModbusRequest
的用法示例。
在下文中一共展示了ModbusRequest.__init__方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from pymodbus.pdu import ModbusRequest [as 别名]
# 或者: from pymodbus.pdu.ModbusRequest import __init__ [as 别名]
def __init__(self, records=None, **kwargs):
''' Initializes a new instance
:param records: The file record requests to be read
'''
ModbusRequest.__init__(self, **kwargs)
self.records = records or []
示例2: __init__
# 需要导入模块: from pymodbus.pdu import ModbusRequest [as 别名]
# 或者: from pymodbus.pdu.ModbusRequest import __init__ [as 别名]
def __init__(self, status):
''' Initializes a new instance
:param status: The status response to report
'''
ModbusRequest.__init__(self)
self.status = status
示例3: __init__
# 需要导入模块: from pymodbus.pdu import ModbusRequest [as 别名]
# 或者: from pymodbus.pdu.ModbusRequest import __init__ [as 别名]
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
示例4: __init__
# 需要导入模块: from pymodbus.pdu import ModbusRequest [as 别名]
# 或者: from pymodbus.pdu.ModbusRequest import __init__ [as 别名]
def __init__(self, read_code=None, object_id=0x00, **kwargs):
''' Initializes a new instance
:param read_code: The device information read code
:param object_id: The object to read from
'''
ModbusRequest.__init__(self, **kwargs)
self.read_code = read_code or DeviceInformation.Basic
self.object_id = object_id
示例5: __init__
# 需要导入模块: from pymodbus.pdu import ModbusRequest [as 别名]
# 或者: from pymodbus.pdu.ModbusRequest import __init__ [as 别名]
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
'''
ModbusRequest.__init__(self, **kwargs)
self.address = address
self.value = value
示例6: __init__
# 需要导入模块: from pymodbus.pdu import ModbusRequest [as 别名]
# 或者: from pymodbus.pdu.ModbusRequest import __init__ [as 别名]
def __init__(self, address=None, value=None, **kwargs):
''' Initializes a new instance
:param address: The variable address to write
:param value: The value to write at address
'''
ModbusRequest.__init__(self, **kwargs)
self.address = address
self.value = bool(value)
示例7: __init__
# 需要导入模块: from pymodbus.pdu import ModbusRequest [as 别名]
# 或者: from pymodbus.pdu.ModbusRequest import __init__ [as 别名]
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
示例8: __init__
# 需要导入模块: from pymodbus.pdu import ModbusRequest [as 别名]
# 或者: from pymodbus.pdu.ModbusRequest import __init__ [as 别名]
def __init__(self, address, count, **kwargs):
''' Initializes a new instance
:param address: The address to start the read from
:param count: The number of registers to read
'''
ModbusRequest.__init__(self, **kwargs)
self.address = address
self.count = count
示例9: __init__
# 需要导入模块: from pymodbus.pdu import ModbusRequest [as 别名]
# 或者: from pymodbus.pdu.ModbusRequest import __init__ [as 别名]
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 = []
示例10: __init__
# 需要导入模块: from pymodbus.pdu import ModbusRequest [as 别名]
# 或者: from pymodbus.pdu.ModbusRequest import __init__ [as 别名]
def __init__(self, address, count, **kwargs):
''' Initializes a new instance
:param address: The address to start the read from
:param count: The number of registers to read
'''
ModbusRequest.__init__(self, **kwargs)
self.address = address
self.count = count
frame_struct = struct.Struct('>HH')
self._unpack = frame_struct.unpack
self._pack = frame_struct.pack
示例11: __init__
# 需要导入模块: from pymodbus.pdu import ModbusRequest [as 别名]
# 或者: from pymodbus.pdu.ModbusRequest import __init__ [as 别名]
def __init__(self, address=None, values=None, **kwargs):
''' Initializes a new instance
:param address: The address to start writing to
:param values: The values to write
'''
ModbusRequest.__init__(self, **kwargs)
self.address = address
self.values = values or []
if not hasattr(values, '__iter__'):
values = [values]
self.count = len(self.values)
self.byte_count = self.count * 2
示例12: __init__
# 需要导入模块: from pymodbus.pdu import ModbusRequest [as 别名]
# 或者: from pymodbus.pdu.ModbusRequest import __init__ [as 别名]
def __init__(self, raddress=None, rcount=None, waddress=None, wcount=None):
''' Initializes a new request message
:param raddress: The address to start reading from
:param rcount: The number of registers to read from address
:param waddress: The address to start writing to
:param wcount: The number of registers to write from address
'''
ModbusRequest.__init__(self)
self.raddress = raddress
self.rcount = rcount
self.waddress = waddress
self.wbyte_count = 0
if wcount != None and wcount > 0:
self.wregisters = [0] * wcount
else: self.wregisters = []
示例13: __init__
# 需要导入模块: from pymodbus.pdu import ModbusRequest [as 别名]
# 或者: from pymodbus.pdu.ModbusRequest import __init__ [as 别名]
def __init__(self, address=None, **kwargs):
ModbusRequest.__init__(self, **kwargs)
self.address = address
self.count = 16
示例14: __init__
# 需要导入模块: from pymodbus.pdu import ModbusRequest [as 别名]
# 或者: from pymodbus.pdu.ModbusRequest import __init__ [as 别名]
def __init__(self):
'''
Base initializer for a diagnostic request
'''
self.message = None
ModbusRequest.__init__(self)
示例15: __init__
# 需要导入模块: from pymodbus.pdu import ModbusRequest [as 别名]
# 或者: from pymodbus.pdu.ModbusRequest import __init__ [as 别名]
def __init__(self, **kwargs):
'''
Base initializer for a diagnostic request
'''
ModbusRequest.__init__(self, **kwargs)
self.message = None