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


Java MifareClassic.get方法代码示例

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


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

示例1: doInBackground

import android.nfc.tech.MifareClassic; //导入方法依赖的package包/类
protected Pair<ReadCardResult, Wallet> doInBackground(Tag... tags) {
	MifareClassic card = null;
	try {
		card = MifareClassic.get(tags[0]);
	} catch (NullPointerException e) {
		/* Error while reading card. This problem occurs on HTC devices from the ONE series with Android Lollipop (status of June 2015)
		 * Try to repair the tag.
		 */
		card = MifareClassic.get(MifareUtils.repairTag(tags[0]));
	}

	if(card == null)
		return new Pair<ReadCardResult, Wallet>(null, null);

	final Wallet wallet = new Wallet(card);
	final ReadCardResult result = wallet.readCard();
	return new Pair<ReadCardResult, Wallet>(result, wallet);
}
 
开发者ID:pkern,项目名称:kitcard-reader,代码行数:19,代码来源:ReadCardTask.java

示例2: resolveIntent

import android.nfc.tech.MifareClassic; //导入方法依赖的package包/类
void resolveIntent(Intent intent) {
	// 1) Parse the intent and get the action that triggered this intent
	String action = intent.getAction();
	// 2) Check if it was triggered by a tag discovered interruption.
	if (NfcAdapter.ACTION_TECH_DISCOVERED.equals(action)) {
		// 3) Get an instance of the TAG from the NfcAdapter
		Tag tagFromIntent = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
		// 4) Get an instance of the Mifare classic card from this TAG
		// intent
		MifareClassic mfc = MifareClassic.get(tagFromIntent);
		try {
			mfc.connect();
			mRKFCard = new RKFCard(mfc);
			mCardContents = mRKFCard.readEntireCard();
			txtRaw.setText(DataType.getHexString(mCardContents));
		} catch (IOException e1) {
			Log.e(TAG, e1.getLocalizedMessage(), e1);
		}
		Toast t = Toast.makeText(this, "Dump done!", Toast.LENGTH_SHORT);
		t.show();
	}
}
 
开发者ID:mchro,项目名称:RejsekortReader,代码行数:23,代码来源:DumpRaw.java

示例3: onResume

import android.nfc.tech.MifareClassic; //导入方法依赖的package包/类
@Override
   public void onResume() {
       super.onResume();

if(oldIntent != getIntent()) {
    if(NfcAdapter.ACTION_TECH_DISCOVERED.equals(getIntent().getAction())) {
	Tag tag = getIntent().getParcelableExtra(NfcAdapter.EXTRA_TAG);
	mfc = null;
	if(tag != null) {
	    mfc = MifareClassic.get(tag);
	}
	debugString = "";
	if(null != mfc) {
	    readCard();
	}
    }
}

oldIntent = getIntent();
   }
 
开发者ID:norenh,项目名称:RKFRead,代码行数:21,代码来源:RKFRead.java

示例4: tagDetected

import android.nfc.tech.MifareClassic; //导入方法依赖的package包/类
private void tagDetected(Tag tag) {
    MifareClassic mifareTag = MifareClassic.get(tag);
    if (mifareTag == null) {
        Toast.makeText(this, getString(R.string.err_unknown_card_type), Toast.LENGTH_SHORT).show();
        return;
    }

    if (!mState.hasKeys()) {
        Toast.makeText(this, R.string.tag_no_keys, Toast.LENGTH_SHORT).show();
    } else if (mState.getState() == DomainState.State.CLEAN) {
        Toast.makeText(this, R.string.tag_not_recording, Toast.LENGTH_SHORT).show();
    } else if (mState.getState() == DomainState.State.LOADED) {
        Toast.makeText(this, R.string.tag_not_replaying, Toast.LENGTH_SHORT).show();
    } else if (mState.getState() == DomainState.State.RECORDING) {
        readTag(mifareTag);
    } else if (mState.getState() == DomainState.State.REPLAYING) {
        writeTag(mifareTag);
    }
}
 
开发者ID:paulmd,项目名称:graboid,代码行数:20,代码来源:GrabActivity.java

示例5: runMifareTest

import android.nfc.tech.MifareClassic; //导入方法依赖的package包/类
private void runMifareTest(Tag tag) {

		MifareClassic mf = MifareClassic.get(tag);

		mMifareTest = new MifareTest(mf, this, MAIN_Log);

		mMifareTest.execute();
		dismissDialog(DIALOG_MF_WAIT_FOR_TAG);
		showDialog(DIALOG_MF_WAIT_FOR_FINISH);
	}
 
开发者ID:mobilesec,项目名称:secure-element-gpdroid-nfc,代码行数:11,代码来源:MainActivity.java


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