diff --git a/AIParkingApplication/LaneIn.cs b/AIParkingApplication/LaneIn.cs index f9fbaab..eb05e70 100644 --- a/AIParkingApplication/LaneIn.cs +++ b/AIParkingApplication/LaneIn.cs @@ -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)