def modbus_server(request): modbus_server = Server(address='127.0.0.1', port=5020) modbus_server.define_slave(1, PPSPi32Client, unsigned=True) # Set values for registers from server as the default values modbus_server.set_values(1, PPSPi32Client().field_by_name("BigUShort"), 0) modbus_server.set_values(1, PPSPi32Client().field_by_name("BigUInt"), 0) modbus_server.set_values(1, PPSPi32Client().field_by_name("BigULong"), 0) modbus_server.set_values(1, PPSPi32Client().field_by_name("BigShort"), 0) modbus_server.set_values(1, PPSPi32Client().field_by_name("BigInt"), 0) modbus_server.set_values(1, PPSPi32Client().field_by_name("BigFloat"), 0) modbus_server.set_values(1, PPSPi32Client().field_by_name("BigLong"), 0) modbus_server.set_values(1, PPSPi32Client().field_by_name("LittleUShort"), unpack('<H', pack('>H', 0))[0]) modbus_server.set_values(1, PPSPi32Client().field_by_name("LittleUInt"), unpack('<I', pack('>I', 0))[0]) modbus_server.set_values(1, PPSPi32Client().field_by_name("LittleULong"), unpack('<Q', pack('>Q', 0))[0]) modbus_server.set_values(1, PPSPi32Client().field_by_name("LittleShort"), unpack('<h', pack('>h', 0))[0]) modbus_server.set_values(1, PPSPi32Client().field_by_name("LittleInt"), unpack('<i', pack('>i', 0))[0]) modbus_server.set_values(1, PPSPi32Client().field_by_name("LittleFloat"), unpack('<f', pack('>f', 0))[0]) modbus_server.set_values(1, PPSPi32Client().field_by_name("LittleLong"), unpack('<q', pack('>q', 0))[0]) modbus_server.start() time.sleep(1) yield modbus_server time.sleep(1) modbus_server.stop()
def modbus_server(request): ModbusClient = Catalog()['battery_meter'].get_class() server_process = Server(address='127.0.0.1', port=5020) server_process.define_slave(1, ModbusClient, unsigned=False) server_process.start() time.sleep(1) yield server_process time.sleep(1) server_process.stop()
def modbus_server(request): ModbusClient = Catalog()['mixed_endian_reg'].get_class() server_process = Server(address='127.0.0.1', port=5020) server_process.define_slave(1, ModbusClient, unsigned=False) server_process.start() time.sleep(1) yield server_process time.sleep(1) server_process.stop()
def modbus_server(request): modbus_client = Catalog()['battery_meter'].get_class() server_process = Server(address=IP, port=PORT) server_process.define_slave(1, modbus_client, unsigned=False) server_process.start() time.sleep(1) yield server_process time.sleep(1) server_process.stop()
def modbus_server(request): # modbus_map = Map(map_dir=os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "maps")), # addressing='offset', name='modbus_tk_test', file='modbus_tk_test.csv', endian='big') # ModbusClient = modbus_map.get_class() ModbusClient = Catalog()['modbus_tk_test'].get_class() server_process = Server(address='127.0.0.1', port=5020) server_process.define_slave(1, ModbusClient, unsigned=False) server_process.start() time.sleep(1) yield server_process time.sleep(1) server_process.stop()
def modbus_server(request): # modbus_map = Map(map_dir=os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "maps")), # addressing='address', name='ion6200', file='ion6200.csv', endian='big') # ModbusClient = modbus_map.get_class() ModbusClient = Catalog()['ion6200'].get_class() server_process = Server(address='127.0.0.1', port=5020) server_process.define_slave(1, ModbusClient, unsigned=False) server_process.start() time.sleep(1) yield server_process time.sleep(1) server_process.stop()
def modbus_server(request): # modbus_map = Map( # map_dir=os.path.abspath( # os.path.join(os.path.dirname(__file__), "..", "maps")), # addressing='offset', name='modbus_tk_test', # file='modbus_tk_test.csv', endian='big') # ModbusClient = modbus_map.get_class() modbus_client = Catalog()['modbus_tk_test'].get_class() server_process = Server(address=IP, port=PORT) server_process.define_slave(1, modbus_client, unsigned=False) server_process.start() time.sleep(1) yield server_process time.sleep(1) server_process.stop()