110,529
社区成员
发帖
与我相关
我的任务
分享
// ============== 常量定义 =====================
#define ID_MAX_SIZE 8 // ID号最多8字节(64bits)
#define MAX_LABELS 5 // 一次读写操作最多不超过5个
typedef struct tagID
{
unsigned short Address; // ID号在标签内存中的地址
unsigned short Length; // ID号字节数
unsigned char Num[MAX_LABELS][ID_MAX_SIZE]; // 存放ID号的字节数组
} ID;
//读取标签ID号
apiReturn _stdcall ReadLabelID(HANDLE hScanner, int nMax, ID *IDBuffer, int *nCounter);
[DllImport("Reader2022DLL.dll")]
unsafe public static extern UInt16 ReadLabelID(IntPtr hScanner,int nMax,ref tagID IDBuffer,ref int nCounter);
public const int ID_MAX_SIZE=8; // ID号最多8字节(64bits)
public const int MAX_LABELS = 5; // 一次读写操作最多不超过5个
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi,Pack=1)]
unsafe public struct tagID
{
public ushort Address; // ID号在标签内存中的地址
public ushort Length; // ID号字节数
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 40)]
public byte [,] Num; // 存放ID号的字节数组
};