70 lines
3.1 KiB
C#
70 lines
3.1 KiB
C#
|
using System;
|
|||
|
using System.Linq;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.ComponentModel;
|
|||
|
using System.Data;
|
|||
|
using System.Drawing;
|
|||
|
using System.Text;
|
|||
|
using System.Windows.Forms;
|
|||
|
using System.Runtime.InteropServices;
|
|||
|
|
|||
|
namespace ITC81DB_0H.SerialManager
|
|||
|
{
|
|||
|
public partial class SerialMgrComm
|
|||
|
{
|
|||
|
private const string PathDll = "SD Card\\Run\\DllSerialMgr.dll";
|
|||
|
|
|||
|
public delegate void fnSerialVersionCB(StringBuilder pVersion);
|
|||
|
public static fnSerialVersionCB fnSerialVersionCallback;
|
|||
|
|
|||
|
public delegate void fnSerialMgrDebugCB(int level, StringBuilder pMessage);
|
|||
|
public static fnSerialMgrDebugCB fnSerialMgrDebugCallback;
|
|||
|
|
|||
|
public delegate void fnSerialMgrPortConnectCB(StringBuilder commPort, int status, int errDetail);
|
|||
|
public static fnSerialMgrPortConnectCB fnSerialMgrPortConnectCallback;
|
|||
|
|
|||
|
public delegate void fnSerialMgrRcvPacketCB(StringBuilder commPort, IntPtr pData, int length);
|
|||
|
public static fnSerialMgrRcvPacketCB fnSerialMgrRcvPacketCallback;
|
|||
|
|
|||
|
public delegate void fnSerialMgrRcvErrPacketCB(StringBuilder commPort, IntPtr pData, int length);
|
|||
|
public static fnSerialMgrRcvErrPacketCB fnSerialMgrRcvErrPacketCallback;
|
|||
|
|
|||
|
[DllImport(PathDll, CallingConvention = CallingConvention.Winapi)]
|
|||
|
public static extern void DLL_SerialMgr_Register_DebugCB(fnSerialMgrDebugCB func);
|
|||
|
|
|||
|
[DllImport(PathDll, CallingConvention = CallingConvention.Winapi)]
|
|||
|
public static extern void DLL_SerialMgr_Register_ConnectCB(fnSerialMgrPortConnectCB func);
|
|||
|
|
|||
|
[DllImport(PathDll, CallingConvention = CallingConvention.Winapi)]
|
|||
|
public static extern void DLL_SerialMgr_Register_VersionCB(fnSerialVersionCB func);
|
|||
|
|
|||
|
[DllImport(PathDll, CallingConvention = CallingConvention.Winapi)]
|
|||
|
public static extern void DLL_SerialMgr_Register_RcvPacketCB(fnSerialMgrRcvPacketCB func);
|
|||
|
|
|||
|
[DllImport(PathDll, CallingConvention = CallingConvention.Winapi)]
|
|||
|
public static extern void DLL_SerialMgr_Register_RcvErrPacketCB(fnSerialMgrRcvErrPacketCB func);
|
|||
|
|
|||
|
[DllImport(PathDll, CallingConvention = CallingConvention.Winapi)]
|
|||
|
public static extern void DLL_SerialMgr_HelloWorld();
|
|||
|
|
|||
|
[DllImport(PathDll, CallingConvention = CallingConvention.Winapi)]
|
|||
|
public static extern void DLL_SerialMgr_Getversion();
|
|||
|
|
|||
|
[DllImport(PathDll, CallingConvention = CallingConvention.Winapi)]
|
|||
|
public static extern void DLL_SerialMgr_Activation();
|
|||
|
|
|||
|
[DllImport(PathDll, CallingConvention = CallingConvention.Winapi)]
|
|||
|
public static extern void DLL_SerialMgr_Deactivation();
|
|||
|
|
|||
|
[DllImport(PathDll, CallingConvention = CallingConvention.Winapi)]
|
|||
|
public static extern int DLL_SerialMgr_PortOpen(IntPtr commPort, int BaudRate, int StopBit, int Parity, int DataBit);
|
|||
|
|
|||
|
[DllImport(PathDll, CallingConvention = CallingConvention.Winapi)]
|
|||
|
public static extern int DLL_SerialMgr_PortClose(IntPtr commPort);
|
|||
|
|
|||
|
[DllImport(PathDll, CallingConvention = CallingConvention.Winapi)]
|
|||
|
public static extern int DLL_SerialMgr_PortSendMsg(IntPtr commPort, IntPtr pData, int Length);
|
|||
|
|
|||
|
}
|
|||
|
}
|