当前位置: 首页>>代码示例>>Java>>正文


Java EMVApplication类代码示例

本文整理汇总了Java中sasc.emv.EMVApplication的典型用法代码示例。如果您正苦于以下问题:Java EMVApplication类的具体用法?Java EMVApplication怎么用?Java EMVApplication使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


EMVApplication类属于sasc.emv包,在下文中一共展示了EMVApplication类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addAID

import sasc.emv.EMVApplication; //导入依赖的package包/类
public void addAID(AID aid){
    allAIDs.add(aid);
    
    KnownAIDList.KnownAID knownAID = KnownAIDList.searchAID(aid.getAIDBytes());
    if(knownAID != null){
        String type = knownAID.getType();
        if("EMV".equalsIgnoreCase(type)){
            EMVApplication emvApp = new EMVApplication();
            emvApp.setAID(aid);
            emvApp.setCard(this);
            addEMVApplication(emvApp);
        }else if("GP".equalsIgnoreCase(type)){
            //TODO
        }
    } else {
        //TODO unhandled AIDs list
    }
}
 
开发者ID:yinheli,项目名称:javaemvreader,代码行数:19,代码来源:SmartCard.java

示例2: addEMVApplication

import sasc.emv.EMVApplication; //导入依赖的package包/类
public void addEMVApplication(EMVApplication app) {
//        if (applicationsMap.containsKey(app.getAID())) {
//            throw new IllegalArgumentException("EMVApplication already added: " + app.getAID() + " " + app.getPreferredName());
//        }
        if(app.getAID() == null){
            throw new IllegalArgumentException("Invalid EMVApplication object: AID == null");
        }
        Log.debug("ADDING EMV aid: "+Util.prettyPrintHexNoWrap(app.getAID().getAIDBytes()));
        if(app.getCard() == null){
            app.setCard(this);
        }
        emvApplicationsMap.put(app.getAID(), app);
    }
 
开发者ID:yinheli,项目名称:javaemvreader,代码行数:14,代码来源:SmartCard.java

示例3: addApplication

import sasc.emv.EMVApplication; //导入依赖的package包/类
public void addApplication(Application app) {
    if(app == null) {
        throw new IllegalArgumentException("Param app cannot be null");
    }
    if(app.getAID() == null){
        throw new IllegalArgumentException("Invalid Application object: AID == null");
    }
    if(app instanceof EMVApplication) {
        addEMVApplication((EMVApplication)app);
    } else {
        otherApplicationsMap.put(app.getAID(), app);
    }
}
 
开发者ID:yinheli,项目名称:javaemvreader,代码行数:14,代码来源:SmartCard.java

示例4: run

import sasc.emv.EMVApplication; //导入依赖的package包/类
@Override
public void run() {
    EMVTerminal.setPinCallbackHandler(new PinCallbackHandlerGui());
    CardExplorer explorer = new CardExplorer();
    try {
        explorer.start();
    } catch (Exception ex) {
        StringWriter st = new StringWriter();
        ex.printStackTrace(new PrintWriter(st));
        console.append(st.toString());
    } finally {
        //Show submit feedback dialogue
        boolean foundUnhandledRecords = false;
        SmartCard card = explorer.getEMVCard();
        if(card != null){
            if(card.getUnhandledRecords().size() > 0){
                foundUnhandledRecords = true;
            }
            for(EMVApplication app : card.getEmvApplications()){
                if(app != null && app.getUnknownRecords().size() > 0){
                    foundUnhandledRecords = true;
                }
            }
        }

        if (!console.getText().contains("Finished Processing card.") 
                || console.getText().contains("Error processing app")) {
            //Assume something failed. Show Popup with option to send email
            submitFeedback("[JavaEMVReader-BUGREPORT]", "Error", "Something failed. Would you like to send an email report?");
        }else if(foundUnhandledRecords){
            submitFeedback("[JavaEMVReader-UNKNOWN-RECORDS]", "Unknown Record(s)", "Found unknown records. Would you like to send an email report?");
        }
    }
}
 
开发者ID:yinheli,项目名称:javaemvreader,代码行数:35,代码来源:GUI.java

示例5: getSelectedApplication

import sasc.emv.EMVApplication; //导入依赖的package包/类
public EMVApplication getSelectedApplication() {
    return selectedApp;
}
 
开发者ID:yinheli,项目名称:javaemvreader,代码行数:4,代码来源:SmartCard.java

示例6: setSelectedApplication

