Commit 815cf0a6 authored by 姜春辉's avatar 姜春辉

优化WebSocket验脸连接过程

parent e3e93781
......@@ -4,7 +4,7 @@
<Dict Caption="基础配置" Name="defaultconfig">
<Key Caption="人脸识别阀值" Name="FaceMinValue" Value="0.85"/>
<Key Caption="心跳端口" Name="HeartPort" Value="18083"/>
<Key Caption="远程认证地址" Name="FaceWebSocket" Value="ws://192.168.1.7:5012/face/sdk2?persontype=访客"/>
<Key Caption="远程认证地址" Name="FaceWebSocket" Value="ws://192.168.1.7:15056/face/sdk2?persontype=访客"/>
</Dict>
<Dict Caption="识别方式配置" Name="authenticationconfig">
<Key Caption="人脸识别" Name="EnableFace" Value="true"/>
......
......@@ -119,7 +119,7 @@ namespace GS.Terminal.VisitorSelfService.Logic.Core
private void _faceWebSocket_Error(object sender, SuperSocket.ClientEngine.ErrorEventArgs e)
{
Program._Context.Logger.Error($"WebSocket远程验脸连接错误", e.Exception);
}
private void _faceWebSocket_Closed(object sender, EventArgs e)
......@@ -135,8 +135,16 @@ namespace GS.Terminal.VisitorSelfService.Logic.Core
private void VM_OnAuthModeChanged(ViewModels.Pages.AuthenticationPage.AuthenticationMode nowMode)
{
if (nowMode == ViewModels.Pages.AuthenticationPage.AuthenticationMode.Face)
{
try
{
_faceWebSocket.Open();
}
catch (Exception ex)
{
Program._Context.Logger.Error($"远程认证服务异常", ex);
MainShell.ShowPrompt("远程认证服务异常");
}
ThirdAddon.FaceRecognization.RegistOutPutMatEvent(VideoOut);
ThirdAddon.FastRecognization.Restart(_FaceEngineId);
_faceValidating = false;
......@@ -183,10 +191,12 @@ namespace GS.Terminal.VisitorSelfService.Logic.Core
if (!_faceValidating)
{
if (fid == _fid)
{
if (result == 1)
_faceWebSocket.Send(_currentFeature, 0, _currentFeature.Length);
else
MainShell.ShowPrompt($"活体检测失败");
MainShell.ShowPrompt($"面部识别失败,正在重试...");
}
}
}
/// <summary>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment