Skip to content
Tauri
Releases

@tauri-apps/plugin-nfc

Enumerations

NFCTypeNameFormat

Enumeration Members

AbsoluteURI
AbsoluteURI: 3;

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L84

Empty
Empty: 0;

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L81

Media
Media: 2;

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L83

NfcExternal
NfcExternal: 4;

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L85

NfcWellKnown
NfcWellKnown: 1;

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L82

Unchanged
Unchanged: 6;

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L87

Unknown
Unknown: 5;

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L86


TechKind

Enumeration Members

IsoDep
IsoDep: 0;

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L17

MifareClassic
MifareClassic: 1;

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L18

MifareUltralight
MifareUltralight: 2;

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L19

Ndef
Ndef: 3;

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L20

NdefFormatable
NdefFormatable: 4;

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L21

NfcA
NfcA: 5;

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L22

NfcB
NfcB: 6;

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L23

NfcBarcode
NfcBarcode: 7;

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L24

NfcF
NfcF: 8;

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L25

NfcV
NfcV: 9;

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L26

Interfaces

NFCRecord

Properties

PropertyType
formatNFCTypeNameFormat
idnumber[]
kindnumber[]
payloadnumber[]

ScanOptions

Properties

PropertyTypeDescription
keepSessionAlive?boolean-
message?stringMessage displayed in the UI. iOS only.
successMessage?stringMessage displayed in the UI when the message has been read. iOS only.

Tag

Properties

PropertyType
idnumber[]
kindstring[]
recordsTagRecord[]

TagRecord

Properties

PropertyType
idnumber[]
kindnumber[]
payloadnumber[]
tnfNFCTypeNameFormat

UriFilter

Properties

PropertyType
host?string
pathPrefix?string
scheme?string

WriteOptions

Properties

PropertyTypeDescription
kind?ScanKind-
message?stringMessage displayed in the UI when reading the tag. iOS only.
successMessage?stringMessage displayed in the UI when the message has been written. iOS only.
successfulReadMessage?stringMessage displayed in the UI when the tag has been read. iOS only.

Type Aliases

ScanKind

type ScanKind: object | object;

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L29

Variables

RTD_TEXT

const RTD_TEXT: number[];

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L7


RTD_URI

const RTD_URI: number[];

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L8

Functions

isAvailable()

function isAvailable(): Promise<boolean>

Returns

Promise<boolean>

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L270


record()

function record(
format,
kind,
id,
payload): NFCRecord

Parameters

ParameterType
formatNFCTypeNameFormat
kindstring | number[]
idstring | number[]
payloadstring | number[]

Returns

NFCRecord

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L110


scan()

function scan(kind, options?): Promise<Tag>

Scans an NFC tag.

import { scan } from "@tauri-apps/plugin-nfc";
await scan({ type: "tag" });

See https://developer.android.com/develop/connectivity/nfc/nfc#ndef for more information.

Parameters

ParameterTypeDescription
kindScanKind
options?ScanOptions

Returns

Promise<Tag>

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L230


textRecord()

function textRecord(
text,
id?,
language?): NFCRecord

Parameters

ParameterTypeDefault value
textstringundefined
id?string | number[]undefined
language?string"en"

Returns

NFCRecord

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L130


uriRecord()

function uriRecord(uri, id?): NFCRecord

Parameters

ParameterType
uristring
id?string | number[]

Returns

NFCRecord

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L202


write()

function write(records, options?): Promise<void>

Write to an NFC tag.

import { uriRecord, write } from "@tauri-apps/plugin-nfc";
await write([uriRecord("https://tauri.app")], { kind: { type: "ndef" } });

If you did not previously call scan with ScanOptions.keepSessionAlive set to true, it will first scan the tag then write to it.

Parameters

ParameterTypeDescription
recordsNFCRecord[]
options?WriteOptions

Returns

Promise<void>

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L255


© 2024 Tauri Contributors. CC-BY / MIT