[DllImport("mwrf32.dll", EntryPoint = "rf_init", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
public static extern Int16 rf_init(Int16 port, long baud);
//取得读写器硬件版本号
[DllImport("mwrf32.dll", EntryPoint = "rf_get_status", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
public static extern Int16 rf_get_status(Int16 icdev, byte* banben);
/// <summary>
///鸣叫
/// </summary>
/// <param name="icdev"></param>
/// <param name="banben"></param>
/// <returns></returns>
[DllImport("mwrf32.dll", EntryPoint = "rf_beep", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
public static extern Int16 rf_beep(Int16 icdev, int m);
/// <summary>
///射频读写模式复位
/// </summary>
/// <param name="icdev"></param>
/// <param name="banben"></param>
/// <returns></returns>
[DllImport("mwrf32.dll", EntryPoint = "rf_reset", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
public static extern Int16 rf_reset(Int16 icdev, int m);
//将密码装入读写模块RAM块中
[DllImport("mwrf32.dll", EntryPoint = "rf_load_key", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
public static extern Int16 rf_load_key(Int16 icdev, byte passordmode, byte sector, byte[] passord);
//向读写器装入十六进制密码
[DllImport("mwrf32.dll", EntryPoint = "rf_load_key_hex", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
public static extern Int16 rf_load_key_hex(int icdev, byte passordmode, byte sector, string w_passord);
//断开与读卡器的连接
[DllImport("mwrf32.dll", EntryPoint = "rf_exit", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
public static extern Int16 rf_exit(Int16 icdev);
/*----------------------读写器操作-----------------------------------*/
/*----------------------卡操作-----------------------------------*/
//返回卡的序列号---- 防冲突
[DllImport("mwrf32.dll", EntryPoint = "rf_anticoll", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
public static extern Int16 rf_anticoll(Int16 icdev, byte m, ulong* kahao);
//返回卡的序列号---- 寻卡
[DllImport("mwrf32.dll", EntryPoint = "rf_card", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
public static extern Int16 rf_card(Int16 icdev, byte m, out ulong kahao);
/// <summary>
/// 寻卡
/// </summary>
/// <param name="icdev"></param>
/// <param name="m"></param>
/// <param name="kahao"></param>
/// <returns></returns>
[DllImport("mwrf32.dll", EntryPoint = "rf_request", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
public static extern Int16 rf_request(Int16 icdev, Int16 m, uint* kahao);
//初始化块值---在进行值操作时,必须先执行初始化值函数,然后才可以读、减、加的操作
[DllImport("mwrf32.dll", EntryPoint = "rf_initval", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
public static extern Int16 rf_initval(int icdev, int mode, byte date);
//读块值
[DllImport("mwrf32.dll", EntryPoint = "rf_initval", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
public static extern Int16 rf_initval(Int16 icdev, Int16 adr, ulong date);
//读取卡中数据
[DllImport("mwrf32.dll", EntryPoint = "rf_read", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
public static extern Int16 rf_read(Int16 icdev, byte mode, byte[] date);
//向卡中写数据
[DllImport("mwrf32.dll", EntryPoint = "rf_write", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
public static extern Int16 rf_write(Int16 icdev, byte mode, byte[] date);
//验证卡某一扇区密码
[DllImport("mwrf32.dll", EntryPoint = "rf_authentication", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
public static extern Int16 rf_authentication(Int16 icdev, byte mode, byte SecNr);
//检测指定数据是否与卡中数据一致
[DllImport("mwrf32.dll", EntryPoint = "rf_check_write", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
public static extern Int16 rf_check_write(Int16 icdev, int snr, int authmode, int adr, byte date);
//终止该卡操作
[DllImport("mwrf32.dll", EntryPoint = "rf_halt", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
public static extern Int16 rf_halt(int icdev);
/*----------------------卡操作-----------------------------------*/
转载于:https://www.cnblogs.com/hehexiaoxia/archive/2013/05/30/3108107.html