示例#1
0
        public Task <byte[]> ExecuteFunction12Async(byte slaveAddress, byte moduleNumber, byte queryId,
                                                    byte numberOfBytes)
        {
            var request = new Function12Request(
                Modbus.Function12,
                slaveAddress, moduleNumber, queryId, numberOfBytes);

            return(PerformFunction12Request(request));
        }
示例#2
0
        private async Task <byte[]> PerformFunction12Request(Function12Request request)
        {
            Function12Response response = null;
            await Task.Factory.StartNew((() =>
            {
                response = Transport.UnicastMessage <Function12Response>(request);
            }));

            return(response?.BytesResult.ToArray());
        }