public override bool Init() { if (_isTcp) { var port = GetProperty("modbus-port").ValueInt.Value; var ignoreDeviceId = GetProperty("modbus-ignoreDeviceId").ValueBool.Value; var devices = new List <int>(); foreach (var ch in DriverContext.NodeInstance.InverseThis2ParentNodeInstanceNavigation) { devices.Add(GetProperty(ch, "modbus-device-id").ValueInt.Value); } var config = new ModBusSlaveTcpConfig(); config.Port = (ushort)port; config.IgnoreDeviceId = ignoreDeviceId; config.DeviceIds = devices; _modBusDriver = new ModBusSlaveTcpDriver(config, TelegramMonitor); } else { throw new NotImplementedException(); } return(base.Init()); }
public ModBusSlaveAttribute(IDriverContext driverContext, ModBusSlaveDevice parent, IModBusSlaveDriver driver, ModBusAttribute attribute) : base(driverContext) { Driver = driver; _parent = parent; _attribute = attribute; }
public ModBusSlaveDevice(IDriverContext driverContext, IModBusSlaveDriver driver) : base(driverContext) { _driver = driver; DeviceId = (byte)GetProperty("modbus-device-id").ValueInt; }