@tauri-apps/plugin-nfc
Enumerations
NFCTypeNameFormat
Enumeration Members
AbsoluteURI
AbsoluteURI: 3;Source: index.ts:84
Empty
Empty: 0;Source: index.ts:81
Media
Media: 2;Source: index.ts:83
NfcExternal
NfcExternal: 4;Source: index.ts:85
NfcWellKnown
NfcWellKnown: 1;Source: index.ts:82
Unchanged
Unchanged: 6;Source: index.ts:87
Unknown
Unknown: 5;Source: index.ts:86
TechKind
Enumeration Members
IsoDep
IsoDep: 0;Source: index.ts:17
MifareClassic
MifareClassic: 1;Source: index.ts:18
MifareUltralight
MifareUltralight: 2;Source: index.ts:19
Ndef
Ndef: 3;Source: index.ts:20
NdefFormatable
NdefFormatable: 4;Source: index.ts:21
NfcA
NfcA: 5;Source: index.ts:22
NfcB
NfcB: 6;Source: index.ts:23
NfcBarcode
NfcBarcode: 7;Source: index.ts:24
NfcF
NfcF: 8;Source: index.ts:25
NfcV
NfcV: 9;Source: index.ts:26
Interfaces
NFCRecord
Properties
| Property | Type |
|---|---|
format | NFCTypeNameFormat |
id | number[] |
kind | number[] |
payload | number[] |
ScanOptions
Properties
| Property | Type | Description |
|---|---|---|
keepSessionAlive? | boolean | - |
message? | string | Message displayed in the UI. iOS only. |
successMessage? | string | Message displayed in the UI when the message has been read. iOS only. |
Tag
Properties
| Property | Type |
|---|---|
id | number[] |
kind | string[] |
records | TagRecord[] |
TagRecord
Properties
| Property | Type |
|---|---|
id | number[] |
kind | number[] |
payload | number[] |
tnf | NFCTypeNameFormat |
UriFilter
Properties
| Property | Type |
|---|---|
host? | string |
pathPrefix? | string |
scheme? | string |
WriteOptions
Properties
| Property | Type | Description |
|---|---|---|
kind? | ScanKind | - |
message? | string | Message displayed in the UI when reading the tag. iOS only. |
successMessage? | string | Message displayed in the UI when the message has been written. iOS only. |
successfulReadMessage? | string | Message displayed in the UI when the tag has been read. iOS only. |
Type Aliases
ScanKind
ScanKind: {mimeType: string; type: "tag"; uri: UriFilter;} | {mimeType: string; techLists: TechKind[][]; type: "ndef"; uri: UriFilter;}Source: index.ts:29
Variables
RTD_TEXT
const RTD_TEXT: number[];Source: index.ts:7
RTD_URI
const RTD_URI: number[];Source: index.ts:8
Functions
isAvailable()
isAvailable(): Promise< boolean >Returns
Promise< boolean >
Source: index.ts:270
record()
record( format, kind, id, payload): NFCRecordParameters
| Parameter | Type |
|---|---|
format | NFCTypeNameFormat |
kind | string | number[] |
id | string | number[] |
payload | string | number[] |
Returns
Source: index.ts:110
scan()
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
| Parameter | Type | Description |
|---|---|---|
kind | ScanKind | |
options? | ScanOptions |
Returns
Source: index.ts:230
textRecord()
textRecord( text, id?, language? = "en"): NFCRecordParameters
| Parameter | Type | Default value |
|---|---|---|
text | string | undefined |
id? | string | number[] | undefined |
language? | string | "en" |
Returns
Source: index.ts:130
uriRecord()
uriRecord(uri, id?): NFCRecordParameters
| Parameter | Type |
|---|---|
uri | string |
id? | string | number[] |
Returns
Source: index.ts:202
write()
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
| Parameter | Type | Description |
|---|---|---|
records | NFCRecord[] | |
options? | WriteOptions |
Returns
Promise< void >
Source: index.ts:255
© 2024 Tauri Contributors. CC-BY / MIT