本文整理汇总了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
}
}
示例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);
}
示例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);
}
}
示例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?");
}
}
}
示例5: getSelectedApplication
import sasc.emv.EMVApplication; //导入依赖的package包/类
public EMVApplication getSelectedApplication() {
return selectedApp;
}
示例6: setSelectedApplication
import sasc.emv.EMVApplication; //导入依赖的package包/类
public void setSelectedApplication(EMVApplication app) {
this.selectedApp = app;
}
示例7: getEmvApplications
import sasc.emv.EMVApplication; //导入依赖的package包/类
public Collection<EMVApplication> getEmvApplications() {
return Collections.unmodifiableCollection(emvApplicationsMap.values());
}
示例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();
}
示例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);
}