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)))); }
public static IMessage OpenReader(int port) { var ret = HsPinvoke.OpenReader(port); return(ret == SuccessCode ? CommonDeviceMsg.CreateSuccess() : CommonDeviceMsg.CreateFail(OpenResult[ret])); }
public static void CloseReader() { HsPinvoke.CloseReader(); }