예제 #1
0
        public override OpResult <short> ReadInt16(string address)
        {
            var result  = new OpResult <short>();
            var encoder = new FinsReadCommand();
            var decoder = new FinsReadResponseCommand();

            Read(address, result, encoder, decoder, (r, en, de) =>
            {
                var val = decoder.DataAsInt16;
                if (result.CheckNotNull(val, SR.DecodeError))
                {
                    result.Content = val.Value;
                }
            });

            return(result);
        }
예제 #2
0
        public override OpResult <byte[]> ReadUInt16Bytes(string address, int count)
        {
            var result  = new OpResult <byte[]>();
            var encoder = new FinsReadCommand()
            {
                Length = (ushort)(1 * count)
            };
            var decoder = new FinsReadResponseCommand();

            Read(address, result, encoder, decoder, (r, en, de) =>
            {
                if (result.CheckNotNull(decoder.Data, SR.DecodeError))
                {
                    result.Content = decoder.Data;
                }
            });

            return(result);
        }
예제 #3
0
        public override OpResult <bool> ReadBoolean(string address)
        {
            var result  = new OpResult <bool>();
            var encoder = new FinsReadCommand()
            {
                Length = 1
            };
            var decoder = new FinsReadResponseCommand();

            Read(address, result, encoder, decoder, (r, en, de) =>
            {
                var val = decoder.DataAsBoolean;
                if (result.CheckNotNull(val, SR.DecodeError))
                {
                    result.Content = val.Value;
                }
            });

            return(result);
        }
예제 #4
0
        public override OpResult <uint[]> ReadUInt32(string address, int count)
        {
            var result  = new OpResult <uint[]>();
            var encoder = new FinsReadCommand()
            {
                Length = (ushort)(2 * count)
            };
            var decoder = new FinsReadResponseCommand();

            Read(address, result, encoder, decoder, (r, en, de) =>
            {
                var val = decoder.DataAsUInt32Array;
                if (result.CheckNotNull(val, SR.DecodeError))
                {
                    result.Content = val;
                }
            });

            return(result);
        }