Quantcast
Channel: Planet Object Pascal
Viewing all articles
Browse latest Browse all 1725

Daniel Magin's Logfile: NFC Android Application with Delphi XE6 and XE7

$
0
0

NFC Android Application with Delphi XE6 and XE7

DelphiXE6

Download Delphi XE6 Example Source Code

For the German Delphi Days last Weekend in Bonn i prepared a Workshop and a Session how to develop with Delphi a Android Application to read and write NFC tags. So i worked out a Delphi Example to do this. Delphi brings no ready components to do this out of the box. So i tried my first steps and i found it is not only necessary to add in classes.dex the NFC SDK Jar Files, no it was also necessary to change the NativeActivity in the AndroidManfifest.template (see later more in detail). I remember that my friend Brian Long, also a Embarcadero MVP have done this with XE5 and XE6 on his blog (LINK). So i called him and we suprise, he was also to test out NFC with Delphi for Android at the same time. So we decided everybody was work for 1 week seperate and then we merge our knowledge. It was really funny later he did found out what i am missing and i found out stuff he missed.

Brian Long also published his result here: LINK

Requirements

1. to run such Android Applications you need a Android Device WITH NFC ! So please check your device. I found also a nice webpage with a collection of NFC Android Devices on LINK/

2. Ready installed Delphi XE6 or XE7

3. Read AND understand (!) the Article published from Google in the Developer Network. Minimum read and understand the following parts in Chapter NFC Basics:

LINK

NFC Basics

  • The Tag Dispatch System
  • Requesting NFC Access in the Android Manifest
  • Filtering for NFC Intents
  • Creating Common Types of NDEF Records

4. Read dokwiki what is classes.dex in Delphi and how to patch this:

- XE6 Users: LINK

- XE7 Users: LINK

XE6 Users: A big new function in XE7 IDE is to drag and drop a jar file in your porject, and Delphi create on compile the classes.dex file for you automatic. So ist is extreme much easier to add your custom or 3rd Party JARS from other Hardware for your device into your Delphi Project

RadStudioXE7

Ok let's rock Delphi to work with NFC on Android Devices

Before we create the Delphi Project, we need to pack all the NFC SDK stuff in a JAR file and create the Pascal files to use it.

The minimum version requirements, the NFC is to Android2.3 (Level 10) began to support the minimum version requirements must be specified as 10. Introduced in Android 4.0 (API level 14) we can all we need to read and write NFC and much more. This should also you minimum SDK on your Computer. So if you have not this SDK on your machine, please update your sdk folder with local "SDK Manager.exe" in your Android SDK folder Path.

RadStudioXE7

Let's tals also for nun Java Friends how to generate a .java text file to a .jar file. It is very simple. For Delphi XE6 you need minimum java 1.6 and XE7 java 1.7 on your machine. Open a Command box and type "java -version". If java is installed correct you should a result like this:

RadStudioXE7

crash session how to compile a jar file from a .java text file

  1. javac ABC.java <-- create a ABC.class from .java file
  2. jar cfv ABC.jar ABC.class <-- this create a .jar file from .class file

so wee need all NFC .java files in your

PATH_TO YOUR SDK FOLDER ..Android\sdk\sources\android-20\android\nfc\

After this two simple commands we have a ready jar file to generate the pascal file.

This inteface pascal file for this new Java classes. This is not so simple for XE6 Users. You can write it by hand but this will end in a horror never ending time. There are some 3rd party tools like Java2Pas and other, but this produce for each created .jar file a seperate .pas file. But mostly each file uses each other. So you have circular uses wich delphi can not compile this, so you must copy paste all .pas files in one file per hand. XE7 Users get a free tool Java2OP.exe (it should be possible to download in a few days). This tool handles all for you perfect - LINK TO JAVA2OP .

I think the generated files can be used also in XE6, but i have not tested out, cause the Embarcadero Java2OP.exe is not available now during the time i was writing this article. Also the Embarcadero Java2OP.exe should generate the Pascal files direct form the .java files, so compiling to jar is not necessary anymore, as the documentation is talk about it. but it was not possible to test.

Don't go in panic in my example download, the .pas file is ready to use. i have generated it with my own converter.

Ok what also we need and this we add in the classes.dex file:

to catch the event if a user is bring a NFC Card to the Phone i found out the application get a onNewIntent fired. But this Events we did not find translated to the firemonkey framework. but this is very simple to solve. we write a very small java class and add this class to our classes.dex.

This java class handles everything for us like onNewIntent, NFC enable/disable on pause, resume,...

With the line public native void onNewIntentNative(Intent NewIntent); we introduce a new method wich will be fired on the original onNewIntent method. Thanks to Brian Long to figure this out :-)

  1. packagenet.developerexperts.nfc;
  2.  
  3. importandroid.os.Bundle;
  4. importandroid.util.Log;
  5. importandroid.content.Intent;
  6.  
  7. importandroid.nfc.NfcAdapter;
  8. importandroid.content.Intent;
  9. importandroid.app.PendingIntent;
  10.  
  11. importandroid.app.AlertDialog;
  12. importandroid.content.DialogInterface;
  13. importandroid.content.DialogInterface.OnClickListener;
  14.  
  15. publicclass NativeActivitySubclass extends com.embarcadero.firemonkey.FMXNativeActivity{
  16.  
  17. staticfinalString TAG ="NativeActivitySubclass";
  18.  
  19. private NfcAdapter nfcAdapter;
  20. private PendingIntent pendingIntent;
  21.  
  22. @Override
  23. protectedvoid onCreate(Bundle savedInstanceState){
  24. super.onCreate(savedInstanceState);
  25. //Custom initialization
  26. nfcAdapter = NfcAdapter.getDefaultAdapter(this);
  27.         Intent intent =new Intent(this, getClass());
  28.         pendingIntent = PendingIntent.getActivity(this, 0,
  29.             intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0);
  30. }
  31.  
  32. publicnativevoid onNewIntentNative(Intent NewIntent);
  33.  
  34. @Override
  35. protectedvoid onNewIntent(Intent intent)
  36.     {
  37. super.onNewIntent(intent);
  38. onNewIntentNative(intent);
  39. }
  40.  
  41. @Override
  42.     publicvoid onPause()
  43.     {
  44.         super.onPause();
  45. disableForegroundDispatch();
  46.     }
  47.  
  48. @Override
  49.     publicvoid onResume()
  50.     {
  51.         super.onResume();
  52. enableForegroundDispatch(pendingIntent);
  53.     }
  54.  
  55. publicvoid enableForegroundDispatch(PendingIntent pendingIntent)
  56. {
  57. nfcAdapter.enableForegroundDispatch(this, pendingIntent, null, null);
  58. }
  59.  
  60. publicvoid disableForegroundDispatch()
  61. {
  62. nfcAdapter.disableForegroundDispatch(this);
  63. }
  64.  
  65. publicvoid showDialog(finalString title, finalString msg)
  66. {
  67. Log.d(TAG, "Displaying dialog");
  68. runOnUiThread(newRunnable(){
  69. publicvoid run(){
  70. AlertDialog.Builder builder =new AlertDialog.Builder(NativeActivitySubclass.this);
  71. builder.setMessage(msg).
  72.                         setTitle(title).
  73.                         setCancelable(true).
  74.                         setPositiveButton("OK", new OnClickListener(){
  75. publicvoid onClick(DialogInterface dialog, int which)
  76. {
  77. dialog.dismiss();
  78. }
  79.        }).show();
  80. }
  81. });
  82. }
  83. }

for this small new onNewIntentNative we add later a method in our mainform:

  1. procedure OnNewIntentNative(PEnv: PJNIEnv; This: JNIObject; NewIntent: JNIObject);cdecl;
  2. begin
  3.   Log.d('Queuing native routine to run synchronized');
  4.   TThread.Queue(nil,
  5.     procedure
  6.     begin
  7.       frmMain.OnNewIntent(TJIntent.Wrap(NewIntent));//CALL the next procedure
  8.     end);
  9. end;
  10.  
  11.  
  12. procedure TfrmMain.OnNewIntent(Intent: JIntent);
  13. begin
  14.   //here we add later code what ever we like to do if a NFC Card is found
  15. end;

to register the native event we this code in delphi

  1. procedure TfrmMain.RegisterDelphiNativeMethods;
  2. var
  3.   PEnv: PJNIEnv;
  4.   ActivityClass: JNIClass;
  5.   NativeMethod: JNINativeMethod;
  6. begin
  7.   Log.d('Starting the registration JNI stuff');
  8.  
  9.   PEnv := TJNIResolver.GetJNIEnv;
  10.  
  11.   Log.d('Registering interop method');
  12.  
  13.   NativeMethod.Name:='onNewIntentNative';
  14.   NativeMethod.Signature:='(Landroid/content/Intent;)V';
  15.   NativeMethod.FnPtr:=@OnNewIntentNative;
  16.  
  17.   ActivityClass := PEnv^.GetObjectClass(PEnv, PANativeActivity(System.DelphiActivity).clazz);
  18.  
  19.   PEnv^.RegisterNatives(PEnv, ActivityClass,@NativeMethod,1);
  20.  
  21.   PEnv^.DeleteLocalRef(PEnv, ActivityClass);
  22. end;

Ok let's go back to add our small jar file into XE6