import sasc.emv.EMVApplication; //导入依赖的package包/类
public void setSelectedApplication(EMVApplication app) {
    this.selectedApp = app;
}
 
开发者ID:yinheli,项目名称:javaemvreader,代码行数:4,代码来源:SmartCard.java

示例7: getEmvApplications

import sasc.emv.EMVApplication; //导入依赖的package包/类
public Collection<EMVApplication> getEmvApplications() {
    return Collections.unmodifiableCollection(emvApplicationsMap.values());
}
 
开发者ID:yinheli,项目名称:javaemvreader,代码行数:4,代码来源:SmartCard.java

示例8: getEmvCardDisplayString

import sasc.emv.EMVApplication; //导入依赖的package包/类
private String getEmvCardDisplayString(EMVCard card) {
		StringBuilder buff = new StringBuilder();
		int indent = 2;

		if (card.getApplications().isEmpty()) {
			buff.append("Google Wallet not installed or locked. Install and unlock Wallet and try again.");
			buff.append("\n");
			// PPSE in fact
			if (card.getPSE() != null) {
				buff.append("\n");
				buff.append("PPSE: ");
				buff.append("\n");
				buff.append(Util.getSpaces(indent) + card.getPSE().toString());

				return buff.toString();
			}
		}

		buff.append((Util.getSpaces(indent) + "EMV applications on SE"));
		buff.append("\n\n");
		buff.append(Util.getSpaces(indent + 2 * indent) + "Applications ("
				+ card.getApplications().size() + " found):");
		buff.append("\n");
		for (EMVApplication app : card.getApplications()) {
			buff.append(Util.getSpaces(indent + 3 * indent) + app.toString());
		}

		if (card.getMasterFile() != null) {
			buff.append(Util.getSpaces(indent + indent) + "MF: "
					+ card.getMasterFile());
		}

		buff.append("Extra info (if any)");
		buff.append(Util.getSpaces(indent) + "ATR: " + App.seConn.getATR());
//		buff.append(Util.getSpaces(indent + indent) + "Interface Type: "
//		 + card.getType());
		buff.append("\n");

		if (!card.getUnhandledRecords().isEmpty()) {
			buff.append(Util.getSpaces(indent + indent)
					+ "UNHANDLED GLOBAL RECORDS ("
					+ card.getUnhandledRecords().size() + " found):");

			for (BERTLV tlv : card.getUnhandledRecords()) {
				buff.append(Util.getSpaces(indent + 2 * indent) + tlv.getTag()
						+ " " + tlv);
			}
		}
		buff.append("\n");

		return buff.toString();
	}
 
开发者ID:gsbabil,项目名称:ClassicNFC,代码行数:53,代码来源:MainActivity.java

示例9: selectApplication

import sasc.emv.EMVApplication; //导入依赖的package包/类
public void selectApplication(EMVApplication app) throws TerminalException {
    if (app == null) {
        throw new IllegalArgumentException("Parameter 'app' cannot be null");
    }

    if (!cardInitalized) {
        throw new SmartCardException(
                "Card not initialized. Call initCard() first");
    }

    EMVApplication currentSelectedApp = card.getSelectedApplication();
    if (currentSelectedApp != null
            && app.getAID().equals(currentSelectedApp.getAID())) {
        throw new SmartCardException("Application already selected. AID: "
                + app.getAID());
    }

    AID aid = app.getAID();
    Log.d(TAG, "Select application by AID: " + aid);
    String command = EMVAPDUCommands.selectByDFName(aid.getAIDBytes());
    CardResponse selectAppResponse = EMVUtil.sendCmd(seConn, command);

    if (selectAppResponse.getSW() == SW.SELECTED_FILE_INVALIDATED.getSW()) {
        // App blocked
        Log.i(TAG, "Application BLOCKED");
        // TODO abort execution if app blocked?
        throw new SmartCardException("EMVApplication "
                + Util.byteArrayToHexString(aid.getAIDBytes()) + " blocked");
    }

    if (selectAppResponse.getSW() != SW.SUCCESS.getSW()) {
        Log.e(TAG, "Can't select app. Card response: " + selectAppResponse);
        return;
    }

    ApplicationDefinitionFile adf = EMVUtil.parseFCIADF(
            selectAppResponse.getData(), app);
    Log.d(TAG, "ADF: " + adf);

    getCurrentCard().setSelectedApplication(app);
}
 
开发者ID:gsbabil,项目名称:ClassicNFC,代码行数:42,代码来源:SEEMVSession.java


注:本文中的sasc.emv.EMVApplication类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。