1 /*---------------------------------------------------------------------------*
2   Project:  Cafe
3   File:     nfp_Api.h
4 
5   Copyright (C) 2014 Nintendo.  All rights reserved.
6 
7   These coded instructions, statements, and computer programs contain
8   proprietary information of Nintendo of America Inc. and/or Nintendo
9   Company Ltd., and are protected by Federal copyright law.  They may
10   not be disclosed to third parties or copied or duplicated in any form,
11   in whole or in part, without the prior written consent of Nintendo.
12 
13  *---------------------------------------------------------------------------*/
14 
15 #ifndef NN_NFP_API_H_
16 #define NN_NFP_API_H_
17 
18 #include <cafe/sysapp.h>
19 
20 #include <nn/Result.h>
21 #include <nn/nfp/nfp_Types.h>
22 
23 namespace nn {
24 namespace nfp {
25 
26 /*!
27     @ingroup    nn_nfp
28     @defgroup   nn_nfp_api  Nintendo Figurine Platform (NFP) API
29     @brief A list of Nintendo Figurine Platform (NFP) library members. (Includes only C++ API members.)
30     @{
31 */
32 
33 /*!
34       @name Initialization and Finalization
35 
36       @{
37 */
38 
39 /*!
40 @brief Initializes the Nintendo Figurine Platform (NFP) library.
41 
42 @retval ResultSuccess  Initialization successful.
43 @retval ResultInvalidOperation  The library is already initialized.
44 @retval ResultOperationFailed  Initialization failed.
45 @retval ResultNoBackupFile  There is no backup file.
46 
47 @details This function must be called before using any of the features in the NFP library.
48 The initialization process takes approximately one second.
49 
50 Backup data is automatically created the first time the NFP library is initialized on the console where the application is running.
51 The save data creation process takes approximately five seconds.
52 
53 @sa Finalize
54 
55 */
56 nn::Result Initialize( void );
57 
58 /*!
59 @brief Finalizes the Nintendo Figurine Platform (NFP) library.
60 
61 @retval ResultSuccess  Finalized successfully.
62 @retval ResultInvalidOperation  Already finalized.
63 
64 @details Call this function when you are done using the NFP library.
65 
66 If this function is called while a tag is detected, the Deactivate event is signaled.
67 
68 @sa Initialize
69 */
70 nn::Result Finalize( void );
71 
72 /*!
73       @}
74  */
75 
76 /*!
77 @name RW Mode API
78       @{
79 
80 */
81 
82 /*!
83 @brief Starts detecting a tag.
84 
85 @retval ResultSuccess  Started detecting the tag.
86 @retval ResultInvalidOperation  The library is not in the correct state.
87 @retval ResultOperationFailed  Unable to start tag detection. The console has been disconnected from the Wii U GamePad (DRC), or the communication environment is poor.
88 
89 @details Before using this function, call <tt>@ref SetActivateEvent</tt> and <tt>@ref SetDeactivateEvent</tt> to get the library ready to receive tag detection and tag loss events.
90 
91 @sa SetActivateEvent
92 @sa SetDeactivateEvent
93 @sa StopDetection
94 
95 */
96 nn::Result StartDetection( void );
97 
98 /*!
99 @brief Stops detecting a tag.
100 
101 @retval ResultSuccess  Stopped detecting the tag successfully.
102 @retval ResultInvalidOperation  The library is not in the correct state.
103 @retval ResultOperationFailed  Unable to stop tag detection. The signal between the Wii U GamePad (DRC) and console may be weak.
104 
105 @details If this function is called while a tag is detected, the Deactivate event is signaled.
106 
107 If it is called while a tag is mounted, <tt>@ref Unmount</tt> is called automatically.
108 
109 @sa StartDetection
110 */
111 nn::Result StopDetection( void );
112 
113 /*!
114 @brief Mounts a tag. This function returns <tt>@ref ResultNotSupported</tt> for non-NFP NOFT tags.
115 
116 @retval ResultSuccess  Mount succeeded.
117 @retval ResultInvalidOperation  The library is not in the correct state.
118 @retval ResultNotSupported  Not an NFP NOFT tag. Check the tag being used.
119 @retval ResultNeedRetry  An error occurred in the mount process. Remount the tag.
120 @retval ResultNeedRestore  The tag data is corrupted. The tag must be restored.
121 @retval ResultNeedFormat  The tag data is corrupted but there is no backup data. The tag must be reformatted.
122 @retval ResultTagNotFound  Target tag not found. The tag may have been replaced with another tag during the write process.
123 @retval ResultInvalidFormatVersion  Unsupported tag version. Notify the user that the tag is not supported.
124 @retval ResultBackupError  Failed to access the backup file.
125 
126 @details This function must be called while a tag is being detected before any API functions that require the tag to be mounted can be called.
127 
128 The backup data is updated if the tag is being read the first time by the tag being mounted, or if the tag was overwritten using another console.
129 
130 @sa GetNfpCommonInfo
131 @sa GetNfpRegisterInfo
132 @sa Flush
133 @sa OpenApplicationArea
134 @sa ReadApplicationArea
135 @sa WriteApplicationArea
136 @sa Unmount
137 
138 
139 */
140 nn::Result Mount( void );
141 
142 /*!
143 @brief Mounts a tag in a state where only the ROM region can be accessed.
144 This function returns <tt>@ref ResultNotSupported</tt> for non-NFP NOFT tags.
145 
146 @retval ResultSuccess  Mount succeeded.
147 @retval ResultInvalidOperation  The library is not in the correct state.
148 @retval ResultNotSupported  Not an NFP NOFT tag. Check the tag being used.
149 @retval ResultTagNotFound  Target tag not found. The tag may have been replaced with another tag during the write process.
150 @retval ResultInvalidFormatVersion  Unsupported tag version. Notify the user that the tag is not supported.
151 
152 @details The behavior of this function has the following differences when compared to <tt>@ref Mount</tt>.
153 @li Can only access the ROM region (<tt>@ref GetNfpRomInfo</tt>, <tt>@ref GetTagInfo</tt>).
154 @li Can be called even if the tag data is corrupted (<tt>@ref Mount</tt> returns <tt>@ref ResultNeedRestore</tt> or <tt>@ref ResultNeedFormat</tt>).
155 @li Does not update backup data.
156 
157 @sa GetNfpRomInfo
158 @sa Unmount
159 */
160 nn::Result MountRom( void );
161 
162 /*!
163 @brief Unmounts a tag.
164 
165 @retval ResultSuccess  Unmounted successfully.
166 @retval ResultInvalidOperation  The library is not in the correct state.
167 
168 @details When a tag is unmounted, API functions that require a mounted tag can no longer be used.
169 Call the <tt>@ref Mount</tt> function again to use API functions that require a mounted tag.
170 
171 The tag is automatically unmounted if <tt>@ref StopDetection</tt> is called or the tag is lost (deactivate) without unmounting it.
172 
173 @sa     Mount
174 
175 */
176 nn::Result Unmount( void );
177 
178 /*!
179 @brief Enables access to the application area.
180 
181 @param[in] accessID  The ID to use to access the application area.
182 
183 @retval ResultSuccess  Access to the application area was enabled.
184 @retval ResultInvalidOperation  The library is not in the correct state.
185 @retval ResultAccessIdMisMatch  Cannot access the application area because the access IDs do not match.
186 @retval ResultNeedCreate  No application area. The application area must be created.
187 @retval ResultNotSupported  Unsupported format.
188 
189 @sa Mount
190 @sa ReadApplicationArea
191 @sa WriteApplicationArea
192 */
193 nn::Result OpenApplicationArea( u32 accessID );
194 
195 /*!
196 @brief Reads the data in the application area on a tag.
197 
198 @param[out] pReadBuf  A buffer to load the data into.
199 @param[in] readSize  The size of the data to read.
200 
201 @retval ResultSuccess  Read successful.
202 @retval ResultInvalidArgument  Invalid argument.
203 @retval ResultInvalidPointer  An invalid pointer was specified. Use the <tt>@ref ResultInvalidArgument</tt> function to handle this result.
204 @retval ResultInvalidOperation  The library is not in the correct state.
205 
206 @details To use this API function, you must first mount the tag and call <tt>@ref OpenApplicationArea</tt>.
207 
208 Use <tt>@ref CommonInfo::applicationAreaSize</tt> for the maximum size of data that can be read.
209 
210 @sa CommonInfo
211 @sa GetNfpCommonInfo
212 @sa Mount
213 @sa OpenApplicationArea
214 
215 */
216 nn::Result ReadApplicationArea( void* pReadBuf, u32 readSize );
217 
218 /*!
219 @brief Writes data to the application area on a tag.
220 
221 @param[in] pWriteBuf  The data to write.
222 @param[in] writeSize  The size of the data to write.
223 @param[in] tagId  The UID of the tag to write the data to. Use the <tt>@ref TagId</tt> that is retrieved from the <tt>@ref GetTagInfo</tt> function.
224 
225 @retval ResultSuccess  Read successful.
226 @retval ResultInvalidArgument  Invalid argument. Or, the size of the data to write exceeds the size of the application area.
227 @retval ResultInvalidPointer  An invalid pointer was specified. Use the <tt>@ref ResultInvalidArgument</tt> function to handle this result.
228 @retval ResultInvalidOperation  The library is not in the correct state.
229 @retval ResultUidMisMatch  The specified UID does not match the tag's UID.
230 
231 @details To use this API function, you must first mount the tag and call <tt>@ref OpenApplicationArea</tt>.
232 
233 If the size of the data to write is smaller than <tt>@ref CommonInfo::applicationAreaSize</tt>, the remaining space is filled with random numbers.
234 
235 You must call <tt>@ref Flush</tt> to finalize the write operation.
236 
237 @sa Flush
238 @sa Mount
239 @sa OpenApplicationArea
240 
241 */
242 nn::Result WriteApplicationArea( const void* pWriteBuf,
243                                  u32 writeSize,
244                                  const TagId& tagId );
245 
246 /*!
247 @brief      Writes the data in an internal buffer to the tag.
248 The data is not actually written to the tag until this function is called.
249 @retval ResultSuccess           Data written successfully.
250 @retval     ResultInvalidOperation  The library is not in the correct state.
251 @retval ResultNotSupported      Non-NFP NOFT tag, or invalid tag format. Check the tag being used.
252 @retval ResultNeedRetry         Failed to write the data. Try writing the data again.
253 @retval ResultTimeOutError      The write process timed out. Try writing the data again. Use the <tt>@ref ResultNeedRetry</tt> function to handle this result.
254 @retval ResultTagNotFound       Target tag not found. The tag may have been replaced with another tag during the write process.
255 @retval ResultOperationFailed   An error occurred while writing to the tag. The tag data may have been corrupted.
256 @retval ResultBackupError       Failed to access the backup file.
257 @details    This function writes data to the tag and to the backup file.
258 The write process takes at least one to two seconds.
259 When writing to a tag, display a message or animation that lets the user know a write operation is in progress.
260 @note       The write time might take longer depending on system load and whether other files are being accessed.
261 @sa     WriteApplicationArea
262 
263 
264 
265 
266 
267 */
268 nn::Result Flush( void );
269 
270 /*!
271 @brief Formats a corrupted tag and restores the tag data using the backup data.
272 
273 @retval ResultSuccess  Data restored successfully.
274 @retval ResultInvalidOperation  The library is not in the correct state.
275 @retval ResultNotSupported  Non-NFP NOFT tag, or invalid tag format. Check the tag being used.
276 @retval ResultNotBroken  Tag data does not need to be restored because it is not corrupted.
277 @retval ResultNeedRetry  An error occurred during the restore process. Call this function again.
278 @retval ResultTimeOutError  The write process timed out. Try writing the data again. Use the <tt>@ref ResultNeedRetry</tt> function to handle this result.
279 @retval ResultTagNotFound  Target tag not found. The tag may have been replaced with another tag during the write process.
280 @retval ResultOperationFailed  An error occurred while writing to the tag. The tag data may not have been restored correctly.
281 @retval ResultBackupError  Failed to access the backup file.
282 
283 @details Tag data must be restored if it gets corrupted for any reason. @n
284 This function formats the tag and then writes the backup data to the tag.
285 
286 The <tt>@ref Flush</tt> function is also executed when a tag is restored.
287 
288 @sa Flush
289 @sa Mount
290 */
291 nn::Result Restore( void );
292 
293 /*!
294 @brief Creates the application area on a tag.
295 The application area must be created before using a blank tag for the first time.
296 
297 @param[in] createInfo  The application area creation info. Use the <tt>@ref InitializeCreateInfo</tt> function to initialize the data before passing it to this function.
298 
299 @retval ResultSuccess  Creation successful.
300 @retval ResultInvalidArgument  Invalid argument.
301 @retval ResultInvalidPointer  An invalid pointer to the creation info was specified. Use the <tt>@ref ResultInvalidArgument</tt> function to handle this result.
302 @retval ResultInvalidOperation  The library is not in the correct state.
303 @retval ResultNotSupported  Non-NFP NOFT tag, or invalid tag format. Check the tag being used.
304 @retval ResultAlreadyCreated  The application area has already been created.
305 @retval ResultNeedRetry  An error occurred during creation. Call this function again.
306 @retval ResultTimeOutError  The write process timed out. Call this function again. Use the <tt>@ref ResultNeedRetry</tt> function to handle this result.
307 @retval ResultTagNotFound  Target tag not found. The tag may have been replaced with another tag during the write process.
308 @retval ResultOperationFailed  An error occurred while writing to the tag. The tag data may have been corrupted.
309 @retval ResultBackupError  Failed to access the backup file.
310 
311 @details You must call the <tt>@ref InitializeCreateInfo</tt> function to initialize the argument before passing it to this function.
312 
313 To call this function, the tag must be mounted and not currently have an application area.
314 Use the <tt>@ref OpenApplicationArea</tt> function to check whether the tag has an application area.
315 
316 The <tt>@ref Flush</tt> function is also executed when the application area is created.
317 
318 @sa ApplicationAreaCreateInfo
319 @sa Flush
320 @sa InitializeCreateInfo
321 @sa Mount
322 @sa OpenApplicationArea
323 */
324 nn::Result CreateApplicationArea( const ApplicationAreaCreateInfo& createInfo );
325 
326 /*!
327 @brief Gets tag information.
328 
329 @param[out] pTagInfo  Pointer to the <tt>@ref TagInfo</tt> object in which the retrieved data was stored.
330 
331 @retval ResultSuccess  Obtained successfully.
332 @retval ResultInvalidPointer  An invalid pointer was specified. Use the <tt>@ref ResultInvalidArgument</tt> function to handle this result.
333 @retval ResultTagNotFound  Target tag not found. The tag may have been replaced with another tag during the write process.
334 @retval ResultInvalidOperation  The library is not in the correct state.
335 @retval ResultNotSupported  Not an NFP NOFT tag. Check the tag being used.
336 
337 @details Gets the tag ID and tag type.
338 Use this function to get the tag ID that is used in functions such as <tt>@ref WriteApplicationArea</tt>.
339 
340 A tag must be detected to call this API function.
341 
342 This API function gets unique value for each tag.
343 
344 @sa TagInfo
345 @sa WriteApplicationArea
346 */
347 nn::Result GetTagInfo( TagInfo* pTagInfo );
348 
349 /*!
350 @brief Gets initial NFP tag registration info.
351 
352 @param[out] pRegData  Pointer to the <tt>@ref RegisterInfo</tt> object in which the retrieved data was stored.
353 
354 @retval ResultSuccess  Obtained successfully.
355 @retval ResultInvalidPointer  An invalid pointer was specified. Use the <tt>@ref ResultInvalidArgument</tt> function to handle this result.
356 @retval ResultInvalidOperation  The library is not in the correct state.
357 @retval ResultNeedRegister  The tag has not been registered. The tag must be registered in <tt>Cabinet</tt>.
358 @retval ResultNotSupported  Non-NFP NOFT tag, or invalid tag format. Check the tag being used.
359 
360 @details A tag must be mounted to call this API function.
361 
362 Tag nicknames may sometimes include characters that are not supported in the application.
363 When that happens, you must handle it such that the screen display is not adversely affected and there are no hindrances to the application's progress.
364 For more details, see the section on Nicknames and Creator Names in the Wii U Guidelines.
365 
366 @sa Mount
367 @sa RegisterInfo
368 */
369 nn::Result GetNfpRegisterInfo( RegisterInfo* pRegData );
370 
371 /*!
372 @brief Gets the data in the common region on the NFP tag.
373 
374 @param[out] pCommonData  Pointer to the <tt> @ref CommonInfo</tt> object in which the retrieved data was stored.
375 
376 @retval ResultSuccess  Obtained successfully.
377 @retval ResultInvalidPointer  An invalid pointer was specified. Use the <tt>@ref ResultInvalidArgument</tt> function to handle this result.
378 @retval ResultInvalidOperation  The library is not in the correct state.
379 @retval ResultNotSupported  Non-NFP NOFT tag, or invalid tag format. Check the tag being used.
380 
381 @details A tag must be mounted to call this API function.
382 
383 Use <tt>@ref CommonInfo::applicationAreaSize</tt> to get the application-specific region size used by the <tt>@ref ReadApplicationArea</tt> and <tt>@ref WriteApplicationArea</tt> function.
384 
385 @sa CommonInfo
386 @sa Mount
387 
388 
389 */
390 nn::Result GetNfpCommonInfo( CommonInfo* pCommonData );
391 
392 /*!
393 @brief Gets the information in the common region of the tag.
394 
395 @param[out] pRomInfo  Stores the ROM information.
396 
397 @retval ResultSuccess  Obtained successfully.
398 @retval ResultInvalidPointer  An invalid pointer was specified. Use the <tt>@ref ResultInvalidArgument</tt> function to handle this result.
399 @retval ResultInvalidOperation  The library is not in the correct state.
400 
401 @details The <tt>@ref Mount</tt> or <tt>@ref MountRom</tt> function must be called before calling this API function.
402 
403 @sa RomInfo
404 @sa Mount
405 @sa MountRom
406 */
407 nn::Result GetNfpRomInfo( RomInfo* pRomInfo );
408 
409 /*!
410       @}
411  */
412 
413 /*!
414 @brief Gets the error code that is shown to users from the specified <tt>nn::Result</tt> object.
415 
416 @param[in] result  The <tt>nn::Result</tt> instance to get the error code from. Specify a <tt>nn::Result</tt> returned by the NFP library.
417 
418 @return Returns the error code as a seven-digit decimal number (168XXXX).
419 If <tt>nn::ResultSuccess</tt> or a <tt>nn::Result</tt> instance not from the NFP library is passed as an argument, this function returns <tt>@ref nn::nfp::ERROR_CODE_UNKNOWN</tt>.
420 
421 @details Use this API function to get the error code that is passed to the error viewer.
422 
423 */
424 u32 GetErrorCode( const nn::Result& result );
425 
426 /*!
427 @brief Gets the state of the NFP library.
428 
429 @return Returns the current state of the NFP library.
430 
431 @sa NfpState
432 */
433 NfpState GetNfpState( void );
434 
435 /*!
436 @brief Sets an event indicating that a tag was detected (Activate).
437 
438 @param[in,out] pEvent  Specifies an event to use for tag detection notification.
439 
440 @retval ResultSuccess  Event set successfully.
441 @retval ResultInvalidPointer  An invalid pointer was specified. Use the <tt>@ref ResultInvalidArgument</tt> function to handle this result.
442 @retval ResultInvalidOperation  The library is not in the correct state.
443 
444 @details When a tag is detected, a notification with the event specified in this function is sent.
445 
446 The event is initialized in auto-mode (<tt>OS_EVENT_AUTO</tt>) in this function. You do not need to call <tt>OSInitEvent[Ex]</tt> in advance.
447 
448 This API function can be used when the library state is <tt>@ref INIT</tt>.
449 
450 @sa SetDeactivateEvent
451 */
452 nn::Result SetActivateEvent( OSEvent* pEvent );
453 
454 /*!
455 @brief Sets an event indicating that a tag was lost (Deactivate).
456 
457 @param[in,out] pEvent  Sets an event to use for the notification for when the tag is lost.
458 
459 @retval ResultSuccess  Event set successfully.
460 @retval ResultInvalidPointer  An invalid pointer was specified. Use the <tt>@ref ResultInvalidArgument</tt> function to handle this result.
461 @retval ResultInvalidOperation  The library is not in the correct state.
462 
463 @details When a tag that has been detected is removed from the reader, a notification with the event specified in this function is sent.
464 
465 The event is initialized in auto-mode (<tt>OS_EVENT_AUTO</tt>) in this function. You do not need to call <tt>OSInitEvent[Ex]</tt> in advance.
466 
467 This API function can be used when the library state is <tt>@ref INIT</tt>.
468 
469 @sa SetActivateEvent
470 */
471 nn::Result SetDeactivateEvent( OSEvent* pEvent );
472 
473 /*!
474 @brief Gets the connection status for the tag.
475 
476 @param[out] pConnectionStatus  A pointer to the <tt>ConnectionStatus</tt> object in which the retrieved data was stored.
477 
478 @retval ResultSuccess  Obtained successfully.
479 @retval ResultInvalidPointer  An invalid pointer was specified. Use the <tt>@ref ResultInvalidArgument</tt> function to handle this result.
480 @retval ResultInvalidOperation  The library is not in the correct state.
481 
482 @sa ConnectionStatus
483 */
484 nn::Result GetConnectionStatus( ConnectionStatus* pConnectionStatus );
485 
486 /*!
487 @brief Initializes application area creation info.
488 
489 @param[out] pCreateInfo  The application area creation info.
490 
491 @retval ResultSuccess  Initialization successful.
492 @retval ResultInvalidPointer  An invalid pointer was specified. Use the <tt>@ref ResultInvalidArgument</tt> function to handle this result.
493 @retval ResultInvalidOperation  The library is not in the correct state.
494 
495 @details After using this function to initialize the creation info, set the members to the necessary values before passing the creation info to the <tt>@ref CreateApplicationArea</tt> function.
496 
497 @sa ApplicationAreaCreateInfo
498 @sa CreateApplicationArea
499 */
500 nn::Result InitializeCreateInfo( ApplicationAreaCreateInfo* pCreateInfo );
501 
502 
503 /*!
504       @name amiibo Settings API
505       @{
506  */
507 
508 /*!
509 @brief  Initializes the structure that is passed when calling amiibo Settings.
510 
511 @param[out]  pArgs  The structure to initialize.
512 
513 @details The argument that is passed to the <tt>@ref SwitchToAmiiboSettings</tt> function must be initialized using this API function beforehand.
514 
515 @retval ResultSuccess  Indicates that initialization succeeded.
516 @retval ResultInvalidPointer  An invalid pointer was specified. Use the <tt>@ref ResultInvalidArgument</tt> function to handle this result.
517 
518 @sa SwitchToAmiiboSettings
519 
520 */
521 nn::Result InitializeAmiiboSettingsArgsIn( AmiiboSettingsArgsIn* pArgs );
522 
523 /*!
524 @brief Issues a process transition (application jump) request to go to amiibo Settings.
525 
526 @param[in] args  The arguments to pass to the process. Must be initialized by <tt>@ref InitializeAmiiboSettingsArgsIn</tt> in advance.
527 @param[in] pAnchor  The anchor string received by the application when control returns from the jump. You can specify a value up to <tt>OS_ARGS_SIZE - 1</tt> bytes.
528 @param[in] anchorSize  The size of the data in <tt><em>pAnchor</em></tt> (in bytes). Specify a size that includes a string terminator.
529 
530 @retval ResultSuccess  Issued the transition request.
531 @retval ResultInvalidArgument  Invalid argument.
532 @retval ResultOperationFailed  Failed to issue the transition request. (This never occurs in the production environment.)
533 
534 @details After the process transition request has been issued, <tt>@ref Finalize</tt> is called on the NFP library and the system prepares for the process transition.
535 
536 After preparations are complete, a <tt>PROCUI_MESSAGE_RELEASE</tt> message is issued.
537 When your application receives this message, release the foreground.
538 For more information, see the ProcUI Library section of the Cafe SDK Reference Manual.
539 
540 After the process transition is complete, the current process moves to the background.
541 
542 @note By specifying an anchor string, you can determine whether control was returned by the application to which it jumped.
543 If control returned from the application that was jumped to, you can get the anchor string by calling the <tt>SYSGetArguments</tt> function with <tt>SYS_ARG_ID_ANCHOR</tt> specified.
544 The anchor string can be omitted, but specify it for applications that use multiple overlay applications (such as Miiverse) to determine whether control was returned by amiibo Settings.
545 
546 @note When this API function is called and the <tt>@ref Finalize</tt> function is called on the NFP library, any registered tag detection/loss events are cleared.
547 
548 @attention Do not call this API function from the background.
549 
550 @sa InitializeAmiiboSettingsArgsIn
551 
552 */
553 nn::Result SwitchToAmiiboSettings( const AmiiboSettingsArgsIn& args,
554                                    const char* pAnchor,
555                                    u32 anchorSize );
556 
557 /*!
558 @overload
559 
560 @details Use this API function for cases where an anchor string is unnecessary.
561 
562 This API function is handled the same as <tt>@ref SwitchToAmiiboSettings</tt> with <tt>NULL</tt> specified for <tt><em>pAnchor</em></tt> and <tt>0</tt> specified for <tt><em>anchorSize</em></tt>.
563 
564 @attention Do not call this API function from the background.
565 
566 */
567 nn::Result SwitchToAmiiboSettings( const AmiiboSettingsArgsIn& args );
568 
569 /*!
570 @brief Gets the return value from amiibo Settings.
571 
572 @param[out] pResult  Stores the return value.
573 @param[in] resultDataBlock  Specifies the data block of the result data retrieved with the <tt>SYSGetArguments</tt> function. To get the result data, call the <tt>SYSGetArguments</tt> function with <tt>SYS_ARG_ID_RESULT</tt> specified.
574 
575 @retval ResultSuccess  Obtained successfully.
576 @retval ResultInvalidPointer  An invalid pointer was specified. Use the <tt>@ref ResultInvalidArgument</tt> function to handle this result. If this result is returned, the <tt>@ref Initialize</tt> function of the NFP library is not called.
577 @retval ResultNoData  No data can be retrieved because the result data is not from amiibo Settings.
578 
579 @details This function receives the result data (<tt>_blk</tt> member of the <tt>SysArgSlot</tt> structure) that is returned when <tt>SYS_ARG_ID_RESULT</tt> is specified in the <tt>SYSGetArguments</tt> function, and stores the return value only if it is in a format that can be retrieved as an <tt>@ref AmiiboSettingsResult</tt> object.
580 However, if the previous application was not amiibo Settings but returned a value in a format that can be recognized as an <tt>@ref AmiiboSettingsResult</tt> object, an unexpected value could be retrieved.
581 
582 If your application calls multiple overlay applications (such as Miiverse), call the <tt>SYSGetArguments</tt> function in advance and check the anchor string to make sure control was returned from amiibo Settings before calling this function.
583 
584 The <tt>@ref Initialize</tt> function is automatically called on the NFP library when this API function is called.
585 This function takes about one second to execute. we recommend displaying an animation or something similar when calling this function to avoid any stuttering or pauses in the application.
586 
587 @note The <tt>@ref Initialize</tt> function is automatically called on the NFP library, so the library cannot be restored to the state prior to the process transition.
588 Any registered events are cleared and must be reregistered using <tt>@ref SetActivateEvent</tt> and <tt>@ref SetDeactivateEvent</tt>.
589 
590 
591 
592 
593 
594 
595 */
596 nn::Result GetAmiiboSettingsResult( AmiiboSettingsResult* pResult,
597                                     const SysArgDataBlock& resultDataBlock );
598 
599 /*!
600       @}
601  */
602 
603 /*!
604     @}
605 */
606 
607 
608 }  // namespace nfp
609 }  // namespace nn
610 
611 #endif // ifndef NN_NFP_API_H_
612