To generate in XE6 your custom classes.dex file Brian Long have written a wonderful batch file:

  1. @echo off
  2.  
  3. setlocal
  4.  
  5.  
  6. // CHANGE IN NEXT LINE YOUR SDK ROOT FOLDER
  7. if x%ANDROID% == x set ANDROID=c:\Android\sdk\
  8. set ANDROID_PLATFORM=%ANDROID%\platforms\android-19
  9. set DX_LIB=%ANDROID%\build-tools\android-4.4\lib
  10. set DX_BATCH=%ANDROID%\build-tools\android-4.4
  11.  
  12. set EMBO_DEX="C:\Program Files (x86)\Embarcadero\Studio\14.0\lib\android\debug\classes.dex"
  13. set PROJ_DIR="%CD%"
  14. set VERBOSE=0
  15.  
  16. echo.
  17. echo Compiling the Java activity source file
  18. echo.
  19. mkdir output 2>nul
  20. mkdir output\classes 2>nul
  21. if x%VERBOSE% == x1 SET VERBOSE_FLAG=-verbose
  22. javac %VERBOSE_FLAG% -source 1.6 -target 1.6 -Xlint:deprecation -cp %ANDROID_PLATFORM%\android.jar;classes.jar -d output\classes src\net\developerexperts\nfc\NativeActivitySubclass.java
  23.  
  24. echo.
  25. echo Creating jar containing the new classes
  26. echo.
  27. mkdir output\jar 2>nul
  28. if x%VERBOSE% == x1 SET VERBOSE_FLAG=v
  29. jar c%VERBOSE_FLAG%f output\jar\test_classes.jar -C output\classes net
  30.  
  31. echo.
  32. echo Converting from jar to dex...
  33. echo.
  34. mkdir output\dex 2>nul
  35. if x%VERBOSE% == x1 SET VERBOSE_FLAG=--verbose
  36. call%DX_BATCH%\dx --dex %VERBOSE_FLAG% --output=%PROJ_DIR%\output\dex\test_classes.dex --positions=lines %PROJ_DIR%\output\jar\test_classes.jar
  37.  
  38. echo.
  39. echo Merging dex files
  40. echo.
  41. java -cp %DX_LIB%\dx.jar com.android.dx.merge.DexMerger %PROJ_DIR%\output\dex\classes.dex %PROJ_DIR%\output\dex\test_classes.dex %EMBO_DEX%
  42.  
  43. echo Tidying up
  44. echo.
  45. del output\classes\net\developerexperts\nfc\NativeActivitySubclass*.class
  46. rmdir output\classes\net\developerexperts\nfc
  47. rmdir output\classes\net\developerexperts
  48. rmdir output\classes\net
  49. rmdir output\classes
  50. del output\dex\test_classes.dex
  51. del output\jar\test_classes.jar
  52. rmdir output\jar
  53.  
  54. echo.
  55. echo Now we have the end result, which is output\dex\classes.dex
  56.  
  57. :Exit
  58.  
  59. endlocal

Important: if you have installed on your machine Java 1.7 or higher you must compile for Delphi XE6 in java 1.6 this you do like in the batch file:

javac %VERBOSE_FLAG% -source 1.6 -target 1.6 -Xlint:deprecation......

This batch file is not needed for XE7 users cause as i have written you can easy drag and drop the jar files in your project under the project tree in android section.

WOW what a hard work, but if you understand this you are now a hero. now you can add every other jar file in your classes.dex and can easy call.

Now we can with Delphi and welcome back to pascal code ;-)

Generate a new Delphi FMX Project and change it to Android. Save and open the AndroidManifest.template.xml

there we found in the activity area and have to change:

  1.       <activityandroid:name="com.embarcadero.firemonkey.FMXNativeActivity"
  2.                 android:label="%activityLabel%"
  3.                 android:configChanges="orientation|keyboardHidden">

Replace with our new Added class to receive our onNewIntent

  1.      <activityandroid:name="net.developerexperts.nfc.NativeActivitySubclass"
  2.                 android:label="%activityLabel%"
  3.                 android:configChanges="orientation|keyboardHidden"
  4. android:launchMode="singleTop">

Also we add all NFC enhancements what we like to use in our Delphi Application, as you have readed in the Google Developer docs (see requirements on the top of this article). So your AndroidManifest.template.xml sould look like this:

  1. <?xmlversion="1.0"encoding="utf-8"?>
  2. <!-- BEGIN_INCLUDE(manifest) -->
  3. <manifestxmlns:android="http://schemas.android.com/apk/res/android"
  4.         package="%package%"
  5.         android:versionCode="%versionCode%"
  6.         android:versionName="%versionName%">
  7.  
  8.     <!-- This is the platform API where NativeActivity was introduced. -->
  9.     <!--<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="%targetSdkVersion%" /> -->
  10.    <!--  <uses-sdk android:minSdkVersion="10" android:targetSdkVersion="11" /> -->
  11.      <uses-sdkandroid:minSdkVersion="%minSdkVersion%"android:targetSdkVersion="%targetSdkVersion%"/>
  12.  
  13. <%uses-permission%>
  14.     <applicationandroid:persistent="%persistent%"
  15.         android:restoreAnyVersion="%restoreAnyVersion%"
  16.         android:label="%label%"
  17.         android:installLocation="%installLocation%"
  18.         android:debuggable="%debuggable%"
  19.         android:largeHeap="%largeHeap%"
  20.         android:icon="%icon%"
  21.         android:theme="%theme%"
  22.         android:hardwareAccelerated="%hardwareAccelerated%">
  23.         <!-- Our activity is a subclass of the built-in NativeActivity framework class.
  24.              This will take care of integrating with our NDK code. -->
  25.         <activityandroid:name="net.developerexperts.nfc.NativeActivitySubclass"
  26.                 android:label="%activityLabel%"
  27.                 android:configChanges="orientation|keyboardHidden"
  28. android:launchMode="singleTop">
  29.             <!-- Tell NativeActivity the name of our .so -->
  30.             <meta-dataandroid:name="android.app.lib_name"
  31.                 android:value="%libNameValue%"/>
  32.  
  33.  
  34. <intent-filter>
  35.                 <actionandroid:name="android.intent.action.MAIN"/>
  36.                 <categoryandroid:name="android.intent.category.LAUNCHER"/>
  37.             </intent-filter>
  38.  
  39.  
  40. <intent-filter>  
  41.          <actionandroid:name="android.nfc.action.NDEF_DISCOVERED"/>
  42. <categoryandroid:name="android.intent.category.DEFAULT"/>
  43. <dataandroid:mimeType="text/plain"/>
  44.  
  45.             </intent-filter>
  46.  
  47. <intent-filter>
  48.      <actionandroid:name="android.nfc.action.NDEF_DISCOVERED"/>
  49.      <categoryandroid:name="android.intent.category.DEFAULT"/>
  50.      <dataandroid:scheme="http"/>
  51. </intent-filter>
  52.  
  53. <intent-filter>
  54.      <actionandroid:name="android.nfc.action.NDEF_DISCOVERED"/>
  55.      <categoryandroid:name="android.intent.category.DEFAULT"/>
  56.      <dataandroid:scheme="dav"/>
  57. </intent-filter>
  58.  
  59.  
  60. <intent-filter>
  61. <actionandroid:name="android.nfc.action.TECH_DISCOVERED"/>
  62. <categoryandroid:name="android.intent.category.DEFAULT"/>
  63. </intent-filter>
  64. <meta-dataandroid:name="android.nfc.action.TECH_DISCOVERED"
  65. android:resource="@xml/nfc_tech_filter"/>
  66.  
  67.  
  68.  
  69.  
  70. </activity>
  71.         <receiverandroid:name="com.embarcadero.firemonkey.notifications.FMXNotificationAlarm"/>
  72.     </application>
  73. </manifest>  
  74. <!-- END_INCLUDE(manifest) -->

Also in in Deployment Options (Menu: Project - Deployment) it is important to disable (only XE6, XE7 do it four you automatic as you learned) the original classes.dex file and deploy your new generated classes.dex file.

DelphiXE6

Next important step is to enable in your Application under Menu Project - Options the NFC rights.

DelphiXE6

I think it is not necessary to discuss all the source lines, but lets try to explain all the new NFC new line. In my Project you find two units:

DeveloperExperts.Android.nfc.pas

this is the generated interface unit to the NFC Android imported SDK we like to use and call

DeveloperExperts.Android.nfc.Helper.pas

this unit handles the most important stuff to work with NFC and Delphi

  1. TDXNFCHelper =class
  2.   private
  3.   public
  4.     classfunction getNFCManager: JNfcManager;
  5.     classfunction checkNFC:boolean;
  6.     classfunction getNFCDefaultAdapter: JNfcAdapter;
  7.     classfunction NdefRecordsJavaBytesToString(jbytes: TJavaArray<Byte>;const MimeType: TDXMimeType): TDXStringRecord;
  8.     classfunction GetDXMimeTypeFromString(const sMimeType:string): TDXMimeType;
  9.     classfunction GetURIType(const _uriID:integer): TDXUriResult;
  10.     classfunction StringToJavaArrayOfBytes(sText:string): TJavaArray<System.Byte>; static;
  11.     classprocedure JavaArrayByteCopy(src: TJavaArray<System.Byte>; srcPos:integer; dest: TJavaArray<System.Byte>; destPos:integer; _length:integer);
  12.     classprocedure WriteTextRecordsToNfcCard(NdefRecordsText: TList<string>; IsoLangCode:string; _tag: JTag);
  13.  
  14.   end;
  15.   

this helper class with class methods (for delphi beginners: you do not need to create this class) gives you some methods:

class function checkNFC: boolean;

check is NFC is available an possible to access

class function getNFCManager: JNfcManager;

like described in the Google Developer NFC Guide you get back a NFCManager over this you can access for example the default Adapter to read and write the NFC Card stuff

class function getNFCDefaultAdapter: JNfcAdapter;

direct access to the NFC Default Adapter

class procedure WriteTextRecordsToNfcCard(NdefRecordsText: TList; IsoLangCode: string; _tag: JTag);

write all strings from the Input Parameter TList to text records to the NCF card

all other methods are helper to convert String to Java Array, getMimeTypes, URIType and much more...

Lets analyse the main form

You find a ListBox with 2 items:

checkNFC: call the HelperClass checkNFC to check is NFC available

writeNFC: set a local variable NextNFCTagScanWaitingDataToWrite:=true

so next NFC card touched to the device will be written. Every time a NFC card touched to the device OnNewIntent will be fired (you remember we introduced our java class to get this event)

  1. procedure TfrmMain.OnNewIntent(Intent: JIntent);
  2. begin
  3.   SharedActivity.setIntent(Intent);
  4.  
  5.   CurrentNFCTag := Intent.getParcelableExtra(TJNFCAdapter.JavaClass.EXTRA_TAG);
  6.  
  7.   ifnot NextNFCTagScanWaitingDataToWrite then
  8.     ReadAllInfomationsFromCurrentNFCIntent
  9.   else
  10.   begin
  11.     WriteWaitingDataToNfcTag;
  12.   end;
  13. end;

There you can found the local variable NextNFCTagScanWaitingDataToWrite check if we read or write the NFC Card.

