Browse Source

热敏可以

master
胡超1 1 year ago
parent
commit
823333307e
  1. 10
      CPF_Cef/Devices/LhtCF.cs
  2. 9
      CPF_Cef/Devices/PrintPJ.cs

10
CPF_Cef/Devices/LhtCF.cs

@ -19,7 +19,7 @@ namespace AksWebBrowser.Devices
/// </summary> /// </summary>
/// <param name="code"></param> /// <param name="code"></param>
/// <returns></returns> /// <returns></returns>
public static string LhtCFFace(string code,string faceA) public static string LhtCFFace(string code,string face)
{ {
string result = string.Empty; string result = string.Empty;
try try
@ -46,8 +46,10 @@ namespace AksWebBrowser.Devices
{ {
string time = DateTime.Now.ToString("yyyyMMddHHmmss", DateTimeFormatInfo.InvariantInfo); string time = DateTime.Now.ToString("yyyyMMddHHmmss", DateTimeFormatInfo.InvariantInfo);
var tmpFile = "/tmp/" + time + ".jpg"; 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(); }); 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)] [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); 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)] [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); public static extern int CF_FaceCompare(byte[] picPathA, byte[] picPathB, int score);

9
CPF_Cef/Devices/PrintPJ.cs

@ -115,7 +115,7 @@ namespace AksWebBrowser.Devices
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error("票据打印失败:"+ex.Message); Log.Error("票据打印失败:" + ex.Message);
return 1; return 1;
} }
return 0; return 0;
@ -131,8 +131,9 @@ namespace AksWebBrowser.Devices
byte[] cDevname = Encoding.UTF8.GetBytes(comAddr); byte[] cDevname = Encoding.UTF8.GetBytes(comAddr);
int iBaudrate = port; int iBaudrate = port;
//打开连接 //打开连接
m_iInit = LibPrint.SetDevname(1, cDevname, iBaudrate); m_iInit = LibPrint.SetDevname(3,"", 0);
if (m_iInit == 0) { if (m_iInit == 0)
{
Log.Info("热敏打印机已连接"); Log.Info("热敏打印机已连接");
//初始化打印机 //初始化打印机
m_iInit = LibPrint.SetInit(); m_iInit = LibPrint.SetInit();
@ -182,7 +183,7 @@ namespace AksWebBrowser.Devices
public static extern int SetLinespace(int iLinespace); public static extern int SetLinespace(int iLinespace);
//设置设备名称(Linux) //设置设备名称(Linux)
[DllImport("libmsprintsdk", EntryPoint = "SetDevname", CharSet = CharSet.Ansi)] [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)] [DllImport("libmsprintsdk", EntryPoint = "PrintString", CharSet = CharSet.Ansi)]
public static extern int PrintString(byte[] strData, int iImme); public static extern int PrintString(byte[] strData, int iImme);

Loading…
Cancel
Save