(1) StandardCamera.TestStartEndForm fixed (exclamation), (2) Simulate mode for camera with sample.bmp.
This commit is contained in:
parent
688580c29f
commit
4fc427d875
@ -470,19 +470,22 @@ namespace TBF.BenchControl.DataEntry.StandardCamera
|
||||
private void endTextBox24_TextChanged(object sender, EventArgs e) { UpdateExclamation(23); }
|
||||
///
|
||||
void UpdateExclamation(int uiCtrlPos) /// uiCtrlPos = 0 .. TextBoxesCount-1
|
||||
{
|
||||
if ((mode == Tst.End) || (mode == Tst.Both))
|
||||
{
|
||||
try
|
||||
{
|
||||
double startVolumeLtr = Utils.ParseUDouble(startTextBoxes[uiCtrlPos].Text) * regReaders[phys2wm[uiCtrlPos] - 1].LtrsPerPulse;
|
||||
double endVolumeLtr = Utils.ParseUDouble(endTextBoxes[uiCtrlPos].Text) * regReaders[phys2wm[uiCtrlPos] - 1].LtrsPerPulse;
|
||||
double err = 100.0 * (endVolumeLtr - startVolumeLtr - refVolume) / refVolume;
|
||||
exclamations[uiCtrlPos].Visible = (err < warningLimLo) || (err > warningLimHi);
|
||||
exclamations[uiCtrlPos].Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
}
|
||||
catch
|
||||
{
|
||||
exclamations[uiCtrlPos].Visible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void startTextBox1_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, startTextBox1); }
|
||||
|
||||
@ -32,9 +32,9 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
|
||||
this.GetType().Namespace.Substring(17),
|
||||
CameraCfg.Name,
|
||||
CameraCfg.HardwareAddress,
|
||||
ipAddress == null ? "not detected" : ipAddress.ToString(),
|
||||
string.IsNullOrEmpty(cpuSerialNr) ? "not detected" : cpuSerialNr,
|
||||
string.IsNullOrEmpty(sdCardVer) ? "not detected" : sdCardVer);
|
||||
CameraCfg.DebugLevel == DebugMode.Simulate ? "simulated" : ((ipAddress == null) ? "not detected" : ipAddress.ToString()),
|
||||
CameraCfg.DebugLevel == DebugMode.Simulate ? "simulated" : (string.IsNullOrEmpty(cpuSerialNr) ? "not detected" : cpuSerialNr),
|
||||
CameraCfg.DebugLevel == DebugMode.Simulate ? "simulated" : (string.IsNullOrEmpty(sdCardVer) ? "not detected" : sdCardVer));
|
||||
}
|
||||
|
||||
|
||||
@ -161,13 +161,16 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
|
||||
{
|
||||
cameraIdx = GetCameraIdx();
|
||||
|
||||
if (CameraCfg.DebugLevel == DebugMode.Simulate) return;
|
||||
if (CameraCfg.DebugLevel == DebugMode.Simulate)
|
||||
{
|
||||
UiBridge.Bridge.OnCameraInfo(this.cameraIdx, string.Format("{0} s/n {1} si simulated", Name, CameraCfg.HardwareAddress));
|
||||
return;
|
||||
}
|
||||
|
||||
/// Detect a camera
|
||||
bool cameraDetected = DetectCamera(CameraCfg.HardwareAddress % 100, ref ipAddress, true,
|
||||
out cpuHardware, out cpuRevision, out cpuSerialNr, out sdCardVer);
|
||||
|
||||
|
||||
if (CameraCfg.DebugLevel == DebugMode.AutoDetect)
|
||||
{
|
||||
CameraCfg.DebugLevel = cameraDetected ? DebugMode.DetectedOn : DebugMode.DetectedOff;
|
||||
@ -218,6 +221,8 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
|
||||
}
|
||||
|
||||
public void StopDevice()
|
||||
{
|
||||
if ((CameraCfg.DebugLevel != DebugMode.Simulate) && (CameraCfg.DebugLevel != DebugMode.DetectedOff))
|
||||
{
|
||||
running = false;
|
||||
|
||||
@ -230,9 +235,12 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
|
||||
Telnet.Dispose();
|
||||
Telnet = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void StopDevice2()
|
||||
{
|
||||
if ((CameraCfg.DebugLevel != DebugMode.Simulate) && (CameraCfg.DebugLevel != DebugMode.DetectedOff))
|
||||
{
|
||||
if (scpThread != null) scpThread.Join(50);
|
||||
if (rtpListenerThread != null) rtpListenerThread.Join(50);
|
||||
@ -249,9 +257,12 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
|
||||
msrmntUdpClient.Close();
|
||||
msrmntUdpClient = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void RunDeviceBefore()
|
||||
{
|
||||
if ((CameraCfg.DebugLevel != DebugMode.Simulate) && (CameraCfg.DebugLevel != DebugMode.DetectedOff))
|
||||
{
|
||||
if (sha1sumResponse != null && !sha1sumResponseProcessed)
|
||||
{
|
||||
@ -260,6 +271,7 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
|
||||
|
||||
sha1sumResponseProcessed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
public void RunDeviceAfter() { }
|
||||
|
||||
|
||||
@ -50,10 +50,13 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
|
||||
grabImageCommandSent = false;
|
||||
transferringGrabbedImage = false;
|
||||
|
||||
if (camera.DebugLevel == DebugMode.Normal || camera.DebugLevel == DebugMode.DetectedOn)
|
||||
{
|
||||
telnet.promptReceivedHandler += delegate(object sndr, PromptReceivedEventArgs a)
|
||||
{
|
||||
OnPromptReceived(sndr, a);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
void OnPromptReceived(object sndr, PromptReceivedEventArgs a)
|
||||
@ -65,33 +68,58 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
|
||||
|
||||
public void Start()
|
||||
{
|
||||
if (camera.CameraCfg.DebugLevel == Config.Entities.DebugMode.Simulate) return;
|
||||
|
||||
grabImageCommandSent = false;
|
||||
transferringGrabbedImage = false;
|
||||
if (File.Exists(imgFileNames[0])) File.Delete(imgFileNames[0]);
|
||||
|
||||
if ((imgFileNames != null) && (imgFileNames.Length > 0) && File.Exists(imgFileNames[0]))
|
||||
{
|
||||
///
|
||||
/// An image specified, (1) delete previous image, (2) check if this is a simulation
|
||||
///
|
||||
File.Delete(imgFileNames[0]);
|
||||
|
||||
if (camera.CameraCfg.DebugLevel == Config.Entities.DebugMode.Simulate || camera.CameraCfg.DebugLevel == Config.Entities.DebugMode.DetectedOff)
|
||||
{
|
||||
///
|
||||
/// Camera is in simulation mode => create a simulated image
|
||||
///
|
||||
File.Copy(string.Format("{0}\\Pictures\\sample.jpg", Program.ExecutableDir), imgFileNames[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Event Run()
|
||||
{
|
||||
if (camera.CameraCfg.DebugLevel == Config.Entities.DebugMode.Simulate) return Event.None;
|
||||
|
||||
if (imgFileNames.Length < 1 || imgFileNames[0] == null)
|
||||
if ((imgFileNames == null) || (imgFileNames.Length < 1) || (imgFileNames[0] == null))
|
||||
{
|
||||
///
|
||||
/// No images to be grabbed => Done
|
||||
///
|
||||
return Event.GrabPassed;
|
||||
}
|
||||
else if (camera.CameraCfg.DebugLevel == Config.Entities.DebugMode.Simulate ||
|
||||
camera.CameraCfg.DebugLevel == Config.Entities.DebugMode.DetectedOff)
|
||||
{
|
||||
///
|
||||
/// Camera is in simulation mode => create a simulated image and complete
|
||||
///
|
||||
return Event.GrabPassed;
|
||||
}
|
||||
else if (!grabImageCommandSent)
|
||||
{
|
||||
///
|
||||
/// Normal operation, no command sent yet => (1) wait until telnet state = Inactive, (2) send a command
|
||||
///
|
||||
if (camera.Running && (telnet.State == TelnetClient.TelnetState.Inactive))
|
||||
{
|
||||
//
|
||||
// State variables
|
||||
//
|
||||
///
|
||||
/// State variables
|
||||
///
|
||||
response = null;
|
||||
|
||||
//
|
||||
// Prepare command
|
||||
//
|
||||
///
|
||||
/// Prepare a command
|
||||
///
|
||||
int rotation = 0;
|
||||
if (imageRotation == ImageRotation.Deg90)
|
||||
rotation = 90;
|
||||
@ -119,6 +147,9 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
|
||||
}
|
||||
else if (grabPassed)
|
||||
{
|
||||
///
|
||||
/// Normal operation, grab passed => transfer/transferring the image
|
||||
///
|
||||
if (transferringGrabbedImage)
|
||||
{
|
||||
/// Grab passed and image transfer is in progress
|
||||
@ -138,11 +169,16 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
|
||||
}
|
||||
else if (grabFailed)
|
||||
{
|
||||
/// Grab failed, there in no image to transfer
|
||||
///
|
||||
/// Normal operation, grab failed => there in no image to transfer
|
||||
///
|
||||
return Event.GrabFailed;
|
||||
}
|
||||
else if (response != null)
|
||||
{
|
||||
///
|
||||
/// Normal operation
|
||||
///
|
||||
if (response.Contains("completed"))
|
||||
{
|
||||
grabPassed = true;
|
||||
|
||||
@ -127,17 +127,11 @@ namespace TBF.BenchControl.Network.Camera.RoiForFixedStart
|
||||
|
||||
public IOperation GrabImageOp(string imageFileName)
|
||||
{
|
||||
if (NetCamera != null)
|
||||
{
|
||||
/// TODO: Implement support for sharing one camera by multiple ROI-s
|
||||
return NetCamera.GrabImagesOp(new string[] { imageFileName }, roiCfg.BlackAndWhite, roiCfg.LowResolution, roiCfg.ImageRotation);
|
||||
}
|
||||
else
|
||||
return null;
|
||||
return GrabImageOp(imageFileName, roiCfg.BlackAndWhite, roiCfg.LowResolution, roiCfg.ImageRotation);
|
||||
}
|
||||
|
||||
public IOperation GrabImageOp(string imageFileName, bool blackAndWhite,
|
||||
bool lowResolution, Config.Entities.ImageRotation imageRotation)
|
||||
public IOperation GrabImageOp(string imageFileName,
|
||||
bool blackAndWhite, bool lowResolution, Config.Entities.ImageRotation imageRotation)
|
||||
{
|
||||
if (NetCamera != null)
|
||||
{
|
||||
|
||||
BIN
TBF/Pictures/sample.bmp
Normal file
BIN
TBF/Pictures/sample.bmp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 900 KiB |
@ -3362,6 +3362,7 @@
|
||||
<Content Include="Pictures\reversed_dir_right.jpg">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Pictures\sample.bmp" />
|
||||
<Content Include="Resources\empty.png" />
|
||||
<Content Include="Resources\switch-off.png" />
|
||||
<Content Include="Resources\switch-on.png" />
|
||||
|
||||
Loading…
Reference in New Issue
Block a user