Writing is very simple.

  1. procedure TfrmMain.WriteWaitingDataToNfcTag;
  2. var
  3.   _tag: JTag;
  4.   sRecords: TList<string>;
  5.  
  6. begin
  7.   NextNFCTagScanWaitingDataToWrite :=false;
  8.   displayResult('start writing data',true);
  9.   _tag := TJTag.Wrap((CurrentNFCTag as ILocalObject).GetObjectID);
  10.   ifAssigned(_tag)then
  11.   begin
  12.     sRecords:=TList<string>.Create;
  13.     sRecords.Add('This record is from Elmo');
  14.     sRecords.Add('This record is from Bert');
  15.     sRecords.Add('This record is from Cookiemonster');
  16.     TDXNFCHelper.WriteTextRecordsToNfcCard(sRecords,'en',_tag);
  17.     displayResult('finished writing data',true);
  18.   end
  19.   else
  20.   begin
  21.     displayResult('Tag instance not found');
  22.   end;
  23. end;

We generate a TList with all the string we write to the NFC Records. The Helper class make us easy to write:

TDXNFCHelper.WriteTextRecordsToNfcCard(sRecords,'en',_tag);

1. Parameter = the list of strings

2. given a Language Code of our text

3. the _tag (our NFC Card access)

Reading:

  1. procedure TfrmMain.ReadNFCRecords;
  2. var
  3.   Intent: JIntent;
  4.   jIntentName: JString;
  5.   IntentName:string;
  6.   rawMsgs: Androidapi.JNIBridge.TJavaArray<JParcelable>;
  7.   msg: JNdefMessage;
  8.   msgRecords: Androidapi.JNIBridge.TJavaObjectArray<JNdefRecord>;
  9.   i:Integer;
  10.   _NdefRecordRaw: JNIObject;
  11.   _NdefRecord: JNdefRecord;
  12.   recBytes: Androidapi.JNIBridge.TJavaArray<Byte>;
  13.   _currentRecord: TDXStringRecord;
  14. begin
  15.   Intent := SharedActivity.getIntent;
  16.   if Intent <> nilthen
  17.   begin
  18.     jIntentName := Intent.getAction;
  19.     IntentName := JStringToString(jIntentName);
  20.     if(TJNFCAdapter.JavaClass.ACTION_NDEF_DISCOVERED.equals(Intent.getAction))or(TJNFCAdapter.JavaClass.ACTION_TECH_DISCOVERED.equals(Intent.getAction))then
  21.     begin
  22.       try
  23.         rawMsgs := Intent.getParcelableArrayExtra(TJNFCAdapter.JavaClass.EXTRA_NDEF_MESSAGES);
  24.         if rawMsgs <> nilthen
  25.         begin
  26.           if rawMsgs.Length> 0then
  27.           begin
  28.             msg := TJNdefMessage.Wrap((rawMsgs[0]as ILocalObject).GetObjectID);
  29.             msgRecords := msg.getRecords;
  30.             for i :=0to msgRecords.Length-1do
  31.             begin
  32.               _NdefRecordRaw := msgRecords.GetRawItem(i);
  33.               _NdefRecord := TJNdefRecord.Wrap(_NdefRecordRaw);
  34.               recBytes := _NdefRecord.getPayload;
  35.               _currentRecord := TDXNfcHelper.NdefRecordsJavaBytesToString(recBytes, TDXNfcHelper.GetDXMimeTypeFromString(JStringToString(_NdefRecord.toMimeType)));
  36.               ifnot _currentRecord.UriResult.UriIsValidthen
  37.               begin
  38.                 // mimetype text
  39.                 displayResult('Record '+ i.ToString);
  40.                 displayResult('MIME: '+ JStringToString(_NdefRecord.toMimeType));
  41.                 displayResult('ISO CODE: '+ _currentRecord.ISOCode);
  42.                 displayResult(_currentRecord.payload);
  43.               end
  44.               else
  45.               begin
  46.                 // mimetype URI
  47.                 displayResult('Record '+ i.ToString);
  48.                 displayResult('URI: '+ _currentRecord.UriResult.UriText+ _currentRecord.payload);
  49.               end;
  50.             end;
  51.           end;
  52.         end;
  53.       except
  54.         on E: Exception do
  55.         begin
  56.           //Log however you like
  57.         end;
  58.       end;
  59.     end;
  60.   end;
  61. end;

First we check over the intent name if ACTION_NDEF_DISCOVERED (remmeber Google Article NFC Basics). If NFC Intent equals ACTION_NDEF_DISCOVERED so we know we have standard records. So we must read out the the message. The message contains none to many records. we loop over each record and read out the mime time and display the result. In my example i analyse only text and URI types, but you can easy extend to every valid type.

Now you know the most basic steps. You find much more in my example. So take your time to play and work with it.

Summary

You learned how to:

- import android sdk framework stuff

- convert your self written java to jar's

- add your jar's to classes.dex

- how to generate pascal interface files

- call from delphi such stuff

Download Delphi XE6 Example Source Code

What's coming next? Waiting to catch a iPhone 6 to use Delphi and NFC on iOS. This Article will be continued after i have this device in my hand :-)

regards

daniel magin

Embarcadero MVP

