NFC Library for Android 3.0 Full Source » Developer.Team - Developers Paradise!

NFC Library for Android 3.0 Full Source

NFC Library for Android 3.0 Full Source
NFC Library for Android 3.0 Full Source | 789 kB


Delphi and C++ Builder NFC library for Android.

FEATURES

Uses Android NFC API
Provides reading, writing and formatting NFC tags
Supports NDEF, NFC-A, NFC-V, MIFARE Classic and MIFARE Ultralight tags
Available for Delphi/C++ Builder XE7 - XE8
Source code included in full version
Royalty free distribution in applications

type
  TOnNfcIntent = procedure(Env: PJNIEnv; This: JNIObject; Intent: JNIObject); cdecl;

procedure RegisterNfc(OnNfcIntent: TOnNfcIntent); overload;

function GetNfcAdapter: JNfcAdapter;

procedure ShowNfcSettings;

function BytesToHex(Bytes: TJavaArray<Byte>; Separator: Char = ':'): string; overload;
function BytesToHex(const Bytes: TArray<Byte>; Separator: Char = ':'): string; overload;
function BytesToHex(const Bytes: TArray<Byte>; From, Count: Integer; Separator: Char = ':'): string; overload;

function BytesToHexReverse(Bytes: TJavaArray<Byte>; Separator: Char = ':'): string; overload;
function BytesToHexReverse(const Bytes: TArray<Byte>; Separator: Char = ':'): string; overload;
function BytesToHexReverse(const Bytes: TArray<Byte>; From, Count: Integer; Separator: Char = ':'): string; overload;

// TAG

function GetTag(Intent: JIntent): JTag;
function GetId(Tag: JTag; Separator: Char = ':'): string;
function GetTechList(Tag: JTag): TArray<string>;

function GetNfcA(Tag: JTag): JNfcA;
function GetNfcV(Tag: JTag): JNfcV;
function GetNdefFormatable(Tag: JTag): JNdefFormatable;
function GetNdef(Tag: JTag): JNdef;
function GetMifareClassic(Tag: JTag): JMifareClassic;
function GetMifareUltralight(Tag: JTag): JMifareUltralight;

function Format(Tag: JTag): Boolean; overload;

// MIFARE Ultralight

function GetTypeDescription(MifareUltralight: JMifareUltralight): string; overload;
function GetPageCount(MifareUltralight: JMifareUltralight): Integer;
function ReadPage(MifareUltralight: JMifareUltralight; PageOffset: Integer): TArray<Byte>;
function ReadPages(MifareUltralight: JMifareUltralight): TArray<TArray<Byte>>;
function ReadData(MifareUltralight: JMifareUltralight): TArray<Byte>; overload;
procedure WritePage(MifareUltralight: JMifareUltralight; PageOffset: Integer; Data: TArray<Byte>);
procedure WritePages(MifareUltralight: JMifareUltralight; FirstPageOffset: Integer; Data: TArray<TArray<Byte>>);

// MIFARE Classic

function GetTypeDescription(MifareClassic: JMifareClassic): string; overload;
function ReadBlock(MifareClassic: JMifareClassic; Index: Integer): TArray<Byte>; overload;
function ReadBlocks(MifareClassic: JMifareClassic): TArray<TArray<Byte>>; overload;
function ReadData(MifareClassic: JMifareClassic): TArray<Byte>; overload;

// NDEF Formattable

function Format(NdefFormattable: JNdefFormatable): Boolean; overload;

// NDEF

function GetRecords(Ndef: JNdef): TArray<JNdefRecord>;

function GetTnfDescription(NdefRecord: JNdefRecord): string;
function IsEmpty(NdefRecord: JNdefRecord): Boolean;
function IsWellKnown(NdefRecord: JNdefRecord): Boolean;
function IsMimeMedia(NdefRecord: JNdefRecord): Boolean;
function IsAbsoluteUri(NdefRecord: JNdefRecord): Boolean;
function IsExternalType(NdefRecord: JNdefRecord): Boolean;
function IsUnknown(NdefRecord: JNdefRecord): Boolean;
function IsUnchanged(NdefRecord: JNdefRecord): Boolean;

function GetExternalText(NdefRecord: JNdefRecord): string;

function GetPayload(NdefRecord: JNdefRecord): TArray<Byte>;
function GetPayloadHex(NdefRecord: JNdefRecord): string;
function GetPayloadUtf8(NdefRecord: JNdefRecord): string;

function IsText(NdefRecord: JNdefRecord): Boolean;
function GetText(NdefRecord: JNdefRecord): string;
function GetTextLanguageCode(NdefRecord: JNdefRecord): string;

function IsUri(NdefRecord: JNdefRecord): Boolean;
function GetUri(NdefRecord: JNdefRecord): string;

function CreateExternalRecord(const Domain, &Type: string; const Data: TArray<Byte>): JNdefRecord;
function CreateApplicationRecord(const PackageName: string): JNdefRecord;
function CreateMimeRecord(const MimeType: string; const MimeData: TArray<Byte>): JNdefRecord;
function CreateTextRecord(const Text: string; const LanguageCode: string = 'en'): JNdefRecord;
function CreateUriRecord(const Uri: string): JNdefRecord;

function Write(Ndef: JNdef; NdefRecord: JNdefRecord): Boolean; overload;
function Write(Ndef: JNdef; NdefRecords: TArray<JNdefRecord>): Boolean; overload;
function Write(Ndef: JNdef; NdefRecords: array of JNdefRecord): Boolean; overload;

// NFC V

function Transceive(NfcV: JNfcV; Data: TArray<Byte>): TArray<Byte>;
function Inventory(NfcV: JNfcV): TArray<Byte>;
function ReadBlock(NfcV: JNfcV; Block: Byte): TArray<Byte>; overload;
function WriteBlock(NfcV: JNfcV; Block: Byte; Data: TArray<Byte>): TArray<Byte>;
function LockBlock(NfcV: JNfcV; Block: Byte): TArray<Byte>;
function ReadBlocks(NfcV: JNfcV; FirstBlock, BlockCount: Byte): TArray<Byte>; overload;
function WriteBlocks(NfcV: JNfcV; FirstBlock, BlockCount: Byte; Data: TArray<Byte>): TArray<Byte>;
function ResetToReady(NfcV: JNfcV): TArray<Byte>;
function WriteAfi(NfcV: JNfcV; AFI: Byte): TArray<Byte>;
function LockAfi(NfcV: JNfcV): TArray<Byte>;
function WriteDsfid(NfcV: JNfcV; DSFID: Byte): TArray<Byte>;
function LockDsfid(NfcV: JNfcV): TArray<Byte>;
function GetInformation(NfcV: JNfcV): TArray<Byte>;
function GetBlockCount(NfcV: JNfcV): Integer;
function GetBlockSize(NfcV: JNfcV): Integer;
function GetIc(NfcV: JNfcV): Integer;
function GetSecurity(NfcV: JNfcV; FirstBlock, BlockCount: Byte): TArray<Byte>;
function SetEas(NfcV: JNfcV): TArray<Byte>;
function ResetEas(NfcV: JNfcV): TArray<Byte>;
function LockEas(NfcV: JNfcV): TArray<Byte>;
function EasAlarm(NfcV: JNfcV): TArray<Byte>;


[/b]

[b] Only for V.I.P
Warning! You are not allowed to view this text.