123456789101112131415161718192021222324252627282930 |
- using FxpConvert.Common;
- namespace NIFPGA
- {
- public sealed class FPGAFXPReadProperty : FPGABaseProperty
- {
- Interop.NiFpgaDll_ReadU64 Read;
- private NiFpga_FxpTypeInfo _TypeInfo;
- private object _Lock = new object();
- private IFxpConvert _Convert;
- internal FPGAFXPReadProperty(FPGASession session, uint indicator, NiFpga_FxpTypeInfo typeInfo, IFxpConvert convert) : base(session, indicator, true)
- {
- _TypeInfo = typeInfo;
- _Convert = convert;
- Read = _Session.GetDelegate<Interop.NiFpgaDll_ReadU64>();
- }
- private double GetValue()
- {
- lock (_Lock)
- {
- ulong value = 0;
- double temp = 0;
- _Session.CheckResult(Read(_Session.Session, Indicator, ref value));
- _Convert.FxpConvertToDouble(ref value, _TypeInfo, ref temp, 1);
- return temp;
- }
- }
- public double Value => GetValue();
- }
- }
|