@ the end here the wrapped NFC Pascal file (also included in download)

  1. // File generated on 29.07.2014 12:05:01 by DeveloperExperts
  2.  
  3. unit DeveloperExperts.Android.nfc;
  4.  
  5. interface
  6.  
  7. uses
  8.   Androidapi.JNIBridge,
  9.   Androidapi.JNI.Analytics,
  10.   Androidapi.JNI.ApkExpansion,
  11.   Androidapi.JNI.App,
  12.   Androidapi.JNI.Dalvik,
  13.   Androidapi.JNI.Embarcadero,
  14.   Androidapi.JNI.GraphicsContentViewText,
  15.   Androidapi.JNI.Hardware,
  16.   Androidapi.JNI.InputMethodService,
  17.   Androidapi.JNI.JavaTypes,
  18.   Androidapi.JNI.Licensing,
  19.   Androidapi.JNI.Location,
  20.   Androidapi.JNI.Media,
  21.   Androidapi.JNI.Net,
  22.   Androidapi.JNI.OpenGL,
  23.   Androidapi.JNI.Os,
  24.   Androidapi.JNI.PlayServices,
  25.   Androidapi.JNI.Provider,
  26.   Androidapi.JNI.Support,
  27.   Androidapi.JNI.Telephony,
  28.   Androidapi.JNI.Util,
  29.   Androidapi.JNI.VideoView,
  30.   Androidapi.JNI.Webkit,
  31.   Androidapi.JNI.Widget;
  32.  
  33. type
  34.   { Class forward declarations }
  35.   JCardEmulation =interface;{ android/nfc/cardemulation/CardEmulation }
  36.   JHostApduService =interface;{ android/nfc/cardemulation/HostApduService }
  37.   JOffHostApduService =interface;{ android/nfc/cardemulation/OffHostApduService }
  38.   JFormatException =interface;{ android/nfc/FormatException }
  39.   JNdefMessage =interface;{ android/nfc/NdefMessage }
  40.   JNdefRecord =interface;{ android/nfc/NdefRecord }
  41.   JNfcAdapter_CreateBeamUrisCallback =interface;{ android/nfc/NfcAdapter$CreateBeamUrisCallback }
  42.   JNfcAdapter_CreateNdefMessageCallback =interface;{ android/nfc/NfcAdapter$CreateNdefMessageCallback }
  43.   JNfcAdapter_OnNdefPushCompleteCallback =interface;{ android/nfc/NfcAdapter$OnNdefPushCompleteCallback }
  44.   JNfcAdapter_ReaderCallback =interface;{ android/nfc/NfcAdapter$ReaderCallback }
  45.   JNfcAdapter =interface;{ android/nfc/NfcAdapter }
  46.   JNfcEvent =interface;{ android/nfc/NfcEvent }
  47.   JNfcManager =interface;{ android/nfc/NfcManager }
  48.   JTag =interface;{ android/nfc/Tag }
  49.   JTagLostException =interface;{ android/nfc/TagLostException }
  50.   JBasicTagTechnology =interface;{ android/nfc/tech/BasicTagTechnology }
  51.   JIsoDep =interface;{ android/nfc/tech/IsoDep }
  52.   JMifareClassic =interface;{ android/nfc/tech/MifareClassic }
  53.   JMifareUltralight =interface;{ android/nfc/tech/MifareUltralight }
  54.   JNdef =interface;{ android/nfc/tech/Ndef }
  55.   JNdefFormatable =interface;{ android/nfc/tech/NdefFormatable }
  56.   JNfcA =interface;{ android/nfc/tech/NfcA }
  57.   JNfcB =interface;{ android/nfc/tech/NfcB }
  58.   JNfcBarcode =interface;{ android/nfc/tech/NfcBarcode }
  59.   JNfcF =interface;{ android/nfc/tech/NfcF }
  60.   JNfcV =interface;{ android/nfc/tech/NfcV }
  61.   JTagTechnology =interface;{ android/nfc/tech/TagTechnology }
  62.  
  63.   JCardEmulationClass =interface(JObjectClass)
  64.     ['{43DA51E2-EA67-4A69-A20F-1DD312214C2E}']
  65.     { Property methods }
  66.     function _GetACTION_CHANGE_DEFAULT: JString;
  67.     function _GetCATEGORY_OTHER: JString;
  68.     function _GetCATEGORY_PAYMENT: JString;
  69.     function _GetEXTRA_CATEGORY: JString;
  70.     function _GetEXTRA_SERVICE_COMPONENT: JString;
  71.     function _GetSELECTION_MODE_ALWAYS_ASK:Integer;
  72.     function _GetSELECTION_MODE_ASK_IF_CONFLICT:Integer;
  73.     function _GetSELECTION_MODE_PREFER_DEFAULT:Integer;
  74.     { Methods }
  75.     function getInstance(adapter: JNfcAdapter): JCardEmulation;cdecl;
  76.     { Properties }
  77.     property ACTION_CHANGE_DEFAULT: JString read _GetACTION_CHANGE_DEFAULT;
  78.     property CATEGORY_OTHER: JString read _GetCATEGORY_OTHER;
  79.     property CATEGORY_PAYMENT: JString read _GetCATEGORY_PAYMENT;
  80.     property EXTRA_CATEGORY: JString read _GetEXTRA_CATEGORY;
  81.     property EXTRA_SERVICE_COMPONENT: JString read _GetEXTRA_SERVICE_COMPONENT;
  82.     property SELECTION_MODE_ALWAYS_ASK:Integerread _GetSELECTION_MODE_ALWAYS_ASK;
  83.     property SELECTION_MODE_ASK_IF_CONFLICT:Integerread _GetSELECTION_MODE_ASK_IF_CONFLICT;
  84.     property SELECTION_MODE_PREFER_DEFAULT:Integerread _GetSELECTION_MODE_PREFER_DEFAULT;
  85.   end;
  86.  
  87.   [JavaSignature('android/nfc/cardemulation/CardEmulation')]
  88.   JCardEmulation =interface(JObject)
  89.     ['{79EFB1E2-A217-4FA3-BF59-5E79FE67A54B}']
  90.     { Methods }
  91.     function getSelectionModeForCategory(category: JString):Integer;cdecl;
  92.     function isDefaultServiceForAid(service: JComponentName; aid: JString):Boolean;cdecl;
  93.     function isDefaultServiceForCategory(service: JComponentName; category: JString):Boolean;cdecl;
  94.   end;
  95.  
  96.   TJCardEmulation =class(TJavaGenericImport<JCardEmulationClass, JCardEmulation>)
  97.   end;
  98.  
  99.   JHostApduServiceClass =interface(JObjectClass)
  100.     ['{D81BC39F-9EC2-4FF2-80C2-AA000344F762}']
  101.     { Property methods }
  102.     function _GetDEACTIVATION_DESELECTED:Integer;
  103.     function _GetDEACTIVATION_LINK_LOSS:Integer;
  104.     function _GetSERVICE_INTERFACE: JString;
  105.     function _GetSERVICE_META_DATA: JString;
  106.     { Methods }
  107.     function init: JHostApduService;cdecl;
  108.     { Properties }
  109.     property DEACTIVATION_DESELECTED:Integerread _GetDEACTIVATION_DESELECTED;
  110.     property DEACTIVATION_LINK_LOSS:Integerread _GetDEACTIVATION_LINK_LOSS;
  111.     property SERVICE_INTERFACE: JString read _GetSERVICE_INTERFACE;
  112.     property SERVICE_META_DATA: JString read _GetSERVICE_META_DATA;
  113.   end;
  114.  
  115.   [JavaSignature('android/nfc/cardemulation/HostApduService')]
  116.   JHostApduService =interface(JObject)
  117.     ['{C0BA2359-5768-4B3B-9404-2AFFD6F6541B}']
  118.     { Methods }
  119.     procedure notifyUnhandled;cdecl;
  120.     function onBind(intent: JIntent): JIBinder;cdecl;
  121.     procedure onDeactivated(Param0:Integer);cdecl;
  122.     function processCommandApdu(Param0: TJavaArray<Byte>; Param1: JBundle): TJavaArray<Byte>;cdecl;
  123.     procedure sendResponseApdu(responseApdu: TJavaArray<Byte>);cdecl;
  124.   end;
  125.  
  126.   TJHostApduService =class(TJavaGenericImport<JHostApduServiceClass, JHostApduService>)
  127.   end;
  128.  
  129.   JOffHostApduServiceClass =interface(JObjectClass)
  130.     ['{F4642B6A-DEFB-49D6-9A3A-D90BB03600AF}']
  131.     { Property methods }
  132.     function _GetSERVICE_INTERFACE: JString;
  133.     function _GetSERVICE_META_DATA: JString;
  134.     { Methods }
  135.     function init: JOffHostApduService;cdecl;
  136.     { Properties }
  137.     property SERVICE_INTERFACE: JString read _GetSERVICE_INTERFACE;
  138.     property SERVICE_META_DATA: JString read _GetSERVICE_META_DATA;
  139.   end;
  140.  
  141.   [JavaSignature('android/nfc/cardemulation/OffHostApduService')]
  142.   JOffHostApduService =interface(JObject)
  143.     ['{94CBB2DE-3E84-4557-B253-2747C82EBBBA}']
  144.     { Methods }
  145.     function onBind(Param0: JIntent): JIBinder;cdecl;
  146.   end;
  147.  
  148.   TJOffHostApduService =class(TJavaGenericImport<JOffHostApduServiceClass, JOffHostApduService>)
  149.   end;
  150.  
  151.   JFormatExceptionClass =interface(JObjectClass)
  152.     ['{558F4E4C-2DE0-4352-B626-2C9B0D482504}']
  153.     { Methods }
  154.     function init: JFormatException;cdecl;overload;
  155.     function init(&message: JString): JFormatException;cdecl;overload;
  156.     function init(&message: JString; e: JThrowable): JFormatException;cdecl;overload;
  157.   end;
  158.  
  159.   [JavaSignature('android/nfc/FormatException')]
  160.   JFormatException =interface(JObject)
  161.     ['{9F16ED2E-6826-4A40-959E-8858D07D7EF4}']
  162.   end;
  163.  
  164.   TJFormatException =class(TJavaGenericImport<JFormatExceptionClass, JFormatException>)
  165.   end;
  166.  
  167.   JNdefMessageClass =interface(JObjectClass)
  168.     ['{1FFA39B2-A5DB-47A9-9737-7C5821DD97ED}']
  169.     { Property methods }
  170.     function _GetCREATOR: JParcelable_Creator;
  171.     procedure _SetCREATOR(Value: JParcelable_Creator);
  172.     { Methods }
  173.     function init(data: TJavaArray<Byte>): JNdefMessage;cdecl;overload;
  174.     function init(&record: JNdefRecord; records: TJavaObjectArray<JNdefRecord>): JNdefMessage;cdecl;overload;
  175.     function init(records: TJavaObjectArray<JNdefRecord>): JNdefMessage;cdecl;overload;
  176.     { Properties }
  177.     property CREATOR: JParcelable_Creator read _GetCREATOR write _SetCREATOR;
  178.   end;
  179.  
  180.   [JavaSignature('android/nfc/NdefMessage')]
  181.   JNdefMessage =interface(JObject)
  182.     ['{6F6F2C4B-72AA-4F38-9253-A2EF427721C6}']
  183.     { Methods }
  184.     function describeContents:Integer;cdecl;
  185.     function equals(obj: JObject):Boolean;cdecl;
  186.     function getByteArrayLength:Integer;cdecl;
  187.     function getRecords: TJavaObjectArray<JNdefRecord>;cdecl;
  188. //    function getRecords: TJavaArray<JNdefRecord>; cdecl;
  189.     function hashCode:Integer;cdecl;
  190.     function toByteArray: TJavaArray<Byte>;cdecl;
  191.     function toString: JString;cdecl;
  192.     procedure writeToParcel(dest: JParcel; flags:Integer);cdecl;
  193.   end;
  194.  
  195.   TJNdefMessage =class(TJavaGenericImport<JNdefMessageClass, JNdefMessage>)
  196.   end;
  197.  
  198.   JNdefRecordClass =interface(JObjectClass)
  199.     ['{A378AA8C-A1F5-4846-9983-EA96BB1E87E4}']
  200.     { Property methods }
  201.     function _GetCREATOR: JParcelable_Creator;
  202.     procedure _SetCREATOR(Value: JParcelable_Creator);
  203.     function _GetRTD_ALTERNATIVE_CARRIER: TJavaArray<Byte>;
  204.     procedure _SetRTD_ALTERNATIVE_CARRIER(Value: TJavaArray<Byte>);
  205.     function _GetRTD_HANDOVER_CARRIER: TJavaArray<Byte>;
  206.     procedure _SetRTD_HANDOVER_CARRIER(Value: TJavaArray<Byte>);
  207.     function _GetRTD_HANDOVER_REQUEST: TJavaArray<Byte>;
  208.     procedure _SetRTD_HANDOVER_REQUEST(Value: TJavaArray<Byte>);
  209.     function _GetRTD_HANDOVER_SELECT: TJavaArray<Byte>;
  210.     procedure _SetRTD_HANDOVER_SELECT(Value: TJavaArray<Byte>);
  211.     function _GetRTD_SMART_POSTER: TJavaArray<Byte>;
  212.     procedure _SetRTD_SMART_POSTER(Value: TJavaArray<Byte>);
  213.     function _GetRTD_TEXT: TJavaArray<Byte>;
  214.     procedure _SetRTD_TEXT(Value: TJavaArray<Byte>);
  215.     function _GetRTD_URI: TJavaArray<Byte>;
  216.     procedure _SetRTD_URI(Value: TJavaArray<Byte>);
  217.     function _GetTNF_ABSOLUTE_URI:SmallInt;
  218.     function _GetTNF_EMPTY:SmallInt;
  219.     function _GetTNF_EXTERNAL_TYPE:SmallInt;
  220.     function _GetTNF_MIME_MEDIA:SmallInt;
  221.     function _GetTNF_UNCHANGED:SmallInt;
  222.     function _GetTNF_UNKNOWN:SmallInt;
  223.     function _GetTNF_WELL_KNOWN:SmallInt;
  224.     { Methods }
  225.     function init(tnf:SmallInt;&type: TJavaArray<Byte>; id: TJavaArray<Byte>; payload: TJavaArray<Byte>): JNdefRecord;cdecl;overload;
  226.     function init(data: TJavaArray<Byte>): JNdefRecord;cdecl;overload; deprecated;
  227.     function createApplicationRecord(packageName: JString): JNdefRecord;cdecl;
  228.     function createExternal(domain: JString;&type: JString; data: TJavaArray<Byte>): JNdefRecord;cdecl;
  229.     function createMime(mimeType: JString; mimeData: TJavaArray<Byte>): JNdefRecord;cdecl;
  230.     function createUri(uriString: JString): JNdefRecord;cdecl;overload;
  231.     function createUri(uri: Jnet_Uri): JNdefRecord;cdecl;overload;
  232.     { Properties }
  233.     property CREATOR: JParcelable_Creator read _GetCREATOR write _SetCREATOR;
  234.     property RTD_ALTERNATIVE_CARRIER: TJavaArray<Byte> read _GetRTD_ALTERNATIVE_CARRIER write _SetRTD_ALTERNATIVE_CARRIER;
  235.     property RTD_HANDOVER_CARRIER: TJavaArray<Byte> read _GetRTD_HANDOVER_CARRIER write _SetRTD_HANDOVER_CARRIER;
  236.     property RTD_HANDOVER_REQUEST: TJavaArray<Byte> read _GetRTD_HANDOVER_REQUEST write _SetRTD_HANDOVER_REQUEST;
  237.     property RTD_HANDOVER_SELECT: TJavaArray<Byte> read _GetRTD_HANDOVER_SELECT write _SetRTD_HANDOVER_SELECT;
  238.     property RTD_SMART_POSTER: TJavaArray<Byte> read _GetRTD_SMART_POSTER write _SetRTD_SMART_POSTER;
  239.     property RTD_TEXT: TJavaArray<Byte> read _GetRTD_TEXT write _SetRTD_TEXT;
  240.     property RTD_URI: TJavaArray<Byte> read _GetRTD_URI write _SetRTD_URI;
  241.     property TNF_ABSOLUTE_URI:SmallIntread _GetTNF_ABSOLUTE_URI;
  242.     property TNF_EMPTY:SmallIntread _GetTNF_EMPTY;
  243.     property TNF_EXTERNAL_TYPE:SmallIntread _GetTNF_EXTERNAL_TYPE;
  244.     property TNF_MIME_MEDIA:SmallIntread _GetTNF_MIME_MEDIA;
  245.     property TNF_UNCHANGED:SmallIntread _GetTNF_UNCHANGED;
  246.     property TNF_UNKNOWN:SmallIntread _GetTNF_UNKNOWN;
  247.     property TNF_WELL_KNOWN:SmallIntread _GetTNF_WELL_KNOWN;
  248.   end;
  249.  
  250.   [JavaSignature('android/nfc/NdefRecord')]
  251.   JNdefRecord =interface(JObject)
  252.     ['{0E552F6E-B67C-4A19-9BD0-82864906025B}']
  253.     { Methods }
  254.     function describeContents:Integer;cdecl;
  255.     function equals(obj: JObject):Boolean;cdecl;
  256.     function getId: TJavaArray<Byte>;cdecl;
  257.     function getPayload: TJavaArray<Byte>;cdecl;
  258.     function getTnf:SmallInt;cdecl;
  259.     function getType: TJavaArray<Byte>;cdecl;
  260.     function hashCode:Integer;cdecl;
  261.     function toByteArray: TJavaArray<Byte>;cdecl; deprecated;
  262.     function toMimeType: JString;cdecl;
  263.     function toString: JString;cdecl;
  264.     function toUri: Jnet_Uri;cdecl;
  265.     procedure writeToParcel(dest: JParcel; flags:Integer);cdecl;
  266.   end;
  267.  
  268.   TJNdefRecord =class(TJavaGenericImport<JNdefRecordClass, JNdefRecord>)
  269.   end;
  270.  
  271.   JNfcAdapter_CreateBeamUrisCallbackClass =interface(IJavaClass)
  272.     ['{BFE6DE18-1854-4C2C-A523-6425F39AE21C}']
  273.   end;
  274.  
  275.   [JavaSignature('android/nfc/NfcAdapter$CreateBeamUrisCallback')]
  276.   JNfcAdapter_CreateBeamUrisCallback =interface(IJavaInstance)
  277.     ['{609C5FF3-B699-4E05-AF60-567A0BBF0E01}']
  278.     { Methods }
  279.     function createBeamUris(Param0: JNfcEvent): TJavaObjectArray<Jnet_Uri>;cdecl;
  280.   end;
  281.  
  282.   TJNfcAdapter_CreateBeamUrisCallback =class(TJavaGenericImport<JNfcAdapter_CreateBeamUrisCallbackClass, JNfcAdapter_CreateBeamUrisCallback>)
  283.   end;
  284.  
  285.   JNfcAdapter_CreateNdefMessageCallbackClass =interface(IJavaClass)
  286.     ['{51DBF0BD-EF76-40F6-9570-4CA6C447E19A}']
  287.   end;
  288.  
  289.   [JavaSignature('android/nfc/NfcAdapter$CreateNdefMessageCallback')]
  290.   JNfcAdapter_CreateNdefMessageCallback =interface(IJavaInstance)
  291.     ['{A72FD9C9-8A67-499D-B3B0-10E8EC2D6139}']
  292.     { Methods }
  293.     function createNdefMessage(Param0: JNfcEvent): JNdefMessage;cdecl;
  294.   end;
  295.  
  296.   TJNfcAdapter_CreateNdefMessageCallback =class(TJavaGenericImport<JNfcAdapter_CreateNdefMessageCallbackClass, JNfcAdapter_CreateNdefMessageCallback>)
  297.   end;
  298.  
  299.   JNfcAdapter_OnNdefPushCompleteCallbackClass =interface(IJavaClass)
  300.     ['{D859E3F0-641A-410A-9876-DD609FA72DAD}']
  301.   end;
  302.  
  303.   [JavaSignature('android/nfc/NfcAdapter$OnNdefPushCompleteCallback')]
  304.   JNfcAdapter_OnNdefPushCompleteCallback =interface(IJavaInstance)
  305.     ['{01D93D7A-2E1E-4C87-ABE1-77EE7D98C77B}']
  306.     { Methods }
  307.     procedure onNdefPushComplete(Param0: JNfcEvent);cdecl;
  308.   end;
  309.  
  310.   TJNfcAdapter_OnNdefPushCompleteCallback =class(TJavaGenericImport<JNfcAdapter_OnNdefPushCompleteCallbackClass, JNfcAdapter_OnNdefPushCompleteCallback>)
  311.   end;
  312.  
  313.   JNfcAdapter_ReaderCallbackClass =interface(IJavaClass)
  314.     ['{823E7F01-FCE8-43A5-96D4-57B348EDCDF2}']
  315.   end;
  316.  
  317.   [JavaSignature('android/nfc/NfcAdapter$ReaderCallback')]
  318.   JNfcAdapter_ReaderCallback =interface(IJavaInstance)
  319.     ['{F7435248-FC54-4183-923D-BE74FF7E3D40}']
  320.     { Methods }
  321.     procedure onTagDiscovered(Param0: JTag);cdecl;
  322.   end;
  323.  
  324.   TJNfcAdapter_ReaderCallback =class(TJavaGenericImport<JNfcAdapter_ReaderCallbackClass, JNfcAdapter_ReaderCallback>)
  325.   end;
  326.  
  327.   JNfcAdapterClass =interface(JObjectClass)
  328.     ['{16C97862-EAB8-4A85-A481-2DBF26084379}']
  329.     { Property methods }
  330.     function _GetACTION_ADAPTER_STATE_CHANGED: JString;
  331.     function _GetACTION_NDEF_DISCOVERED: JString;
  332.     function _GetACTION_TAG_DISCOVERED: JString;
  333.     function _GetACTION_TECH_DISCOVERED: JString;
  334.     function _GetEXTRA_ADAPTER_STATE: JString;
  335.     function _GetEXTRA_ID: JString;
  336.     function _GetEXTRA_NDEF_MESSAGES: JString;
  337.     function _GetEXTRA_READER_PRESENCE_CHECK_DELAY: JString;
  338.     function _GetEXTRA_TAG: JString;
  339.     function _GetFLAG_READER_NFC_A:Integer;
  340.     function _GetFLAG_READER_NFC_B:Integer;
  341.     function _GetFLAG_READER_NFC_BARCODE:Integer;
  342.     function _GetFLAG_READER_NFC_F:Integer;
  343.     function _GetFLAG_READER_NFC_V:Integer;
  344.     function _GetFLAG_READER_NO_PLATFORM_SOUNDS:Integer;
  345.     function _GetFLAG_READER_SKIP_NDEF_CHECK:Integer;
  346.     function _GetSTATE_OFF:Integer;
  347.     function _GetSTATE_ON:Integer;
  348.     function _GetSTATE_TURNING_OFF:Integer;
  349.     function _GetSTATE_TURNING_ON:Integer;
  350.     { Methods }
  351.     function getDefaultAdapter(context: JContext): JNfcAdapter;cdecl;
  352.     { Properties }
  353.     property ACTION_ADAPTER_STATE_CHANGED: JString read _GetACTION_ADAPTER_STATE_CHANGED;
  354.     property ACTION_NDEF_DISCOVERED: JString read _GetACTION_NDEF_DISCOVERED;
  355.     property ACTION_TAG_DISCOVERED: JString read _GetACTION_TAG_DISCOVERED;
  356.     property ACTION_TECH_DISCOVERED: JString read _GetACTION_TECH_DISCOVERED;
  357.     property EXTRA_ADAPTER_STATE: JString read _GetEXTRA_ADAPTER_STATE;
  358.     property EXTRA_ID: JString read _GetEXTRA_ID;
  359.     property EXTRA_NDEF_MESSAGES: JString read _GetEXTRA_NDEF_MESSAGES;
  360.     property EXTRA_READER_PRESENCE_CHECK_DELAY: JString read _GetEXTRA_READER_PRESENCE_CHECK_DELAY;
  361.     property EXTRA_TAG: JString read _GetEXTRA_TAG;
  362.     property FLAG_READER_NFC_A:Integerread _GetFLAG_READER_NFC_A;
  363.     property FLAG_READER_NFC_B:Integerread _GetFLAG_READER_NFC_B;
  364.     property FLAG_READER_NFC_BARCODE:Integerread _GetFLAG_READER_NFC_BARCODE;
  365.     property FLAG_READER_NFC_F:Integerread _GetFLAG_READER_NFC_F;
  366.     property FLAG_READER_NFC_V:Integerread _GetFLAG_READER_NFC_V;
  367.     property FLAG_READER_NO_PLATFORM_SOUNDS:Integerread _GetFLAG_READER_NO_PLATFORM_SOUNDS;
  368.     property FLAG_READER_SKIP_NDEF_CHECK:Integerread _GetFLAG_READER_SKIP_NDEF_CHECK;
  369.     property STATE_OFF:Integerread _GetSTATE_OFF;
  370.     property STATE_ON:Integerread _GetSTATE_ON;
  371.     property STATE_TURNING_OFF:Integerread _GetSTATE_TURNING_OFF;
  372.     property STATE_TURNING_ON:Integerread _GetSTATE_TURNING_ON;
  373.   end;
  374.  
  375.   [JavaSignature('android/nfc/NfcAdapter')]
  376.   JNfcAdapter =interface(JObject)
  377.     ['{DADBBFEC-CED5-4E38-8BCD-A45F01CE3EFE}']
  378.     { Methods }
  379.     procedure disableForegroundDispatch(activity: JActivity);cdecl;
  380.     procedure disableForegroundNdefPush(activity: JActivity);cdecl; deprecated;
  381.     procedure disableReaderMode(activity: JActivity);cdecl;
  382.     procedure enableForegroundDispatch(activity: JActivity; intent: JPendingIntent; filters: TJavaObjectArray<JIntentFilter>; techLists: TJavaObjectArray<JString>);cdecl;
  383.     procedure enableForegroundNdefPush(activity: JActivity;&message: JNdefMessage);cdecl; deprecated;
  384.     procedure enableReaderMode(activity: JActivity; callback: JNfcAdapter_ReaderCallback; flags:Integer; extras: JBundle);cdecl;
  385.     function isEnabled:Boolean;cdecl;
  386.     function isNdefPushEnabled:Boolean;cdecl;
  387.     procedure setBeamPushUris(uris: TJavaObjectArray<Jnet_Uri>; activity: JActivity);cdecl;
  388.     procedure setBeamPushUrisCallback(callback: JNfcAdapter_CreateBeamUrisCallback; activity: JActivity);cdecl;
  389.     procedure setNdefPushMessage(&message: JNdefMessage; activity: JActivity; activities: TJavaObjectArray<JActivity>);cdecl;
  390.     procedure setNdefPushMessageCallback(callback: JNfcAdapter_CreateNdefMessageCallback; activity: JActivity; activities: TJavaObjectArray<JActivity>);cdecl;
  391.     procedure setOnNdefPushCompleteCallback(callback: JNfcAdapter_OnNdefPushCompleteCallback; activity: JActivity; activities: TJavaObjectArray<JActivity>);cdecl;
  392.   end;
  393.  
  394.   TJNfcAdapter =class(TJavaGenericImport<JNfcAdapterClass, JNfcAdapter>)
  395.   end;
  396.  
  397.   JNfcEventClass =interface(JObjectClass)
  398.     ['{83B91408-3117-4EC6-AC92-6D62F859ADCF}']
  399.   end;
  400.  
  401.   [JavaSignature('android/nfc/NfcEvent')]
  402.   JNfcEvent =interface(JObject)
  403.     ['{AB045C54-D04D-418B-921A-6D63C2F234A4}']
  404.     { Property methods }
  405.     function _GetnfcAdapter: JNfcAdapter;
  406.     procedure _SetnfcAdapter(Value: JNfcAdapter);
  407.     { Properties }
  408.     property nfcAdapter: JNfcAdapter read _GetnfcAdapter write _SetnfcAdapter;
  409.   end;
  410.  
  411.   TJNfcEvent =class(TJavaGenericImport<JNfcEventClass, JNfcEvent>)
  412.   end;
  413.  
  414.   JNfcManagerClass =interface(JObjectClass)
  415.     ['{7C17404C-DC8B-45BF-95F5-89BB7C8ACD7B}']
  416.   end;
  417.  
  418.   [JavaSignature('android/nfc/NfcManager')]
  419.   JNfcManager =interface(JObject)
  420.     ['{CC1C67F6-DB7C-422E-AEED-8BE978E38F82}']
  421.     { Methods }
  422.     function getDefaultAdapter: JNfcAdapter;cdecl;
  423.   end;
  424.  
  425.   TJNfcManager =class(TJavaGenericImport<JNfcManagerClass, JNfcManager>)
  426.   end;
  427.  
  428.   JTagClass =interface(JObjectClass)
  429.     ['{70D70482-9B7C-4FED-8F69-531F49E8F179}']
  430.     { Property methods }
  431.     function _GetCREATOR: JParcelable_Creator;
  432.     procedure _SetCREATOR(Value: JParcelable_Creator);
  433.     { Properties }
  434.     property CREATOR: JParcelable_Creator read _GetCREATOR write _SetCREATOR;
  435.   end;
  436.  
  437.   [JavaSignature('android/nfc/Tag')]
  438.   JTag =interface(JObject)
  439.     ['{F0137B87-18CA-4D88-A95B-0E02B5A8448C}']
  440.     { Methods }
  441.     function describeContents:Integer;cdecl;
  442.     function getId: TJavaArray<Byte>;cdecl;
  443.     function getTechList: TJavaObjectArray<JString>;cdecl;
  444.     function toString: JString;cdecl;
  445.     procedure writeToParcel(dest: JParcel; flags:Integer);cdecl;
  446.   end;
  447.  
  448.   TJTag =class(TJavaGenericImport<JTagClass, JTag>)
  449.   end;
  450.  
  451.   JTagLostExceptionClass =interface(JObjectClass)
  452.     ['{1FFE5C44-ABD4-487B-9755-0F5250B7C1F5}']
  453.     { Methods }
  454.     function init: JTagLostException;cdecl;overload;
  455.     function init(&message: JString): JTagLostException;cdecl;overload;
  456.   end;
  457.  
  458.   [JavaSignature('android/nfc/TagLostException')]
  459.   JTagLostException =interface(JObject)
  460.     ['{FD51EE40-3222-4B5F-96E5-E03C32DF270C}']
  461.   end;
  462.  
  463.   TJTagLostException =class(TJavaGenericImport<JTagLostExceptionClass, JTagLostException>)
  464.   end;
  465.  
  466.   JBasicTagTechnologyClass =interface(JObjectClass)
  467.     ['{EAB8AA93-40FD-4CD1-9D54-794094E3242E}']
  468.   end;
  469.  
  470.   [JavaSignature('android/nfc/tech/BasicTagTechnology')]
  471.   JBasicTagTechnology =interface(JObject)
  472.     ['{783BBD0E-6377-4C10-9D11-0D6F496F9180}']
  473.     { Methods }
  474.     procedure close;cdecl;
  475.     procedure connect;cdecl;
  476.     function getTag: JTag;cdecl;
  477.     function isConnected:Boolean;cdecl;
  478.   end;
  479.  
  480.   TJBasicTagTechnology =class(TJavaGenericImport<JBasicTagTechnologyClass, JBasicTagTechnology>)
  481.   end;
  482.  
  483.   JIsoDepClass =interface(JObjectClass)
  484.     ['{CFC924FE-2D4A-49A6-AB30-BAF82FEBD2A6}']
  485.     { Methods }
  486.     function get(tag: JTag): JIsoDep;cdecl;
  487.   end;
  488.  
  489.   [JavaSignature('android/nfc/tech/IsoDep')]
  490.   JIsoDep =interface(JObject)
  491.     ['{2DC3AA71-4565-4D17-99DA-9B82DB9FFD06}']
  492.     { Methods }
  493.     procedure close;cdecl;
  494.     procedure connect;cdecl;
  495.     function getHiLayerResponse: TJavaArray<Byte>;cdecl;
  496.     function getHistoricalBytes: TJavaArray<Byte>;cdecl;
  497.     function getMaxTransceiveLength:Integer;cdecl;
  498.     function getTag: JTag;cdecl;
  499.     function getTimeout:Integer;cdecl;
  500.     function isConnected:Boolean;cdecl;
  501.     function isExtendedLengthApduSupported:Boolean;cdecl;
  502.     procedure setTimeout(timeout:Integer);cdecl;
  503.     function transceive(data: TJavaArray<Byte>): TJavaArray<Byte>;cdecl;
  504.   end;
  505.  
  506.   TJIsoDep =class(TJavaGenericImport<JIsoDepClass, JIsoDep>)
  507.   end;
  508.  
  509.   JMifareClassicClass =interface(JObjectClass)
  510.     ['{354CDE1A-A65C-43A7-A03F-11614913B0EB}']
  511.     { Property methods }
  512.     function _GetBLOCK_SIZE:Integer;
  513.     function _GetKEY_DEFAULT: TJavaArray<Byte>;
  514.     procedure _SetKEY_DEFAULT(Value: TJavaArray<Byte>);
  515.     function _GetKEY_MIFARE_APPLICATION_DIRECTORY: TJavaArray<Byte>;
  516.     procedure _SetKEY_MIFARE_APPLICATION_DIRECTORY(Value: TJavaArray<Byte>);
  517.     function _GetKEY_NFC_FORUM: TJavaArray<Byte>;
  518.     procedure _SetKEY_NFC_FORUM(Value: TJavaArray<Byte>);
  519.     function _GetSIZE_1K:Integer;
  520.     function _GetSIZE_2K:Integer;
  521.     function _GetSIZE_4K:Integer;
  522.     function _GetSIZE_MINI:Integer;
  523.     function _GetTYPE_CLASSIC:Integer;
  524.     function _GetTYPE_PLUS:Integer;
  525.     function _GetTYPE_PRO:Integer;
  526.     function _GetTYPE_UNKNOWN:Integer;
  527.     { Methods }
  528.     function get(tag: JTag): JMifareClassic;cdecl;
  529.     { Properties }
  530.     property BLOCK_SIZE:Integerread _GetBLOCK_SIZE;
  531.     property KEY_DEFAULT: TJavaArray<Byte> read _GetKEY_DEFAULT write _SetKEY_DEFAULT;
  532.     property KEY_MIFARE_APPLICATION_DIRECTORY: TJavaArray<Byte> read _GetKEY_MIFARE_APPLICATION_DIRECTORY write _SetKEY_MIFARE_APPLICATION_DIRECTORY;
  533.     property KEY_NFC_FORUM: TJavaArray<Byte> read _GetKEY_NFC_FORUM write _SetKEY_NFC_FORUM;
  534.     property SIZE_1K:Integerread _GetSIZE_1K;
  535.     property SIZE_2K:Integerread _GetSIZE_2K;
  536.     property SIZE_4K:Integerread _GetSIZE_4K;
  537.     property SIZE_MINI:Integerread _GetSIZE_MINI;
  538.     property TYPE_CLASSIC:Integerread _GetTYPE_CLASSIC;
  539.     property TYPE_PLUS:Integerread _GetTYPE_PLUS;
  540.     property TYPE_PRO:Integerread _GetTYPE_PRO;
  541.     property TYPE_UNKNOWN:Integerread _GetTYPE_UNKNOWN;
  542.   end;
  543.  
  544.   [JavaSignature('android/nfc/tech/MifareClassic')]
  545.   JMifareClassic =interface(JObject)
  546.     ['{AB88587E-A31A-4797-BF79-F178123160E3}']
  547.     { Methods }
  548.     function authenticateSectorWithKeyA(sectorIndex:Integer; key: TJavaArray<Byte>):Boolean;cdecl;
  549.     function authenticateSectorWithKeyB(sectorIndex:Integer; key: TJavaArray<Byte>):Boolean;cdecl;
  550.     function blockToSector(blockIndex:Integer):Integer;cdecl;
  551.     procedure close;cdecl;
  552.     procedure connect;cdecl;
  553.     procedure decrement(blockIndex:Integer; Value:Integer);cdecl;
  554.     function getBlockCount:Integer;cdecl;
  555.     function getBlockCountInSector(sectorIndex:Integer):Integer;cdecl;
  556.     function getMaxTransceiveLength:Integer;cdecl;
  557.     function getSectorCount:Integer;cdecl;
  558.     function getSize:Integer;cdecl;
  559.     function getTag: JTag;cdecl;
  560.     function getTimeout:Integer;cdecl;
  561.     function getType:Integer;cdecl;
  562.     procedure increment(blockIndex:Integer; Value:Integer);cdecl;
  563.     function isConnected:Boolean;cdecl;
  564.     function readBlock(blockIndex:Integer): TJavaArray<Byte>;cdecl;
  565.     procedure restore(blockIndex:Integer);cdecl;
  566.     function sectorToBlock(sectorIndex:Integer):Integer;cdecl;
  567.     procedure setTimeout(timeout:Integer);cdecl;
  568.     function transceive(data: TJavaArray<Byte>): TJavaArray<Byte>;cdecl;
  569.     procedure transfer(blockIndex:Integer);cdecl;
  570.     procedure writeBlock(blockIndex:Integer; data: TJavaArray<Byte>);cdecl;
  571.   end;
  572.  
  573.   TJMifareClassic =class(TJavaGenericImport<JMifareClassicClass, JMifareClassic>)
  574.   end;
  575.  
  576.   JMifareUltralightClass =interface(JObjectClass)
  577.     ['{6677366A-EC35-4855-9D4A-29833A20930B}']
  578.     { Property methods }
  579.     function _GetPAGE_SIZE:Integer;
  580.     function _GetTYPE_ULTRALIGHT:Integer;
  581.     function _GetTYPE_ULTRALIGHT_C:Integer;
  582.     function _GetTYPE_UNKNOWN:Integer;
  583.     { Methods }
  584.     function get(tag: JTag): JMifareUltralight;cdecl;
  585.     { Properties }
  586.     property PAGE_SIZE:Integerread _GetPAGE_SIZE;
  587.     property TYPE_ULTRALIGHT:Integerread _GetTYPE_ULTRALIGHT;
  588.     property TYPE_ULTRALIGHT_C:Integerread _GetTYPE_ULTRALIGHT_C;
  589.     property TYPE_UNKNOWN:Integerread _GetTYPE_UNKNOWN;
  590.   end;
  591.  
  592.   [JavaSignature('android/nfc/tech/MifareUltralight')]
  593.   JMifareUltralight =interface(JObject)
  594.     ['{25C8EEF0-D566-4014-8DF8-6FF039A88DEB}']
  595.     { Methods }
  596.     procedure close;cdecl;
  597.     procedure connect;cdecl;
  598.     function getMaxTransceiveLength:Integer;cdecl;
  599.     function getTag: JTag;cdecl;
  600.     function getTimeout:Integer;cdecl;
  601.     function getType:Integer;cdecl;
  602.     function isConnected:Boolean;cdecl;
  603.     function readPages(pageOffset:Integer): TJavaArray<Byte>;cdecl;
  604.     procedure setTimeout(timeout:Integer);cdecl;
  605.     function transceive(data: TJavaArray<Byte>): TJavaArray<Byte>;cdecl;
  606.     procedure writePage(pageOffset:Integer; data: TJavaArray<Byte>);cdecl;
  607.   end;
  608.  
  609.   TJMifareUltralight =class(TJavaGenericImport<JMifareUltralightClass, JMifareUltralight>)
  610.   end;
  611.  
  612.   JNdefClass =interface(JObjectClass)
  613.     ['{952E5F09-C924-419A-AEA0-802C8F4B018C}']
  614.     { Property methods }
  615.     function _GetMIFARE_CLASSIC: JString;
  616.     function _GetNFC_FORUM_TYPE_1: JString;
  617.     function _GetNFC_FORUM_TYPE_2: JString;
  618.     function _GetNFC_FORUM_TYPE_3: JString;
  619.     function _GetNFC_FORUM_TYPE_4: JString;
  620.     { Methods }
  621.     function get(tag: JTag): JNdef;cdecl;
  622.     { Properties }
  623.     property MIFARE_CLASSIC: JString read _GetMIFARE_CLASSIC;
  624.     property NFC_FORUM_TYPE_1: JString read _GetNFC_FORUM_TYPE_1;
  625.     property NFC_FORUM_TYPE_2: JString read _GetNFC_FORUM_TYPE_2;
  626.     property NFC_FORUM_TYPE_3: JString read _GetNFC_FORUM_TYPE_3;
  627.     property NFC_FORUM_TYPE_4: JString read _GetNFC_FORUM_TYPE_4;
  628.   end;
  629.  
  630.   [JavaSignature('android/nfc/tech/Ndef')]
  631.   JNdef =interface(JObject)
  632.     ['{07CB3172-9D1B-48BE-A9A6-01884C306109}']
  633.     { Methods }
  634.     function canMakeReadOnly:Boolean;cdecl;
  635.     procedure close;cdecl;
  636.     procedure connect;cdecl;
  637.     function getCachedNdefMessage: JNdefMessage;cdecl;
  638.     function getMaxSize:Integer;cdecl;
  639.     function getNdefMessage: JNdefMessage;cdecl;
  640.     function getTag: JTag;cdecl;
  641.     function getType: JString;cdecl;
  642.     function isConnected:Boolean;cdecl;
  643.     function isWritable:Boolean;cdecl;
  644.     function makeReadOnly:Boolean;cdecl;
  645.     procedure writeNdefMessage(msg: JNdefMessage);cdecl;
  646.   end;
  647.  
  648.   TJNdef =class(TJavaGenericImport<JNdefClass, JNdef>)
  649.   end;
  650.  
  651.   JNdefFormatableClass =interface(JObjectClass)
  652.     ['{FD2507AE-8201-4056-9603-01834A2E375D}']
  653.     { Methods }
  654.     function get(tag: JTag): JNdefFormatable;cdecl;
  655.   end;
  656.  
  657.   [JavaSignature('android/nfc/tech/NdefFormatable')]
  658.   JNdefFormatable =interface(JObject)
  659.     ['{08C293E6-9130-457A-BE7D-0EFCCB5AB8AF}']
  660.     { Methods }
  661.     procedure close;cdecl;
  662.     procedure connect;cdecl;
  663.     procedureformat(firstMessage: JNdefMessage);cdecl;
  664.     procedure formatReadOnly(firstMessage: JNdefMessage);cdecl;
  665.     function getTag: JTag;cdecl;
  666.     function isConnected:Boolean;cdecl;
  667.   end;
  668.  
  669.   TJNdefFormatable =class(TJavaGenericImport<JNdefFormatableClass, JNdefFormatable>)
  670.   end;
  671.  
  672.   JNfcAClass =interface(JObjectClass)
  673.     ['{C7CC1347-7CCB-4ED5-9A2C-1D82FA20AD1B}']
  674.     { Methods }
  675.     function get(tag: JTag): JNfcA;cdecl;
  676.   end;
  677.  
  678.   [JavaSignature('android/nfc/tech/NfcA')]
  679.   JNfcA =interface(JObject)
  680.     ['{6EAD7DA0-95A6-4230-B33E-FDDF98D80ACD}']
  681.     { Methods }
  682.     procedure close;cdecl;
  683.     procedure connect;cdecl;
  684.     function getAtqa: TJavaArray<Byte>;cdecl;
  685.     function getMaxTransceiveLength:Integer;cdecl;
  686.     function getSak:SmallInt;cdecl;
  687.     function getTag: JTag;cdecl;
  688.     function getTimeout:Integer;cdecl;
  689.     function isConnected:Boolean;cdecl;
  690.     procedure setTimeout(timeout:Integer);cdecl;
  691.     function transceive(data: TJavaArray<Byte>): TJavaArray<Byte>;cdecl;
  692.   end;
  693.  
  694.   TJNfcA =class(TJavaGenericImport<JNfcAClass, JNfcA>)
  695.   end;
  696.  
  697.   JNfcBClass =interface(JObjectClass)
  698.     ['{3AA0A259-27DC-4442-BA25-B5C44DE8FC1D}']
  699.     { Methods }
  700.     function get(tag: JTag): JNfcB;cdecl;
  701.   end;
  702.  
  703.   [JavaSignature('android/nfc/tech/NfcB')]
  704.   JNfcB =interface(JObject)
  705.     ['{ECEFD061-2CE5-4B51-AC25-C98A28C79FB5}']
  706.     { Methods }
  707.     procedure close;cdecl;
  708.     procedure connect;cdecl;
  709.     function getApplicationData: TJavaArray<Byte>;cdecl;
  710.     function getMaxTransceiveLength:Integer;cdecl;
  711.     function getProtocolInfo: TJavaArray<Byte>;cdecl;
  712.     function getTag: JTag;cdecl;
  713.     function isConnected:Boolean;cdecl;
  714.     function transceive(data: TJavaArray<Byte>): TJavaArray<Byte>;cdecl;
  715.   end;
  716.  
  717.   TJNfcB =class(TJavaGenericImport<JNfcBClass, JNfcB>)
  718.   end;
  719.  
  720.   JNfcBarcodeClass =interface(JObjectClass)
  721.     ['{969DCC14-1526-486B-A41B-3E7DC426DB36}']
  722.     { Property methods }
  723.     function _GetTYPE_KOVIO:Integer;
  724.     function _GetTYPE_UNKNOWN:Integer;
  725.     { Methods }
  726.     function get(tag: JTag): JNfcBarcode;cdecl;
  727.     { Properties }
  728.     property TYPE_KOVIO:Integerread _GetTYPE_KOVIO;
  729.     property TYPE_UNKNOWN:Integerread _GetTYPE_UNKNOWN;
  730.   end;
  731.  
  732.   [JavaSignature('android/nfc/tech/NfcBarcode')]
  733.   JNfcBarcode =interface(JObject)
  734.     ['{0E0D7BC3-EE8B-4E84-A497-E42FEE88A6F4}']
  735.     { Methods }
  736.     procedure close;cdecl;
  737.     procedure connect;cdecl;
  738.     function getBarcode: TJavaArray<Byte>;cdecl;
  739.     function getTag: JTag;cdecl;
  740.     function getType:Integer;cdecl;
  741.     function isConnected:Boolean;cdecl;
  742.   end;
  743.  
  744.   TJNfcBarcode =class(TJavaGenericImport<JNfcBarcodeClass, JNfcBarcode>)
  745.   end;
  746.  
  747.   JNfcFClass =interface(JObjectClass)
  748.     ['{A61ADBBC-6687-442F-9005-48CFBAA1D3BF}']
  749.     { Methods }
  750.     function get(tag: JTag): JNfcF;cdecl;
  751.   end;
  752.  
  753.   [JavaSignature('android/nfc/tech/NfcF')]
  754.   JNfcF =interface(JObject)
  755.     ['{76433696-EF45-4D38-A3C2-15C5B9D6817D}']
  756.     { Methods }
  757.     procedure close;cdecl;
  758.     procedure connect;cdecl;
  759.     function getManufacturer: TJavaArray<Byte>;cdecl;
  760.     function getMaxTransceiveLength:Integer;cdecl;
  761.     function getSystemCode: TJavaArray<Byte>;cdecl;
  762.     function getTag: JTag;cdecl;
  763.     function getTimeout:Integer;cdecl;
  764.     function isConnected:Boolean;cdecl;
  765.     procedure setTimeout(timeout:Integer);cdecl;
  766.     function transceive(data: TJavaArray<Byte>): TJavaArray<Byte>;cdecl;
  767.   end;
  768.  
  769.   TJNfcF =class(TJavaGenericImport<JNfcFClass, JNfcF>)
  770.   end;
  771.  
  772.   JNfcVClass =interface(JObjectClass)
  773.     ['{30E78EF3-BA54-43EA-A30B-E7DB2F13F635}']
  774.     { Methods }
  775.     function get(tag: JTag): JNfcV;cdecl;
  776.   end;
  777.  
  778.   [JavaSignature('android/nfc/tech/NfcV')]
  779.   JNfcV =interface(JObject)
  780.     ['{79448CB5-93BC-49D4-8424-B1CEE62FA71F}']
  781.     { Methods }
  782.     procedure close;cdecl;
  783.     procedure connect;cdecl;
  784.     function getDsfId:Byte;cdecl;
  785.     function getMaxTransceiveLength:Integer;cdecl;
  786.     function getResponseFlags:Byte;cdecl;
  787.     function getTag: JTag;cdecl;
  788.     function isConnected:Boolean;cdecl;
  789.     function transceive(data: TJavaArray<Byte>): TJavaArray<Byte>;cdecl;
  790.   end;
  791.  
  792.   TJNfcV =class(TJavaGenericImport<JNfcVClass, JNfcV>)
  793.   end;
  794.  
  795.   JTagTechnologyClass =interface(IJavaClass)
  796.     ['{3C1A028A-02C0-4AEC-9EAC-5CFA949C5ACF}']
  797.   end;
  798.  
  799.   [JavaSignature('android/nfc/tech/TagTechnology')]
  800.   JTagTechnology =interface(IJavaInstance)
  801.     ['{C191C90F-0D45-468B-8DFC-463313DFA51D}']
  802.     { Methods }
  803.     procedure close;cdecl;
  804.     procedure connect;cdecl;
  805.     function getTag: JTag;cdecl;
  806.     function isConnected:Boolean;cdecl;
  807.   end;
  808.  
  809.   TJTagTechnology =class(TJavaGenericImport<JTagTechnologyClass, JTagTechnology>)
  810.   end;
  811.  
  812. const
  813.   TJCardEmulation_ACTION_CHANGE_DEFAULT ='android.nfc.cardemulation.action.ACTION_CHANGE_DEFAULT';
  814.   TJCardEmulation_CATEGORY_OTHER ='other';
  815.   TJCardEmulation_CATEGORY_PAYMENT ='payment';
  816.   TJCardEmulation_EXTRA_CATEGORY ='category';
  817.   TJCardEmulation_EXTRA_SERVICE_COMPONENT ='component';
  818.   TJCardEmulation_SELECTION_MODE_ALWAYS_ASK =1;
  819.   TJCardEmulation_SELECTION_MODE_ASK_IF_CONFLICT =2;
  820.   TJCardEmulation_SELECTION_MODE_PREFER_DEFAULT =0;
  821.  
  822.   TJHostApduService_DEACTIVATION_DESELECTED =1;
  823.   TJHostApduService_DEACTIVATION_LINK_LOSS =0;
  824.   TJHostApduService_SERVICE_INTERFACE ='android.nfc.cardemulation.action.HOST_APDU_SERVICE';
  825.   TJHostApduService_SERVICE_META_DATA ='android.nfc.cardemulation.host_apdu_service';
  826.  
  827.   TJOffHostApduService_SERVICE_INTERFACE ='android.nfc.cardemulation.action.OFF_HOST_APDU_SERVICE';
  828.   TJOffHostApduService_SERVICE_META_DATA ='android.nfc.cardemulation.off_host_apdu_service';
  829.  
  830.   TJNdefRecord_TNF_ABSOLUTE_URI =3;
  831.   TJNdefRecord_TNF_EMPTY =0;
  832.   TJNdefRecord_TNF_EXTERNAL_TYPE =4;
  833.   TJNdefRecord_TNF_MIME_MEDIA =2;
  834.   TJNdefRecord_TNF_UNCHANGED =6;
  835.   TJNdefRecord_TNF_UNKNOWN =5;
  836.   TJNdefRecord_TNF_WELL_KNOWN =1;
  837.  
  838.   TJNfcAdapter_ACTION_ADAPTER_STATE_CHANGED ='android.nfc.action.ADAPTER_STATE_CHANGED';
  839.   TJNfcAdapter_ACTION_NDEF_DISCOVERED ='android.nfc.action.NDEF_DISCOVERED';
  840.   TJNfcAdapter_ACTION_TAG_DISCOVERED ='android.nfc.action.TAG_DISCOVERED';
  841.   TJNfcAdapter_ACTION_TECH_DISCOVERED ='android.nfc.action.TECH_DISCOVERED';
  842.   TJNfcAdapter_EXTRA_ADAPTER_STATE ='android.nfc.extra.ADAPTER_STATE';
  843.   TJNfcAdapter_EXTRA_ID ='android.nfc.extra.ID';
  844.   TJNfcAdapter_EXTRA_NDEF_MESSAGES ='android.nfc.extra.NDEF_MESSAGES';
  845.   TJNfcAdapter_EXTRA_READER_PRESENCE_CHECK_DELAY ='presence';
  846.   TJNfcAdapter_EXTRA_TAG ='android.nfc.extra.TAG';
  847.   TJNfcAdapter_FLAG_READER_NFC_A =1;
  848.   TJNfcAdapter_FLAG_READER_NFC_B =2;
  849.   TJNfcAdapter_FLAG_READER_NFC_BARCODE =16;
  850.   TJNfcAdapter_FLAG_READER_NFC_F =4;
  851.   TJNfcAdapter_FLAG_READER_NFC_V =8;
  852.   TJNfcAdapter_FLAG_READER_NO_PLATFORM_SOUNDS =256;
  853.   TJNfcAdapter_FLAG_READER_SKIP_NDEF_CHECK =128;
  854.   TJNfcAdapter_STATE_OFF =1;
  855.   TJNfcAdapter_STATE_ON =3;
  856.   TJNfcAdapter_STATE_TURNING_OFF =4;
  857.   TJNfcAdapter_STATE_TURNING_ON =2;
  858.  
  859.   TJMifareClassic_BLOCK_SIZE =16;
  860.   TJMifareClassic_SIZE_1K =1024;
  861.   TJMifareClassic_SIZE_2K =2048;
  862.   TJMifareClassic_SIZE_4K =4096;
  863.   TJMifareClassic_SIZE_MINI =320;
  864.   TJMifareClassic_TYPE_CLASSIC =0;
  865.   TJMifareClassic_TYPE_PLUS =1;
  866.   TJMifareClassic_TYPE_PRO =2;
  867.   TJMifareClassic_TYPE_UNKNOWN =-1;
  868.  
  869.   TJMifareUltralight_PAGE_SIZE =4;
  870.   TJMifareUltralight_TYPE_ULTRALIGHT =1;
  871.   TJMifareUltralight_TYPE_ULTRALIGHT_C =2;
  872.   TJMifareUltralight_TYPE_UNKNOWN =-1;
  873.  
  874.   TJNdef_MIFARE_CLASSIC ='com.nxp.ndef.mifareclassic';
  875.   TJNdef_NFC_FORUM_TYPE_1 ='org.nfcforum.ndef.type1';
  876.   TJNdef_NFC_FORUM_TYPE_2 ='org.nfcforum.ndef.type2';
  877.   TJNdef_NFC_FORUM_TYPE_3 ='org.nfcforum.ndef.type3';
  878.   TJNdef_NFC_FORUM_TYPE_4 ='org.nfcforum.ndef.type4';
  879.  
  880.   TJNfcBarcode_TYPE_KOVIO =1;
  881.   TJNfcBarcode_TYPE_UNKNOWN =-1;
  882.  
  883. implementation
  884.  
  885. end.

Viewing all articles
Browse latest Browse all 1725

Trending Articles