LaneIn - Handle Event C3Device_OnNewCardReceived

This commit is contained in:
DucDangAnh 2020-06-22 13:58:55 +07:00
parent 4df6d9f2d6
commit 3332827fd5

View File

@ -14,18 +14,30 @@ namespace AIParkingApplication
private PlateProcessor plateProcessor;
private bool isSupportSquarePlate;
private bool isSupportLongPlate;
private bool isAutoOpenDoor;
private bool isRetryMode;
private bool isRetryModeUntilOk; //TODO: Test mode
private C3DeviceController c3Device;
public LaneIn(string plateStream, string overviewStream, bool isSupportSquarePlate = true, bool isSupportLongPlate = false, bool isRetryMode = false, bool isRetryModeUntilOk = false)
public LaneIn(string plateStream,
string overviewStream,
C3DeviceController c3Device,
bool isSupportSquarePlate = true,
bool isSupportLongPlate = false,
bool isAutoOpenDoor = true,
bool isRetryMode = false,
bool isRetryModeUntilOk = false)
{
InitializeComponent();
this.isSupportSquarePlate = isSupportSquarePlate;
this.isSupportLongPlate = isSupportLongPlate;
this.isAutoOpenDoor = isAutoOpenDoor;
this.isRetryMode = isRetryMode;
this.isRetryModeUntilOk = isRetryModeUntilOk;
overviewCamera = new Camera(overviewStream);
plateCamera = new Camera(plateStream);
this.c3Device = c3Device;
this.c3Device.OnNewCardReceived += C3Device_OnNewCardReceived;
plateCamera.OnVideoFrameReceived += PlateCameraOnVideoFrameReceived;
plateCamera.OnOneVideoFrameRequested += PlateCamera_OnOneVideoFrameRequested;
@ -36,6 +48,16 @@ namespace AIParkingApplication
overviewCamera.OnOpenVideoStreamFailed += OverviewCamera_OnOpenVideoStreamFailed;
plateProcessor = new PlateProcessor(this.isSupportSquarePlate, this.isSupportLongPlate);
if (!this.c3Device.Connect().HasError)
{
_ = this.c3Device.GetLogToReceiveNewCard();
}
}
private void C3Device_OnNewCardReceived(int doorId, string cardNumber)
{
CaptureAllCamera();
}
private void PlateCamera_OnOpenVideoStreamFailed(Mat videoFrame)