nfc
Enumerations
NFCTypeNameFormat
Enumeration Members
AbsoluteURI
AbsoluteURI: 3;Empty
Empty: 0;Media
Media: 2;NfcExternal
NfcExternal: 4;NfcWellKnown
NfcWellKnown: 1;Unchanged
Unchanged: 6;Unknown
Unknown: 5;TechKind
Enumeration Members
IsoDep
IsoDep: 0;MifareClassic
MifareClassic: 1;MifareUltralight
MifareUltralight: 2;Ndef
Ndef: 3;NdefFormatable
NdefFormatable: 4;NfcA
NfcA: 5;NfcB
NfcB: 6;NfcBarcode
NfcBarcode: 7;NfcF
NfcF: 8;NfcV
NfcV: 9;Interfaces
NFCRecord
Properties
| Property | Type | Defined in |
|---|---|---|
format | NFCTypeNameFormat | |
id | number[] | |
kind | number[] | |
payload | number[] |
ScanOptions
Properties
Tag
Properties
| Property | Type | Defined in |
|---|---|---|
id | number[] | |
kind | string[] | |
records | TagRecord[] |
TagRecord
Properties
| Property | Type | Defined in |
|---|---|---|
id | number[] | |
kind | number[] | |
payload | number[] | |
tnf | NFCTypeNameFormat |
UriFilter
Properties
| Property | Type | Defined in |
|---|---|---|
host? | string | |
pathPrefix? | string | |
scheme? | string |
WriteOptions
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
kind? | ScanKind | - | |
message? | string | Message displayed in the UI when reading the tag. iOS only. | |
successfulReadMessage? | string | Message displayed in the UI when the tag has been read. iOS only. | |
successMessage? | string | Message displayed in the UI when the message has been written. iOS only. |
Type Aliases
ScanKind
type ScanKind: object | object;Variables
RTD_TEXT
const RTD_TEXT: number[];RTD_URI
const RTD_URI: number[];Functions
isAvailable()
function isAvailable(): Promise<boolean>Returns
Promise<boolean>
record()
function record( format, kind, id, payload): NFCRecordParameters
| Parameter | Type |
|---|---|
format | NFCTypeNameFormat |
kind | string | number[] |
id | string | number[] |
payload | string | number[] |
Returns
scan()
function scan(kind, options?): Promise<Tag>Scans an NFC tag.
import { scan } from "@crabnebula/taurify-api/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
textRecord()
function textRecord( text, id?, language?): NFCRecordParameters
| Parameter | Type | Default value |
|---|---|---|
text | string | undefined |
id? | string | number[] | undefined |
language? | string | 'en' |
Returns
uriRecord()
function uriRecord(uri, id?): NFCRecordParameters
| Parameter | Type |
|---|---|
uri | string |
id? | string | number[] |
Returns
write()
function write(records, options?): Promise<void>Write to an NFC tag.
import { uriRecord, write } from "@crabnebula/taurify-api/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>