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


Java IsoDep.get方法代码示例

本文整理汇总了Java中android.nfc.tech.IsoDep.get方法的典型用法代码示例。如果您正苦于以下问题:Java IsoDep.get方法的具体用法?Java IsoDep.get怎么用?Java IsoDep.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.nfc.tech.IsoDep的用法示例。


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

示例1: onTagDiscovered

import android.nfc.tech.IsoDep; //导入方法依赖的package包/类
@Override
public void onTagDiscovered(final Tag tag) {
    Log.d(TAG, "Tag found: " + tag.toString());
    Log.d(TAG, "Id: " + HexStrings.toHexString(tag.getId()));
    for (String tech: tag.getTechList()) {
        Log.d(TAG, "Tech: " + tech);
    }

    if (Arrays.asList(tag.getTechList()).contains("android.nfc.tech.IsoDep")) {
        IsoDepApduInterface apduInterface;
        try {
            apduInterface = new IsoDepApduInterface(IsoDep.get(tag));
        } catch (IOException e) {
            fail(e.getMessage());
            e.printStackTrace();
            return;
        }

        dispatchLoadTask(apduInterface);
    }
}
 
开发者ID:mDL-ILP,项目名称:mDL-ILP,代码行数:22,代码来源:NFCConnection.java

示例2: onTagDiscovered

import android.nfc.tech.IsoDep; //导入方法依赖的package包/类
@Override
public void onTagDiscovered(Tag tag) {
    Log.d(TAG, "onTagDiscovered: " + tag);

    final long startTime = System.currentTimeMillis();
    long duration;

    try {
        IsoDep isoDep = IsoDep.get(tag);
        isoDep.connect();
        onTagDiscovered(tag, isoDep, true);
    } catch (Throwable e) {
        Log.e(TAG, "Exception in onTagDiscovered", e);
        getPaymentRequestDelegate().onPaymentError(e.getMessage());
    }
}
 
开发者ID:coinblesk,项目名称:coinblesk-client-gui,代码行数:17,代码来源:NFCServerCLTV.java

示例3: create

import android.nfc.tech.IsoDep; //导入方法依赖的package包/类
/**
 * Creates a transceiver for the specified tag.
 * @return null is returned if a transceiver could not be created
 */
public static Transceiver create(Logger logger, Tag tag)
{
	IsoDep isoDep = IsoDep.get(tag);
	if (null == isoDep)
	{
		logger.warn(TAG, "Unable to create IsoDep for NFC tag: " + StringUtil.join(tag.getTechList(), ", "));
		return null;
	}

	logger.info(TAG, "Connnecting to ISO-DEP: " + isoDep.isConnected());
	try
	{
		isoDep.connect();
		isoDep.setTimeout(30000);
		return new Transceiver(logger, isoDep);
	}
	catch (Exception ex)
	{
		logger.error(TAG, "Unable to connect to ISO-DEP", ex);
		return null;
	}
}
 
开发者ID:PIVopacity,项目名称:PIVOpacityDemo-android,代码行数:27,代码来源:Transceiver.java

示例4: get

import android.nfc.tech.IsoDep; //导入方法依赖的package包/类
public static AndroidCard get(Tag tag) throws IOException {
    IsoDep card = IsoDep.get(tag);

    if(card != null) {
        /* Workaround for the Samsung Galaxy S5 (since the
         * first connection always hangs on transceive).
         * TODO: This could be improved if we could identify
         * Samsung Galaxy S5 devices
         */
        card.connect();
        card.close();
        return new AndroidCard(card);
    } else {
        return null;
    }
}
 
开发者ID:fidesmo,项目名称:nordpol,代码行数:17,代码来源:AndroidCard.java

示例5: doInBackground

import android.nfc.tech.IsoDep; //导入方法依赖的package包/类
@Override
protected String doInBackground(Tag... params) {
    Tag tag = params[0];

    tagCommunicator = IsoDep.get(tag);

    try {
        tagCommunicator.connect();
        tagCommunicator.setTimeout(5000);

        if (tagCommunicator.isConnected()) {
            readCard();
        }
    } catch (IOException e) {
        e.printStackTrace();
    }

    return null;
}
 
开发者ID:jthuraisamy,项目名称:MasterTap,代码行数:20,代码来源:CardReaderTask.java

示例6: get

import android.nfc.tech.IsoDep; //导入方法依赖的package包/类
public static AndroidCard get(Tag tag) throws IOException {
    IsoDep card = IsoDep.get(tag);

    /* Workaround for the Samsung Galaxy S5 (since the
     * first connection always hangs on transceive).
     * TODO: This could be improved if we could identify
     * Samsung Galaxy S5 devices
     */
    card.connect();
    card.close();

    if(card != null) {
        return new AndroidCard(card);
    } else {
        return null;
    }
}
 
