diff --git a/CPF_Cef/Devices/LhtCF.cs b/CPF_Cef/Devices/LhtCF.cs index 0f4dfd6..f499d8a 100644 --- a/CPF_Cef/Devices/LhtCF.cs +++ b/CPF_Cef/Devices/LhtCF.cs @@ -19,7 +19,7 @@ namespace AksWebBrowser.Devices /// /// /// - public static string LhtCFFace(string code,string faceA) + public static string LhtCFFace(string code,string face) { string result = string.Empty; try @@ -46,8 +46,10 @@ namespace AksWebBrowser.Devices { string time = DateTime.Now.ToString("yyyyMMddHHmmss", DateTimeFormatInfo.InvariantInfo); var tmpFile = "/tmp/" + time + ".jpg"; - - + byte[] faceA = Convert.FromBase64String(face); + byte[] faceB = Encoding.UTF8.GetBytes(tmpFile); + status = libLhtCFs.CF_FaceCompare(faceA, faceB, 60); + Log.Info("人脸比对:" + status); //停止活体检测 Task.Run(() => { libLhtCFs.CF_StopLiveDetect(); }); @@ -144,7 +146,7 @@ namespace AksWebBrowser.Devices [DllImport("libLhtCF", EntryPoint = "CF_GetImage", SetLastError = true, CharSet = CharSet.Auto, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)] public static extern int CF_GetImage(int nImageType, [MarshalAs(UnmanagedType.LPArray)] byte[] FilePath); - //获取采集图像 + //人脸比对 [DllImport("libLhtCF", EntryPoint = "CF_GetImage", SetLastError = true, CharSet = CharSet.Auto, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)] public static extern int CF_FaceCompare(byte[] picPathA, byte[] picPathB, int score); diff --git a/CPF_Cef/Devices/PrintPJ.cs b/CPF_Cef/Devices/PrintPJ.cs index d38e6e2..c661ec3 100644 --- a/CPF_Cef/Devices/PrintPJ.cs +++ b/CPF_Cef/Devices/PrintPJ.cs @@ -115,7 +115,7 @@ namespace AksWebBrowser.Devices } catch (Exception ex) { - Log.Error("票据打印失败:"+ex.Message); + Log.Error("票据打印失败:" + ex.Message); return 1; } return 0; @@ -131,8 +131,9 @@ namespace AksWebBrowser.Devices byte[] cDevname = Encoding.UTF8.GetBytes(comAddr); int iBaudrate = port; //打开连接 - m_iInit = LibPrint.SetDevname(1, cDevname, iBaudrate); - if (m_iInit == 0) { + m_iInit = LibPrint.SetDevname(3,"", 0); + if (m_iInit == 0) + { Log.Info("热敏打印机已连接"); //初始化打印机 m_iInit = LibPrint.SetInit(); @@ -182,7 +183,7 @@ namespace AksWebBrowser.Devices public static extern int SetLinespace(int iLinespace); //设置设备名称(Linux) [DllImport("libmsprintsdk", EntryPoint = "SetDevname", CharSet = CharSet.Ansi)] - public static extern int SetDevname(int iDevtype, byte[] cDevname, int iBaudrate); + public static extern int SetDevname(int iDevtype, string cDevname, int iBaudrate); [DllImport("libmsprintsdk", EntryPoint = "PrintString", CharSet = CharSet.Ansi)] public static extern int PrintString(byte[] strData, int iImme);