public IVIBridge(IVIBridgeConfig config) : base(config.PartID, initialSettings: SimpleActivePartBaseSettings.DefaultVersion2.Build(waitTimeLimit: TimeSpan.FromSeconds((config.MinSyncInterval != TimeSpan.Zero) ? 0.05 : 0.2), partBaseIVI: config.PartBaseIVI, disableBusyBehavior: true)) { BridgeConfig = new IVIBridgeConfig(config); useNominalSyncHoldoffTimer = (BridgeConfig.MinSyncInterval != TimeSpan.Zero); if (useNominalSyncHoldoffTimer) { nominalSyncHoldoffTimer.TriggerInterval = BridgeConfig.MinSyncInterval; } IssueEmitter = Log.Emitter(BridgeConfig.IssueLogMesgType); ValueTraceEmitter = Log.Emitter(BridgeConfig.ValueUpdateTraceLogMesgType); IVI1 = BridgeConfig.IVI1; // BridgeConfig Copy constructor converts passed nulls to singleton instance IVI2 = BridgeConfig.IVI2; // BridgeConfig Copy constructor converts passed nulls to singleton instance IVI1.NotificationList.AddItem(this); IVI2.NotificationList.AddItem(this); AddExplicitDisposeAction(() => { IVI1.NotificationList.RemoveItem(this); IVI2.NotificationList.RemoveItem(this); }); PerformMainLoopService(); }
public IVIBridgeConfig(IVIBridgeConfig other) { PartID = other.PartID; MinSyncInterval = other.MinSyncInterval.Clip(TimeSpan.Zero, TimeSpan.FromSeconds(0.2)); IssueLogMesgType = other.IssueLogMesgType; ValueUpdateTraceLogMesgType = other.ValueUpdateTraceLogMesgType; PartBaseIVI = other.PartBaseIVI ?? Modular.Interconnect.Values.Values.Instance; IVI1 = other.IVI1 ?? Modular.Interconnect.Values.Values.Instance; IVI2 = other.IVI2 ?? Modular.Interconnect.Values.Values.Instance; if (other.IVA1PropagateNameMatchRuleSet != null) { IVA1PropagateNameMatchRuleSet = new MatchRuleSet(other.IVA1PropagateNameMatchRuleSet); } IVA1MapNameFromTo = other.IVA1MapNameFromTo; if (other.IVA2PropagateNameMatchRuleSet != null) { IVA2PropagateNameMatchRuleSet = new MatchRuleSet(other.IVA2PropagateNameMatchRuleSet); } IVA2MapNameFromTo = other.IVA2MapNameFromTo; }