コード例 #1
0
 def __init__(self, channel_params, devices_file_name, protocol,
              mqtt_client, network_name):
     BaseChannel.__init__(self, channel_params, devices_file_name, protocol,
                          mqtt_client, network_name)
     self.host = self.channel_params.get("host", "127.0.0.1")
     self.port = self.channel_params.get("port", 0)
     self.protocol.set_device_info(self.host, self.port)
コード例 #2
0
 def __init__(self, channel_params, devices_file_name, protocol, mqtt_client, network_name):
     BaseChannel.__init__(self, channel_params, devices_file_name, protocol, mqtt_client, network_name)
     # 配置项
     self.server = channel_params.get("server", "")
     self.port = channel_params.get("port", 0)
     self.protocol.set_device_info(self.server, self.port)
     # 通信对象
     self.modbus_client = None
コード例 #3
0
ファイル: tcprtu.py プロジェクト: lianwutech/plugin_xxx_yyy
 def __init__(self, channel_params, devices_file_name, protocol, mqtt_client, network_name):
     BaseChannel.__init__(self, channel_params, devices_file_name, protocol, mqtt_client, network_name)
     # 配置项
     self.server = channel_params.get("server", "")
     self.port = channel_params.get("port", 0)
     self.protocol.set_device_info(self.server, self.port)
     # 通信对象
     self.modbus_client = None
コード例 #4
0
 def __init__(self, network, channel_name, channel_protocol, channel_params, manager, channel_type):
     self.status = None
     self.port = channel_params.get("port", "")
     self.stopbits = channel_params.get("stopbits", serial.STOPBITS_ON)
     self.parity = channel_params.get("parity", serial.PARITY_NONE)
     self.bytesize = channel_params.get("bytesize", serial.EIGHTBITS)
     self.baudrate = channel_params.get("baudrate", 9600)
     self.timeout = channel_params.get("timeout", 1)
     BaseChannel.__init__(network, channel_name, channel_protocol, channel_params, manager, channel_type)
コード例 #5
0
 def __init__(self, channel_params, devices_file_name, protocol, mqtt_client, network_name):
     BaseChannel.__init__(self, channel_params, devices_file_name, protocol, mqtt_client, network_name)
     # 配置项
     self.vendor_id = int(channel_params.get("vendor_id", "0"), 16)
     self.product_id = int(channel_params.get("product_id", "0"), 16)
     self.timeout = channel_params.get("timeout", 2)
     self.protocol.set_device_info(self.vendor_id, self.product_id)
     usb_context = usb1.USBContext()
     usb_device = usb_context.getByVendorIDAndProductID(self.vendor_id, self.product_id)
     self.device_max_packet_size = usb_device.getMaxPacketSize0()
     self.device_bus = usb_device.getBusNumber()
     self.device_port = usb_device.getDeviceAddress()
     logger.debug("device bus:%03i device:%03i" % (self.device_bus, self.device_port))
コード例 #6
0
 def __init__(self, channel_params, devices_file_name, protocol, mqtt_client, network_name):
     BaseChannel.__init__(self, channel_params, devices_file_name, protocol, mqtt_client, network_name)
     # 配置项
     self.port = channel_params.get("port", "")
     self.baund = channel_params.get("baund", 9600)
     self.stopbits = channel_params.get("stopbits", serial.STOPBITS_ONE)
     self.parity = channel_params.get("parity", serial.PARITY_NONE)
     self.bytesize = channel_params.get("bytesize", serial.EIGHTBITS)
     self.timeout = channel_params.get("timeout", 2)
     self.protocol.set_device_info(self.port, self.baund)
     # modbus通信对象
     self.modbus_client = ModbusSerialClient(method='rtu',
                                             port=self.port,
                                             baudrate=self.baund,
                                             stopbits=self.stopbits,
                                             parity=self.parity,
                                             bytesize=self.bytesize,
                                             timeout=self.timeout)
コード例 #7
0
 def __init__(self, channel_params, devices_file_name, protocol,
              mqtt_client, network_name):
     BaseChannel.__init__(self, channel_params, devices_file_name, protocol,
                          mqtt_client, network_name)
     # 配置项
     self.port = channel_params.get("port", "")
     self.baund = channel_params.get("baund", 9600)
     self.stopbits = channel_params.get("stopbits", serial.STOPBITS_ONE)
     self.parity = channel_params.get("parity", serial.PARITY_NONE)
     self.bytesize = channel_params.get("bytesize", serial.EIGHTBITS)
     self.timeout = channel_params.get("timeout", 2)
     self.protocol.set_device_info(self.port, self.baund)
     # modbus通信对象
     self.modbus_client = ModbusSerialClient(method='rtu',
                                             port=self.port,
                                             baudrate=self.baund,
                                             stopbits=self.stopbits,
                                             parity=self.parity,
                                             bytesize=self.bytesize,
                                             timeout=self.timeout)
コード例 #8
0
 def __init__(self, network, channel_name, channel_protocol, channel_params, manager, channel_type):
     self.status = None
     BaseChannel.__init__(network, channel_name, channel_protocol, channel_params, manager, channel_type)
コード例 #9
0
 def check_config(channel_params):
     if "host" not in channel_params or "port" not in channel_params:
         return False
     return BaseChannel.check_config(channel_params)
コード例 #10
0
 def __init__(self, network, channel_name, channel_protocol, channel_params, manager, channel_type):
     self.status = None
     self.host = channel_params.get("host", "127.0.0.1")
     self.port = channel_params.get("port", 26)
     self.socket = None
     BaseChannel.__init__(self, network, channel_name, channel_protocol, channel_params, manager, channel_type)
コード例 #11
0
 def check_config(channel_params):
     if "vendor_id" not in channel_params or "product_id" not in channel_params:
         return False
     return BaseChannel.check_config(channel_params)
コード例 #12
0
 def check_config(channel_params):
     return BaseChannel.check_config(channel_params)
コード例 #13
0
 def __init__(self, channel_params, devices_file_name, protocol, mqtt_client, network_name):
     BaseChannel.__init__(self, channel_params, devices_file_name, protocol, mqtt_client, network_name)
コード例 #14
0
ファイル: tcprtu.py プロジェクト: lianwutech/plugin_xxx_yyy
 def check_config(channel_params):
     if "server" not in channel_params or "port" not in channel_params:
         return False
     return BaseChannel.check_config(channel_params)
コード例 #15
0
 def __init__(self, network, channel_name, channel_protocol, channel_params, manager, channel_type):
     self.server = channel_params.get("server", "")
     self.port = channel_params.get("port", "")
     self.modbus_client = None
     BaseChannel.__init__(self, network, channel_name, channel_protocol, channel_params, manager, channel_type)
コード例 #16
0
 def check_config(channel_params):
     return BaseChannel.check_config(channel_params)
コード例 #17
0
 def __init__(self, channel_params, devices_file_name, protocol,
              mqtt_client, network_name):
     BaseChannel.__init__(self, channel_params, devices_file_name, protocol,
                          mqtt_client, network_name)
コード例 #18
0
 def __init__(self, channel_params, devices_file_name, protocol, mqtt_client, network_name):
     BaseChannel.__init__(self, channel_params, devices_file_name, protocol, mqtt_client, network_name)
     self.host = self.channel_params.get("host", "127.0.0.1")
     self.port = self.channel_params.get("port", 0)
     self.protocol.set_device_info(self.host, self.port)