コード例 #1
0
        public int[] AsyncWriteItems(int[] serverIds, object[] values, int transactionId, out int cancelId)
        {
            cancelId = 0;
            if (_group == null)
            {
                throw new ObjectDisposedException("Group");
            }
            if (_asyncIo == null)
            {
                throw new NotSupportedException();
            }
            if (serverIds == null)
            {
                throw new ArgumentNullException(nameof(serverIds));
            }
            if (serverIds.Length == 0)
            {
                return(new int[0]);
            }

            using (var writer = new ItemValueWriter(values))
            {
                _asyncIo.Write((uint)serverIds.Length, serverIds, writer.Values, transactionId, out var tmp, out var errorsPtr);

                cancelId = tmp;
                return(ItemResultReader.Read(serverIds.Length, errorsPtr));
            }
        }
コード例 #2
0
        public int[] SetDatatypes(int[] serverIds, VarEnum[] types)
        {
            if (_group == null)
            {
                throw new ObjectDisposedException("Group");
            }
            if (serverIds == null)
            {
                throw new ArgumentNullException(nameof(serverIds));
            }
            if (serverIds.Length == 0)
            {
                return(new int[0]);
            }

            var typesAsShort = new short[types.Length];

            for (var i = 0; i < types.Length; i++)
            {
                typesAsShort[i] = (short)types[i];
            }

            _group.SetDatatypes((uint)serverIds.Length, serverIds, typesAsShort, out var errorsPtr);

            return(ItemResultReader.Read(serverIds.Length, errorsPtr));
        }
コード例 #3
0
        public int[] SetActiveState(int[] serverIds, bool active)
        {
            if (_group == null)
            {
                throw new ObjectDisposedException("Group");
            }
            if (serverIds == null)
            {
                throw new ArgumentNullException(nameof(serverIds));
            }
            if (serverIds.Length == 0)
            {
                return(new int[0]);
            }

            _group.SetActiveState((uint)serverIds.Length, serverIds, active ? 1 : 0, out var errorsPtr);

            return(ItemResultReader.Read(serverIds.Length, errorsPtr));
        }
コード例 #4
0
        public int[] SetClientHandles(int[] serverIds, int[] clientIds)
        {
            if (_group == null)
            {
                throw new ObjectDisposedException("Group");
            }
            if (serverIds == null)
            {
                throw new ArgumentNullException(nameof(serverIds));
            }
            if (serverIds.Length == 0)
            {
                return(new int[0]);
            }

            _group.SetClientHandles((uint)serverIds.Length, serverIds, clientIds, out var errorsPtr);

            return(ItemResultReader.Read(serverIds.Length, errorsPtr));
        }
コード例 #5
0
        public ItemResult[] ValidateItems(Item[] items)
        {
            if (_group == null)
            {
                throw new ObjectDisposedException("Group");
            }
            if (items == null)
            {
                throw new ArgumentNullException(nameof(items));
            }
            if (items.Length == 0)
            {
                return(new ItemResult[0]);
            }

            using (var reader = new ItemResultReader(items))
            {
                _group.ValidateItems((uint)items.Length, reader.Items, 0, out var dataPtr, out var errorsPtr);
                return(reader.Read(dataPtr, errorsPtr));
            }
        }