LaneIn - Refactor C3Device_OnNewCardReceived
This commit is contained in:
parent
ab14853d29
commit
5259eba6b5
|
@ -68,25 +68,23 @@ namespace AIParkingApplication
|
||||||
plateCamera.RequestCaptureOneFrame();
|
plateCamera.RequestCaptureOneFrame();
|
||||||
overviewCamera.RequestCaptureOneFrame();
|
overviewCamera.RequestCaptureOneFrame();
|
||||||
await Task.Delay(200);
|
await Task.Delay(200);
|
||||||
var plateVideoFrame = plateCamera.CurrentFrame;
|
|
||||||
var overviewVideoFrame = overviewCamera.CurrentFrame;
|
|
||||||
|
|
||||||
pictureBoxOverviewImage.Invoke(new Action(() =>
|
|
||||||
{
|
|
||||||
pictureBoxOverviewImage.Image?.Dispose();
|
|
||||||
pictureBoxOverviewImage.Image = overviewVideoFrame.ToBitmap();
|
|
||||||
}));
|
|
||||||
|
|
||||||
|
var plateVideoFrame = plateCamera.CurrentFrame;
|
||||||
FinalPlateResult result = await ProcessFrameImage(plateProcessor, plateVideoFrame, isRetryMode);
|
FinalPlateResult result = await ProcessFrameImage(plateProcessor, plateVideoFrame, isRetryMode);
|
||||||
|
|
||||||
pictureBoxPlateImage.Invoke(new Action(() =>
|
pictureBoxPlateImage.Invoke(new Action(() =>
|
||||||
{
|
{
|
||||||
pictureBoxPlateImage.Image?.Dispose();
|
pictureBoxPlateImage.Image?.Dispose();
|
||||||
pictureBoxPlateImage.Image = result.PlateImage.ToBitmap();
|
pictureBoxPlateImage.Image = result.PlateImage.ToBitmap();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
var cardInformation = await apiController.GetCardInformation(cardNumber);
|
var overviewVideoFrame = overviewCamera.CurrentFrame;
|
||||||
|
pictureBoxOverviewImage.Invoke(new Action(() =>
|
||||||
|
{
|
||||||
|
pictureBoxOverviewImage.Image?.Dispose();
|
||||||
|
pictureBoxOverviewImage.Image = overviewVideoFrame.ToBitmap();
|
||||||
|
}));
|
||||||
|
|
||||||
|
var cardInformation = await apiController.GetCardInformation(cardNumber);
|
||||||
ShowCardInfoOnUI(cardNumber, result.PlateString, cardInformation.CardType, DateTime.Now.ToString(AppConstant.DATETIME_FORMAT));
|
ShowCardInfoOnUI(cardNumber, result.PlateString, cardInformation.CardType, DateTime.Now.ToString(AppConstant.DATETIME_FORMAT));
|
||||||
|
|
||||||
var saveLogResult = await apiController.SaveLog(LaneDirection.In, cardInformation.CardRealID.ToString(), "1", result.PlateType, DateTime.Now.ToString(AppConstant.DATETIME_FORMAT), result.PlateString, result.PlateImage, result.PlateImage, result.PlateImage, overviewVideoFrame);
|
var saveLogResult = await apiController.SaveLog(LaneDirection.In, cardInformation.CardRealID.ToString(), "1", result.PlateType, DateTime.Now.ToString(AppConstant.DATETIME_FORMAT), result.PlateString, result.PlateImage, result.PlateImage, result.PlateImage, overviewVideoFrame);
|
||||||
|
@ -94,15 +92,7 @@ namespace AIParkingApplication
|
||||||
{
|
{
|
||||||
if (isAutoOpenDoor && this.doorId == doorId)
|
if (isAutoOpenDoor && this.doorId == doorId)
|
||||||
{
|
{
|
||||||
var openDoorResult = c3Device.OpenDoor(doorId);
|
OpenDoor(doorId);
|
||||||
if (openDoorResult.HasError)
|
|
||||||
{
|
|
||||||
lblRecogizePlateStatus.Invoke(new Action(() =>
|
|
||||||
{
|
|
||||||
lblRecogizePlateStatus.BackColor = Color.Red;
|
|
||||||
lblRecogizePlateStatus.Text = "KHÔNG THỂ MỞ CỬA";
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -119,7 +109,7 @@ namespace AIParkingApplication
|
||||||
lblRecogizePlateStatus.Invoke(new Action(() =>
|
lblRecogizePlateStatus.Invoke(new Action(() =>
|
||||||
{
|
{
|
||||||
lblRecogizePlateStatus.BackColor = Color.Red;
|
lblRecogizePlateStatus.BackColor = Color.Red;
|
||||||
lblRecogizePlateStatus.Text = "XE ĐÃ Ở TRONG BÃI";
|
lblRecogizePlateStatus.Text = "THẺ ĐÃ ĐƯỢC SỬ DỤNG - XE ĐÃ TRONG BÃI";
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -151,6 +141,18 @@ namespace AIParkingApplication
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OpenDoor(int doorId)
|
||||||
|
{
|
||||||
|
if (c3Device.OpenDoor(doorId).HasError)
|
||||||
|
{
|
||||||
|
lblRecogizePlateStatus.Invoke(new Action(() =>
|
||||||
|
{
|
||||||
|
lblRecogizePlateStatus.BackColor = Color.Red;
|
||||||
|
lblRecogizePlateStatus.Text = "KHÔNG THỂ KẾT NỐI TỚI THIẾT BỊ MỞ CỬA";
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private async Task<FinalPlateResult> ProcessFrameImage(PlateProcessor plateProcessor, Mat frame, bool isRetryMode)
|
private async Task<FinalPlateResult> ProcessFrameImage(PlateProcessor plateProcessor, Mat frame, bool isRetryMode)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
Loading…
Reference in New Issue
Block a user