172 lines
6.5 KiB
C#
172 lines
6.5 KiB
C#
using MagFlux6200_metrology_reg_list;
|
|
using XYLEM.Communication;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Diagnostics;
|
|
using System.IO.Ports;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace XYLEM.Device
|
|
{
|
|
/// <summary>
|
|
/// Command interface for MagFlux 6200
|
|
/// https://xyleminc.atlassian.net/wiki/spaces/MJKMF/pages/7112855120/Command+Interface+Draft
|
|
/// </summary>
|
|
public interface IMagFluxRequestProtocol
|
|
{
|
|
/// <summary>
|
|
/// Is connected
|
|
/// </summary>
|
|
/// <returns>true if yes</returns>
|
|
Boolean IsConnected();
|
|
|
|
/// <summary>
|
|
/// Make communication connection to Meter
|
|
/// !!NOTE!! Only one meter is supported for each com port
|
|
/// </summary>
|
|
/// <param name="comport">Like "COM1"</param>
|
|
/// <returns>true on okay or false on error</returns>
|
|
Boolean Connect(string comport);
|
|
|
|
/// <summary>
|
|
/// Close communication connection to Meter
|
|
/// </summary>
|
|
/// <returns>true on okay or false on error</returns>
|
|
Boolean CloseConnection();
|
|
|
|
/// <summary>
|
|
/// Get printout of communication counters
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
string GetComCounters();
|
|
|
|
/// <summary>
|
|
/// Set location for where log data can saved.
|
|
/// </summary>
|
|
/// <param name="path">path for where to log file should be saved</param>
|
|
/// <param name="filename">set a custom log file name without extension (ex. "UserCustomLogFile") or null if use default</param>
|
|
/// <returns>true on okay or false on error</returns>
|
|
Boolean SetLogLocation(String path, string filename = null);
|
|
|
|
/// <summary>
|
|
/// Open saved log file
|
|
/// </summary>
|
|
void OpenLogFile();
|
|
|
|
/// <summary>
|
|
/// MagFlux Sensor serial number
|
|
/// </summary>
|
|
/// <param name="value_out">a decimal serial number ex. 12345678 or NULL at error</param>
|
|
/// <returns>true on okay or false on error</returns>
|
|
Boolean GetSensorSerialNo(out string value_out);
|
|
|
|
|
|
/// <summary>
|
|
/// Set MagFlux Sensor serial number
|
|
/// </summary>
|
|
/// <param name="new_serial_number"></param>
|
|
/// <returns>true on okay or false on error</returns>
|
|
Boolean SetSensorSerialNo(UInt32 new_serial_number);
|
|
|
|
/// <summary>
|
|
/// Unique-ID for the MagFlux electronics
|
|
/// </summary>
|
|
/// <param name="value_out">a hex decimal string 0x1234ABCDEF or NULL at error</param>
|
|
/// <returns>true on okay or false on error</returns>
|
|
Boolean GetUniqueId(out string value_out);
|
|
|
|
/// <summary>
|
|
/// Get the firmware version
|
|
/// </summary>
|
|
/// <param name="value_out">like 1.2.4 (MAJOR.MINOR.REVISION)</param>
|
|
/// <returns>true on okay or false on error</returns>
|
|
Boolean GetFirmwareVersion(out string value_out);
|
|
|
|
/// <summary>
|
|
/// Get the firmware build date
|
|
/// </summary>
|
|
/// <param name="value_out">like 2022/12/24 13:00:00 or 2022-12-24 13:45:10</param>
|
|
/// <returns>true on okay or false on error</returns>
|
|
Boolean GetFwBuildDate(out string value_out);
|
|
|
|
/// <summary>
|
|
/// Git Hash to Unique identify firmware
|
|
/// </summary>
|
|
/// <param name="value_out">like 0xABCDE123</param>
|
|
/// <returns>true on okay or false on error</returns>
|
|
Boolean GetFwGitHash(out string value_out);
|
|
|
|
/// <summary>
|
|
/// Flow rate calibrated
|
|
/// </summary>
|
|
/// <param name="value_out"> Actual flow rate [l/s] </param>
|
|
/// <returns>true on okay or false on error</returns>
|
|
Boolean GetFlowRate_lps(out Single value_out);
|
|
|
|
/// <summary>
|
|
/// MagFlux Sensor nominal DN size in millimeters
|
|
/// </summary>
|
|
/// <param name="dn_mm_out">DN size in [mm] is -1 on error</param>
|
|
/// <returns>true on okay or false on error</returns>
|
|
Boolean GetDn_mm(out Int32 dn_mm_out);
|
|
|
|
/// <summary>
|
|
/// Set Sensor nominal DN size in millimeters
|
|
/// </summary>
|
|
/// <param name="new_dn_mm">DN size in [mm] ex 50 is 50mm or DN50</param>
|
|
/// <returns>true on okay or false on error</returns>
|
|
Boolean SetDn_mm(UInt16 new_dn_mm);
|
|
|
|
/// <summary>
|
|
/// Check if there is problem with the DUT
|
|
/// use <see cref="GetDeviceErrorMessages"/>" to get a list of error messages for debug problems
|
|
/// </summary>
|
|
/// <returns>>true if device operates correctly</returns>
|
|
Boolean GetDeviceHealthy();
|
|
|
|
/// <summary>
|
|
/// get a list of error messages for debug problem
|
|
/// </summary>
|
|
/// <param name="status_list_out">Will return a empty list if there is no messages to return</param>
|
|
/// <returns>true on okay or false on error</returns>
|
|
Boolean GetDeviceErrorMessages(out List<string> status_list_out);
|
|
|
|
/// <summary>
|
|
/// This function prepares the DUT for the calibration.
|
|
///
|
|
/// ATTENTION:
|
|
/// This function needs to be called before the calibration process starts any flow of water.
|
|
/// </summary>
|
|
/// <returns>true on okay or false on error</returns>
|
|
Boolean PrepareDeviceForCalibration();
|
|
|
|
/// <summary>
|
|
/// This function will abort started or failed calibration to bring DUT back to normal calibration state
|
|
/// </summary>
|
|
/// <returns>true on okay or false on error</returns>
|
|
Boolean AbortDeviceForCalibration();
|
|
|
|
/// <summary>
|
|
/// The maximum calibration points that is supported by the device
|
|
/// </summary>
|
|
int CalibrationPointsMax { get; }
|
|
|
|
/// <summary>
|
|
/// Get list of calibration points saved in DUT
|
|
/// </summary>
|
|
/// <param name="values_read">The calibrations points from device</param>
|
|
/// <returns>true on okay or false on error</returns>
|
|
Boolean GetCalibrationPoints(out CalibrationPoints values_read);
|
|
|
|
/// <summary>
|
|
/// set calibration in DUT.
|
|
/// Remember to run <see cref="PrepareDeviceForCalibration"/> before the calibration process is started.
|
|
/// </summary>
|
|
/// <param name="new_calibration_points">A list of calibration points to write to DUT</param>
|
|
/// <returns>true on okay or false on error</returns>
|
|
Boolean SetCalibrationPoints(CalibrationPoints new_calibration_points);
|
|
}
|
|
}
|