using System; using System.Collections.Generic; using System.Text; using System.Runtime.InteropServices; namespace DBUtility { public class mwxrf32dll { public mwxrf32dll() { // // TODO: 在此处添加构造函数逻辑 // } [DllImport("mwxrf32.dll", EntryPoint = "rf_init", SetLastError = true, CharSet = CharSet.Auto, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)] //说明:打开通讯接口 public static extern Int16 rf_init(byte nPort, long ulBaud); [DllImport("mwxrf32.dll", EntryPoint = "rf_exit", SetLastError = true, CharSet = CharSet.Auto, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)] //说明: 关闭通讯口 public static extern Int16 rf_exit(int icdev); [DllImport("mwxrf32.dll", EntryPoint = "hex_a", SetLastError = true, CharSet = CharSet.Auto, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)] public static extern Int16 hex_a([MarshalAs(UnmanagedType.LPArray)]byte[] sHex, [MarshalAs(UnmanagedType.LPArray)]byte[] sAsc, ulong ulLength); [DllImport("mwxrf32.dll", EntryPoint = "a_hex", SetLastError = true, CharSet = CharSet.Auto, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)] public static extern Int16 a_hex([MarshalAs(UnmanagedType.LPArray)]byte[] sAsc, [MarshalAs(UnmanagedType.LPArray)]byte[] sHex, ulong ulLength); [DllImport("mwxrf32.dll", EntryPoint = "rf_request", SetLastError = true, CharSet = CharSet.Auto, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)] public static extern Int16 rf_request(int icdev, byte mode, [MarshalAs(UnmanagedType.LPArray)]byte[] sAtr); [DllImport("mwxrf32.dll", EntryPoint = "rf_authentication_key", SetLastError = true, CharSet = CharSet.Auto, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)] public static extern Int16 rf_authentication_key(int icdev, byte mode, byte _BlockNr, [MarshalAs(UnmanagedType.LPArray)]byte[] key); [DllImport("mwxrf32.dll", EntryPoint = "rf_read", SetLastError = true, CharSet = CharSet.Auto, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)] public static extern Int16 rf_read(int icdev, byte Add, [MarshalAs(UnmanagedType.LPArray)]byte[] read); [DllImport("mwxrf32.dll", EntryPoint = "rf_write", SetLastError = true, CharSet = CharSet.Auto, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)] public static extern Int16 rf_write(int icdev, byte Add, [MarshalAs(UnmanagedType.LPArray)]byte[] write); [DllImport("mwxrf32.dll", EntryPoint = "rf_initval", SetLastError = true, CharSet = CharSet.Auto, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)] public static extern Int16 rf_initval(int icdev, byte Add, long val); [DllImport("mwxrf32.dll", EntryPoint = "rf_increment", SetLastError = true, CharSet = CharSet.Auto, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)] public static extern Int16 rf_increment(int icdev, byte Add, long val); [DllImport("mwxrf32.dll", EntryPoint = "rf_decrement", SetLastError = true, CharSet = CharSet.Auto, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)] public static extern Int16 rf_decrement(int icdev, byte Add, long val); [DllImport("mwxrf32.dll", EntryPoint = "rf_readval", SetLastError = true, CharSet = CharSet.Auto, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)] public static extern Int16 rf_readval(int icdev, byte Add, [MarshalAs(UnmanagedType.LPArray)]long[] val); [DllImport("mwxrf32.dll", EntryPoint = "rf_beep", SetLastError = true, CharSet = CharSet.Auto, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)] public static extern Int16 rf_beep(int icdev, short _Msec); } }