5 changed files with 401 additions and 62 deletions
@ -0,0 +1,260 @@ |
|||||||
|
using AKSWebBrowser.Commen; |
||||||
|
using System; |
||||||
|
using System.Globalization; |
||||||
|
using System.IO; |
||||||
|
using System.Runtime.InteropServices; |
||||||
|
using System.Text; |
||||||
|
//0816加实时报点 |
||||||
|
[StructLayout(LayoutKind.Sequential)] |
||||||
|
public struct TOUCH_INFO |
||||||
|
{ |
||||||
|
public int X; |
||||||
|
public int Y; |
||||||
|
public int Pressure; |
||||||
|
public int SN; |
||||||
|
public int btnID;//5寸 确定 重签 取消按钮 |
||||||
|
} |
||||||
|
namespace DevicesService.Devices |
||||||
|
{ |
||||||
|
|
||||||
|
|
||||||
|
public class SignDll |
||||||
|
{ |
||||||
|
//public static PointF endPos; |
||||||
|
//public static PointF beginPos; |
||||||
|
//public static PointF frontPos; |
||||||
|
//private static int xypointcount = 0; |
||||||
|
//private static int[] lastpointx = new int[3]; |
||||||
|
//private static int[] lastpointy = new int[3]; |
||||||
|
//Point mPoint = new Point(-1, -1); |
||||||
|
//private static System.Drawing.SolidBrush myBrush = new System.Drawing.SolidBrush(System.Drawing.Color.Red); |
||||||
|
//private Graphics mGraphicsBuffer; |
||||||
|
//private static Pen pen = new Pen(Color.Black); // |
||||||
|
public static int status = -1; |
||||||
|
//private static Bitmap bitmap = new Bitmap(594, 392); |
||||||
|
public SignDll() |
||||||
|
{ |
||||||
|
try |
||||||
|
{ |
||||||
|
//endPos = new PointF(-1F, -1f); |
||||||
|
//beginPos = new PointF(-1F, -1f); |
||||||
|
//frontPos = new PointF(-1F, -1f); |
||||||
|
//lastpointx[0] = -1; |
||||||
|
//lastpointy[0] = -1; |
||||||
|
//lastpointx[1] = -1; |
||||||
|
//lastpointy[1] = -1; |
||||||
|
//lastpointx[2] = -1; |
||||||
|
//lastpointy[2] = -1; |
||||||
|
//xypointcount = 0; |
||||||
|
} |
||||||
|
catch (Exception ex) { } |
||||||
|
finally { } |
||||||
|
} |
||||||
|
|
||||||
|
public static void DevGetTouchNumber(int number) |
||||||
|
{ |
||||||
|
try |
||||||
|
{ |
||||||
|
Log.Info(number.ToString()); |
||||||
|
//1 签字确定按钮 2签字取消按钮 3 签字重签按钮(清空界面) |
||||||
|
if (number == 1) |
||||||
|
{ |
||||||
|
int ret = FiveInchDll.ComSignOK(); |
||||||
|
Log.Info("ComSignOK:" + ret); |
||||||
|
FiveInchDll.ComSetBackGroundAdv(); |
||||||
|
} |
||||||
|
else if (number == 3) |
||||||
|
{ |
||||||
|
string UIFile = Environment.CurrentDirectory + @"/sign_ui.jpg"; |
||||||
|
int ret = FiveInchDll.ComSetSignBackgroundImage(UIFile); |
||||||
|
Log.Info("ComSetSignBackgroundImage:" + ret); |
||||||
|
} |
||||||
|
else |
||||||
|
{ |
||||||
|
//lastpointx[0] = -1; |
||||||
|
//lastpointy[0] = -1; |
||||||
|
//lastpointx[1] = -1; |
||||||
|
//lastpointy[1] = -1; |
||||||
|
//lastpointx[2] = -1; |
||||||
|
//lastpointy[2] = -1; |
||||||
|
FiveInchDll.ComSetBackGroundAdv(); |
||||||
|
} |
||||||
|
} |
||||||
|
catch { } |
||||||
|
finally { } |
||||||
|
} |
||||||
|
|
||||||
|
//0816加报点 |
||||||
|
public static void GetTouchPoint(TOUCH_INFO[] info1) |
||||||
|
{ |
||||||
|
return; |
||||||
|
} |
||||||
|
|
||||||
|
//打开签字版 |
||||||
|
public static int OpenComDevice() |
||||||
|
{ |
||||||
|
//GetTouchNumber m_GetTouchCB = new(DevGetTouchNumber); |
||||||
|
try |
||||||
|
{ |
||||||
|
status = FiveInchDll.OpenComDevice(DevGetTouchNumber); |
||||||
|
Log.Info(status.ToString()); |
||||||
|
//Console.WriteLine("OpenComDevice:" + status); |
||||||
|
//清空界面 |
||||||
|
// GetTouchNumber(2); |
||||||
|
if (status == 0) |
||||||
|
{ |
||||||
|
//关闭报点 |
||||||
|
int ret = FiveInchDll.ComSendPoint(0, GetTouchPoint); |
||||||
|
Log.Info(ret.ToString()); |
||||||
|
if (true) |
||||||
|
{ |
||||||
|
string UIFile = Environment.CurrentDirectory + @"/adv_ui.jpg"; |
||||||
|
Log.Info(UIFile.ToString()); |
||||||
|
int ret1 = FiveInchDll.ComSendAdvantageImage(UIFile); |
||||||
|
Log.Info(ret1.ToString()); |
||||||
|
// Console.WriteLine("ComSendAdvantageImage:" + ret1); |
||||||
|
FiveInchDll.ComSetBackGroundAdv(); |
||||||
|
} |
||||||
|
|
||||||
|
if (true) |
||||||
|
{ |
||||||
|
string UIFile = Environment.CurrentDirectory + @"/sign_ui.jpg"; |
||||||
|
Log.Info(UIFile.ToString()); |
||||||
|
int ret1 = FiveInchDll.ComSetSignBackgroundImage(UIFile); |
||||||
|
Log.Info(ret1.ToString()); |
||||||
|
//Console.WriteLine("ComSetSignBackgroundImage:" + ret1); |
||||||
|
} |
||||||
|
} |
||||||
|
////status = FiveInchDll.OpenComDevice(DevGetTouchNumber); |
||||||
|
//if (status == -1) |
||||||
|
//{ |
||||||
|
// status = FiveInchDll.OpenComDevice(DevGetTouchNumber); |
||||||
|
// Log.Info(status.ToString()); |
||||||
|
// //Console.WriteLine("OpenComDevice:" + status); |
||||||
|
// //清空界面 |
||||||
|
// // GetTouchNumber(2); |
||||||
|
// if (status == 0) |
||||||
|
// { |
||||||
|
// //关闭报点 |
||||||
|
// int ret = FiveInchDll.ComSendPoint(0, GetTouchPoint); |
||||||
|
// Log.Info(ret.ToString()); |
||||||
|
// if (true) |
||||||
|
// { |
||||||
|
// string UIFile = Environment.CurrentDirectory + @"/adv_ui.jpg"; |
||||||
|
// Log.Info(UIFile.ToString()); |
||||||
|
// int ret1 = FiveInchDll.ComSendAdvantageImage(UIFile); |
||||||
|
// Log.Info(ret1.ToString()); |
||||||
|
// // Console.WriteLine("ComSendAdvantageImage:" + ret1); |
||||||
|
// FiveInchDll.ComSetBackGroundAdv(); |
||||||
|
// } |
||||||
|
|
||||||
|
// if (true) |
||||||
|
// { |
||||||
|
// string UIFile = Environment.CurrentDirectory + @"/adv_ui.jpg"; |
||||||
|
// Log.Info(UIFile.ToString()); |
||||||
|
// int ret1 = FiveInchDll.ComSetSignBackgroundImage(UIFile); |
||||||
|
// Log.Info(ret1.ToString()); |
||||||
|
// //Console.WriteLine("ComSetSignBackgroundImage:" + ret1); |
||||||
|
// } |
||||||
|
// } |
||||||
|
//} |
||||||
|
//else |
||||||
|
//{ |
||||||
|
// //清空界面 |
||||||
|
// //GetTouchNumber(2); |
||||||
|
// if (status == 0) |
||||||
|
// { |
||||||
|
// //关闭报点 |
||||||
|
// int ret = FiveInchDll.ComSendPoint(0, GetTouchPoint); |
||||||
|
// if (true) |
||||||
|
// { |
||||||
|
// string UIFile = Environment.CurrentDirectory + @"/adv_ui.jpg"; |
||||||
|
// int ret1 = FiveInchDll.ComSendAdvantageImage(UIFile); |
||||||
|
// //Console.WriteLine("ComSendAdvantageImage:" + ret1); |
||||||
|
// FiveInchDll.ComSetBackGroundAdv(); |
||||||
|
// } |
||||||
|
|
||||||
|
// if (true) |
||||||
|
// { |
||||||
|
// string UIFile = Environment.CurrentDirectory + @"/adv_ui.jpg"; |
||||||
|
// int ret1 = FiveInchDll.ComSetSignBackgroundImage(UIFile); |
||||||
|
// //Console.WriteLine("ComSetSignBackgroundImage:" + ret1); |
||||||
|
// } |
||||||
|
// } |
||||||
|
//} |
||||||
|
} |
||||||
|
catch { } |
||||||
|
finally { } |
||||||
|
return status; |
||||||
|
} |
||||||
|
|
||||||
|
//关闭签字版 |
||||||
|
public static int CloseComDevice() |
||||||
|
{ |
||||||
|
int ret = -1; |
||||||
|
try |
||||||
|
{ |
||||||
|
if (status == 0) |
||||||
|
{ |
||||||
|
ret = FiveInchDll.CloseComDevice(); |
||||||
|
if (ret == 0) |
||||||
|
{ |
||||||
|
status = -1; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
catch { } |
||||||
|
finally { } |
||||||
|
return ret; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
class FiveInchDll |
||||||
|
{ |
||||||
|
|
||||||
|
[System.Runtime.InteropServices.UnmanagedFunctionPointerAttribute(System.Runtime.InteropServices.CallingConvention.StdCall)] |
||||||
|
public delegate void GetTouchNumber(int number); |
||||||
|
//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.so", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] |
||||||
|
public static extern int ComSendPoint(int nState, [MarshalAs(UnmanagedType.FunctionPtr)] TOUCH_INFO_FUNC callback); //0816加报点 |
||||||
|
|
||||||
|
[DllImport("libdevice5_hid_sdk.so", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] |
||||||
|
public static extern int OpenComDevice([MarshalAs(UnmanagedType.FunctionPtr)] GetTouchNumber callback); |
||||||
|
|
||||||
|
[DllImport("libdevice5_hid_sdk.so", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] |
||||||
|
public static extern int CloseComDevice(); |
||||||
|
|
||||||
|
[DllImport("libdevice5_hid_sdk.so", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] |
||||||
|
public static extern int ComSetSignBackgroundImage(string UIFile); |
||||||
|
|
||||||
|
[DllImport("libdevice5_hid_sdk.so", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] |
||||||
|
public static extern int ComSetPictureSavePath(string PicturePath, int PicturePathLen); |
||||||
|
|
||||||
|
[DllImport("libdevice5_hid_sdk.so", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] |
||||||
|
public static extern int ComSignOK(); |
||||||
|
|
||||||
|
|
||||||
|
[DllImport("libdevice5_hid_sdk.so", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] |
||||||
|
public static extern int ComSetPenStyle(int PenStyle); |
||||||
|
|
||||||
|
[DllImport("libdevice5_hid_sdk.so", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] |
||||||
|
public static extern int ComGetDevSN(StringBuilder pDevSN, int iSync); |
||||||
|
|
||||||
|
[DllImport("libdevice5_hid_sdk.so", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] |
||||||
|
public static extern int ComGetDevSN_Async(StringBuilder pDevSN); |
||||||
|
|
||||||
|
|
||||||
|
[DllImport("libdevice5_hid_sdk.so", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] |
||||||
|
public static extern int ComWhiteScreen(); |
||||||
|
|
||||||
|
[DllImport("libdevice5_hid_sdk.so", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] |
||||||
|
public static extern int ComSendAdvantageImage(string UIFile); |
||||||
|
|
||||||
|
|
||||||
|
[DllImport("libdevice5_hid_sdk.so", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] |
||||||
|
public static extern int ComSetBackGroundAdv(); |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue