Add IDoorControlAccess. LaneIn - use IDoorControlAccess instead of C3DeviceController

This commit is contained in:
DucDangAnh 2020-06-30 16:52:53 +07:00
parent e72f365013
commit b5d532f2a9
5 changed files with 25 additions and 10 deletions

View File

@ -81,6 +81,7 @@
<Compile Include="C3DeviceController.cs" />
<Compile Include="Camera.cs" />
<Compile Include="Enums.cs" />
<Compile Include="IDoorControlAccess.cs" />
<Compile Include="ILane.cs" />
<Compile Include="LaneIn.cs">
<SubType>UserControl</SubType>

View File

@ -6,7 +6,7 @@ namespace AIParkingApplication
{
//@"C:\CongRa_1.mp4"; @"C:\HS_test.mp4"; @"rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov"
private ApiController apiController;
private C3DeviceController c3Device;
private IDoorControlAccess c3Device;
private LaneIn laneIn;
public AIParkingApplicationForm()

View File

@ -7,7 +7,7 @@ namespace AIParkingApplication
{
public delegate void C3DeviceEvent(int doorId, string cardNumber);
public class C3DeviceController
public class C3DeviceController : IDoorControlAccess
{
private string ipAddress;
private int port;
@ -131,7 +131,7 @@ namespace AIParkingApplication
}
}
public ActionResult GetRTLog(out int doorId, out string cardNumber)
private ActionResult GetRTLog(out int doorId, out string cardNumber)
{
doorId = C3Constant.DEFAULT_DOOR_ID;
cardNumber = C3Constant.DEFAULT_CARD_NUMBER;

View File

@ -0,0 +1,14 @@
using System.Threading.Tasks;
namespace AIParkingApplication
{
public interface IDoorControlAccess
{
event C3DeviceEvent OnNewCardReceived;
ActionResult Connect();
ActionResult Disconnect();
Task GetLogToReceiveNewCard();
ActionResult OpenDoor(int doorId);
}
}

View File

@ -18,13 +18,13 @@ namespace AIParkingApplication
private bool isSupportLongPlate;
private bool isAutoOpenDoor;
private bool isRetryMode;
private C3DeviceController c3Device;
private IDoorControlAccess doorControlAccess;
private ApiController apiController;
public LaneIn(int doorId,
string plateStream,
string overviewStream,
C3DeviceController c3Device,
IDoorControlAccess doorControlAccess,
ApiController apiController,
bool isSupportSquarePlate = true,
bool isSupportLongPlate = false,
@ -41,8 +41,8 @@ namespace AIParkingApplication
overviewCamera = new Camera(overviewStream);
plateCamera = new Camera(plateStream);
this.apiController = apiController;
this.c3Device = c3Device;
this.c3Device.OnNewCardReceived += C3Device_OnNewCardReceived;
this.doorControlAccess = doorControlAccess;
this.doorControlAccess.OnNewCardReceived += C3Device_OnNewCardReceived;
plateCamera.OnVideoFrameReceived += PlateCameraOnVideoFrameReceived;
plateCamera.OnOpenVideoStreamFailed += PlateCamera_OnOpenVideoStreamFailed;
@ -115,7 +115,7 @@ namespace AIParkingApplication
private void OpenDoor(int doorId)
{
if (c3Device.OpenDoor(doorId).HasError)
if (doorControlAccess.OpenDoor(doorId).HasError)
{
lblStatusInfo.UpdateLabel("KHÔNG THỂ MỞ CỬA", Color.Red);
}
@ -196,9 +196,9 @@ namespace AIParkingApplication
private void ConnectToDoorAccessControl()
{
if (!this.c3Device.Connect().HasError)
if (!this.doorControlAccess.Connect().HasError)
{
_ = this.c3Device.GetLogToReceiveNewCard();
_ = this.doorControlAccess.GetLogToReceiveNewCard();
}
else
{