public RtuController(ModuleConfig config, ILogger logger = null) { this.channel = ModuleTcpChannel.CreateSingleton(config, logger); if (!this.channel.IsConnected) { this.channel.OpenAsync().GetAwaiter(); } this.logger = logger; }
public ModuleService(ModuleConfig config, ModuleTcpChannel channel, Logger logger = null) { this.config = config; output = channel; this.logger = logger; mapper = new MbapMapper(Guid.NewGuid().ToString()); adapter = new ModuleTwinAdapter(); adapter.OnConfigurationReceived += Adapter_OnConfigurationReceived; }
public RtuController(ModuleConfig config, ModuleTcpChannel channel, ILogger logger = null) { if (channel == null) { this.channel = ModuleTcpChannel.CreateSingleton(config, logger); if (!this.channel.IsConnected) { this.channel.OpenAsync().GetAwaiter(); } } else { this.channel = channel; } this.logger = logger; mapper = new MbapMapper(Guid.NewGuid().ToString()); }