当前位置: 首页>>代码示例>>Python>>正文


Python pdu.ModbusRequest类代码示例

本文整理汇总了Python中pymodbus.pdu.ModbusRequest的典型用法代码示例。如果您正苦于以下问题:Python ModbusRequest类的具体用法?Python ModbusRequest怎么用?Python ModbusRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ModbusRequest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

    def __init__(self, status):
        ''' Initializes a new instance

        :param status: The status response to report
        '''
        ModbusRequest.__init__(self)
        self.status = status
开发者ID:D3f0,项目名称:txscada,代码行数:7,代码来源:other_message.py

示例2: __init__

    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 []
开发者ID:semyont,项目名称:pymodbus,代码行数:7,代码来源:file_message.py

示例3: __init__

 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
开发者ID:rgborges,项目名称:sensorNetwork,代码行数:8,代码来源:bit_read_massage.py

示例4: __init__

    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
开发者ID:bashwork,项目名称:pymodbus,代码行数:9,代码来源:register_write_message.py

示例5: __init__

    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)
开发者ID:bashwork,项目名称:pymodbus,代码行数:9,代码来源:bit_write_message.py

示例6: __init__

    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
开发者ID:D3f0,项目名称:txscada,代码行数:9,代码来源:bit_write_message.py

示例7: __init__

    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
开发者ID:thom-nic,项目名称:pymodbus,代码行数:9,代码来源:register_read_message.py

示例8: __init__

    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
开发者ID:semyont,项目名称:pymodbus,代码行数:9,代码来源:mei_message.py

示例9: testInverterFramerEncoding

 def testInverterFramerEncoding(self):
     old_encode = ModbusRequest.encode
     ModbusRequest.encode = lambda self: ''
     message = ModbusRequest()
     message.unit_id = 0xff
     message.function_code = 0x01
     expected = '\x0a\xff\x01\x81\x80\x0d'
     actual = self.framer.buildPacket(message)
     ModbusRequest.encode = old_encode
     self.assertEqual(expected, actual)
开发者ID:deuxpi,项目名称:pysunrise,代码行数:10,代码来源:test_modbus.py

示例10: __init__

    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 = []
开发者ID:D3f0,项目名称:txscada,代码行数:11,代码来源:register_write_message.py

示例11: __init__

    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
开发者ID:vrtsystems,项目名称:pymodbus,代码行数:12,代码来源:register_read_message.py

示例12: __init__

    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
开发者ID:4rc4n4,项目名称:pymodbus,代码行数:13,代码来源:register_write_message.py

示例13: __init__

    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 = []
开发者ID:D3f0,项目名称:txscada,代码行数:16,代码来源:register_read_message.py

示例14: __init__

 def __init__(self, address=None, **kwargs):
     ModbusRequest.__init__(self, **kwargs)
     self.address = address
     self.count = 16
开发者ID:bashwork,项目名称:pymodbus,代码行数:4,代码来源:custom_message_async_clients.py

示例15: __init__

 def __init__(self, **kwargs):
     '''
     Base initializer for a diagnostic request
     '''
     ModbusRequest.__init__(self, **kwargs)
     self.message = None
开发者ID:bashwork,项目名称:pymodbus,代码行数:6,代码来源:diag_message.py


注:本文中的pymodbus.pdu.ModbusRequest类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。