using FxpConvert.Common; namespace NIFPGA { public sealed class FPGAArrayFXPWriteProperty : FPGABaseProperty { Interop.NiFpgaDll_ReadArrayU64 Read; Interop.NiFpgaDll_WriteArrayU64 Write; private NiFpga_FxpTypeInfo _TypeInfo; private IFxpConvert _Convert; private ulong[] tempvalue = new ulong[0]; private float[] doubles = new float[0]; internal FPGAArrayFXPWriteProperty(FPGASession session, uint indicator, uint count,NiFpga_FxpTypeInfo typeInfo, IFxpConvert convert) : base(session, indicator,false) { _Convert = convert; Count = count; tempvalue = new ulong[count]; doubles = new float[count]; _TypeInfo = typeInfo; Read = _Session.GetDelegate(); Write = _Session.GetDelegate(); } private float[] GetData() { _Session.CheckResult(Read(_Session.Session, Indicator, ref tempvalue[0], Count)); _Convert.FxpConvertToFloat(ref tempvalue[0], _TypeInfo, ref doubles[0], Count); return doubles; } private void SetData(float[] values) { if (values.Length != Count) return; _Convert.FloatConvertToDxp(ref values[0], _TypeInfo, ref tempvalue[0], Count); _Session.CheckResult(Write(_Session.Session,Indicator, ref tempvalue[0], Count)); } public uint Count { get; } public float[] Value { get => GetData(); set => SetData(value); } } }