diff --git a/AIParkingApplication.sln b/AIParkingApplication.sln
index 9ee5f5a..2989cf8 100644
--- a/AIParkingApplication.sln
+++ b/AIParkingApplication.sln
@@ -8,13 +8,19 @@ EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
+ Debug|x64 = Debug|x64
Release|Any CPU = Release|Any CPU
+ Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{AAB88B46-4AAC-4BE6-8847-E7E4C37AEB6D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AAB88B46-4AAC-4BE6-8847-E7E4C37AEB6D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {AAB88B46-4AAC-4BE6-8847-E7E4C37AEB6D}.Debug|x64.ActiveCfg = Debug|x64
+ {AAB88B46-4AAC-4BE6-8847-E7E4C37AEB6D}.Debug|x64.Build.0 = Debug|x64
{AAB88B46-4AAC-4BE6-8847-E7E4C37AEB6D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AAB88B46-4AAC-4BE6-8847-E7E4C37AEB6D}.Release|Any CPU.Build.0 = Release|Any CPU
+ {AAB88B46-4AAC-4BE6-8847-E7E4C37AEB6D}.Release|x64.ActiveCfg = Release|x64
+ {AAB88B46-4AAC-4BE6-8847-E7E4C37AEB6D}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/AIParkingApplication/AIParkingApplication.csproj b/AIParkingApplication/AIParkingApplication.csproj
index eb84b9a..b93cdfb 100644
--- a/AIParkingApplication/AIParkingApplication.csproj
+++ b/AIParkingApplication/AIParkingApplication.csproj
@@ -36,6 +36,28 @@
prompt
4
+
+ true
+ bin\x64\Debug\
+ DEBUG;TRACE
+ full
+ x64
+ 7.3
+ prompt
+ MinimumRecommendedRules.ruleset
+ true
+
+
+ bin\x64\Release\
+ TRACE
+ true
+ pdbonly
+ x64
+ 7.3
+ prompt
+ MinimumRecommendedRules.ruleset
+ true
+
..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll
@@ -137,6 +159,9 @@
StatusBar.cs
+
+ PreserveNewest
+
SettingsSingleFileGenerator
diff --git a/AIParkingApplication/Camera.cs b/AIParkingApplication/Camera.cs
index 18dc6b3..15cd409 100644
--- a/AIParkingApplication/Camera.cs
+++ b/AIParkingApplication/Camera.cs
@@ -57,6 +57,7 @@ namespace AIParkingApplication
Mat videoFrame = new Mat();
while (true)
{
+ //Thread.Sleep(5);
Thread.Sleep(50); //Stream Thread Sleep
//Thread.Sleep(40); //Video Thread Sleep
diff --git a/AIParkingApplication/StatusBar.Designer.cs b/AIParkingApplication/StatusBar.Designer.cs
index eccab37..fad849a 100644
--- a/AIParkingApplication/StatusBar.Designer.cs
+++ b/AIParkingApplication/StatusBar.Designer.cs
@@ -31,9 +31,11 @@
this.lblPingTimeServer = new System.Windows.Forms.Label();
this.lblDateTime = new System.Windows.Forms.Label();
this.lblPingDoorAccessControlDevice = new System.Windows.Forms.Label();
- this.lblPingTimeC3 = new System.Windows.Forms.Label();
+ this.lblPingTimeToDoorAccessControl = new System.Windows.Forms.Label();
this.lblConnectionStatus = new System.Windows.Forms.Label();
this.lblServer = new System.Windows.Forms.Label();
+ this.lblEngine = new System.Windows.Forms.Label();
+ this.lblEngineStatus = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// lblPingTimeServer
@@ -67,20 +69,20 @@
this.lblPingDoorAccessControlDevice.Text = "Thiết bị mở cửa:";
this.lblPingDoorAccessControlDevice.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
- // lblPingTimeC3
+ // lblPingTimeToDoorAccessControl
//
- this.lblPingTimeC3.Font = new System.Drawing.Font("Microsoft Sans Serif", 11F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.lblPingTimeC3.Location = new System.Drawing.Point(436, 0);
- this.lblPingTimeC3.Name = "lblPingTimeC3";
- this.lblPingTimeC3.Size = new System.Drawing.Size(71, 24);
- this.lblPingTimeC3.TabIndex = 3;
- this.lblPingTimeC3.Text = "500ms";
- this.lblPingTimeC3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+ this.lblPingTimeToDoorAccessControl.Font = new System.Drawing.Font("Microsoft Sans Serif", 11F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.lblPingTimeToDoorAccessControl.Location = new System.Drawing.Point(437, 0);
+ this.lblPingTimeToDoorAccessControl.Name = "lblPingTimeToDoorAccessControl";
+ this.lblPingTimeToDoorAccessControl.Size = new System.Drawing.Size(71, 24);
+ this.lblPingTimeToDoorAccessControl.TabIndex = 3;
+ this.lblPingTimeToDoorAccessControl.Text = "500ms";
+ this.lblPingTimeToDoorAccessControl.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// lblConnectionStatus
//
this.lblConnectionStatus.Font = new System.Drawing.Font("Microsoft Sans Serif", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.lblConnectionStatus.Location = new System.Drawing.Point(3, 0);
+ this.lblConnectionStatus.Location = new System.Drawing.Point(0, 0);
this.lblConnectionStatus.Name = "lblConnectionStatus";
this.lblConnectionStatus.Size = new System.Drawing.Size(125, 24);
this.lblConnectionStatus.TabIndex = 1;
@@ -97,11 +99,33 @@
this.lblServer.Text = "Server";
this.lblServer.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
+ // lblEngine
+ //
+ this.lblEngine.Font = new System.Drawing.Font("Microsoft Sans Serif", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.lblEngine.Location = new System.Drawing.Point(570, 0);
+ this.lblEngine.Name = "lblEngine";
+ this.lblEngine.Size = new System.Drawing.Size(65, 24);
+ this.lblEngine.TabIndex = 3;
+ this.lblEngine.Text = "Engine:";
+ this.lblEngine.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+ //
+ // lblEngineStatus
+ //
+ this.lblEngineStatus.Font = new System.Drawing.Font("Microsoft Sans Serif", 11F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.lblEngineStatus.Location = new System.Drawing.Point(641, 0);
+ this.lblEngineStatus.Name = "lblEngineStatus";
+ this.lblEngineStatus.Size = new System.Drawing.Size(169, 24);
+ this.lblEngineStatus.TabIndex = 3;
+ this.lblEngineStatus.Text = "ĐANG HOẠT ĐỘNG";
+ this.lblEngineStatus.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+ //
// StatusBar
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.Controls.Add(this.lblPingTimeC3);
+ this.Controls.Add(this.lblEngineStatus);
+ this.Controls.Add(this.lblPingTimeToDoorAccessControl);
+ this.Controls.Add(this.lblEngine);
this.Controls.Add(this.lblPingDoorAccessControlDevice);
this.Controls.Add(this.lblDateTime);
this.Controls.Add(this.lblServer);
@@ -120,8 +144,10 @@
private System.Windows.Forms.Label lblPingTimeServer;
private System.Windows.Forms.Label lblDateTime;
private System.Windows.Forms.Label lblPingDoorAccessControlDevice;
- private System.Windows.Forms.Label lblPingTimeC3;
+ private System.Windows.Forms.Label lblPingTimeToDoorAccessControl;
private System.Windows.Forms.Label lblConnectionStatus;
private System.Windows.Forms.Label lblServer;
+ private System.Windows.Forms.Label lblEngine;
+ private System.Windows.Forms.Label lblEngineStatus;
}
}
diff --git a/AIParkingApplication/StatusBar.cs b/AIParkingApplication/StatusBar.cs
index 401fc46..810f949 100644
--- a/AIParkingApplication/StatusBar.cs
+++ b/AIParkingApplication/StatusBar.cs
@@ -1,4 +1,5 @@
using System;
+using System.Diagnostics;
using System.Drawing;
using System.Threading;
using System.Windows.Forms;
@@ -31,10 +32,21 @@ namespace AIParkingApplication
lblDateTime.UpdateLabel(DateTime.Now.GetTimeFormatted());
PingResult pingDoorAccessControlResult = GetPingStatus(doorAccessControlDeviceIP);
- lblPingTimeC3.UpdateLabel($"{pingDoorAccessControlResult.ReplyTime} ms", pingDoorAccessControlResult.BackColor, pingDoorAccessControlResult.ForeColor);
+ lblPingTimeToDoorAccessControl.UpdateLabel($"{pingDoorAccessControlResult.ReplyTime} ms", pingDoorAccessControlResult.BackColor, pingDoorAccessControlResult.ForeColor);
PingResult pingWebServerResult = GetPingStatus(webServerIP);
lblPingTimeServer.UpdateLabel($"{pingWebServerResult.ReplyTime} ms", pingWebServerResult.BackColor, pingWebServerResult.ForeColor);
+
+ if (Process.GetProcessesByName("tmux").Length == 0)
+ {
+ string engineBatFilePath = Application.StartupPath + @"\engine.bat";
+ Util.ExecuteCommand(engineBatFilePath);
+ lblEngineStatus.UpdateLabel("DỪNG HOẠT ĐỘNG", Color.Red);
+ }
+ else
+ {
+ lblEngineStatus.UpdateLabel("ĐANG HOẠT ĐỘNG", Color.Green);
+ }
}
Thread.Sleep(updateInterval);
}
diff --git a/AIParkingApplication/Util.cs b/AIParkingApplication/Util.cs
index c19de9a..1db17c6 100644
--- a/AIParkingApplication/Util.cs
+++ b/AIParkingApplication/Util.cs
@@ -128,6 +128,26 @@ namespace AIParkingApplication
{
return dateTime.ToString(AppConstant.DATETIME_FORMAT);
}
+
+ public static void ExecuteCommand(string command)
+ {
+ var processInfo = new ProcessStartInfo("cmd.exe", "/c " + command);
+ processInfo.CreateNoWindow = true;
+ processInfo.UseShellExecute = false;
+ processInfo.RedirectStandardError = true;
+ processInfo.RedirectStandardOutput = true;
+ using (var process = Process.Start(processInfo))
+ {
+ process.OutputDataReceived += (object sender, DataReceivedEventArgs e) => Console.WriteLine("Engine Output >>" + e.Data);
+ process.BeginOutputReadLine();
+
+ process.ErrorDataReceived += (object sender, DataReceivedEventArgs e) => Console.WriteLine("Engine Error >>" + e.Data);
+ process.BeginErrorReadLine();
+ //process.WaitForExit();
+ //Console.WriteLine("ExitCode: {0}", process.ExitCode);
+ //process.Close();
+ }
+ }
}
public class PlateRequestEngineModel
diff --git a/AIParkingApplication/engine.bat b/AIParkingApplication/engine.bat
new file mode 100644
index 0000000..f1c9768
--- /dev/null
+++ b/AIParkingApplication/engine.bat
@@ -0,0 +1,3 @@
+@echo off
+wsl bash -c "cd ~/AIParking_Engine_deploy && tmux new-session -d -s "engine" gunicorn app:app -b 0.0.0.0:8080 --workers=2"
+exit