nn::dlp::CTR::Server::Initialize Member Function

Syntax

static nn::Result Initialize(
     bool * pNotice,
     nn::Handle eventHandle,
     u8 maxClientNum,
     u8 childIndex,
     void * pBuffer,
     size_t bufferSize,
     size_t blockBufferSize = MIN_NETWORK_BLOCK_BUFFER_SIZE *2,
     size_t blockBufferNum = MIN_NETWORK_BLOCK_BUFFER_NUM
);

Parameters

Name Description
out pNotice Returns true if message display is required. For details, see the Description section further down on this page.
in eventHandle Specifies a handle to the nn::os::Event object waiting for a signal from Download Play. Initialize the event in the application. Use the GetEventDesc function to get the event information.
in maxClientNum Specifies the maximum number of clients (from 1 to MAX_CLIENT_NUM) that can connect to the server.
in childIndex Specify the index (the RSF ChildIndex) of the child program to distribute. You can specify a value between 0 and 255. (A server can have up to 256 children.)
in pBuffer Pointer to the DLP working buffer. Must be 4096-byte aligned.
in bufferSize Size of working buffer. Must be 4096-byte aligned.
in blockBufferSize This is the size of the block buffer when data that has been read from a file is kept before sending. Specify a size is greater than or equal to MIN_NETWORK_BLOCK_BUFFER_SIZE and less than or equal to MAX_NETWORK_BLOCK_BUFFER_SIZE.
in blockBufferNum This is the number of block buffers. Specify a number greater than or equal to MIN_NETWORK_BLOCK_BUFFER_NUM and less than or equal to MAX_NETWORK_BLOCK_BUFFER_NUM.

Return Values

The following Result values are returned as the result of the operation.

Value Description
Result::IsSuccess Initialization was successful.
ResultInvalidPointer pBuffer is either NULL or not 4096-byte aligned.
ResultOutOfRange maxClientNum, bufferSize, blockBufferSize, and blockBufferNum are invalid.
ResultInvalidHandle eventHandle is invalid.
ResultAlreadyOccupiedWirelessDevice The wireless device is already occupied for another purpose. Exit the other wireless process.
ResultInternalError An irrecoverable error occurred internally.
ResultWirelessOff Communication is impossible (the system is in Sleep Mode or wireless-disabled mode).
ResultFailedToAccessMedia Cannot access the media. The child program may not be properly installed on the parent or a card may have been removed.
ResultChildTooLarge The child program exceeds the standard import size (MAX_CHILD_IMPORT_SIZE).
ResultInvalidRegion The child program and the system have different regions.

Description

Initializes the server.

For the pBuffer argument, specify a 4096-byte aligned buffer of the size specified by the GetBufferSize function. Do not use device memory for the buffer. The maximum import size for a child program that can be distributed is 32 MB.
The import size can be checked using the RequiredSize item that is displayed when you select a child device on the DevMenu's Import tab.
This function might block for a long time. This can happen because communications in the background have been completed and the DLP library has taken control of the communications device.
Control of the communications device will continue until the Finalize function is called. If the server is a download application, continued communication with clients with a low system version is impossible because a system update has not been performed.
For this reason, the server rejects the connection of clients with low system versions and the client is disconnected without any warning to the user.
For development devices, the client may experience a FatalError. For actual products, a disconnection occurs.
Because the client cannot display a warning related to this disconnection, you must have the server display a message to the user.
In the numerals that are separated by a period in the system version, the upper three digit values determine whether a system update is performed.
The parameter pNotice is used to determined whether the display of a message is required. When pNotice returns true, we recommend the display of a message.
For more information about the messages displayed, see the guidelines.
If sometime in the future the system is updated by a download application and the message no longer needs to be displayed, pNotice will return false.
If you enable the Download Play debug settings with the Config tool, then pNotice will be forcibly set to false even when the server is a download application.
Be sure to always display a message according to the result of pNote to switch the message display depending on the system update support status.
Also, note that pNotice does not return true for card applications. However, if you implement message display depending on pNotice, then no changes need to be made to the source code when releasing a card application as a download application. If you enable the Dlp Debug flag using the Config tool, then pNotice will return false. Use this flag to check what is happening when messages are not displayed.

Revision History

2010/08/16
Initial version.
2011/05/26
Added an explanation about the child device import size.
2012/01/10
Added a description of how a client on development hardware with a low version number may result in a fatal error.
2012/04/11
Added a method for forcing pNotice to return false.
2012/04/12
Deleted the explanation about ResultInvalidMediaType.
2012/05/02
Added an explanation about the Config tool, Dlp Debug.
2012/07/25
Added the location that is referenced in the system version for system updates.

CONFIDENTIAL