/// <summary> /// Returns true if the system must be scanning to provide updates for the monitored item. /// </summary> private bool SystemScanRequired(MonitoredNode2 monitoredNode, IDataChangeMonitoredItem2 monitoredItem) { // ingore other types of monitored items. if (monitoredItem == null) { return(false); } // only care about variables. BaseDataVariableState source = monitoredNode.Node as BaseDataVariableState; if (source == null) { return(false); } // check for variables that need to be scanned. if (monitoredItem.AttributeId == Attributes.Value) { TestDataObjectState test = source.Parent as TestDataObjectState; if (test != null && test.SimulationActive.Value) { return(true); } } return(false); }
public void Initialize(int id, string name, int size) { m_id = id; m_name = name; m_values = new int[size]; m_monitoredItems = new IDataChangeMonitoredItem2[size][]; }
public void Unsubscribe(int index, IDataChangeMonitoredItem2 monitoredItem) { lock (m_lock) { if (index >= 0 && index < m_values.Length) { IDataChangeMonitoredItem2[] monitoredItems = m_monitoredItems[index]; if (monitoredItems != null) { for (int ii = 0; ii < monitoredItems.Length; ii++) { if (Object.ReferenceEquals(monitoredItems[ii], monitoredItem)) { m_monitoredItems[index] = new IDataChangeMonitoredItem2[monitoredItems.Length - 1]; if (ii > 0) { Array.Copy(monitoredItems, m_monitoredItems[index], ii); } if (ii < monitoredItems.Length - 1) { Array.Copy(monitoredItems, ii + 1, m_monitoredItems[index], 0, monitoredItems.Length - ii - 1); } monitoredItems = m_monitoredItems[index]; break; } } } } } }
public void Subscribe(int index, IDataChangeMonitoredItem2 monitoredItem) { lock (m_lock) { if (m_timer == null) { m_timer = new Timer(OnUpdate, null, 45, 45); } if (index >= 0 && index < m_values.Length) { IDataChangeMonitoredItem2[] monitoredItems = m_monitoredItems[index]; if (monitoredItems == null) { m_monitoredItems[index] = monitoredItems = new IDataChangeMonitoredItem2[1]; } else { m_monitoredItems[index] = new IDataChangeMonitoredItem2[monitoredItems.Length + 1]; Array.Copy(monitoredItems, m_monitoredItems[index], monitoredItems.Length); monitoredItems = m_monitoredItems[index]; } monitoredItems[monitoredItems.Length - 1] = monitoredItem; } } }
/// <summary> /// Returns true if the system must be scanning to provide updates for the monitored item. /// </summary> private bool SystemScanRequired(MonitoredNode2 monitoredNode, IDataChangeMonitoredItem2 monitoredItem) { // ingore other types of monitored items. if (monitoredItem == null) { return false; } // only care about variables. BaseDataVariableState source = monitoredNode.Node as BaseDataVariableState; if (source == null) { return false; } // check for variables that need to be scanned. if (monitoredItem.AttributeId == Attributes.Value) { TestDataObjectState test = source.Parent as TestDataObjectState; if (test != null && test.SimulationActive.Value) { return true; } } return false; }
public void Initialize(int id, string name, int size) { m_id = id; m_name = name; m_values = new int[size]; m_monitoredItems = new IDataChangeMonitoredItem2[size][]; }
public void Unsubscribe(int index, IDataChangeMonitoredItem2 monitoredItem) { lock (m_lock) { if (index >= 0 && index < m_values.Length) { IDataChangeMonitoredItem2[] monitoredItems = m_monitoredItems[index]; if (monitoredItems != null) { for (int ii = 0; ii < monitoredItems.Length; ii++) { if (Object.ReferenceEquals(monitoredItems[ii], monitoredItem)) { m_monitoredItems[index] = new IDataChangeMonitoredItem2[monitoredItems.Length - 1]; if (ii > 0) { Array.Copy(monitoredItems, m_monitoredItems[index], ii); } if (ii < monitoredItems.Length - 1) { Array.Copy(monitoredItems, ii + 1, m_monitoredItems[index], 0, monitoredItems.Length - ii - 1); } monitoredItems = m_monitoredItems[index]; break; } } } } } }
public void Subscribe(int index, IDataChangeMonitoredItem2 monitoredItem) { lock (m_lock) { if (m_timer == null) { m_timer = new Timer(OnUpdate, null, 45, 45); } if (index >= 0 && index < m_values.Length) { IDataChangeMonitoredItem2[] monitoredItems = m_monitoredItems[index]; if (monitoredItems == null) { m_monitoredItems[index] = monitoredItems = new IDataChangeMonitoredItem2[1]; } else { m_monitoredItems[index] = new IDataChangeMonitoredItem2[monitoredItems.Length + 1]; Array.Copy(monitoredItems, m_monitoredItems[index], monitoredItems.Length); monitoredItems = m_monitoredItems[index]; } monitoredItems[monitoredItems.Length - 1] = monitoredItem; } } }