Add IDoorControlAccess. LaneIn - use IDoorControlAccess instead of C3DeviceController
This commit is contained in:
parent
e72f365013
commit
b5d532f2a9
|
@ -81,6 +81,7 @@
|
||||||
<Compile Include="C3DeviceController.cs" />
|
<Compile Include="C3DeviceController.cs" />
|
||||||
<Compile Include="Camera.cs" />
|
<Compile Include="Camera.cs" />
|
||||||
<Compile Include="Enums.cs" />
|
<Compile Include="Enums.cs" />
|
||||||
|
<Compile Include="IDoorControlAccess.cs" />
|
||||||
<Compile Include="ILane.cs" />
|
<Compile Include="ILane.cs" />
|
||||||
<Compile Include="LaneIn.cs">
|
<Compile Include="LaneIn.cs">
|
||||||
<SubType>UserControl</SubType>
|
<SubType>UserControl</SubType>
|
||||||
|
|
|
@ -6,7 +6,7 @@ namespace AIParkingApplication
|
||||||
{
|
{
|
||||||
//@"C:\CongRa_1.mp4"; @"C:\HS_test.mp4"; @"rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov"
|
//@"C:\CongRa_1.mp4"; @"C:\HS_test.mp4"; @"rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov"
|
||||||
private ApiController apiController;
|
private ApiController apiController;
|
||||||
private C3DeviceController c3Device;
|
private IDoorControlAccess c3Device;
|
||||||
private LaneIn laneIn;
|
private LaneIn laneIn;
|
||||||
|
|
||||||
public AIParkingApplicationForm()
|
public AIParkingApplicationForm()
|
||||||
|
|
|
@ -7,7 +7,7 @@ namespace AIParkingApplication
|
||||||
{
|
{
|
||||||
public delegate void C3DeviceEvent(int doorId, string cardNumber);
|
public delegate void C3DeviceEvent(int doorId, string cardNumber);
|
||||||
|
|
||||||
public class C3DeviceController
|
public class C3DeviceController : IDoorControlAccess
|
||||||
{
|
{
|
||||||
private string ipAddress;
|
private string ipAddress;
|
||||||
private int port;
|
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;
|
doorId = C3Constant.DEFAULT_DOOR_ID;
|
||||||
cardNumber = C3Constant.DEFAULT_CARD_NUMBER;
|
cardNumber = C3Constant.DEFAULT_CARD_NUMBER;
|
||||||
|
|
14
AIParkingApplication/IDoorControlAccess.cs
Normal file
14
AIParkingApplication/IDoorControlAccess.cs
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -18,13 +18,13 @@ namespace AIParkingApplication
|
||||||
private bool isSupportLongPlate;
|
private bool isSupportLongPlate;
|
||||||
private bool isAutoOpenDoor;
|
private bool isAutoOpenDoor;
|
||||||
private bool isRetryMode;
|
private bool isRetryMode;
|
||||||
private C3DeviceController c3Device;
|
private IDoorControlAccess doorControlAccess;
|
||||||
private ApiController apiController;
|
private ApiController apiController;
|
||||||
|
|
||||||
public LaneIn(int doorId,
|
public LaneIn(int doorId,
|
||||||
string plateStream,
|
string plateStream,
|
||||||
string overviewStream,
|
string overviewStream,
|
||||||
C3DeviceController c3Device,
|
IDoorControlAccess doorControlAccess,
|
||||||
ApiController apiController,
|
ApiController apiController,
|
||||||
bool isSupportSquarePlate = true,
|
bool isSupportSquarePlate = true,
|
||||||
bool isSupportLongPlate = false,
|
bool isSupportLongPlate = false,
|
||||||
|
@ -41,8 +41,8 @@ namespace AIParkingApplication
|
||||||
overviewCamera = new Camera(overviewStream);
|
overviewCamera = new Camera(overviewStream);
|
||||||
plateCamera = new Camera(plateStream);
|
plateCamera = new Camera(plateStream);
|
||||||
this.apiController = apiController;
|
this.apiController = apiController;
|
||||||
this.c3Device = c3Device;
|
this.doorControlAccess = doorControlAccess;
|
||||||
this.c3Device.OnNewCardReceived += C3Device_OnNewCardReceived;
|
this.doorControlAccess.OnNewCardReceived += C3Device_OnNewCardReceived;
|
||||||
|
|
||||||
plateCamera.OnVideoFrameReceived += PlateCameraOnVideoFrameReceived;
|
plateCamera.OnVideoFrameReceived += PlateCameraOnVideoFrameReceived;
|
||||||
plateCamera.OnOpenVideoStreamFailed += PlateCamera_OnOpenVideoStreamFailed;
|
plateCamera.OnOpenVideoStreamFailed += PlateCamera_OnOpenVideoStreamFailed;
|
||||||
|
@ -115,7 +115,7 @@ namespace AIParkingApplication
|
||||||
|
|
||||||
private void OpenDoor(int doorId)
|
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);
|
lblStatusInfo.UpdateLabel("KHÔNG THỂ MỞ CỬA", Color.Red);
|
||||||
}
|
}
|
||||||
|
@ -196,9 +196,9 @@ namespace AIParkingApplication
|
||||||
|
|
||||||
private void ConnectToDoorAccessControl()
|
private void ConnectToDoorAccessControl()
|
||||||
{
|
{
|
||||||
if (!this.c3Device.Connect().HasError)
|
if (!this.doorControlAccess.Connect().HasError)
|
||||||
{
|
{
|
||||||
_ = this.c3Device.GetLogToReceiveNewCard();
|
_ = this.doorControlAccess.GetLogToReceiveNewCard();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user