public static BaseDataVariableState GetRegisterVariable(MemoryRegister register, int index, ushort namespaceIndex)
        {
            if (index < 0 || index >= register.Size)
            {
                return(null);
            }

            var variable = new BaseDataVariableState <int>(null)
            {
                NodeId     = GetRegisterVariableId(register, index, namespaceIndex),
                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);
        }
Beispiel #2
0
        public void Initialize()
        {
            _registers = new List <MemoryRegister>();
            var register1 = new MemoryRegister();

            register1.Initialize(1, "R1", 50000);
            _registers.Add(register1);
        }
        public MemoryRegisterState(MemoryRegister register, ushort namespaceIndex) : base(null)
        {
            Register = register;

            NodeId      = new NodeId((uint)register.Id, namespaceIndex);
            BrowseName  = new QualifiedName(register.Name, namespaceIndex);
            DisplayName = BrowseName.Name;

            AddReference(ReferenceTypeIds.Organizes, true, ObjectIds.ObjectsFolder);
        }
        public static MemoryRegisterState GetRegister(MemoryRegister register, ushort namespaceIndex)
        {
            var node = new MemoryRegisterState(register, namespaceIndex);

            return(node);
        }
        public static NodeId GetRegisterVariableId(MemoryRegister register, int index, ushort namespaceIndex)
        {
            var 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));
 }