#include <cafe/ntag.h>

typedef void (*NTAGResultCheckCallback)(s32 chan, NTAGError error_code, void* userData); 

NTAGError NTAGSetReadOnly( s32 chan, u16 time_out, const u8* uid, const u8* uid_mask, u8 read_only, 
                           NTAGResultCheckCallback callback, void* userData ); 


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.
read_only Sets the read-only state for the tag.
1 : Read-only.
0 : Not read-only.
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.

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_SET_READ_ONLY : An error occurred during formatting.
  • NTAG_ERR_ABORT : The process was ended partway by the system.
    (When the HOME Menu is called or the TV control button is pressed.)
userDataUser data.


Sets the read-only feature for tags. When this function is used to set a tag to a read-only state, it is no longer possible to use the NTAGWrite function to write to the tag. The read-only setting is for software only, so it is only effective for tags with Nintendo's proprietary format.

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.

Revision History

2013/05/08 Automated cleanup pass.
2012/12/11 Initial version.