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