54 lines
1.2 KiB
C#
54 lines
1.2 KiB
C#
///
|
|
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
|
|
///
|
|
using System;
|
|
using log4net;
|
|
using TBF.Boxes;
|
|
|
|
namespace TBF.BenchControl.MettlerToledo.Standard
|
|
{
|
|
public class ReadMassOp : IOperation
|
|
{
|
|
private static readonly ILog log = LogManager.GetLogger(typeof(ReadMassOp));
|
|
public override string ToString() { return string.Format("ReadMassOp(.,.)"); }
|
|
|
|
/// Set by the constructor
|
|
BalanceDev scale;
|
|
DoubleBox result;
|
|
|
|
/// <summary>
|
|
/// Events: BalanceDone (always)
|
|
/// </summary>
|
|
/// <param name="scale">Balance device instance</param>
|
|
/// <param name="result">Reference to the measured mass in kg</param>
|
|
public ReadMassOp(BalanceDev scale, ref DoubleBox result)
|
|
{
|
|
if (scale == null) throw new ArgumentNullException("balanceDev");
|
|
this.scale = scale;
|
|
this.result = result;
|
|
log.Debug(this.ToString());
|
|
}
|
|
|
|
/// <summary>Start this operation</summary>
|
|
public void Start()
|
|
{
|
|
result.Val = scale.Mass;
|
|
}
|
|
|
|
/// <summary>Run this operation</summary>
|
|
/// <returns>
|
|
/// Event.BalanceDone
|
|
/// </returns>
|
|
public Event Run()
|
|
{
|
|
result.Val = scale.Mass;
|
|
return Event.BalanceDone;
|
|
}
|
|
|
|
/// <summary>Stop this operation</summary>
|
|
public void Stop()
|
|
{
|
|
}
|
|
}
|
|
}
|