示例#1
0
        public static IMessage <IPersonInfo> ReadCard(int port)
        {
            var findIdRet = HxPinvoke.StartFindIdCard(port, new byte[4], OpenReaderOutside);

            if (findIdRet != FindIdSuccessCode)
            {
                return(CommonDeviceMsg <HxPersonInfo> .CreateFail(Result[findIdRet]));
            }
            var selectIdRet = HxPinvoke.SelectIdCard(port, new byte[8], OpenReaderOutside);

            if (selectIdRet != SuccessCode)
            {
                return(CommonDeviceMsg <HxPersonInfo> .CreateFail(Result[selectIdRet]));
            }
            var  byChMsg     = new byte[257];   //个人基本信息
            uint uiChMsgSize = 0;               //个人基本信息字节数
            var  byPhMsg     = new byte[1025];  //照片信息
            uint uiPhMsgSize = 0;               //照片信息字节数
            var  readRet     = HxPinvoke.ReadCard(port, byChMsg, ref uiChMsgSize, byPhMsg, ref uiPhMsgSize, OpenReaderOutside);

            if (readRet != SuccessCode)
            {
                return(CommonDeviceMsg <HxPersonInfo> .CreateFail(Result[readRet]));
            }
            return(CommonDeviceMsg <HxPersonInfo> .CreateSuccess(HxPersonInfo.CreateHxPersonInfo(byChMsg)));
        }
示例#2
0
        public static IMessage <IPersonInfo> ReadCard()
        {
            var name        = new byte[BufferSize];
            var nameLength  = 0;
            var idNum       = new byte[BufferSize];
            var idNumLength = 0;
            var authRet     = HsPinvoke.Authenticate();

            if (authRet != SuccessCode)
            {
                return(CommonDeviceMsg <HsPersonInfo> .CreateFail(AuthResult[authRet]));
            }
            var readRet = HsPinvoke.ReadCard(NotMean);

            if (readRet != SuccessCode)
            {
                return(CommonDeviceMsg <HsPersonInfo> .CreateFail(ReadResult[readRet]));
            }
            var readName = HsPinvoke.GetPeopleName(ref name[0], ref nameLength);

            if (readName != SuccessCode)
            {
                return(CommonDeviceMsg <HsPersonInfo> .CreateFail(ReadResult[readName]));
            }
            var readIdNum = HsPinvoke.GetPeopleIdNum(ref idNum[0], ref idNumLength);

            if (readIdNum != SuccessCode)
            {
                return(CommonDeviceMsg <HsPersonInfo> .CreateFail(ReadResult[readIdNum]));
            }
            return(CommonDeviceMsg <HsPersonInfo> .CreateSuccess(new HsPersonInfo(GetInfo(name),
                                                                                  GetInfo(idNum))));
        }
示例#3
0
        public static IMessage OpenReader(int port)
        {
            var ret = HxPinvoke.OpenReader(port);

            return(ret == SuccessCode
               ? CommonDeviceMsg.CreateSuccess()
               : CommonDeviceMsg.CreateFail(Result[ret]));
        }
示例#4
0
        public static IMessage <IPersonInfo> ReadSocialCard(CardType cardType)
        {
            var info = new StringBuilder(1024 * 10);
            var ret  = DkPInvoke.ReadCardBas((int)cardType, info);

            return(ret == SuccessCode
                ? CommonDeviceMsg <DkPersonInfo> .CreateSuccess(DkPersonInfo.CreateBySocialResult(info.ToString()))
                : CommonDeviceMsg <DkPersonInfo> .CreateFail(info.ToString()));
        }
示例#5
0
        public static IMessage <IPersonInfo> ReadIdCard()
        {
            var info = new StringBuilder(2048);
            var ret  = TsPinvoke.ReadIdCard(NoCreatePhoto, string.Empty, new StringBuilder(1024 * 10), info);

            return(IdSuccessCode.Contains(ret)
                ? CommonDeviceMsg <TsPersonInfo> .CreateSuccess(TsPersonInfo.CreateByIdResult(ret, info.ToString()))
                : CommonDeviceMsg <TsPersonInfo> .CreateFail(info.ToString()));
        }
示例#6
0
        public static IMessage <IPersonInfo> ReadIdCard()
        {
            var info = new StringBuilder(1024 * 10);
            var notGetFingerDataLength = 0;
            var ret = DkPInvoke.ReadIdCard(ref notGetFingerDataLength, new StringBuilder(1024), info);

            return(ret == SuccessCode
                ? CommonDeviceMsg <DkPersonInfo> .CreateSuccess(DkPersonInfo.CreateByIdResult(info.ToString()))
                : CommonDeviceMsg <DkPersonInfo> .CreateFail(info.ToString()));
        }
示例#7
0
 public Task <IMessage <IPersonInfo> > ReadSocialCardAsync(CardType cardType)
 {
     return(Task.Run(
                () =>
     {
         lock (_lock)
         {
             return CommonDeviceMsg <IPersonInfo> .CreateFail("该设备不支持读社保卡!");
         }
     }
                ));
 }
示例#8
0
 public static IMessage <T> FailToMessageT <T>(this IMessage message)
 {
     return(CommonDeviceMsg <T> .CreateFail(message.Message));
 }