MefImport : Wrappers for DatastreamInterface.StartMeasurement() / StopMeasurement() - connected meters only, ver. 2.26.1708
This commit is contained in:
parent
a1e73be9cb
commit
56fc3b6380
@ -88,7 +88,7 @@ namespace TBF.BenchControl.DataEntry.DataStream
|
||||
public IOperation ShowCycleBeginFormOp()
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
mefImport.CloseAllConnections();
|
||||
mefImport.CloseConnectionAll();
|
||||
currentOp = CurrentOp.ShowFormAtCycleBeginning;
|
||||
this.waterMeters = TBF.BenchControl.Sequences.ProcessData.BatchRslts.Batch.WaterMeters;
|
||||
return this;
|
||||
@ -98,7 +98,7 @@ namespace TBF.BenchControl.DataEntry.DataStream
|
||||
public IOperation ShowCycleEndFormOp()
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
mefImport.CloseAllConnections();
|
||||
mefImport.CloseConnectionAll();
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@ -102,7 +102,7 @@ namespace TBF.BenchControl.RegisterReaders.DataStream.MefImport
|
||||
/// <summary>
|
||||
/// Wrapper for DataStreamIFace.CloseConnection() called in a loop for all connected water meters
|
||||
/// </summary>
|
||||
public void CloseAllConnections()
|
||||
public bool CloseConnectionAll()
|
||||
{
|
||||
if (isConnectedArray != null)
|
||||
{
|
||||
@ -110,13 +110,79 @@ namespace TBF.BenchControl.RegisterReaders.DataStream.MefImport
|
||||
{
|
||||
if (isConnectedArray[ix])
|
||||
{
|
||||
if (DataStreamIFace.CloseConnection(ix))
|
||||
{
|
||||
isConnectedArray[ix] = false; /// reset IsConnected flag
|
||||
}
|
||||
DataStreamIFace.CloseConnection(ix);
|
||||
isConnectedArray[ix] = false; /// reset IsConnected flag regardless of returned value
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Wrapper for DataStreamIFace.StartMeasurement(), starts only connected water meters
|
||||
/// </summary>
|
||||
public bool StartMeasurement(int ix)
|
||||
{
|
||||
if (isConnectedArray != null && ix >= 0 && ix < isConnectedArray.Length && isConnectedArray[ix])
|
||||
{
|
||||
return DataStreamIFace.StartMeasurement(ix);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Wrapper that bypasses DataStreamIFace.StartMeasurementAll(), starts only connected water meters
|
||||
/// </summary>
|
||||
public bool StartMeasurementAll()
|
||||
{
|
||||
if (isConnectedArray != null)
|
||||
{
|
||||
for (int ix = 0; ix < isConnectedArray.Length; ix++)
|
||||
{
|
||||
if (isConnectedArray[ix]) DataStreamIFace.StartMeasurement(ix);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Wrapper for DataStreamIFace.StopMeasurement(), stops only connected water meters
|
||||
/// </summary>
|
||||
public bool StopMeasurement(int ix, out Int64 storedFramesCount)
|
||||
{
|
||||
if (isConnectedArray != null && ix >= 0 && ix < isConnectedArray.Length && isConnectedArray[ix])
|
||||
{
|
||||
return DataStreamIFace.StopMeasurement(ix, out storedFramesCount);
|
||||
}
|
||||
|
||||
storedFramesCount = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Wrapper that bypasses DataStreamIFace.StopMeasurementAll(), stops only connected water meters
|
||||
/// </summary>
|
||||
public bool StopMeasurementAll(out Int64[] storedFramesCounts)
|
||||
{
|
||||
if (isConnectedArray != null)
|
||||
{
|
||||
storedFramesCounts = new Int64[isConnectedArray.Length];
|
||||
for (int ix = 0; ix < isConnectedArray.Length; ix++)
|
||||
{
|
||||
if (isConnectedArray[ix])
|
||||
DataStreamIFace.StopMeasurement(ix, out storedFramesCounts[ix]);
|
||||
else
|
||||
storedFramesCounts[ix] = 0;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
storedFramesCounts = null;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -133,7 +133,7 @@ namespace TBF.BenchControl.RegisterReaders.DataStream.Reader
|
||||
volumeUnit = mefImport.DataStreamIFace.GetVolumeUnits();
|
||||
log.DebugFormat("timeUnit = {0}, volumeUnit = {1}", timeUnit, volumeUnit);
|
||||
|
||||
bool started = mefImport.DataStreamIFace.StartMeasurement(Position - 1);
|
||||
bool started = mefImport.StartMeasurement(Position - 1);
|
||||
log.DebugFormat("{0} : DataStreamIFace.StartMeasurement({1}) in Start() returned {2}", Name, Position - 1, started);
|
||||
}
|
||||
}
|
||||
@ -151,7 +151,7 @@ namespace TBF.BenchControl.RegisterReaders.DataStream.Reader
|
||||
TBF.BenchControl.Sequences.ProcessData.BatchRslts.Batch.WaterMeters[Position - 1] != null &&
|
||||
!TBF.BenchControl.Sequences.ProcessData.BatchRslts.Batch.WaterMeters[Position - 1].Disabled)
|
||||
{
|
||||
bool stopped = mefImport.DataStreamIFace.StopMeasurement(Position - 1, out storedFramesCount);
|
||||
bool stopped = mefImport.StopMeasurement(Position - 1, out storedFramesCount);
|
||||
log.DebugFormat("{0} : DataStreamIFace.StopMeasurement({1}) in Stop() returned {2}, storedFramesCount = {3}", Name, Position - 1, stopped, storedFramesCount);
|
||||
|
||||
if (storedFramesCount >= minSamplesCount)
|
||||
|
||||
@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("2.26.1707.0")]
|
||||
[assembly: AssemblyFileVersion("2.26.1707.0")]
|
||||
[assembly: AssemblyVersion("2.26.1708.0")]
|
||||
[assembly: AssemblyFileVersion("2.26.1708.0")]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user