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)
Exemplo n.º 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
Exemplo n.º 3
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
 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)
Exemplo n.º 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))
 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)
Exemplo n.º 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)
 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)
Exemplo n.º 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)
 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)
Exemplo n.º 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)
Exemplo n.º 12
0
 def check_config(channel_params):
     return BaseChannel.check_config(channel_params)
Exemplo n.º 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)
Exemplo n.º 14
0
 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)
Exemplo n.º 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)
Exemplo n.º 16
0
 def check_config(channel_params):
     return BaseChannel.check_config(channel_params)
Exemplo n.º 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)
 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)