using System.Runtime.InteropServices;
using System.Text;

namespace demo
{
    class InteropHelper
    {
        [DllImport("libLockman.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)]
        public static extern int KReadKeycardUID(StringBuilder returnCardID);

        [DllImport("libLockman.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)]
        public static extern int KCheckinByMobile(string userName, string userPasswd, string lockID, string owner,
            string ownerID, string mobile, string beginDate, string expiryDate, int options, StringBuilder returnKeyID);

        [DllImport("libLockman.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)]
        public static extern int KCheckinByMobileWithPinCode(string userName, string userPasswd, string lockID, string owner,
           string ownerID, string mobile, string beginDate, string expiryDate, int withPinCode, 
           int options, StringBuilder returnKeyID, StringBuilder returnVerifyCode, StringBuilder returnPassword);

        [DllImport("libLockman.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)]
        public static extern int KCheckinByUserId(string userName, string userPasswd, string lockID, string owner,
           string ownerID, string userId, string sdkClientID, string sdkClientSecret,
           string beginDate, string expiryDate, int options, StringBuilder returnKeyID);

        [DllImport("libLockman.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)]
        public static extern int KCheckinByPassword(string userName, string userPasswd, string lockID, string owner,
           string ownerID, string beginDate, string expiryDate, int options, StringBuilder returnKeyID, StringBuilder returnPinCode);

        [DllImport("libLockman.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)]
        public static extern int KCheckinByKeycard(string userName, string userPasswd, string lockID, string owner,
           string ownerID, string expiryDate, int options, StringBuilder returnKeyID);

        [DllImport("libLockman.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)]
        public static extern int KCancelKeyByKeyID(string userName, string userPasswd, string keyID);

        [DllImport("libLockman.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)]
        public static extern int KCancelKeyByLockID(string userName, string userPasswd, string lockID);

        [DllImport("libLockman.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)]
        public static extern int KCancelKeyByKeycard(string userName, string userPasswd);

        [DllImport("libLockman.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)]
        public static extern int KReadKeycard(string userName, string userPasswd, StringBuilder returnKeyID,
            StringBuilder returnLockID, StringBuilder returnOwner, StringBuilder returnMakeDate,
            StringBuilder returnEndDate);

        [DllImport("libLockman.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)]
        public static extern int KFireBeepSuccess();

        [DllImport("libLockman.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)]
        public static extern int KFireBeepFailure();
    }
}
