tencent cloud

Feedback

NFC-NFCAdapter

Last updated: 2024-07-16 17:59:45

    NFCAdapter

    Parameters and Description: Object tech, enumeration of tag types.
    Attributes
    Types
    Note
    ndef
    String
    Corresponds to the Ndef instance, the instance supports reading and writing of NDEF data on NFC tags in NDEF format.
    nfcA
    String
    Corresponds to the NfcA instance, the instance supports reading and writing in accordance with the NFC-A (ISO 14443-3A) standard.
    nfcB
    String
    Corresponds to the NfcB instance, the instance supports reading and writing in accordance with the NFC-B (ISO 14443-3B) standard.
    isoDep
    String
    Corresponds to the IsoDep instance, the instance supports reading and writing in accordance with the ISO-DEP (ISO 14443-4) standard.
    nfcF
    String
    Corresponds to the NfcF instance, the instance supports reading and writing in accordance with the NFC-F (JIS 6319-4) standard.
    nfcV
    String
    Corresponds to the NfcV instance, the instance supports reading and writing in accordance with the NFC-V (ISO 15693) standard.
    mifareClassic
    String
    Corresponds to the MifareClassic instance, the instance supports reading and writing of MIFARE Classic tags.
    mifareUltralight
    String
    Corresponds to the MifareUltralight instance, the instance supports reading and writing of MIFARE Ultralight tags.

    .startDiscovery

    The method is utilized as NFCAdapter.startDiscovery().
    Parameters and Description: Object object.
    Attributes
    Types
    Default value
    Required
    Note
    success
    Function
    -
    Not required
    Callback function for successful interface invocation
    fail
    Function
    -
    Not required
    Callback function for successful interface invocation
    complete
    Function
    -
    Not required
    Callback function executed upon the completion of the interface invocation (both successful and unsuccessful invocations)
    Error Code
    Error Codes
    Error Message
    Note
    13000
    The device does not support NFC
    -
    13001
    The system's NFC switch is not activated.
    -
    13010
    An unknown error occurred.
    -
    13019
    user is not authorized
    User Authorization Denied
    13011
    invalid parameter
    Invalid parameter
    13012
    parse NdefMessage failed
    Failed to parse the parameter into NdefMessage.
    13021
    NFC discovery already started
    NFC scanning has already commenced.
    13018
    NFC discovery has not started
    Attempted to halt NFC scanning without initiating it.
    13022
    Tech already connected
    The tag has been successfully connected.
    13023
    Tech has not connected
    Attempted to disconnect without a tag being connected.
    13013
    NFC tag has not been discovered
    No NFC tag was detected.
    13014
    invalid tech
    Invalid tag technology.
    13015
    unavailable tech
    Failed to acquire the corresponding technology from the tag.
    13024
    function not support
    The current tag technology does not support this feature.
    13017
    system internal error
    The related read-write operation has failed.
    13016
    connect fail
    Connection failed

    .stopDiscovery

    The method is utilized as NFCAdapter.stopDiscovery().
    Parameters and Description: Object object.
    Attributes
    Types
    Default value
    Required
    Note
    success
    function
    -
    Not required
    Callback function for successful interface invocation
    fail
    function
    -
    Not required
    Callback function for unsuccessful interface invocation
    complete
    function
    -
    Not required
    Callback function executed upon the completion of the interface invocation (both successful and unsuccessful invocations)
    Error Code
    Error Codes
    Error Message
    Note
    13000
    The device does not support NFC
    -
    13001
    The system's NFC switch is not activated.
    -
    13010
    An unknown error occurred.
    -
    13019
    user is not authorized
    User Authorization Denied
    13011
    invalid parameter
    Invalid parameter
    13012
    parse NdefMessage failed
    Failed to parse the parameter into NdefMessage.
    13021
    NFC discovery already started
    NFC scanning has already commenced.
    13018
    NFC discovery has not started
    Attempted to halt NFC scanning without initiating it.
    13022
    Tech already connected
    The tag has been successfully connected.
    13023
    Tech has not connected
    Attempted to disconnect without a tag being connected.
    13013
    NFC tag has not been discovered
    No NFC tag was detected.
    13014
    invalid tech
    Invalid tag technology.
    13015
    unavailable tech
    Failed to acquire the corresponding technology from the tag.
    13024
    function not support
    The current tag technology does not support this feature.
    13017
    system internal error
    The related read-write operation has failed.
    13016
    connect fail
    Connection failed

    .getNdef

    The method is employed as Ndef NFCAdapter.getNdef().
    Function Description: Acquire the Ndef instance, which supports reading and writing of NDEF data on NFC tags in NDEF format.
    Return Value: Ndef.

    .getNfcA

    The method is implemented as NfcA NFCAdapter.getNfcA().
    Function Description: Obtain the NfcA instance, which supports reading and writing in accordance with the NFC-A (ISO 14443-3A) standard.
    Return Value: NfcA.

    .getNfcB

    The method is utilized as NfcB NFCAdapter.getNfcB().
    Function Description: Acquire the NfcB instance, which facilitates reading and writing in compliance with the NFC-B (ISO 14443-3B) standard.
    Return Value: NfcB.

    .getNfcF

    The method is employed as NfcF NFCAdapter.getNfcF().
    Function Description: Procure the NfcF instance, which supports reading and writing in accordance with the NFC-F (JIS 6319-4) standard.
    Return Value: NfcF.

    .getNfcV

    The method is utilized as NfcV NFCAdapter.getNfcV().
    Function Description: Acquire the NfcV instance, which supports reading and writing in compliance with the NFC-V (ISO 15693) standard.
    Return Value: NfcV.

    .getIsoDep

    The method is employed as IsoDep NFCAdapter.getIsoDep().
    Function Description: Obtain the IsoDep instance, which supports reading and writing in accordance with the ISO-DEP (ISO 14443-4) standard.
    Return Value: IsoDep.

    .getMifareClassic

    The method is utilized as MifareClassic NFCAdapter.getMifareClassic().
    Function Description: Acquire the MifareClassic instance, which supports reading and writing of MIFARE Classic tags.
    Return Value: MifareUltralight.

    .getMifareUltralight

    The method is employed as MifareUltralight NFCAdapter.getMifareUltralight().
    Function Description: Obtain the MifareUltralight instance, which supports the reading and writing of MIFARE Ultralight tags.
    Parameter Description: MifareUltralight.

    .onDiscovered

    The method is utilized as NFCAdapter.onDiscovered(function listener).
    Function Description: Monitor NFC Tag.
    Parameter Description:function listener, listener function, with the following arguments Object res:
    Attributes
    Types
    Note
    id
    ArrayBuffer
    -
    techs
    Array
    Tech array, used to match which specific standards (such as NfcA instances) can be used to handle NFC cards.
    messages
    Array
    NdefMessage array, the message format is {id: ArrayBuffer, type: ArrayBuffer, payload: ArrayBuffer}.

    .offDiscovered

    The method is utilized as NFCAdapter.offDiscovered(function listener).
    Function Description: Remove the listener function of the NFC Tag.
    Parameters and Description: function listener, the listening function passed in by onDiscovered. If this parameter is not passed, all listening functions will be removed.
    Example Code
    const listener = function (res) { console.log(res) }
    
    NFCAdapter.onDiscovered(listener)
    NFCAdapter.offDiscovered(listener) // The same function object as the listener must be passed in.
    
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support