NFC-Ndef
.connect
TIP
The API usage is as follows: Ndef.connect()
- Functional description: Connect NFC tag
- Parameters and descriptions: Object object。
Properties Type Default value Required Description success Function - No Callback function for successful interface call fail Function - No Callback function for failed interface call complete Function - No Callback function for interface call completion (executed regardless of success or failure)
.close
TIP
The API usage is as follows: Ndef.close()
Functional description: Disconnect
Parameters and descriptions: Object object。
Properties Type Default value Required Description success Function - No Callback function for successful interface call fail Function - No Callback function for failed interface call complete Function - No Callback function for interface call completion (executed regardless of success or failure) Error code
Error code Error message Description 13000 The device does not support NFC - 13001 The system NFC switch is not turned on - 13010 Unknown error - 13019 user is not authorized The user is not authorized 13011 invalid parameter Invalid parameters 13012 parse NdefMessage failed Failed to parse parameters into NdefMessage 13021 NFC discovery already started NFC scanning has started 13018 NFC discovery has not started Attempt to stop NFC scanning when NFC scanning has not started 13022 Tech already connected The tag is already connected 13023 Tech has not connected Attempt to disconnect when the tag is not connected 13013 NFC tag has not been discovered NFC tag not scanned 13014 invalid tech Invalid tag technology 13015 unavailable tech Failed to obtain the corresponding technology from the tag 13024 function not support The current tag technology does not support this function 13017 system internal error Related read and write operations failed 13016 connect fail Connection failed
.setTimeout
TIP
The API usage is as follows: Ndef.setTimeout(Object object)
Functional description: Set timeout
Parameters and descriptions: Object object。
Properties Type Default value Required Description timeout number - Yes Set timeout (ms) success Function - No Callback function for successful interface call fail Function - No Callback function for failed interface call complete Function - No Callback function for interface call completion (executed regardless of success or failure) Error code
Error code Error message Description 13000 The device does not support NFC - 13001 The system NFC switch is not turned on - 13010 Unknown error - 13019 user is not authorized The user is not authorized 13011 invalid parameter Invalid parameters 13012 parse NdefMessage failed Failed to parse parameters into NdefMessage 13021 NFC discovery already started NFC scanning has started 13018 NFC discovery has not started Attempt to stop NFC scanning when NFC scanning has not started 13022 Tech already connected The tag is already connected 13023 Tech has not connected Attempt to disconnect when the tag is not connected 13013 NFC tag has not been discovered NFC tag not scanned 13014 invalid tech Invalid tag technology 13015 unavailable tech Failed to obtain the corresponding technology from the tag 13024 function not support The current tag technology does not support this function 13017 system internal error Related read and write operations failed 13016 connect fail Connection failed
.offNdefMessage
TIP
The API usage is as follows: Ndef.onNdefMessage(function callback)
- Functional description: Cancel listening to Ndef messages
- Parameters and descriptions: function callback。
.onNdefMessage
TIP
The API usage is as follows: Ndef.offNdefMessage(function callback)
- Functional description: Listen to Ndef messages
- Parameters and descriptions: function callback。
.writeNdefMessage
TIP
The API usage is as follows: Ndef.writeNdefMessage(Object object)
Functional description: Rewrite Ndef tag content
Parameters and descriptions: Object object。
Properties Type Default value Required Description uris Array - No uri array texts Array - No text array records Array - No Binary object array, need to specify id, type and payload (all ArrayBuffer type) success Function - No Callback function for successful interface call fail Function - No Callback function for failed interface call complete Function - No Callback function for interface call completion (executed regardless of success or failure) Error code
Error code Error message Description 13000 The device does not support NFC - 13001 The system NFC switch is not turned on - 13010 Unknown error - 13019 user is not authorized The user is not authorized 13011 invalid parameter Invalid parameters 13012 parse NdefMessage failed Failed to parse parameters into NdefMessage 13021 NFC discovery already started NFC scanning has started 13018 NFC discovery has not started Attempt to stop NFC scanning when NFC scanning has not started 13022 Tech already connected The tag is already connected 13023 Tech has not connected Attempt to disconnect when the tag is not connected 13013 NFC tag has not been discovered NFC tag not scanned 13014 invalid tech Invalid tag technology 13015 unavailable tech Failed to obtain the corresponding technology from the tag 13024 function not support The current tag technology does not support this function 13017 system internal error Related read and write operations failed 13016 connect fail Connection failed