Skip to content

NFC-NfcF

.connect

TIP

The API usage is as follows: NfcF.connect()

  • Functional description: Connect NFC tag

  • Parameters and descriptions: Object object。

    PropertiesTypeDefault valueRequiredDescription
    successFunction-NoCallback function for successful interface call
    failFunction-NoCallback function for failed interface call
    completeFunction-NoCallback function for interface call completion (executed regardless of success or failure)
  • Error code

    Error codeError messageDescription
    13000The device does not support NFC-
    13001The system NFC switch is not turned on-
    13010Unknown error-
    13019user is not authorizedThe user is not authorized
    13011invalid parameterInvalid parameters
    13012parse NdefMessage failedFailed to parse parameters into NdefMessage
    13021NFC discovery already startedNFC scanning has started
    13018NFC discovery has not startedAttempt to stop NFC scanning when NFC scanning has not started
    13022Tech already connectedThe tag is already connected
    13023Tech has not connectedAttempt to disconnect when the tag is not connected
    13013NFC tag has not been discoveredNFC tag not scanned
    13014invalid techInvalid tag technology
    13015unavailable techFailed to obtain the corresponding technology from the tag
    13024function not supportThe current tag technology does not support this function
    13017system internal errorRelated read and write operations failed
    13016connect failConnection failed

.close

TIP

The API usage is as follows: NfcF.close()

  • Functional description: Disconnect

  • Parameters and descriptions: Object object。

    PropertiesTypeDefault valueRequiredDescription
    successFunction-NoCallback function for successful interface call
    failFunction-NoCallback function for failed interface call
    completeFunction-NoCallback function for interface call completion (executed regardless of success or failure)
  • Error code

    Error codeError messageDescription
    13000The device does not support NFC-
    13001The system NFC switch is not turned on-
    13010Unknown error-
    13019user is not authorizedThe user is not authorized
    13011invalid parameterInvalid parameters
    13012parse NdefMessage failedFailed to parse parameters into NdefMessage
    13021NFC discovery already startedNFC scanning has started
    13018NFC discovery has not startedAttempt to stop NFC scanning when NFC scanning has not started
    13022Tech already connectedThe tag is already connected
    13023Tech has not connectedAttempt to disconnect when the tag is not connected
    13013NFC tag has not been discoveredNFC tag not scanned
    13014invalid techInvalid tag technology
    13015unavailable techFailed to obtain the corresponding technology from the tag
    13024function not supportThe current tag technology does not support this function
    13017system internal errorRelated read and write operations failed
    13016connect failConnection failed

.setTimeout

TIP

The API usage is as follows: NfcF.setTimeout(Object object)

  • Functional description: Set timeout

  • Parameters and descriptions: Object object。

    PropertiesTypeDefault valueRequiredDescription
    timeoutnumber-YesSet timeout (ms)
    successFunction-NoCallback function for successful interface call
    failFunction-NoCallback function for failed interface call
    completeFunction-NoCallback function for interface call completion (executed regardless of success or failure)
  • Error code

    Error codeError messageDescription
    13000The device does not support NFC-
    13001The system NFC switch is not turned on-
    13010Unknown error-
    13019user is not authorizedThe user is not authorized
    13011invalid parameterInvalid parameters
    13012parse NdefMessage failedFailed to parse parameters into NdefMessage
    13021NFC discovery already startedNFC scanning has started
    13018NFC discovery has not startedAttempt to stop NFC scanning when NFC scanning has not started
    13022Tech already connectedThe tag is already connected
    13023Tech has not connectedAttempt to disconnect when the tag is not connected
    13013NFC tag has not been discoveredNFC tag not scanned
    13014invalid techInvalid tag technology
    13015unavailable techFailed to obtain the corresponding technology from the tag
    13024function not supportThe current tag technology does not support this function
    13017system internal errorRelated read and write operations failed
    13016connect failConnection failed

.isConnected

TIP

