1 unsafe class Program
2 {
3 [DllImport("mwhrf_bj.dll")]
4 public static extern int rf_card(int icdev, Byte _Mode, UInt64* _Snr);
5
6 [DllImport("mwhrf_bj.dll")]
7 public static extern int Open_USB();
8
9 [DllImport("mwhrf_bj.dll")]
10 public static extern int Close_USB(int icdev);
11
12 [DllImport("mwhrf_bj.dll")]
13 public static extern int rf_beep(int icdev, UInt32 _Msec);
14
15 static void Main(string[] args)
16 {
17 int devID = Open_USB();
18 Console.WriteLine("打开端口成功");
19 while (true)
20 {
21 UInt64 cardSN;
22 int flag= rf_card(devID, (Byte)0x00, &cardSN);//寻一次卡 然后卡片必须拿开
23 //int flag= rf_card(devID, (Byte)0x00, &cardSN);//在卡片不拿走的情况连续询卡
24 if (flag != 1)
25 {
26 rf_beep(devID, 10);
27 Console.WriteLine("寻卡成功,卡号是{0}", cardSN);
28 }
29 Thread.Sleep(1000);
30 }
31 Close_USB(devID);
32 Console.WriteLine("关闭端口成功");
33 }
34 }