开发者ID:greenaddress,项目名称:WalletCordova,代码行数:18,代码来源:AndroidCard.java

示例7: onTagDiscovered

import android.nfc.tech.IsoDep; //导入方法依赖的package包/类
@Override
public void onTagDiscovered(Tag tag) {
    doTapFeedback();
    clearImage();
    // maybe clear console or show separator, depends on settings
    if (mAutoClear) {
        clearMessages();
    } else {
        addMessageSeparator();
    }
    // get IsoDep handle and run xcvr thread
    IsoDep isoDep = IsoDep.get(tag);
    if (isoDep == null) {
        onError(getString(R.string.wrong_tag_err));
    } else {
        ReaderXcvr xcvr = new PaymentReaderXcvr(isoDep, "", this, TEST_MODE_EMV_READ);
        new Thread(xcvr).start();
    }
}
 
开发者ID:doc-rj,项目名称:smartcard-reader,代码行数:20,代码来源:EmvReadActivity.java

示例8: onTagDiscovered

import android.nfc.tech.IsoDep; //导入方法依赖的package包/类
@Override
public void onTagDiscovered(Tag tag) {
    doTapFeedback();
    clearImage();
    // maybe clear console or show separator, depends on settings
    if (mAutoClear) {
        clearMessages();
    } else {
        // two separators between taps/discoveries
        addMessageSeparator();
        addMessageSeparator();
    }
    // get IsoDep handle and run xcvr thread
    IsoDep isoDep = IsoDep.get(tag);
    if (isoDep == null) {
        onError(getString(R.string.wrong_tag_err));
    } else {
        List<SmartcardApp> memberApps = mGrpToMembersMap.get(mSelectedGrpPos);
        new Thread(new BatchReaderXcvr(isoDep, memberApps, this)).start();
    }
}
 
开发者ID:doc-rj,项目名称:smartcard-reader,代码行数:22,代码来源:BatchSelectActivity.java

示例9: onTagDiscovered

import android.nfc.tech.IsoDep; //导入方法依赖的package包/类
@Override
public void onTagDiscovered(Tag tag) {
	if (Config.DEBUG)
		Log.d(TAG, "tag discovered: " + tag);
	
	if (!enabled) {
		if (Config.DEBUG)
			Log.d(TAG, "tag discovered, but InternalNfcTransceiver not enabled");
		
		return;
	}
	
	isoDep = IsoDep.get(tag);
	try {
		isoDep.connect();
		nfcInit.tagDiscovered();
	} catch (IOException e) {
		if (Config.DEBUG)
			Log.e(TAG, "Could not connnect isodep: ", e);
		
		eventHandler.handleMessage(NfcEvent.INIT_FAILED, null);
	}
}
 
开发者ID:jetonmemeti,项目名称:android-kitkat-nfc-library,代码行数:24,代码来源:InternalNfcTransceiver.java

示例10: send

import android.nfc.tech.IsoDep; //导入方法依赖的package包/类
/**
 * Send message via a Nfc connection.
 *
 * @param message The message in byte array form
 * @return The response from {@link NfcServerSocket}. null might be returned
 * if <li>the connection is lost. <li> {@link NfcServerSocket} does
 * not return response within timeout. <li> {@link NfcServerSocket}
 * returns a null response.
 */
public byte[] send(byte[] message) {
    if (currentTag == null) {
        return null;
    }

    if (isoDep == null) {
        isoDep = IsoDep.get(currentTag);
    }

    if (isoDep.isConnected()) {
        try {
            byte[] response = isoDep.transceive(message);
            return response;
        } catch (IOException e) {
            e.printStackTrace();
            return null;
        }
    } else {
        log("isodep not connected");
        return null;
    }
}
 
开发者ID:Chrisplus,项目名称:NFCSocket,代码行数:32,代码来源:NfcClientSocket.java

示例11: onNewIntent

import android.nfc.tech.IsoDep; //导入方法依赖的package包/类
/**
 * 
 */
