Esempio n. 1
0
        /// <summary>
        /// 读取设备的double类型的数组
        /// </summary>
        /// <param name="address">起始地址</param>
        /// <param name="length">数组长度</param>
        /// <returns>带成功标志的结果数据对象</returns>
        public OperateResult <double[]> ReadDouble(string address, ushort length)
        {
            OperateResult <byte[]> read = Read(address, (ushort)(length * WordLength * 4));

            if (!read.IsSuccess)
            {
                return(OperateResult.CreateFailedResult <double[]>(read));
            }
            return(OperateResult.CreateSuccessResult(ByteTransform.TransDouble(read.Content, 0, length)));
        }
Esempio n. 2
0
 /// <summary>
 /// 读取PLC的double类型的数组 -> An array that reads the double type of the PLC
 /// </summary>
 /// <param name="address">节点的名称 -> Name of the node </param>
 /// <param name="length">数组长度 -> Array length </param>
 /// <returns>带有结果对象的结果数据 -> Result data with result info </returns>
 /// <example>
 /// 以下为三菱的连接对象示例,其他的设备读写情况参照下面的代码:
 /// <code lang="cs" source="HslCommunication_Net45.Test\Documentation\Samples\Core\NetworkDeviceBase.cs" region="ReadDoubleArray" title="Double类型示例" />
 /// </example>
 public override OperateResult <double[]> ReadDouble(string address, ushort length)
 {
     return(ByteTransformHelper.GetResultFromBytes(Read(address, length), m => ByteTransform.TransDouble(m, 0, length)));
 }
Esempio n. 3
0
 /// <summary>
 /// 读取设备的double类型的数组
 /// </summary>
 /// <param name="address">起始地址</param>
 /// <param name="length">数组长度</param>
 /// <returns>带成功标志的结果数据对象</returns>
 /// <example>
 /// 以下为三菱的连接对象示例,其他的设备读写情况参照下面的代码:
 /// <code lang="cs" source="HslCommunication_Net45.Test\Documentation\Samples\Core\NetworkDeviceBase.cs" region="ReadDoubleArray" title="Double类型示例" />
 /// </example>
 public virtual OperateResult <double[]> ReadDouble(string address, ushort length)
 {
     return(ByteTransformHelper.GetResultFromBytes(Read(address, (ushort)(length * WordLength * 4)), m => ByteTransform.TransDouble(m, 0, length)));
 }