12345678910111213141516171819202122232425262728293031323334 |
- using FxpConvert.Common;
- namespace NIFPGA
- {
- public sealed class FPGAFXPWriteProperty: FPGABaseProperty
- {
- Interop.NiFpgaDll_ReadU64 Read;
- Interop.NiFpgaDll_WriteU64 Write;
- private NiFpga_FxpTypeInfo _TypeInfo;
- private IFxpConvert _Convert;
- internal FPGAFXPWriteProperty(FPGASession session, uint indicator,NiFpga_FxpTypeInfo typeInfo,IFxpConvert convert) : base(session, indicator,false)
- {
- _TypeInfo = typeInfo;
- _Convert = convert;
- Read = _Session.GetDelegate<Interop.NiFpgaDll_ReadU64>();
- Write = _Session.GetDelegate<Interop.NiFpgaDll_WriteU64>();
- }
- private double GetValue()
- {
- ulong value = 0;
- double temp = 0;
- _Session.CheckResult(Read(_Session.Session, Indicator, ref value));
- _Convert.FxpConvertToDouble (ref value, _TypeInfo, ref temp, 1);
- return temp;
- }
- private void SetValue(double value)
- {
- ulong temp = 0;
- _Convert.DoubleConvertToDxp(ref value, _TypeInfo, ref temp, 1);
- _Session.CheckResult(Write(_Session.Session, Indicator, temp));
- }
- public double Value { get => GetValue(); set => SetValue(value); }
- }
- }
|