public void Initialize() { m_registers = new List<MemoryRegister>(); MemoryRegister register1 = new MemoryRegister(); register1.Initialize(1, "R1", 50000); m_registers.Add(register1); }
public void Initialize() { m_registers = new List <MemoryRegister>(); MemoryRegister register1 = new MemoryRegister(); register1.Initialize(1, "R1", 50000); m_registers.Add(register1); }
/// <summary> /// Returns a unique handle for the node. /// </summary> protected override NodeHandle GetManagerHandle(ServerSystemContext context, NodeId nodeId, IDictionary <NodeId, NodeState> cache) { lock (Lock) { // quickly exclude nodes that are not in the namespace. if (!IsNodeIdInNamespace(nodeId)) { return(null); } NodeHandle handle = new NodeHandle(); handle.NodeId = nodeId; handle.Validated = true; uint id = (uint)nodeId.Identifier; // find register int registerId = (int)((id & 0xFF000000) >> 24); int index = (int)(id & 0x00FFFFFF); if (registerId == 0) { MemoryRegister register = m_system.GetRegister(index); if (register == null) { return(null); } handle.Node = ModelUtils.GetRegister(register, NamespaceIndex); } // find register variable. else { MemoryRegister register = m_system.GetRegister(registerId); if (register == null) { return(null); } // find register variable. BaseDataVariableState variable = ModelUtils.GetRegisterVariable(register, index, NamespaceIndex); if (variable == null) { return(null); } handle.Node = variable; } return(handle); } }
public MemoryRegisterState(MemoryRegister register, ushort namespaceIndex) : base(null) { m_register = register; this.NodeId = new NodeId((uint)register.Id, namespaceIndex); this.BrowseName = new QualifiedName(register.Name, namespaceIndex); this.DisplayName = this.BrowseName.Name; this.AddReference(ReferenceTypeIds.Organizes, true, ObjectIds.ObjectsFolder); }
protected override void OnDeleteMonitoredItemsComplete(ServerSystemContext context, IList <IMonitoredItem> monitoredItems) { for (int ii = 0; ii < monitoredItems.Count; ii++) { NodeHandle handle = IsHandleInNamespace(monitoredItems[ii].ManagerHandle); if (handle == null) { continue; } MemoryRegister register = handle.Node.Handle as MemoryRegister; BaseVariableState variable = handle.Node as BaseVariableState; if (register != null) { register.Unsubscribe((int)variable.NumericId, (IDataChangeMonitoredItem2)monitoredItems[ii]); } } }
public static BaseDataVariableState GetRegisterVariable(MemoryRegister register, int index, ushort namespaceIndex) { if (index < 0 || index >= register.Size) { return(null); } BaseDataVariableState <int> variable = new BaseDataVariableState <int>(null); variable.NodeId = GetRegisterVariableId(register, index, namespaceIndex); variable.BrowseName = new QualifiedName(Utils.Format("{0:000000}", index), namespaceIndex); variable.DisplayName = variable.BrowseName.Name; variable.Value = register.Read(index); variable.DataType = DataTypeIds.Int32; variable.ValueRank = ValueRanks.Scalar; variable.MinimumSamplingInterval = 100; variable.AccessLevel = AccessLevels.CurrentReadOrWrite; variable.UserAccessLevel = AccessLevels.CurrentReadOrWrite; variable.Handle = register; variable.NumericId = (uint)index; return(variable); }
public static BaseDataVariableState GetRegisterVariable(MemoryRegister register, int index, ushort namespaceIndex) { if (index < 0 || index >= register.Size) { return null; } BaseDataVariableState<int> variable = new BaseDataVariableState<int>(null); variable.NodeId = GetRegisterVariableId(register, index, namespaceIndex); variable.BrowseName = new QualifiedName(Utils.Format("{0:000000}", index), namespaceIndex); variable.DisplayName = variable.BrowseName.Name; variable.Value = register.Read(index); variable.DataType = DataTypeIds.Int32; variable.ValueRank = ValueRanks.Scalar; variable.MinimumSamplingInterval = 100; variable.AccessLevel = AccessLevels.CurrentReadOrWrite; variable.UserAccessLevel = AccessLevels.CurrentReadOrWrite; variable.Handle = register; variable.NumericId = (uint)index; return variable; }
public static MemoryRegisterState GetRegister(MemoryRegister register, ushort namespaceIndex) { MemoryRegisterState node = new MemoryRegisterState(register, namespaceIndex); return(node); }
public static NodeId GetRegisterVariableId(MemoryRegister register, int index, ushort namespaceIndex) { uint id = (uint)(register.Id << 24) + (uint)index; return(new NodeId(id, namespaceIndex)); }
public static NodeId GetRegisterId(MemoryRegister register, ushort namespaceIndex) { return(new NodeId((uint)register.Id, namespaceIndex)); }
public static MemoryRegisterState GetRegister(MemoryRegister register, ushort namespaceIndex) { MemoryRegisterState node = new MemoryRegisterState(register, namespaceIndex); return node; }
public static NodeId GetRegisterVariableId(MemoryRegister register, int index, ushort namespaceIndex) { uint id = (uint)(register.Id << 24) + (uint)index; return new NodeId(id, namespaceIndex); }
public static NodeId GetRegisterId(MemoryRegister register, ushort namespaceIndex) { return new NodeId((uint)register.Id, namespaceIndex); }