The API usage is as follows: NfcF.isConnected()

  • Functional description: Check if connected

  • Parameters and descriptions: Object object。

    PropertiesTypeDefault valueRequiredDescription
    successFunction-NoCallback function for successful interface call
    failFunction-NoCallback function for failed interface call
    completeFunction-NoCallback function for interface call completion (executed regardless of success or failure)
  • Error code

    Error codeError messageDescription
    13000The device does not support NFC-
    13001The system NFC switch is not turned on-
    13010Unknown error-
    13019user is not authorizedThe user is not authorized
    13011invalid parameterInvalid parameters
    13012parse NdefMessage failedFailed to parse parameters into NdefMessage
    13021NFC discovery already startedNFC scanning has started
    13018NFC discovery has not startedAttempt to stop NFC scanning when NFC scanning has not started
    13022Tech already connectedThe tag is already connected
    13023Tech has not connectedAttempt to disconnect when the tag is not connected
    13013NFC tag has not been discoveredNFC tag not scanned
    13014invalid techInvalid tag technology
    13015unavailable techFailed to obtain the corresponding technology from the tag
    13024function not supportThe current tag technology does not support this function
    13017system internal errorRelated read and write operations failed
    13016connect failConnection failed

.getMaxTransceiveLength

TIP

The API usage is as follows: NfcF.getMaxTransceiveLength()

  • Functional description: Get maximum transmission length

  • Parameters and descriptions: Object object。

    PropertiesTypeDefault valueRequiredDescription
    successFunction-NoCallback function for successful interface call
    failFunction-NoCallback function for failed interface call
    completeFunction-NoCallback function for interface call completion (executed regardless of success or failure)
  • object.success callback function parameters: object res。

    PropertiesTypeDescription
    lengthnumberGet maximum transmission length
  • Error code

    Error codeError messageDescription
    13000The device does not support NFC-
    13001The system NFC switch is not turned on-
    13010Unknown error-
    13019user is not authorizedThe user is not authorized
    13011invalid parameterInvalid parameters
    13012parse NdefMessage failedFailed to parse parameters into NdefMessage
    13021NFC discovery already startedNFC scanning has started
    13018NFC discovery has not startedAttempt to stop NFC scanning when NFC scanning has not started
    13022Tech already connectedThe tag is already connected
    13023Tech has not connectedAttempt to disconnect when the tag is not connected
    13013NFC tag has not been discoveredNFC tag not scanned
    13014invalid techInvalid tag technology
    13015unavailable techFailed to obtain the corresponding technology from the tag
    13024function not supportThe current tag technology does not support this function
    13017system internal errorRelated read and write operations failed
    13016connect failConnection failed

.transceive

TIP

The API usage is as follows: NfcF.transceive(Object object)

  • Functional description: Send data

  • Parameters and descriptions: Object object。

    PropertiesTypeDefault valueRequiredDescription
    dataArrayBuffer-YesBinary data to be passed
    successFunction-NoCallback function for successful interface call
    failFunction-NoCallback function for failed interface call
    completeFunction-NoCallback function for interface call completion (executed regardless of success or failure)
  • object.success callback function parameters: object res。

    PropertiesTypeDescription
    dataArrayBuffer-
  • Error code

    Error codeError messageDescription
    13000The device does not support NFC-
    13001The system NFC switch is not turned on-
    13010Unknown error-
    13019user is not authorizedThe user is not authorized
    13011invalid parameterInvalid parameters
    13012parse NdefMessage failedFailed to parse parameters into NdefMessage
    13021NFC discovery already startedNFC scanning has started
    13018NFC discovery has not startedAttempt to stop NFC scanning when NFC scanning has not started
    13022Tech already connectedThe tag is already connected
    13023Tech has not connectedAttempt to disconnect when the tag is not connected
    13013NFC tag has not been discoveredNFC tag not scanned
    13014invalid techInvalid tag technology
    13015unavailable techFailed to obtain the corresponding technology from the tag
    13024function not supportThe current tag technology does not support this function
    13017system internal errorRelated read and write operations failed
    13016connect failConnection failed