NTAGRead

Syntax

#include <cafe/ntag.h>

typedef void (*NTAGReadCallback)(s32 chan, NTAGError error_code, 
                                 const NTAGInfo* tagInfo, void* userData ); 

NTAGError NTAGRead( s32 chan, u16 time_out, const u8* uid, const u8* uid_mask, 
                    NTAGReadCallback callback, void* userData ); 

Parameters

chan Controller number 0.
time_out Timeout intervals.
0: Infinite
1 through 65535 : ms
uid ID of the target tag (7 bytes).
When NULL is specified, the UID mask feature is disabled.
uid_mask A mask to identify the ID of the target tag (7 bytes).
When NULL is specified, the UID mask feature is disabled.
callback Callback called when data reading finishes.
userData Data to pass to the callback function.

Return Values

NTAG_ERR_NONEThe command was issued normally.
NTAG_ERR_NOT_INITThe initialization of the NFC module is not finished.
NTAG_ERR_INVALID_COMMANDInvalid command.

Callback Notification Details

When tags are detected, the following registered callbacks send notifications with the following details.

chanController number.
error_code Error code:
  • NTAG_ERR_NONE : The process finished normally.
  • NTAG_ERR_TIMEOUT : Timeout occurred.
  • NTAG_ERR_INVALID_UID : The configured UID did not match the UID of the detected tag.
  • NTAG_ERR_INVALID_TAG : An unsupported tag was detected.
  • NTAG_ERR_INVALID_FORMAT : A tag with an invalid format was detected.
  • NTAG_ERR_READ : An error occurred during reading.
  • NTAG_ERR_NEED_FORMAT : A tag that needs a format was detected.
  • NTAG_ERR_ABORT : The process was ended partway by the system.
    (When the HOME Menu is called or the TV control button is pressed.)
tagInfoInformation for the detected tag (NTAGInfo).
userDataUser data.

Description

Reads tag data. The result can be received with the set callback function.

In general, the system determines that abnormal tags (such as invalid or corrupted tags) are errors, but implement the application in a way that anticipates unexpected sizes or content and does not perform abnormally when such data is received.

Do Not Call From

Background Do not call this function from the background.
Multiple threads This function is not thread-safe.
Multiple Cores Do not call this function from more than one Core.

See Also

NTAGInfo

Revision History

2013/05/08 Automated cleanup pass.
2013/01/31 Added information about handling abnormal tags.
2012/12/11 Initial version.


CONFIDENTIAL