當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。