using System; using System.Runtime.InteropServices; namespace JingGong.Abp.Print.GoDEX { public class EzioInterop { const string EzioLibrary = "ezio.so.1.1.0"; const string Usblib = "usb-1.0.so.0"; /// /// Open 函数 /// /// /// /// [DllImport(EzioLibrary, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern bool Open(string hostname, int port); /// /// Close 函数 /// [DllImport(EzioLibrary, CallingConvention = CallingConvention.Cdecl)] public static extern void Close(); // openUSB 函数 [DllImport(Usblib, CallingConvention = CallingConvention.Cdecl)] public static extern int openUSB(); /// /// closeUSB 函数 /// [DllImport(Usblib, CallingConvention = CallingConvention.Cdecl)] public static extern void closeUSB(); /// /// OpenDriver 函数 /// /// /// [DllImport(EzioLibrary, CallingConvention = CallingConvention.Cdecl)] public static extern int OpenDriver(string port); /// /// closeport 函数 /// /// [DllImport(EzioLibrary, CallingConvention = CallingConvention.Cdecl)] public static extern int closeport(); /// /// RcvBuf 函数 /// /// /// /// [DllImport(EzioLibrary, CallingConvention = CallingConvention.Cdecl)] public static extern int RcvBuf(IntPtr buf, UIntPtr count); /// /// sendbuf 函数 /// /// /// /// [DllImport(EzioLibrary, CallingConvention = CallingConvention.Cdecl)] public static extern int sendbuf([MarshalAs(UnmanagedType.LPArray)] byte[] buf, int count); /// /// sendcommand 函数 /// /// /// [DllImport(EzioLibrary, CallingConvention = CallingConvention.Cdecl)] public static extern int sendcommand(string cmd); /// /// setup 函数 /// /// /// /// /// /// /// /// [DllImport(EzioLibrary, CallingConvention = CallingConvention.Cdecl)] public static extern int setup(int mm, int dark, int speed, int mode, int gap, int top); /// /// Bar 函数 /// /// /// /// /// /// /// /// /// /// /// [DllImport(EzioLibrary, CallingConvention = CallingConvention.Cdecl)] public static extern int Bar(string BarcodeType, int PosX, int PosY, int Narrow, int Wide, int Height, int Rotation, int Readable, string data); /// /// Bar_S 函数 /// /// /// /// /// /// [DllImport(EzioLibrary, CallingConvention = CallingConvention.Cdecl)] public static extern int Bar_S(string BarcodeType, int PosX, int PosY, string data); /// /// Bar_QRcode 函数 /// /// /// /// /// /// /// /// /// /// /// /// [DllImport(EzioLibrary, CallingConvention = CallingConvention.Cdecl)] public static extern int Bar_QRcode(int PosX, int PosY, int Mode, int Type, string ErrorLevel, int Mask, int Mul, int Len, int Rotation, string data); /// /// Bar_QRcode_S 函数 /// /// /// /// /// /// [DllImport(EzioLibrary, CallingConvention = CallingConvention.Cdecl)] public static extern int Bar_QRcode_S(int PosX, int PosY, int Len, string data); /// /// DrawHorLine 函数 /// /// /// /// /// /// [DllImport(EzioLibrary, CallingConvention = CallingConvention.Cdecl)] public static extern int DrawHorLine(int PosX, int PosY, int Length, int Thick); /// /// DrawVerLine 函数 /// /// /// /// /// /// [DllImport(EzioLibrary, CallingConvention = CallingConvention.Cdecl)] public static extern int DrawVerLine(int PosX, int PosY, int Length, int Thick); /// /// InternalFont_TextOut 函数 /// /// /// /// /// /// /// /// /// /// [DllImport(EzioLibrary, CallingConvention = CallingConvention.Cdecl)] public static extern int InternalFont_TextOut(string FontType, int PosX, int PosY, int Mul_X, int Mul_Y, int Gap, string RotationInverse, string Data); /// /// InternalFont_TextOut_S 函数 /// /// /// /// /// /// [DllImport(EzioLibrary, CallingConvention = CallingConvention.Cdecl)] public static extern int InternalFont_TextOut_S(string FontType, int PosX, int PosY, string Data); /// /// DownloadFont_TextOut 函数 /// /// /// /// /// /// /// /// /// /// [DllImport(EzioLibrary, CallingConvention = CallingConvention.Cdecl)] public static extern int DownloadFont_TextOut(string FontName, int PosX, int PosY, int Mul_X, int Mul_Y, int Gap, string RotationInverse, string Data); /// /// DownloadFont_TextOut_S 函数 /// /// /// /// /// /// [DllImport(EzioLibrary, CallingConvention = CallingConvention.Cdecl)] public static extern int DownloadFont_TextOut_S(string FontName, int PosX, int PosY, string Data); /// /// TrueTypeFont_TextOut 函数 /// /// /// /// /// /// /// /// /// /// /// /// [DllImport(EzioLibrary, CallingConvention = CallingConvention.Cdecl)] public static extern int TrueTypeFont_TextOut(string FontName, int PosX, int PosY, int Font_W, int Font_H, int SpaceChar, string RotationInverse, string TTFTable, int WidthMode, string Data); /// /// TrueTypeFont_TextOut_S 函数 /// /// /// /// /// /// [DllImport(EzioLibrary, CallingConvention = CallingConvention.Cdecl)] public static extern int TrueTypeFont_TextOut_S(string FontName, int PosX, int PosY, string Data); /// /// ecTextOut 函数 /// /// /// /// /// /// /// [DllImport(EzioLibrary, CallingConvention = CallingConvention.Cdecl)] public static extern int ecTextOut(int x, int y, int height, string fontname, string TEXT); /// /// ecTextOutR 函数 /// /// /// /// /// /// /// /// /// [DllImport(EzioLibrary, CallingConvention = CallingConvention.Cdecl)] public static extern int ecTextOutR(int x, int y, int height, string fontname, string TEXT, int width, int degree); /// /// ecTextOutW 函数 /// /// /// /// /// /// /// [DllImport(EzioLibrary, CallingConvention = CallingConvention.Cdecl)] public static extern int ecTextOutW(int x, int y, int height, string fontname, [MarshalAs(UnmanagedType.LPWStr)] string TEXT); /// /// ecTextOutRW 函数 /// /// /// /// /// /// /// /// /// [DllImport(EzioLibrary, CallingConvention = CallingConvention.Cdecl)] public static extern int ecTextOutRW(int x, int y, int height, string fontname, [MarshalAs(UnmanagedType.LPWStr)] string TEXT, int width, int degree); [DllImport(EzioLibrary, CallingConvention = CallingConvention.Cdecl)] public static extern int putimage(int x, int y, [MarshalAs(UnmanagedType.LPStr)] string Filename, int Degree); } }