|
|
|
using AksWebBrowser;
|
|
|
|
using AksWebBrowser.Common;
|
|
|
|
using AKSWebBrowser.Commen;
|
|
|
|
using System;
|
|
|
|
using System.Globalization;
|
|
|
|
using System.IO;
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
using System.Text;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
public struct TOUCH_INFO
|
|
|
|
{
|
|
|
|
public int btnID;//5寸 确定 重签 取消按钮
|
|
|
|
}
|
|
|
|
namespace DevicesService.Devices
|
|
|
|
{
|
|
|
|
public class SignDll
|
|
|
|
{
|
|
|
|
public static int status = -1;
|
|
|
|
public static string callback;
|
|
|
|
public SignDll()
|
|
|
|
{
|
|
|
|
//OpenSDK();
|
|
|
|
}
|
|
|
|
//打开签字版
|
|
|
|
public void OpenSDK()
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
status = FiveInchDll.GWQ_Init();
|
|
|
|
Log.Info("初始化SDK:" + status.ToString());
|
|
|
|
string UIFile = System.IO.Directory.GetCurrentDirectory();
|
|
|
|
UIFile = UIFile + @"/aks/adv_ui.jpg";
|
|
|
|
FiveInchDll.GWQ_SetImage(UIFile);
|
|
|
|
FiveInchDll.GWQ_ShowImage();
|
|
|
|
//加载回调
|
|
|
|
FiveInchDll.GWQ_setCallback(callback_str_receive);
|
|
|
|
FiveInchDll.GWQ_OnOffPointReporting(0);
|
|
|
|
//FiveInchDll.GWQ_setSignatureData(callback_signatureData);
|
|
|
|
}
|
|
|
|
catch (Exception ex) { Log.Error(ex.Message); }
|
|
|
|
finally { }
|
|
|
|
}
|
|
|
|
|
|
|
|
public void callback_str_receive(int number, byte[] data, byte[] path)
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
//Log.Info(number.ToString());
|
|
|
|
//1 签字确定按钮 2签字取消按钮 3 签字重签按钮(清空界面)
|
|
|
|
if (number == 0x10)
|
|
|
|
{
|
|
|
|
//確認
|
|
|
|
int ret = FiveInchDll.GWQ_GetImage();
|
|
|
|
Log.Info("GWQ_GetImage:" + ret);
|
|
|
|
FiveInchDll.GWQ_ShowImage();
|
|
|
|
}
|
|
|
|
else if (number == 0x40)
|
|
|
|
{
|
|
|
|
//重簽
|
|
|
|
int ret = FiveInchDll.GWQ_ReSign();
|
|
|
|
Log.Info("GWQ_ReSign:" + ret);
|
|
|
|
}
|
|
|
|
else if (number == 0xB0)
|
|
|
|
{
|
|
|
|
//Task.Run(async () =>
|
|
|
|
//{
|
|
|
|
// Log.Info(callback);
|
|
|
|
// Log.Info(path);
|
|
|
|
// byte[] img = File.ReadAllBytes(path);
|
|
|
|
// string base64 = Convert.ToBase64String(img);
|
|
|
|
// Log.Info(base64);
|
|
|
|
// //完成圖片保存
|
|
|
|
// string result = "{\"message\":\"success\",\"code\":\"200\",\"status\":true,\"suffix\":\"png\",\"data\":\"" + base64 + "\"}";
|
|
|
|
// Log.Info(result);
|
|
|
|
// string _parm = callback + "('" + result + "')";
|
|
|
|
// await Parame.webBrowser.ExecuteJavaScript(_parm);
|
|
|
|
//});
|
|
|
|
|
|
|
|
}
|
|
|
|
else if (number == 0x30)
|
|
|
|
{
|
|
|
|
//取消
|
|
|
|
FiveInchDll.GWQ_ShowImage();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception ex) { Log.Error(ex.Message); }
|
|
|
|
finally { }
|
|
|
|
}
|
|
|
|
|
|
|
|
//0816加报点
|
|
|
|
public void callback_signatureData(int x, int y, int p, int sn)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
//打开签字版
|
|
|
|
public void OpenComDevice(string _callback)
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
callback = _callback;
|
|
|
|
OpenSDK();
|
|
|
|
FiveInchDll.GWQ_SwitchLanguage(0);
|
|
|
|
}
|
|
|
|
catch (Exception ex) { Log.Error(ex.Message); }
|
|
|
|
finally { }
|
|
|
|
}
|
|
|
|
|
|
|
|
//釋放簽字版
|
|
|
|
public int ReleaseComDevice()
|
|
|
|
{
|
|
|
|
int ret = -1;
|
|
|
|
//try
|
|
|
|
//{
|
|
|
|
// if (status == 0)
|
|
|
|
// {
|
|
|
|
// ret = FiveInchDll.GWQ_Release();
|
|
|
|
// if (ret == 0)
|
|
|
|
// {
|
|
|
|
// status = -1;
|
|
|
|
// //取消
|
|
|
|
// FiveInchDll.GWQ_ShowImage();
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
//}
|
|
|
|
//catch { }
|
|
|
|
//finally { }
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class FiveInchDll
|
|
|
|
{
|
|
|
|
|
|
|
|
[System.Runtime.InteropServices.UnmanagedFunctionPointerAttribute(System.Runtime.InteropServices.CallingConvention.StdCall)]
|
|
|
|
public delegate void callback_str_receive(int type, byte[] data, byte[] path);// (int number);
|
|
|
|
[System.Runtime.InteropServices.UnmanagedFunctionPointerAttribute(System.Runtime.InteropServices.CallingConvention.StdCall)]
|
|
|
|
public delegate void callback_signatureData(int x, int y, int p, int sn);
|
|
|
|
//0816加报点
|
|
|
|
[System.Runtime.InteropServices.UnmanagedFunctionPointerAttribute(System.Runtime.InteropServices.CallingConvention.StdCall)]
|
|
|
|
public delegate void TOUCH_INFO_FUNC([MarshalAs(UnmanagedType.LPArray, SizeConst = 160)] TOUCH_INFO[] info);
|
|
|
|
|
|
|
|
[DllImport("libdevice5_hid_sdk", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
|
|
|
|
public static extern int GWQ_Init(); //1.1SDK初始化
|
|
|
|
|
|
|
|
[DllImport("libdevice5_hid_sdk", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
|
|
|
|
public static extern int GWQ_Release();//SDK释放
|
|
|
|
|
|
|
|
[DllImport("libdevice5_hid_sdk.so", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
|
|
|
|
public static extern int GWQ_DeviceOnline();//检查设备是否在线
|
|
|
|
|
|
|
|
[DllImport("libdevice5_hid_sdk", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
|
|
|
|
public static extern int GWQ_setCallback(callback_str_receive cb);
|
|
|
|
|
|
|
|
[DllImport("libdevice5_hid_sdk", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
|
|
|
|
public static extern int GWQ_setSignatureData(callback_signatureData cb);
|
|
|
|
|
|
|
|
[DllImport("libdevice5_hid_sdk", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
|
|
|
|
public static extern int GWQ_SwitchLanguage(int language);//语言切换
|
|
|
|
[DllImport("libdevice5_hid_sdk", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
|
|
|
|
public static extern int GWQ_GetImage();//获取签字图片(用户点击确定后发送)
|
|
|
|
|
|
|
|
[DllImport("libdevice5_hid_sdk", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
|
|
|
|
public static extern int GWQ_SetImage(string uifile);//设置签字图片
|
|
|
|
|
|
|
|
[DllImport("libdevice5_hid_sdk", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
|
|
|
|
public static extern int GWQ_ShowImage();//显示设置的图片
|
|
|
|
|
|
|
|
|
|
|
|
[DllImport("libdevice5_hid_sdk", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
|
|
|
|
public static extern int GWQ_OnOffScreen(int type);//亮屏熄屏 1 熄屏 0亮屏
|
|
|
|
|
|
|
|
[DllImport("libdevice5_hid_sdk", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
|
|
|
|
public static extern int GWQ_Reboot();//重启设备
|
|
|
|
[DllImport("libdevice5_hid_sdk", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
|
|
|
|
public static extern int GWQ_ReSign();// 重新签字
|
|
|
|
|
|
|
|
[DllImport("libdevice5_hid_sdk", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
|
|
|
|
public static extern int GWQ_OnOffPointReporting(int type);//开启关闭报点(同屏报点) 1 开启 0关闭
|
|
|
|
|
|
|
|
[DllImport("libdevice5_hid_sdk", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
|
|
|
|
public static extern int GWQ_SetStartUpLogo(string path);//设置开机logo
|
|
|
|
[DllImport("libdevice5_hid_sdk", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
|
|
|
|
public static extern int GWQ_SetSigningBackground(byte[] path, int len);//发送签字背景
|
|
|
|
[DllImport("libdevice5_hid_sdk", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
|
|
|
|
public static extern int GWQ_SetSigningBackground2(byte[] path, int len);//设置开机logo
|
|
|
|
}
|
|
|
|
}
|