MettlerToledo.all and Ambient.Comet : Fixed bugs in serial port handling when closing the program, ver. 2.12.467
This commit is contained in:
@@ -90,6 +90,12 @@ namespace TBF.BenchControl.Ambient.Comet
|
||||
return;
|
||||
}
|
||||
|
||||
if (serialPort == null)
|
||||
{
|
||||
log.ErrorFormat("{0} - RunDeviceBefore() - serial port closed", Name);
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
int receivedBytes = serialPort.BytesToRead;
|
||||
@@ -139,6 +145,12 @@ namespace TBF.BenchControl.Ambient.Comet
|
||||
return;
|
||||
}
|
||||
|
||||
if (serialPort == null)
|
||||
{
|
||||
log.ErrorFormat("{0} - RunDeviceAfter() - serial port closed", Name);
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
/// Each 10 seconds
|
||||
@@ -178,7 +190,11 @@ namespace TBF.BenchControl.Ambient.Comet
|
||||
/// <summary>Stop this device</summary>
|
||||
public void StopDevice()
|
||||
{
|
||||
if (serialPort != null) serialPort.Close();
|
||||
if (serialPort != null)
|
||||
{
|
||||
serialPort.Close();
|
||||
serialPort = null;
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
|
||||
@@ -193,6 +193,12 @@ namespace TBF.BenchControl.MettlerToledo.Multi
|
||||
|
||||
if (balanceCfg.IdNr != 1) return;
|
||||
|
||||
if (serialPort == null)
|
||||
{
|
||||
log.ErrorFormat("{0} - RunDevice() - serial port closed", Name);
|
||||
return;
|
||||
}
|
||||
|
||||
log.DebugFormat("{0} - RunDevice()", Name);
|
||||
|
||||
///
|
||||
@@ -270,7 +276,11 @@ namespace TBF.BenchControl.MettlerToledo.Multi
|
||||
/// <summary>Stop this device</summary>
|
||||
public void StopDevice()
|
||||
{
|
||||
if (balanceCfg.IdNr == 1 && serialPort != null) serialPort.Close();
|
||||
if (balanceCfg.IdNr == 1 && serialPort != null)
|
||||
{
|
||||
serialPort.Close();
|
||||
serialPort = null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -250,6 +250,12 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
return;
|
||||
}
|
||||
|
||||
if (serialPort == null)
|
||||
{
|
||||
log.ErrorFormat("{0} - RunDevice() - serial port closed", Name);
|
||||
return;
|
||||
}
|
||||
|
||||
log.DebugFormat("{0} - RunDeviceBefore()", Name);
|
||||
|
||||
if (msrmntState != MsrmntState.Busy) return; /// No measurement in progress
|
||||
@@ -441,7 +447,11 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
/// <summary>Stop this device</summary>
|
||||
public void StopDevice()
|
||||
{
|
||||
if (serialPort != null) serialPort.Close();
|
||||
if (serialPort != null)
|
||||
{
|
||||
serialPort.Close();
|
||||
serialPort = null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -77,6 +77,12 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
return;
|
||||
}
|
||||
|
||||
if (serialPort == null)
|
||||
{
|
||||
log.ErrorFormat("{0} - RunDevice() - serial port closed", Name);
|
||||
return;
|
||||
}
|
||||
|
||||
log.DebugFormat("{0} - RunDevice()", Name);
|
||||
|
||||
if (base.msrmntState != MsrmntState.Busy) return; /// No measurement in progress
|
||||
|
||||
@@ -70,6 +70,12 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
return;
|
||||
}
|
||||
|
||||
if (serialPort == null)
|
||||
{
|
||||
log.ErrorFormat("{0} - RunDevice() - serial port closed", Name);
|
||||
return;
|
||||
}
|
||||
|
||||
log.DebugFormat("{0} - RunDevice()", Name);
|
||||
|
||||
if (base.msrmntState != MsrmntState.Busy) return; /// No measurement in progress
|
||||
|
||||
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("2.12.466.1")]
|
||||
[assembly: AssemblyFileVersion("2.12.466.1")]
|
||||
[assembly: AssemblyVersion("2.12.467.1")]
|
||||
[assembly: AssemblyFileVersion("2.12.467.1")]
|
||||
|
||||
Reference in New Issue
Block a user