添加 MX-PD-盘古 项目文件
将 MX-PD-盘古 - new 目录下的所有文件添加到主仓库
This commit is contained in:
@@ -0,0 +1,119 @@
|
||||
using MainShell.Common;
|
||||
using MainShell.Models;
|
||||
using System;
|
||||
using AppCameraType = MainShell.Common.CameraType;
|
||||
|
||||
namespace MainShell.Vision
|
||||
{
|
||||
/// <summary>
|
||||
/// ????????????
|
||||
/// </summary>
|
||||
public enum ImageCaptureStatus
|
||||
{
|
||||
Success = 0,
|
||||
Cancelled = 1,
|
||||
CameraNotFound = 2,
|
||||
CameraNotOpen = 3,
|
||||
CameraNotGrabbing = 4,
|
||||
Timeout = 5,
|
||||
NoFrame = 6,
|
||||
SoftTriggerFailed = 7,
|
||||
DriverError = 8,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ??????????
|
||||
/// </summary>
|
||||
public class ImageCaptureResult
|
||||
{
|
||||
public ImageCaptureResult()
|
||||
{
|
||||
Status = ImageCaptureStatus.DriverError;
|
||||
ErrorCode = VisionErrorCode.DriverError;
|
||||
FailureCategory = VisionFailureCategory.Driver;
|
||||
Message = string.Empty;
|
||||
UserMessageKey = MessageKey.None;
|
||||
}
|
||||
|
||||
public ImageCaptureStatus Status { get; set; }
|
||||
|
||||
public VisionErrorCode ErrorCode { get; set; }
|
||||
|
||||
public VisionFailureCategory FailureCategory { get; set; }
|
||||
|
||||
public int? AlarmId { get; set; }
|
||||
|
||||
public MessageKey UserMessageKey { get; set; }
|
||||
|
||||
public AppCameraType CameraSource { get; set; }
|
||||
|
||||
public CameraCaptureMode CaptureMode { get; set; }
|
||||
|
||||
public string Message { get; set; }
|
||||
|
||||
public Exception Exception { get; set; }
|
||||
|
||||
public MxImage Image { get; set; }
|
||||
|
||||
public bool Succeeded
|
||||
{
|
||||
get
|
||||
{
|
||||
return Status == ImageCaptureStatus.Success;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsCancelled
|
||||
{
|
||||
get
|
||||
{
|
||||
return Status == ImageCaptureStatus.Cancelled;
|
||||
}
|
||||
}
|
||||
|
||||
public static ImageCaptureResult Success(AppCameraType source, CameraCaptureMode captureMode, MxImage image)
|
||||
{
|
||||
return new ImageCaptureResult
|
||||
{
|
||||
Status = ImageCaptureStatus.Success,
|
||||
ErrorCode = VisionErrorCode.None,
|
||||
FailureCategory = VisionFailureCategory.None,
|
||||
AlarmId = null,
|
||||
UserMessageKey = MessageKey.None,
|
||||
CameraSource = source,
|
||||
CaptureMode = captureMode,
|
||||
Image = image,
|
||||
Message = string.Format(
|
||||
"ImageCaptureService: capture succeeded from '{0}' with mode '{1}'.",
|
||||
source,
|
||||
captureMode),
|
||||
};
|
||||
}
|
||||
|
||||
public static ImageCaptureResult Failure(
|
||||
ImageCaptureStatus status,
|
||||
VisionErrorCode errorCode,
|
||||
VisionFailureCategory failureCategory,
|
||||
int? alarmId,
|
||||
MessageKey userMessageKey,
|
||||
AppCameraType source,
|
||||
CameraCaptureMode captureMode,
|
||||
string message,
|
||||
Exception exception = null)
|
||||
{
|
||||
return new ImageCaptureResult
|
||||
{
|
||||
Status = status,
|
||||
ErrorCode = errorCode,
|
||||
FailureCategory = failureCategory,
|
||||
AlarmId = alarmId,
|
||||
UserMessageKey = userMessageKey,
|
||||
CameraSource = source,
|
||||
CaptureMode = captureMode,
|
||||
Message = message,
|
||||
Exception = exception,
|
||||
Image = null,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user