@Override
protected void onNewIntent(Intent intent) {
	super.onNewIntent(intent);
	Log.d(TAG, "onNewIntent Called");
	if (NfcAdapter.ACTION_TAG_DISCOVERED.equals(intent.getAction())) {
		// validate that this tag can be written....
		myStatusTextView.setText("tag detected");
		pbCircular.setVisibility(View.VISIBLE);
		Tag detectedTag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
		Log.d(TAG, detectedTag.toString());
		Log.d(TAG, detectedTag.getTechList().toString());

		this.isoDep = IsoDep.get(detectedTag);

		// Have the background task send the image
		fileSender.execute(imageBuffer);
		fileSender = new SendFileToWISP(this);

	}// end if

}
 
开发者ID:wisp,项目名称:nfc-reader-app,代码行数:25,代码来源:MainActivity.java

示例12: onNewIntent

import android.nfc.tech.IsoDep; //导入方法依赖的package包/类
@Override
public void onNewIntent(Intent intent) {
    Log.i(TAG, "Discovered tag with intent: " + intent);
    if (NfcAdapter.ACTION_TECH_DISCOVERED.equals(intent.getAction())) {
     tag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
 	isotag = IsoDep.get(tag);
 	if (isotag != null) {
 		Log.i(TAG,"Found IsoDep tag!");
 		
 		// Make sure we're not already communicating with a card
 		if (activityState == STATE_IDLE) {
 			askForPin();
 		}
 	}
    }
}
 
开发者ID:credentials,项目名称:irma_android_management,代码行数:17,代码来源:WaitingForCardActivity.java

示例13: openConnection

import android.nfc.tech.IsoDep; //导入方法依赖的package包/类
/**
 * Opens a connection with the ID by doing BAC
 * Uses hardcoded parameters for now
 *
 * @param tag - NFC tag that started this activity (ID NFC tag)
 * @return PassportService - passportservice that has an open connection with the ID
 */
public PassportService openConnection(Tag tag, final DocumentData docData) throws CardServiceException {
    try {
        IsoDep nfc = IsoDep.get(tag);
        CardService cs = CardService.getInstance(nfc);
        this.ps = new PassportService(cs);
        this.ps.open();

        // Get the information needed for BAC from the data provided by OCR
        this.ps.sendSelectApplet(false);
        BACKeySpec bacKey = new BACKeySpec() {
            @Override
            public String getDocumentNumber() {
                return docData.getDocumentNumber();
            }

            @Override
            public String getDateOfBirth() { return docData.getDateOfBirth(); }

            @Override
            public String getDateOfExpiry() { return docData.getExpiryDate(); }
        };
        ps.doBAC(bacKey);
        return ps;
    } catch (CardServiceException ex) {
        try {
            ps.close();
        } catch (Exception ex2) {
            ex2.printStackTrace();
        }
        throw ex;
    }
}
 
开发者ID:digital-voting-pass,项目名称:polling-station-app,代码行数:40,代码来源:PassportConnection.java

示例14: AndroidNfcConnection

import android.nfc.tech.IsoDep; //导入方法依赖的package包/类
/** Contructor de la clase para la gesti&oacute;n de la conexi&oacute;n por NFC.
 * @param tag <code>Tag</code> para obtener el objeto <code>IsoDep</code> y establecer la
 *            conexi&oacute;n.
 * @throws IOException Si falla el establecimiento de la conexi&oacute;n. */
public AndroidNfcConnection(final Tag tag) throws IOException {
    if (tag == null) {
        throw new IllegalArgumentException("El tag NFC no puede ser nulo"); //$NON-NLS-1$
    }
    this.mIsoDep = IsoDep.get(tag);
    this.mIsoDep.connect();
    this.mIsoDep.setTimeout(ISODEP_TIMEOUT);
}
 
开发者ID:MiFirma,项目名称:mi-firma-android,代码行数:13,代码来源:AndroidNfcConnection.java

示例15: onTagDiscovered

import android.nfc.tech.IsoDep; //导入方法依赖的package包/类
/**
 * Callback when a new tag is discovered by the system.
 *
 * <p>Communication with the card should take place here.
 *
 * @param tag Discovered tag
 */
public void onTagDiscovered(Tag tag){

    LogUtil.i(TAG, "======= Discovered Tag:" + tag + "==========");

    // Android's Host-based Card Emulation (HCE) feature implements the ISO-DEP (ISO 14443-4)
    // protocol.
    //
    // In order to communicate with a device using HCE, the discovered tag should be processed
    // using the IsoDep class.

    mIsoDep = IsoDep.get(tag);

    // Connect to the remote NFC device
    try {
        mIsoDep.connect();
    } catch (IOException e) {
        e.printStackTrace();
    }

    mIsoDep.setTimeout(TIMEOUT);

}
 
开发者ID:changingp,项目名称:qpboc-kata,代码行数:30,代码来源:IsoDepAdapter.java


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