1
我想在Delphi中編寫應用程序,它可以與Android手機和DESFire卡進行通信。我知道,我必須發送一些字節卡和卡回答我。我讀到它的文章:在Delphi中與Mifare DESFire通信
https://ridrix.wordpress.com/2009/09/19/mifare-desfire-communication-example/
我不知道,我怎麼能寫,並從卡中讀取的字節?我根據丹尼爾Magin寫簡單的應用:
http://www.danielmagin.de/blog/index.php/2014/09/nfc-android-application-with-delphi-xe6-and-xe7/
該程序只能從卡中讀取UID。
function TNfc.ReadNFCUID: string;
var
Intent: JIntent;
jIntentName: JString;
IntentName: string;
tagId: Androidapi.JNIBridge.TJavaArray<Byte>;
tagFromIntent: JParcelable;
id: string;
i: Integer;
begin
id := '';
Intent := SharedActivity.getIntent;
if Intent <> nil then
begin
jIntentName := Intent.getAction;
IntentName := JStringToString(jIntentName);
tagId := Intent.getByteArrayExtra(TJNFCAdapter.JavaClass.EXTRA_ID);
tagFromIntent := Intent.getParcelableExtra
(TJNFCAdapter.JavaClass.EXTRA_TAG);
if (tagId <> nil) and (tagFromIntent <> nil) then
begin
for i := 0 to tagId.Length - 1 do
id := id + IntToHex(tagId.Items[i], 2);
end;
end;
Result := id;
end;
請添加你寫的代碼的重要組成部分,並添加缺少的標籤如德爾福XE7 – bummi 2014-11-05 22:07:43