Exemple #1
0
        /// <summary>
        /// Reads a single Modbus/TCP register
        /// </summary>
        /// <param name="command">Modbus/TCP register index for holding register</param>
        /// <returns>Register content</returns>
        public int ReadInteger(object command)
        {
            int           _value   = 0;
            ModbusCommand _command = (ModbusCommand)command;

            ushort[] _data = ReadModbusRegisters();
            _value = _command.ToValue(_data);
            return(_value);
        }
Exemple #2
0
        /// <summary>
        /// Reads a single Modbus/TCP register
        /// </summary>
        /// <param name="command">Modbus/TCP register index for holding register</param>
        /// <returns>Register content</returns>
        public string Read(object command)
        {
            int           _value   = 0;
            ModbusCommand _command = (ModbusCommand)command;

            ushort[] _data = ReadModbusRegisters();
            _value = _command.ToValue(_data);
            return(_value.ToString());
        }
Exemple #3
0
        /// <inheritdoc />
        public async Task <string> ReadAsync(object command)
        {
            int           _value   = 0;
            ModbusCommand _command = (ModbusCommand)command;

            ushort[] _data = await ReadModbusRegistersAsync();

            _value = _command.ToValue(_data);
            this.UpdateData?.Invoke(this, new EventArgs());
            return(_value.ToString());
        }
Exemple #4
0
        /// <inheritdoc />
        public int ReadIntegerFromBuffer(object command)
        {
            ModbusCommand modbuscommand = (ModbusCommand)command;

            return(modbuscommand.ToValue(AllData));
        }
Exemple #5
0
        public string ReadFromBuffer(object command)
        {
            ModbusCommand modBusCommand = (ModbusCommand)command;

            return((modBusCommand.ToValue(AllData)).ToString());
        }