/// <summary> /// Verifies that command <see cref="CommunicationCommands.ReadIreg"/> was received for /// given register and floating-point value in defined tolerance. /// </summary> /// <typeparam name="TR">A type of register parameter.</typeparam> /// <param name="validator">Validator instance.</param> /// <param name="register">Device register to validate.</param> /// <param name="value">Value sent to device.</param> /// <param name="expectedSet">Expected checkbox state.</param> /// <param name="strict">Whether a strict or loose comparison is required. Use strict for string values and loose for bitfields.</param> /// <returns>A value indicating whether command was sent or not.</returns> public static bool ReadIregSent <TR>(this CommunicationValidator validator, TR register, string value, bool expectedSet, bool strict = true) { return(validator.RegisterCommandSent(CommunicationCommands.ReadIreg, register, value, expectedSet, strict)); }
/// <summary> /// Verifies that command <see cref="CommunicationCommands.ReadIreg"/> was received for /// given register and floating-point value in defined tolerance. /// </summary> /// <typeparam name="TR">A type of register parameter.</typeparam> /// <param name="validator">Validator instance.</param> /// <param name="register">Device register to validate.</param> /// <param name="value">Value sent to device.</param> /// <param name="tolerance">Maximum defference between expected and actual floating-point values.</param> /// <returns>A value indicating whether command was sent or not.</returns> public static bool ReadIregSent <TR>(this CommunicationValidator validator, TR register, float value, float tolerance = 0.0001f) { return(validator.RegisterCommandSent(CommunicationCommands.ReadIreg, register, value, tolerance)); }
/// <summary> /// Verifies that command <see cref="CommunicationCommands.WriteDynamicVariable"/> for /// Primary Variable was sent with given value. /// </summary> /// <param name="validator">Validator instance.</param> /// <param name="value">Value sent to device.</param> /// <returns>A value indicating whether command was sent or not.</returns> public static bool SetPVSent(this CommunicationValidator validator, int value) { return(validator.CommandSent(CommunicationCommands.WriteDynamicVariable, (0, value))); }
/// <summary> /// Gets values of the specified register number for <see cref="CommunicationCommands.WriteHreg"/> commands. /// </summary> /// <typeparam name="TR">Data type register is represented.</typeparam> /// <param name="validator">Validator instance.</param> /// <param name="register">Device register.</param> /// <returns>A collection of <see cref="Reg"/> objects.</returns> public static IEnumerable <Reg> GetWriteHregRegisterValues <TR>(this CommunicationValidator validator, TR register) { return(validator.GetRegisterValue <TR>(CommunicationCommands.WriteHreg, register)); }
/// <summary> /// Verifies that command <see cref="CommunicationCommands.ReadIreg"/> was received for /// given register and value. /// </summary> /// <typeparam name="TR">Data type register is represented.</typeparam> /// <typeparam name="TV">Data type value is represented.</typeparam> /// <param name="validator">Validator instance.</param> /// <param name="register">Device register to validate.</param> /// <param name="value">Value sent to device.</param> /// <returns>A value indicating whether command was sent or not.</returns> public static bool ReadIregSent <TR, TV>(this CommunicationValidator validator, TR register, TV value) { return(validator.RegisterCommandSent(CommunicationCommands.ReadIreg, register, value)); }