80 lines
2.4 KiB
C#
80 lines
2.4 KiB
C#
using System;
|
|
using System.Runtime.InteropServices;
|
|
using System.Threading;
|
|
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
|
|
using Xylem.Common.Hardware.WaterMeter.WaterMeterCore;
|
|
using Xylem.Common.Metrology.Measurements.Consts;
|
|
using XylemCommonUiLegacyGenCtl.DataPackage;
|
|
|
|
namespace XylemCommonUiLegacyGenCtl
|
|
{
|
|
[Guid("F8776118-8F65-4361-A7F2-6857621D5538"),
|
|
ComVisible(true),
|
|
ClassInterface(ClassInterfaceType.None),
|
|
ComSourceInterfaces(typeof(ICtlBatch))]
|
|
class easyBatch //ICtlBatch
|
|
{
|
|
private MeterBatch mb;
|
|
public void PrepareBatch(Boolean useRequest, Boolean rawLogging)
|
|
{
|
|
mb = new MeterBatch();
|
|
}
|
|
|
|
public void AddMeter(string serialNumber, int slot)
|
|
{
|
|
var meter = new GenesisMeter();
|
|
meter.SerialNumber = serialNumber;
|
|
meter.SetupFromConfigFile(slot);
|
|
meter.LogRawData(false);
|
|
mb.AddMeter(meter);
|
|
}
|
|
|
|
public void PrepareMeters(Double errorFrame, Boolean isAdjustment, Boolean IsFlyingStartStop)
|
|
{
|
|
|
|
}
|
|
|
|
public void SetBatchInfos(Double refFlowrate = 0, Double refTestTime = 0, Double refFlowUncorrected = 0,
|
|
Int32 currentPulse = 0, Double currentRefVolume = 0, Int32 remainingPulse = 0, String period = "-")
|
|
{
|
|
|
|
}
|
|
|
|
public void StartMeasurement()
|
|
{
|
|
mb.MetersStartMeasurement();
|
|
}
|
|
|
|
public void StopMeasurement()
|
|
{
|
|
mb.MetersStopMeasurement();
|
|
}
|
|
public double GetVolume(int Slot, int Chnnl, double refVol, double doubleRefTime)
|
|
{
|
|
int RetryCounter = 0;
|
|
var meter = mb.GetMeter(Slot);
|
|
while (meter.GetMeasurementState() != MeasurementStates.IsCompleted && RetryCounter < 100)
|
|
{
|
|
|
|
Thread.Sleep(10);
|
|
RetryCounter = RetryCounter + 1;
|
|
}
|
|
|
|
if (meter.GetMeasurementState() != MeasurementStates.IsCompleted)
|
|
{
|
|
|
|
return meter.GetMainMeasurementResult(refVol, doubleRefTime).DutVolumeCm;
|
|
}
|
|
else
|
|
{
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
public Results GetResults(int Slot, int Chnnl, double refVol, double doubleRefTime)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
}
|
|
}
|