Commit 713f6c8f7411b235026fbf6fc3be793629dd465d
1 parent
630fe9d4
feat(card-client):优化读卡速度
优化读卡速度,调换读卡顺序,先读m1卡再读cpu卡。
Showing
1 changed file
with
41 additions
and
32 deletions
etrade_card_client/ETradeClient/hardware/hardware_cmd.cpp
... | ... | @@ -770,9 +770,49 @@ ReadPINPadCmd::Reply ReadDILICardBasicInfoCmd::Execute(const std::string& input) |
770 | 770 | break; |
771 | 771 | } |
772 | 772 | |
773 | + //读取m1卡 | |
774 | + do | |
775 | + { | |
776 | + reply.error_code = StatusCode::OK; | |
777 | + //判断是否为cpu卡,以防CPU卡读卡失败 | |
778 | + if (card_basic_info.chip_type.compare("1") == 0) | |
779 | + { | |
780 | + break; | |
781 | + } | |
782 | + | |
783 | + if (0 != dili_card_device.M1FindCard()) | |
784 | + { | |
785 | + reply.error_code = StatusCode::CPU_CARD_DEVICE_CANNOT_FIND_CARD; | |
786 | + CString error; | |
787 | + error.Format(L"m1卡寻卡失败,错误信息:%d", reply.error_code); | |
788 | + LOG_FATAL(error.GetBuffer()); | |
789 | + break; | |
790 | + } | |
791 | + | |
792 | + try | |
793 | + { | |
794 | + card_basic_info = dili_card_device.M1ReadBasicInfo(); | |
795 | + } | |
796 | + catch (std::exception& ex) | |
797 | + { | |
798 | + LOG_FATAL(L"m1卡读取基本信息失败,错误信息: " + str_2_wstr(ex.what())); | |
799 | + reply.error_code = StatusCode::DILI_CARD_DEVICE_READ_BASIC_INFO_FAILED; | |
800 | + break; | |
801 | + } | |
802 | + card_basic_info.chip_type = "2";//m1卡类型 | |
803 | + card_basic_info.device_id = card_basic_info.chip_num; | |
804 | + | |
805 | + } while (0); | |
806 | + | |
773 | 807 | //读取CPU卡 |
774 | 808 | do |
775 | 809 | { |
810 | + reply.error_code = StatusCode::OK; | |
811 | + //判断是否为m1卡,以防m1卡读卡失败 | |
812 | + if (card_basic_info.chip_type.compare("2") == 0) | |
813 | + { | |
814 | + break; | |
815 | + } | |
776 | 816 | try |
777 | 817 | { |
778 | 818 | dili_card_device.FindCard(); |
... | ... | @@ -859,38 +899,7 @@ ReadPINPadCmd::Reply ReadDILICardBasicInfoCmd::Execute(const std::string& input) |
859 | 899 | } |
860 | 900 | } while (0); |
861 | 901 | |
862 | - //读取m1卡 | |
863 | - do | |
864 | - { | |
865 | - //判断是否为cpu卡,以防CPU卡读卡失败 | |
866 | - if (card_basic_info.chip_type.compare("1") == 0) | |
867 | - { | |
868 | - break; | |
869 | - } | |
870 | - | |
871 | - if (0 != dili_card_device.M1FindCard()) | |
872 | - { | |
873 | - reply.error_code = StatusCode::CPU_CARD_DEVICE_CANNOT_FIND_CARD; | |
874 | - CString error; | |
875 | - error.Format(L"m1卡寻卡失败,错误信息:%d", reply.error_code); | |
876 | - LOG_FATAL(error.GetBuffer()); | |
877 | - break; | |
878 | - } | |
879 | - | |
880 | - try | |
881 | - { | |
882 | - card_basic_info = dili_card_device.M1ReadBasicInfo(); | |
883 | - } | |
884 | - catch (std::exception& ex) | |
885 | - { | |
886 | - LOG_FATAL(L"m1卡读取基本信息失败,错误信息: " + str_2_wstr(ex.what())); | |
887 | - reply.error_code = StatusCode::DILI_CARD_DEVICE_READ_BASIC_INFO_FAILED; | |
888 | - break; | |
889 | - } | |
890 | - card_basic_info.chip_type = "2";//m1卡类型 | |
891 | - card_basic_info.device_id = card_basic_info.chip_num; | |
892 | - reply.error_code = StatusCode::OK; | |
893 | - } while (0); | |
902 | + | |
894 | 903 | } while (0); |
895 | 904 | |
896 | 905 | dili_card_device.Disconnect(); | ... | ... |